From f70961e67d9b6dfa5b4600393f40b25293503053 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 27 Jan 2022 08:56:51 -0500 Subject: [PATCH] refactor format-bytes to use Intl --- cspell.json | 16 ++++++++-- docs/components/format-bytes.md | 18 +++++------ docs/resources/changelog.md | 2 ++ src/components/format-bytes/format-bytes.ts | 25 ++++++++++++--- src/internal/number.ts | 34 --------------------- 5 files changed, 45 insertions(+), 50 deletions(-) delete mode 100644 src/internal/number.ts diff --git a/cspell.json b/cspell.json index 01539647..06f7af6f 100644 --- a/cspell.json +++ b/cspell.json @@ -38,6 +38,7 @@ "FOUC", "FOUCE", "fullscreen", + "giga", "globby", "Grayscale", "haspopup", @@ -69,6 +70,8 @@ "novalidate", "outdir", "ParamagicDev", + "peta", + "petabit", "popperjs", "progressbar", "radiogroup", @@ -92,6 +95,7 @@ "tablist", "tabpanel", "templating", + "tera", "textareas", "transitionend", "Triaging", @@ -107,7 +111,15 @@ "Webpacker", "wordmark" ], - "ignorePaths": ["package.json", "package-lock.json", ".vscode/**", "src/translations/!(en).ts", "**/*.min.js"], - "ignoreRegExpList": ["(^|[^a-z])sl[a-z]*(^|[^a-z])"], + "ignorePaths": [ + "package.json", + "package-lock.json", + ".vscode/**", + "src/translations/!(en).ts", + "**/*.min.js" + ], + "ignoreRegExpList": [ + "(^|[^a-z])sl[a-z]*(^|[^a-z])" + ], "useGitignore": true } diff --git a/docs/components/format-bytes.md b/docs/components/format-bytes.md index 8eda45bf..eeab55dd 100644 --- a/docs/components/format-bytes.md +++ b/docs/components/format-bytes.md @@ -77,13 +77,13 @@ const App = () => ( ### Formatting Bits -To get the value in bits, set the `unit` attribute to `bits`. +To get the value in bits, set the `unit` attribute to `bit`. ```html preview -
-
-
- +
+
+
+ ``` ```jsx react @@ -91,10 +91,10 @@ import { SlFormatBytes } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> -
-
-
- +
+
+
+ ); ``` diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index b37adb38..45958da6 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -8,9 +8,11 @@ _During the beta period, these restrictions may be relaxed in the event of a mis ## Next +- 🚨 BREAKING: the `unit` property of `` has changed to `byte | bit` instead of `bytes | bits` - Fixed a bug that caused `` to render the wrong size when `--track-width` was increased [#656](https://github.com/shoelace-style/shoelace/issues/656) - Implemented stricter linting to improve consistency and reduce errors, which resulted in many small refactors throughout the codebase [#647](https://github.com/shoelace-style/shoelace/pull/647) - Improved accessibility of `` and `` by making the title an `

` and adding a label to the close button +- Refactored `` to use `Intl.NumberFormat` so it supports localization - Refactored themes so utility styles are no longer injected as `