@redsift/design-system 11.5.0 → 11.6.0-muiv5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/_rollupPluginBabelHelpers.js +133 -0
- package/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/_virtual/jsx-runtime.js +4 -0
- package/_virtual/jsx-runtime.js.map +1 -0
- package/_virtual/react-jsx-runtime.development.js +4 -0
- package/_virtual/react-jsx-runtime.development.js.map +1 -0
- package/_virtual/react-jsx-runtime.production.min.js +4 -0
- package/_virtual/react-jsx-runtime.production.min.js.map +1 -0
- package/components/alert/Alert.d.ts +9 -0
- package/components/alert/Alert.js +117 -0
- package/components/alert/Alert.js.map +1 -0
- package/components/alert/intl/en-US.json.js +7 -0
- package/components/alert/intl/en-US.json.js.map +1 -0
- package/components/alert/intl/fr-FR.json.js +7 -0
- package/components/alert/intl/fr-FR.json.js.map +1 -0
- package/components/alert/intl/index.js +10 -0
- package/components/alert/intl/index.js.map +1 -0
- package/components/alert/styles.js +54 -0
- package/components/alert/styles.js.map +1 -0
- package/components/alert/types.d.ts +49 -0
- package/components/alert/types.js +20 -0
- package/components/alert/types.js.map +1 -0
- package/components/app-bar/AppBar.d.ts +9 -0
- package/components/app-bar/AppBar.js +95 -0
- package/components/app-bar/AppBar.js.map +1 -0
- package/components/app-bar/intl/en-US.json.js +9 -0
- package/components/app-bar/intl/en-US.json.js.map +1 -0
- package/components/app-bar/intl/fr-FR.json.js +9 -0
- package/components/app-bar/intl/fr-FR.json.js.map +1 -0
- package/components/app-bar/intl/index.js +10 -0
- package/components/app-bar/intl/index.js.map +1 -0
- package/components/app-bar/styles.js +139 -0
- package/components/app-bar/styles.js.map +1 -0
- package/components/app-bar/types.d.ts +31 -0
- package/components/app-container/AppContainer.d.ts +11 -0
- package/components/app-container/AppContainer.js +117 -0
- package/components/app-container/AppContainer.js.map +1 -0
- package/components/app-container/context.d.ts +6 -0
- package/components/app-container/context.js +6 -0
- package/components/app-container/context.js.map +1 -0
- package/components/app-container/styles.js +30 -0
- package/components/app-container/styles.js.map +1 -0
- package/components/app-container/types.d.ts +51 -0
- package/components/app-content/AppContent.d.ts +9 -0
- package/components/app-content/AppContent.js +42 -0
- package/components/app-content/AppContent.js.map +1 -0
- package/components/app-content/styles.js +54 -0
- package/components/app-content/styles.js.map +1 -0
- package/components/app-content/types.d.ts +19 -0
- package/components/app-side-panel/AppSidePanel.d.ts +9 -0
- package/components/app-side-panel/AppSidePanel.js +86 -0
- package/components/app-side-panel/AppSidePanel.js.map +1 -0
- package/components/app-side-panel/intl/en-US.json.js +9 -0
- package/components/app-side-panel/intl/en-US.json.js.map +1 -0
- package/components/app-side-panel/intl/fr-FR.json.js +9 -0
- package/components/app-side-panel/intl/fr-FR.json.js.map +1 -0
- package/components/app-side-panel/intl/index.js +10 -0
- package/components/app-side-panel/intl/index.js.map +1 -0
- package/components/app-side-panel/styles.js +183 -0
- package/components/app-side-panel/styles.js.map +1 -0
- package/components/app-side-panel/types.d.ts +39 -0
- package/components/app-side-panel/types.js +15 -0
- package/components/app-side-panel/types.js.map +1 -0
- package/components/app-side-panel/useAppSidePanel.d.ts +6 -0
- package/components/app-side-panel/useAppSidePanel.js +23 -0
- package/components/app-side-panel/useAppSidePanel.js.map +1 -0
- package/components/badge/Badge.d.ts +9 -0
- package/components/badge/Badge.js +44 -0
- package/components/badge/Badge.js.map +1 -0
- package/components/badge/styles.js +93 -0
- package/components/badge/styles.js.map +1 -0
- package/components/badge/types.d.ts +37 -0
- package/components/badge/types.js +14 -0
- package/components/badge/types.js.map +1 -0
- package/components/breadcrumb-item/BreadcrumbItem.d.ts +9 -0
- package/components/breadcrumb-item/BreadcrumbItem.js +47 -0
- package/components/breadcrumb-item/BreadcrumbItem.js.map +1 -0
- package/components/breadcrumb-item/styles.js +48 -0
- package/components/breadcrumb-item/styles.js.map +1 -0
- package/components/breadcrumb-item/types.d.ts +23 -0
- package/components/breadcrumbs/Breadcrumbs.d.ts +13 -0
- package/components/breadcrumbs/Breadcrumbs.js +61 -0
- package/components/breadcrumbs/Breadcrumbs.js.map +1 -0
- package/components/breadcrumbs/styles.js +38 -0
- package/components/breadcrumbs/styles.js.map +1 -0
- package/components/breadcrumbs/types.d.ts +19 -0
- package/components/button/Button.d.ts +13 -0
- package/components/button/Button.js +92 -0
- package/components/button/Button.js.map +1 -0
- package/components/button/styles.d.ts +20 -0
- package/components/button/styles.js +219 -0
- package/components/button/styles.js.map +1 -0
- package/components/button/types.d.ts +67 -0
- package/components/button/types.js +19 -0
- package/components/button/types.js.map +1 -0
- package/components/button-group/ButtonGroup.d.ts +9 -0
- package/components/button-group/ButtonGroup.js +67 -0
- package/components/button-group/ButtonGroup.js.map +1 -0
- package/components/button-group/styles.js +103 -0
- package/components/button-group/styles.js.map +1 -0
- package/components/button-group/types.d.ts +36 -0
- package/components/button-group/types.js +19 -0
- package/components/button-group/types.js.map +1 -0
- package/components/button-link/ButtonLink.d.ts +13 -0
- package/components/button-link/ButtonLink.js +85 -0
- package/components/button-link/ButtonLink.js.map +1 -0
- package/components/button-link/types.d.ts +18 -0
- package/components/card/Card.d.ts +13 -0
- package/components/card/Card.js +81 -0
- package/components/card/Card.js.map +1 -0
- package/components/card/intl/en-US.json.js +9 -0
- package/components/card/intl/en-US.json.js.map +1 -0
- package/components/card/intl/fr-FR.json.js +9 -0
- package/components/card/intl/fr-FR.json.js.map +1 -0
- package/components/card/intl/index.js +10 -0
- package/components/card/intl/index.js.map +1 -0
- package/components/card/styles.js +63 -0
- package/components/card/styles.js.map +1 -0
- package/components/card/types.d.ts +25 -0
- package/components/card-actions/CardActions.d.ts +9 -0
- package/components/card-actions/CardActions.js +33 -0
- package/components/card-actions/CardActions.js.map +1 -0
- package/components/card-actions/styles.js +15 -0
- package/components/card-actions/styles.js.map +1 -0
- package/components/card-actions/types.d.ts +11 -0
- package/components/card-body/CardBody.d.ts +9 -0
- package/components/card-body/CardBody.js +28 -0
- package/components/card-body/CardBody.js.map +1 -0
- package/components/card-body/styles.js +18 -0
- package/components/card-body/styles.js.map +1 -0
- package/components/card-body/types.d.ts +11 -0
- package/components/card-header/CardHeader.d.ts +9 -0
- package/components/card-header/CardHeader.js +56 -0
- package/components/card-header/CardHeader.js.map +1 -0
- package/components/card-header/styles.js +31 -0
- package/components/card-header/styles.js.map +1 -0
- package/components/card-header/types.d.ts +28 -0
- package/components/checkbox/Checkbox.d.ts +11 -0
- package/components/checkbox/Checkbox.js +135 -0
- package/components/checkbox/Checkbox.js.map +1 -0
- package/components/checkbox/styles.js +113 -0
- package/components/checkbox/styles.js.map +1 -0
- package/components/checkbox/types.d.ts +60 -0
- package/components/checkbox-group/CheckboxGroup.d.ts +10 -0
- package/components/checkbox-group/CheckboxGroup.js +101 -0
- package/components/checkbox-group/CheckboxGroup.js.map +1 -0
- package/components/checkbox-group/context.js +6 -0
- package/components/checkbox-group/context.js.map +1 -0
- package/components/checkbox-group/styles.js +78 -0
- package/components/checkbox-group/styles.js.map +1 -0
- package/components/checkbox-group/types.d.ts +72 -0
- package/components/checkbox-group/types.js +18 -0
- package/components/checkbox-group/types.js.map +1 -0
- package/components/conditional-wrapper/ConditionalWrapper.d.ts +6 -0
- package/components/conditional-wrapper/ConditionalWrapper.js +13 -0
- package/components/conditional-wrapper/ConditionalWrapper.js.map +1 -0
- package/components/conditional-wrapper/types.d.ts +10 -0
- package/components/detailed-card/DetailedCard.d.ts +15 -0
- package/components/detailed-card/DetailedCard.js +170 -0
- package/components/detailed-card/DetailedCard.js.map +1 -0
- package/components/detailed-card/intl/en-US.json.js +7 -0
- package/components/detailed-card/intl/en-US.json.js.map +1 -0
- package/components/detailed-card/intl/fr-FR.json.js +7 -0
- package/components/detailed-card/intl/fr-FR.json.js.map +1 -0
- package/components/detailed-card/intl/index.js +10 -0
- package/components/detailed-card/intl/index.js.map +1 -0
- package/components/detailed-card/styles.js +49 -0
- package/components/detailed-card/styles.js.map +1 -0
- package/components/detailed-card/types.d.ts +40 -0
- package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.d.ts +9 -0
- package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js +33 -0
- package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js.map +1 -0
- package/components/detailed-card-collapsible-section-items/styles.js +35 -0
- package/components/detailed-card-collapsible-section-items/styles.js.map +1 -0
- package/components/detailed-card-collapsible-section-items/types.d.ts +16 -0
- package/components/detailed-card-header/DetailedCardHeader.d.ts +9 -0
- package/components/detailed-card-header/DetailedCardHeader.js +45 -0
- package/components/detailed-card-header/DetailedCardHeader.js.map +1 -0
- package/components/detailed-card-header/styles.js +26 -0
- package/components/detailed-card-header/styles.js.map +1 -0
- package/components/detailed-card-header/types.d.ts +20 -0
- package/components/detailed-card-section/DetailedCardSection.d.ts +9 -0
- package/components/detailed-card-section/DetailedCardSection.js +90 -0
- package/components/detailed-card-section/DetailedCardSection.js.map +1 -0
- package/components/detailed-card-section/intl/en-US.json.js +9 -0
- package/components/detailed-card-section/intl/en-US.json.js.map +1 -0
- package/components/detailed-card-section/intl/fr-FR.json.js +9 -0
- package/components/detailed-card-section/intl/fr-FR.json.js.map +1 -0
- package/components/detailed-card-section/intl/index.js +10 -0
- package/components/detailed-card-section/intl/index.js.map +1 -0
- package/components/detailed-card-section/styles.js +69 -0
- package/components/detailed-card-section/styles.js.map +1 -0
- package/components/detailed-card-section/types.d.ts +27 -0
- package/components/detailed-card-section-item/DetailedCardSectionItem.d.ts +9 -0
- package/components/detailed-card-section-item/DetailedCardSectionItem.js +64 -0
- package/components/detailed-card-section-item/DetailedCardSectionItem.js.map +1 -0
- package/components/detailed-card-section-item/styles.js +34 -0
- package/components/detailed-card-section-item/styles.js.map +1 -0
- package/components/detailed-card-section-item/types.d.ts +35 -0
- package/components/flexbox/Flexbox.d.ts +9 -0
- package/components/flexbox/Flexbox.js +44 -0
- package/components/flexbox/Flexbox.js.map +1 -0
- package/components/flexbox/styles.js +54 -0
- package/components/flexbox/styles.js.map +1 -0
- package/components/flexbox/types.d.ts +24 -0
- package/components/focus-within-group/FocusWithinGroup.d.ts +41 -0
- package/components/focus-within-group/FocusWithinGroup.js +91 -0
- package/components/focus-within-group/FocusWithinGroup.js.map +1 -0
- package/components/focus-within-group/context.d.ts +7 -0
- package/components/focus-within-group/context.js +21 -0
- package/components/focus-within-group/context.js.map +1 -0
- package/components/focus-within-group/reducer.d.ts +5 -0
- package/components/focus-within-group/reducer.js +419 -0
- package/components/focus-within-group/reducer.js.map +1 -0
- package/components/focus-within-group/types.d.ts +143 -0
- package/components/focus-within-group/types.js +42 -0
- package/components/focus-within-group/types.js.map +1 -0
- package/components/focus-within-group/useFocusOnList.d.ts +5 -0
- package/components/focus-within-group/useFocusOnList.js +44 -0
- package/components/focus-within-group/useFocusOnList.js.map +1 -0
- package/components/focus-within-group/useFocusOnListItem.d.ts +39 -0
- package/components/focus-within-group/useFocusOnListItem.js +148 -0
- package/components/focus-within-group/useFocusOnListItem.js.map +1 -0
- package/components/gradient-border/index.d.ts +14 -0
- package/components/gradient-border/index.js +38 -0
- package/components/gradient-border/index.js.map +1 -0
- package/components/grid/Grid.d.ts +13 -0
- package/components/grid/Grid.js +45 -0
- package/components/grid/Grid.js.map +1 -0
- package/components/grid/styles.js +55 -0
- package/components/grid/styles.js.map +1 -0
- package/components/grid/types.d.ts +22 -0
- package/components/grid-item/GridItem.d.ts +9 -0
- package/components/grid-item/GridItem.js +28 -0
- package/components/grid-item/GridItem.js.map +1 -0
- package/components/grid-item/styles.js +16 -0
- package/components/grid-item/styles.js.map +1 -0
- package/components/grid-item/types.d.ts +11 -0
- package/components/heading/Heading.d.ts +9 -0
- package/components/heading/Heading.js +50 -0
- package/components/heading/Heading.js.map +1 -0
- package/components/heading/styles.js +67 -0
- package/components/heading/styles.js.map +1 -0
- package/components/heading/types.d.ts +62 -0
- package/components/heading/types.js +26 -0
- package/components/heading/types.js.map +1 -0
- package/components/icon/Icon.d.ts +10 -0
- package/components/icon/Icon.js +116 -0
- package/components/icon/Icon.js.map +1 -0
- package/components/icon/styles.js +84 -0
- package/components/icon/styles.js.map +1 -0
- package/components/icon/types.d.ts +57 -0
- package/components/icon/types.js +18 -0
- package/components/icon/types.js.map +1 -0
- package/components/icon-button/IconButton.d.ts +12 -0
- package/components/icon-button/IconButton.js +81 -0
- package/components/icon-button/IconButton.js.map +1 -0
- package/components/icon-button/styles.js +31 -0
- package/components/icon-button/styles.js.map +1 -0
- package/components/icon-button/types.d.ts +56 -0
- package/components/icon-button/types.js +19 -0
- package/components/icon-button/types.js.map +1 -0
- package/components/icon-button-link/IconButtonLink.d.ts +13 -0
- package/components/icon-button-link/IconButtonLink.js +76 -0
- package/components/icon-button-link/IconButtonLink.js.map +1 -0
- package/components/icon-button-link/types.d.ts +18 -0
- package/components/item/Item.d.ts +10 -0
- package/components/item/Item.js +225 -0
- package/components/item/Item.js.map +1 -0
- package/components/item/styles.d.ts +20 -0
- package/components/item/styles.js +129 -0
- package/components/item/styles.js.map +1 -0
- package/components/item/types.d.ts +59 -0
- package/components/item/useMenuItem.js +55 -0
- package/components/item/useMenuItem.js.map +1 -0
- package/components/link/Link.d.ts +14 -0
- package/components/link/Link.js +67 -0
- package/components/link/Link.js.map +1 -0
- package/components/link/styles.d.ts +15 -0
- package/components/link/styles.js +145 -0
- package/components/link/styles.js.map +1 -0
- package/components/link/types.d.ts +40 -0
- package/components/link-button/LinkButton.d.ts +13 -0
- package/components/link-button/LinkButton.js +66 -0
- package/components/link-button/LinkButton.js.map +1 -0
- package/components/link-button/types.d.ts +13 -0
- package/components/listbox/ActiveDescendantListbox.d.ts +8 -0
- package/components/listbox/ActiveDescendantListbox.js +74 -0
- package/components/listbox/ActiveDescendantListbox.js.map +1 -0
- package/components/listbox/Listbox.d.ts +10 -0
- package/components/listbox/Listbox.js +110 -0
- package/components/listbox/Listbox.js.map +1 -0
- package/components/listbox/RovingTabindexListbox.d.ts +8 -0
- package/components/listbox/RovingTabindexListbox.js +30 -0
- package/components/listbox/RovingTabindexListbox.js.map +1 -0
- package/components/listbox/context.d.ts +7 -0
- package/components/listbox/context.js +15 -0
- package/components/listbox/context.js.map +1 -0
- package/components/listbox/reducer.d.ts +5 -0
- package/components/listbox/reducer.js +45 -0
- package/components/listbox/reducer.js.map +1 -0
- package/components/listbox/styles.js +44 -0
- package/components/listbox/styles.js.map +1 -0
- package/components/listbox/types.d.ts +101 -0
- package/components/listbox/types.js +32 -0
- package/components/listbox/types.js.map +1 -0
- package/components/listbox/useListboxItem.d.ts +12 -0
- package/components/listbox/useListboxItem.js +90 -0
- package/components/listbox/useListboxItem.js.map +1 -0
- package/components/number/Number.d.ts +9 -0
- package/components/number/Number.js +105 -0
- package/components/number/Number.js.map +1 -0
- package/components/number/styles.js +10 -0
- package/components/number/styles.js.map +1 -0
- package/components/number/types.d.ts +63 -0
- package/components/number-field/NumberField.d.ts +10 -0
- package/components/number-field/NumberField.js +216 -0
- package/components/number-field/NumberField.js.map +1 -0
- package/components/number-field/styles.js +240 -0
- package/components/number-field/styles.js.map +1 -0
- package/components/number-field/types.d.ts +74 -0
- package/components/number-field/types.js +14 -0
- package/components/number-field/types.js.map +1 -0
- package/components/pill/Pill.d.ts +9 -0
- package/components/pill/Pill.js +93 -0
- package/components/pill/Pill.js.map +1 -0
- package/components/pill/styles.js +305 -0
- package/components/pill/styles.js.map +1 -0
- package/components/pill/types.d.ts +47 -0
- package/components/pill/types.js +15 -0
- package/components/pill/types.js.map +1 -0
- package/components/progress-bar/ProgressBar.d.ts +9 -0
- package/components/progress-bar/ProgressBar.js +35 -0
- package/components/progress-bar/ProgressBar.js.map +1 -0
- package/components/progress-bar/styles.js +38 -0
- package/components/progress-bar/styles.js.map +1 -0
- package/components/progress-bar/types.d.ts +20 -0
- package/components/radio/Radio.d.ts +11 -0
- package/components/radio/Radio.js +128 -0
- package/components/radio/Radio.js.map +1 -0
- package/components/radio/styles.js +113 -0
- package/components/radio/styles.js.map +1 -0
- package/components/radio/types.d.ts +58 -0
- package/components/radio-group/RadioGroup.d.ts +10 -0
- package/components/radio-group/RadioGroup.js +89 -0
- package/components/radio-group/RadioGroup.js.map +1 -0
- package/components/radio-group/context.js +6 -0
- package/components/radio-group/context.js.map +1 -0
- package/components/radio-group/styles.js +78 -0
- package/components/radio-group/styles.js.map +1 -0
- package/components/radio-group/types.d.ts +68 -0
- package/components/radio-group/types.js +18 -0
- package/components/radio-group/types.js.map +1 -0
- package/components/shared/styles.d.ts +17 -0
- package/components/shared/styles.js +250 -0
- package/components/shared/styles.js.map +1 -0
- package/components/shield/Shield.d.ts +9 -0
- package/components/shield/Shield.js +136 -0
- package/components/shield/Shield.js.map +1 -0
- package/components/shield/styles.js +71 -0
- package/components/shield/styles.js.map +1 -0
- package/components/shield/types.d.ts +52 -0
- package/components/shield/types.js +25 -0
- package/components/shield/types.js.map +1 -0
- package/components/side-navigation-menu/SideNavigationMenu.d.ts +9 -0
- package/components/side-navigation-menu/SideNavigationMenu.js +367 -0
- package/components/side-navigation-menu/SideNavigationMenu.js.map +1 -0
- package/components/side-navigation-menu/context.js +6 -0
- package/components/side-navigation-menu/context.js.map +1 -0
- package/components/side-navigation-menu/reducer.js +26 -0
- package/components/side-navigation-menu/reducer.js.map +1 -0
- package/components/side-navigation-menu/styles.js +196 -0
- package/components/side-navigation-menu/styles.js.map +1 -0
- package/components/side-navigation-menu/types.d.ts +72 -0
- package/components/side-navigation-menu/types.js +21 -0
- package/components/side-navigation-menu/types.js.map +1 -0
- package/components/side-navigation-menu-bar/SideNavigationMenuBar.d.ts +9 -0
- package/components/side-navigation-menu-bar/SideNavigationMenuBar.js +217 -0
- package/components/side-navigation-menu-bar/SideNavigationMenuBar.js.map +1 -0
- package/components/side-navigation-menu-bar/context.js +6 -0
- package/components/side-navigation-menu-bar/context.js.map +1 -0
- package/components/side-navigation-menu-bar/styles.js +89 -0
- package/components/side-navigation-menu-bar/styles.js.map +1 -0
- package/components/side-navigation-menu-bar/types.d.ts +65 -0
- package/components/side-navigation-menu-bar/types.js +22 -0
- package/components/side-navigation-menu-bar/types.js.map +1 -0
- package/components/side-navigation-menu-bar/useSideNavigationMenuBar.d.ts +9 -0
- package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js +70 -0
- package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js.map +1 -0
- package/components/side-navigation-menu-item/SideNavigationMenuItem.d.ts +9 -0
- package/components/side-navigation-menu-item/SideNavigationMenuItem.js +115 -0
- package/components/side-navigation-menu-item/SideNavigationMenuItem.js.map +1 -0
- package/components/side-navigation-menu-item/styles.js +174 -0
- package/components/side-navigation-menu-item/styles.js.map +1 -0
- package/components/side-navigation-menu-item/types.d.ts +51 -0
- package/components/skeleton/Skeleton.d.ts +15 -0
- package/components/skeleton/Skeleton.js +42 -0
- package/components/skeleton/Skeleton.js.map +1 -0
- package/components/skeleton/styles.js +84 -0
- package/components/skeleton/styles.js.map +1 -0
- package/components/skeleton/types.d.ts +18 -0
- package/components/skeleton-circle/SkeletonCircle.d.ts +9 -0
- package/components/skeleton-circle/SkeletonCircle.js +36 -0
- package/components/skeleton-circle/SkeletonCircle.js.map +1 -0
- package/components/skeleton-circle/styles.js +26 -0
- package/components/skeleton-circle/styles.js.map +1 -0
- package/components/skeleton-circle/types.d.ts +12 -0
- package/components/skeleton-text/SkeletonText.d.ts +9 -0
- package/components/skeleton-text/SkeletonText.js +42 -0
- package/components/skeleton-text/SkeletonText.js.map +1 -0
- package/components/skeleton-text/styles.js +39 -0
- package/components/skeleton-text/styles.js.map +1 -0
- package/components/skeleton-text/types.d.ts +36 -0
- package/components/skeleton-text/types.js +20 -0
- package/components/skeleton-text/types.js.map +1 -0
- package/components/spinner/Spinner.d.ts +9 -0
- package/components/spinner/Spinner.js +82 -0
- package/components/spinner/Spinner.js.map +1 -0
- package/components/spinner/images/spinner-grey-l1.svg.js +4 -0
- package/components/spinner/images/spinner-grey-l1.svg.js.map +1 -0
- package/components/spinner/images/spinner-grey-l2.svg.js +4 -0
- package/components/spinner/images/spinner-grey-l2.svg.js.map +1 -0
- package/components/spinner/images/spinner-grey-l3.svg.js +4 -0
- package/components/spinner/images/spinner-grey-l3.svg.js.map +1 -0
- package/components/spinner/images/spinner-primary-n.svg.js +4 -0
- package/components/spinner/images/spinner-primary-n.svg.js.map +1 -0
- package/components/spinner/intl/en-US.json.js +7 -0
- package/components/spinner/intl/en-US.json.js.map +1 -0
- package/components/spinner/intl/fr-FR.json.js +7 -0
- package/components/spinner/intl/fr-FR.json.js.map +1 -0
- package/components/spinner/intl/index.js +10 -0
- package/components/spinner/intl/index.js.map +1 -0
- package/components/spinner/styles.js +13 -0
- package/components/spinner/styles.js.map +1 -0
- package/components/spinner/types.d.ts +38 -0
- package/components/spinner/types.js +16 -0
- package/components/spinner/types.js.map +1 -0
- package/components/switch/Switch.d.ts +11 -0
- package/components/switch/Switch.js +137 -0
- package/components/switch/Switch.js.map +1 -0
- package/components/switch/styles.js +187 -0
- package/components/switch/styles.js.map +1 -0
- package/components/switch/types.d.ts +58 -0
- package/components/switch-group/SwitchGroup.d.ts +10 -0
- package/components/switch-group/SwitchGroup.js +101 -0
- package/components/switch-group/SwitchGroup.js.map +1 -0
- package/components/switch-group/context.js +6 -0
- package/components/switch-group/context.js.map +1 -0
- package/components/switch-group/styles.js +78 -0
- package/components/switch-group/styles.js.map +1 -0
- package/components/switch-group/types.d.ts +72 -0
- package/components/switch-group/types.js +18 -0
- package/components/switch-group/types.js.map +1 -0
- package/components/text/Text.d.ts +9 -0
- package/components/text/Text.js +51 -0
- package/components/text/Text.js.map +1 -0
- package/components/text/styles.js +112 -0
- package/components/text/styles.js.map +1 -0
- package/components/text/types.d.ts +73 -0
- package/components/text/types.js +34 -0
- package/components/text/types.js.map +1 -0
- package/components/text-area/TextArea.d.ts +10 -0
- package/components/text-area/TextArea.js +165 -0
- package/components/text-area/TextArea.js.map +1 -0
- package/components/text-area/styles.js +240 -0
- package/components/text-area/styles.js.map +1 -0
- package/components/text-area/types.d.ts +28 -0
- package/components/text-area/types.js +14 -0
- package/components/text-area/types.js.map +1 -0
- package/components/text-field/TextField.d.ts +10 -0
- package/components/text-field/TextField.js +197 -0
- package/components/text-field/TextField.js.map +1 -0
- package/components/text-field/intl/en-US.json.js +8 -0
- package/components/text-field/intl/en-US.json.js.map +1 -0
- package/components/text-field/intl/fr-FR.json.js +8 -0
- package/components/text-field/intl/fr-FR.json.js.map +1 -0
- package/components/text-field/intl/index.js +10 -0
- package/components/text-field/intl/index.js.map +1 -0
- package/components/text-field/styles.d.ts +22 -0
- package/components/text-field/styles.js +252 -0
- package/components/text-field/styles.js.map +1 -0
- package/components/text-field/types.d.ts +99 -0
- package/components/text-field/types.js +18 -0
- package/components/text-field/types.js.map +1 -0
- package/components/theme/context.d.ts +11 -0
- package/components/theme/context.js +7 -0
- package/components/theme/context.js.map +1 -0
- package/components/theme/useTheme.d.ts +5 -0
- package/components/theme/useTheme.js +13 -0
- package/components/theme/useTheme.js.map +1 -0
- package/hooks/useBoundingRect.d.ts +8 -0
- package/hooks/useBoundingRect.js +17 -0
- package/hooks/useBoundingRect.js.map +1 -0
- package/hooks/useComputeNumberOfRows.d.ts +15 -0
- package/hooks/useComputeNumberOfRows.js +40 -0
- package/hooks/useComputeNumberOfRows.js.map +1 -0
- package/hooks/useIsLoaded.d.ts +5 -0
- package/hooks/useIsLoaded.js +14 -0
- package/hooks/useIsLoaded.js.map +1 -0
- package/hooks/useWindowSize.d.ts +8 -0
- package/hooks/useWindowSize.js +42 -0
- package/hooks/useWindowSize.js.map +1 -0
- package/index.d.ts +157 -4667
- package/index.js +121 -24514
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/packages/popovers/src/components/tooltip/Tooltip.js +62 -0
- package/packages/popovers/src/components/tooltip/Tooltip.js.map +1 -0
- package/packages/popovers/src/components/tooltip/context.js +6 -0
- package/packages/popovers/src/components/tooltip/context.js.map +1 -0
- package/packages/popovers/src/components/tooltip/types.js +28 -0
- package/packages/popovers/src/components/tooltip/types.js.map +1 -0
- package/packages/popovers/src/components/tooltip/useTooltip.js +78 -0
- package/packages/popovers/src/components/tooltip/useTooltip.js.map +1 -0
- package/packages/popovers/src/components/tooltip/useTooltipContext.js +13 -0
- package/packages/popovers/src/components/tooltip/useTooltipContext.js.map +1 -0
- package/packages/popovers/src/components/tooltip-content/TooltipContent.js +80 -0
- package/packages/popovers/src/components/tooltip-content/TooltipContent.js.map +1 -0
- package/packages/popovers/src/components/tooltip-content/styles.js +128 -0
- package/packages/popovers/src/components/tooltip-content/styles.js.map +1 -0
- package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js +47 -0
- package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js.map +1 -0
- package/react-aria/internationalized/date/DateFormatter.d.ts +25 -0
- package/react-aria/internationalized/date/DateFormatter.js +187 -0
- package/react-aria/internationalized/date/DateFormatter.js.map +1 -0
- package/react-aria/internationalized/message/MessageDictionary.d.ts +7 -0
- package/react-aria/internationalized/message/MessageDictionary.js +82 -0
- package/react-aria/internationalized/message/MessageDictionary.js.map +1 -0
- package/react-aria/internationalized/message/MessageFormatter.js +38 -0
- package/react-aria/internationalized/message/MessageFormatter.js.map +1 -0
- package/react-aria/internationalized/number/NumberFormatter.d.ts +6 -0
- package/react-aria/internationalized/number/NumberFormatter.js +222 -0
- package/react-aria/internationalized/number/NumberFormatter.js.map +1 -0
- package/react-aria/internationalized/number/NumberParser.js +288 -0
- package/react-aria/internationalized/number/NumberParser.js.map +1 -0
- package/react-aria/internationalized/string/LocalizedStringDictionary.d.ts +21 -0
- package/react-aria/internationalized/string/LocalizedStringDictionary.js +118 -0
- package/react-aria/internationalized/string/LocalizedStringDictionary.js.map +1 -0
- package/react-aria/internationalized/string/LocalizedStringFormatter.d.ts +21 -0
- package/react-aria/internationalized/string/LocalizedStringFormatter.js +70 -0
- package/react-aria/internationalized/string/LocalizedStringFormatter.js.map +1 -0
- package/react-aria/react-aria/button/useButton.js +95 -0
- package/react-aria/react-aria/button/useButton.js.map +1 -0
- package/react-aria/react-aria/focus/focusSafely.js +33 -0
- package/react-aria/react-aria/focus/focusSafely.js.map +1 -0
- package/react-aria/react-aria/focus/useFocusRing.js +57 -0
- package/react-aria/react-aria/focus/useFocusRing.js.map +1 -0
- package/react-aria/react-aria/focus/useFocusable.js +47 -0
- package/react-aria/react-aria/focus/useFocusable.js.map +1 -0
- package/react-aria/react-aria/form/useFormValidation.js +112 -0
- package/react-aria/react-aria/form/useFormValidation.js.map +1 -0
- package/react-aria/react-aria/i18n/context.d.ts +19 -0
- package/react-aria/react-aria/i18n/context.js +41 -0
- package/react-aria/react-aria/i18n/context.js.map +1 -0
- package/react-aria/react-aria/i18n/useCollator.d.ts +8 -0
- package/react-aria/react-aria/i18n/useCollator.js +25 -0
- package/react-aria/react-aria/i18n/useCollator.js.map +1 -0
- package/react-aria/react-aria/i18n/useDateFormatter.d.ts +13 -0
- package/react-aria/react-aria/i18n/useDateFormatter.js +39 -0
- package/react-aria/react-aria/i18n/useDateFormatter.js.map +1 -0
- package/react-aria/react-aria/i18n/useDefaultLocale.d.ts +10 -0
- package/react-aria/react-aria/i18n/useDefaultLocale.js +67 -0
- package/react-aria/react-aria/i18n/useDefaultLocale.js.map +1 -0
- package/react-aria/react-aria/i18n/useFilter.d.ts +15 -0
- package/react-aria/react-aria/i18n/useFilter.js +58 -0
- package/react-aria/react-aria/i18n/useFilter.js.map +1 -0
- package/react-aria/react-aria/i18n/useListFormatter.d.ts +8 -0
- package/react-aria/react-aria/i18n/useListFormatter.js +20 -0
- package/react-aria/react-aria/i18n/useListFormatter.js.map +1 -0
- package/react-aria/react-aria/i18n/useLocalizedStringFormatter.d.ts +15 -0
- package/react-aria/react-aria/i18n/useLocalizedStringFormatter.js +38 -0
- package/react-aria/react-aria/i18n/useLocalizedStringFormatter.js.map +1 -0
- package/react-aria/react-aria/i18n/useMessageFormatter.d.ts +13 -0
- package/react-aria/react-aria/i18n/useMessageFormatter.js +32 -0
- package/react-aria/react-aria/i18n/useMessageFormatter.js.map +1 -0
- package/react-aria/react-aria/i18n/useNumberFormatter.d.ts +10 -0
- package/react-aria/react-aria/i18n/useNumberFormatter.js +21 -0
- package/react-aria/react-aria/i18n/useNumberFormatter.js.map +1 -0
- package/react-aria/react-aria/i18n/utils.js +49 -0
- package/react-aria/react-aria/i18n/utils.js.map +1 -0
- package/react-aria/react-aria/interactions/context.js +20 -0
- package/react-aria/react-aria/interactions/context.js.map +1 -0
- package/react-aria/react-aria/interactions/createEventHandler.js +48 -0
- package/react-aria/react-aria/interactions/createEventHandler.js.map +1 -0
- package/react-aria/react-aria/interactions/textSelection.js +85 -0
- package/react-aria/react-aria/interactions/textSelection.js.map +1 -0
- package/react-aria/react-aria/interactions/useFocus.js +53 -0
- package/react-aria/react-aria/interactions/useFocus.js.map +1 -0
- package/react-aria/react-aria/interactions/useFocusVisible.js +236 -0
- package/react-aria/react-aria/interactions/useFocusVisible.js.map +1 -0
- package/react-aria/react-aria/interactions/useFocusWithin.js +65 -0
- package/react-aria/react-aria/interactions/useFocusWithin.js.map +1 -0
- package/react-aria/react-aria/interactions/useKeyboard.js +27 -0
- package/react-aria/react-aria/interactions/useKeyboard.js.map +1 -0
- package/react-aria/react-aria/interactions/usePress.js +769 -0
- package/react-aria/react-aria/interactions/usePress.js.map +1 -0
- package/react-aria/react-aria/interactions/useScrollWheel.js +31 -0
- package/react-aria/react-aria/interactions/useScrollWheel.js.map +1 -0
- package/react-aria/react-aria/interactions/utils.js +116 -0
- package/react-aria/react-aria/interactions/utils.js.map +1 -0
- package/react-aria/react-aria/label/useField.js +42 -0
- package/react-aria/react-aria/label/useField.js.map +1 -0
- package/react-aria/react-aria/label/useLabel.js +42 -0
- package/react-aria/react-aria/label/useLabel.js.map +1 -0
- package/react-aria/react-aria/live-announcer/LiveAnnouncer.js +121 -0
- package/react-aria/react-aria/live-announcer/LiveAnnouncer.js.map +1 -0
- package/react-aria/react-aria/numberfield/intl/en-US.json.js +11 -0
- package/react-aria/react-aria/numberfield/intl/en-US.json.js.map +1 -0
- package/react-aria/react-aria/numberfield/intl/fr-FR.json.js +11 -0
- package/react-aria/react-aria/numberfield/intl/fr-FR.json.js.map +1 -0
- package/react-aria/react-aria/numberfield/intl/index.js +10 -0
- package/react-aria/react-aria/numberfield/intl/index.js.map +1 -0
- package/react-aria/react-aria/numberfield/useNumberField.js +294 -0
- package/react-aria/react-aria/numberfield/useNumberField.js.map +1 -0
- package/react-aria/react-aria/spinbutton/intl/en-US.json.js +7 -0
- package/react-aria/react-aria/spinbutton/intl/en-US.json.js.map +1 -0
- package/react-aria/react-aria/spinbutton/intl/fr-FR.json.js +7 -0
- package/react-aria/react-aria/spinbutton/intl/fr-FR.json.js.map +1 -0
- package/react-aria/react-aria/spinbutton/intl/index.js +10 -0
- package/react-aria/react-aria/spinbutton/intl/index.js.map +1 -0
- package/react-aria/react-aria/spinbutton/useSpinButton.js +168 -0
- package/react-aria/react-aria/spinbutton/useSpinButton.js.map +1 -0
- package/react-aria/react-aria/ssr/SSRProvider.d.ts +22 -0
- package/react-aria/react-aria/ssr/SSRProvider.js +157 -0
- package/react-aria/react-aria/ssr/SSRProvider.js.map +1 -0
- package/react-aria/react-aria/textfield/useFormattedTextField.js +142 -0
- package/react-aria/react-aria/textfield/useFormattedTextField.js.map +1 -0
- package/react-aria/react-aria/textfield/useTextField.js +156 -0
- package/react-aria/react-aria/textfield/useTextField.js.map +1 -0
- package/react-aria/react-aria/utils/chain.js +33 -0
- package/react-aria/react-aria/utils/chain.js.map +1 -0
- package/react-aria/react-aria/utils/domHelpers.js +14 -0
- package/react-aria/react-aria/utils/domHelpers.js.map +1 -0
- package/react-aria/react-aria/utils/filterDOMProps.js +45 -0
- package/react-aria/react-aria/utils/filterDOMProps.js.map +1 -0
- package/react-aria/react-aria/utils/focusWithoutScrolling.js +88 -0
- package/react-aria/react-aria/utils/focusWithoutScrolling.js.map +1 -0
- package/react-aria/react-aria/utils/isVirtualEvent.js +51 -0
- package/react-aria/react-aria/utils/isVirtualEvent.js.map +1 -0
- package/react-aria/react-aria/utils/mergeProps.js +48 -0
- package/react-aria/react-aria/utils/mergeProps.js.map +1 -0
- package/react-aria/react-aria/utils/openLink.js +55 -0
- package/react-aria/react-aria/utils/openLink.js.map +1 -0
- package/react-aria/react-aria/utils/platform.js +69 -0
- package/react-aria/react-aria/utils/platform.js.map +1 -0
- package/react-aria/react-aria/utils/runAfterTransition.js +100 -0
- package/react-aria/react-aria/utils/runAfterTransition.js.map +1 -0
- package/react-aria/react-aria/utils/useDeepMemo.js +16 -0
- package/react-aria/react-aria/utils/useDeepMemo.js.map +1 -0
- package/react-aria/react-aria/utils/useEffectEvent.js +31 -0
- package/react-aria/react-aria/utils/useEffectEvent.js.map +1 -0
- package/react-aria/react-aria/utils/useEvent.js +21 -0
- package/react-aria/react-aria/utils/useEvent.js.map +1 -0
- package/react-aria/react-aria/utils/useFormReset.js +23 -0
- package/react-aria/react-aria/utils/useFormReset.js.map +1 -0
- package/react-aria/react-aria/utils/useGlobalListeners.js +44 -0
- package/react-aria/react-aria/utils/useGlobalListeners.js.map +1 -0
- package/react-aria/react-aria/utils/useId.js +86 -0
- package/react-aria/react-aria/utils/useId.js.map +1 -0
- package/react-aria/react-aria/utils/useLabels.js +39 -0
- package/react-aria/react-aria/utils/useLabels.js.map +1 -0
- package/react-aria/react-aria/utils/useLayoutEffect.js +21 -0
- package/react-aria/react-aria/utils/useLayoutEffect.js.map +1 -0
- package/react-aria/react-aria/utils/useSyncRef.js +29 -0
- package/react-aria/react-aria/utils/useSyncRef.js.map +1 -0
- package/react-aria/react-aria/utils/useValueEffect.js +52 -0
- package/react-aria/react-aria/utils/useValueEffect.js.map +1 -0
- package/react-aria/react-stately/form/useFormValidationState.js +191 -0
- package/react-aria/react-stately/form/useFormValidationState.js.map +1 -0
- package/react-aria/react-stately/numberfield/useNumberFieldState.js +196 -0
- package/react-aria/react-stately/numberfield/useNumberFieldState.js.map +1 -0
- package/react-aria/react-stately/utils/number.js +56 -0
- package/react-aria/react-stately/utils/number.js.map +1 -0
- package/react-aria/react-stately/utils/useControlledState.js +68 -0
- package/react-aria/react-stately/utils/useControlledState.js.map +1 -0
- package/react-aria/react-types/shared/locale.d.ts +3 -0
- package/types/colors.d.ts +102 -0
- package/types/colors.js +64 -0
- package/types/colors.js.map +1 -0
- package/types/fonts.d.ts +12 -0
- package/types/fonts.js +10 -0
- package/types/fonts.js.map +1 -0
- package/types/helpers.d.ts +23 -0
- package/types/products.d.ts +40 -0
- package/types/products.js +38 -0
- package/types/products.js.map +1 -0
- package/types/styles.d.ts +283 -0
- package/types/styles.js +161 -0
- package/types/styles.js.map +1 -0
- package/utils/filterComponents.d.ts +12 -0
- package/utils/filterComponents.js +24 -0
- package/utils/filterComponents.js.map +1 -0
- package/utils/getTextWidth.d.ts +6 -0
- package/utils/getTextWidth.js +32 -0
- package/utils/getTextWidth.js.map +1 -0
- package/utils/isComponent.d.ts +12 -0
- package/utils/isComponent.js +15 -0
- package/utils/isComponent.js.map +1 -0
- package/utils/partitionComponents.d.ts +10 -0
- package/utils/partitionComponents.js +26 -0
- package/utils/partitionComponents.js.map +1 -0
- package/utils/redsift-design-tokens.d.ts +1389 -0
- package/utils/redsift-design-tokens.js +1391 -0
- package/utils/redsift-design-tokens.js.map +1 -0
- package/utils/useId.d.ts +6 -0
- package/utils/useId.js +42 -0
- package/utils/useId.js.map +1 -0
- package/utils/warnIfNoAccessibleLabelFound.d.ts +11 -0
- package/utils/warnIfNoAccessibleLabelFound.js +20 -0
- package/utils/warnIfNoAccessibleLabelFound.js.map +1 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable prefer-const */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
let formatterCache = new Map();
|
|
18
|
+
/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */
|
|
19
|
+
class DateFormatter {
|
|
20
|
+
constructor(locale) {
|
|
21
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
22
|
+
_defineProperty(this, "formatter", void 0);
|
|
23
|
+
_defineProperty(this, "options", void 0);
|
|
24
|
+
_defineProperty(this, "resolvedHourCycle", void 0);
|
|
25
|
+
this.formatter = getCachedDateFormatter(locale, options);
|
|
26
|
+
this.options = options;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
30
|
+
format(value) {
|
|
31
|
+
return this.formatter.format(value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
35
|
+
formatToParts(value) {
|
|
36
|
+
return this.formatter.formatToParts(value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Formats a date range as a string. */
|
|
40
|
+
formatRange(start, end) {
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
if (typeof this.formatter.formatRange === 'function') {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
return this.formatter.formatRange(start, end);
|
|
45
|
+
}
|
|
46
|
+
if (end < start) {
|
|
47
|
+
throw new RangeError('End date must be >= start date');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Very basic fallback for old browsers.
|
|
51
|
+
return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Formats a date range as an array of parts. */
|
|
55
|
+
formatRangeToParts(start, end) {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
if (typeof this.formatter.formatRangeToParts === 'function') {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
return this.formatter.formatRangeToParts(start, end);
|
|
60
|
+
}
|
|
61
|
+
if (end < start) {
|
|
62
|
+
throw new RangeError('End date must be >= start date');
|
|
63
|
+
}
|
|
64
|
+
let startParts = this.formatter.formatToParts(start);
|
|
65
|
+
let endParts = this.formatter.formatToParts(end);
|
|
66
|
+
return [...startParts.map(p => _objectSpread2(_objectSpread2({}, p), {}, {
|
|
67
|
+
source: 'startRange'
|
|
68
|
+
})), {
|
|
69
|
+
type: 'literal',
|
|
70
|
+
value: ' – ',
|
|
71
|
+
source: 'shared'
|
|
72
|
+
}, ...endParts.map(p => _objectSpread2(_objectSpread2({}, p), {}, {
|
|
73
|
+
source: 'endRange'
|
|
74
|
+
}))];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
78
|
+
resolvedOptions() {
|
|
79
|
+
let resolvedOptions = this.formatter.resolvedOptions();
|
|
80
|
+
if (hasBuggyResolvedHourCycle()) {
|
|
81
|
+
if (!this.resolvedHourCycle) {
|
|
82
|
+
this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
83
|
+
}
|
|
84
|
+
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
85
|
+
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Safari uses a different name for the Ethiopic (Amete Alem) calendar.
|
|
89
|
+
// https://bugs.webkit.org/show_bug.cgi?id=241564
|
|
90
|
+
if (resolvedOptions.calendar === 'ethiopic-amete-alem') {
|
|
91
|
+
resolvedOptions.calendar = 'ethioaa';
|
|
92
|
+
}
|
|
93
|
+
return resolvedOptions;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
|
|
98
|
+
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
|
|
99
|
+
// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)
|
|
100
|
+
// rather than h12 (12:00 - 11:59).
|
|
101
|
+
// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal
|
|
102
|
+
// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]
|
|
103
|
+
// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791
|
|
104
|
+
// [2] https://github.com/tc39/ecma402/issues/402
|
|
105
|
+
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
|
|
106
|
+
|
|
107
|
+
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
|
|
108
|
+
const hour12Preferences = {
|
|
109
|
+
true: {
|
|
110
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
111
|
+
ja: 'h11'
|
|
112
|
+
},
|
|
113
|
+
false: {
|
|
114
|
+
// All locales use h23 for 24 hour time. None use h24.
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
function getCachedDateFormatter(locale) {
|
|
118
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
119
|
+
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
|
|
120
|
+
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
|
|
121
|
+
if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {
|
|
122
|
+
options = _objectSpread2({}, options);
|
|
123
|
+
let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];
|
|
124
|
+
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
|
|
125
|
+
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
|
|
126
|
+
delete options.hour12;
|
|
127
|
+
}
|
|
128
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');
|
|
129
|
+
if (formatterCache.has(cacheKey)) {
|
|
130
|
+
return formatterCache.get(cacheKey);
|
|
131
|
+
}
|
|
132
|
+
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
133
|
+
formatterCache.set(cacheKey, numberFormatter);
|
|
134
|
+
return numberFormatter;
|
|
135
|
+
}
|
|
136
|
+
let _hasBuggyHour12Behavior = null;
|
|
137
|
+
function hasBuggyHour12Behavior() {
|
|
138
|
+
if (_hasBuggyHour12Behavior == null) {
|
|
139
|
+
_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
|
|
140
|
+
hour: 'numeric',
|
|
141
|
+
hour12: false
|
|
142
|
+
}).format(new Date(2020, 2, 3, 0)) === '24';
|
|
143
|
+
}
|
|
144
|
+
return _hasBuggyHour12Behavior;
|
|
145
|
+
}
|
|
146
|
+
let _hasBuggyResolvedHourCycle = null;
|
|
147
|
+
function hasBuggyResolvedHourCycle() {
|
|
148
|
+
if (_hasBuggyResolvedHourCycle == null) {
|
|
149
|
+
_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
|
|
150
|
+
hour: 'numeric',
|
|
151
|
+
hour12: false
|
|
152
|
+
}).resolvedOptions().hourCycle === 'h12';
|
|
153
|
+
}
|
|
154
|
+
return _hasBuggyResolvedHourCycle;
|
|
155
|
+
}
|
|
156
|
+
function getResolvedHourCycle(locale, options) {
|
|
157
|
+
if (!options.timeStyle && !options.hour) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
|
|
162
|
+
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
|
|
163
|
+
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
|
|
164
|
+
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
|
|
165
|
+
let formatter = getCachedDateFormatter(locale, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
166
|
+
timeZone: undefined // use local timezone
|
|
167
|
+
}));
|
|
168
|
+
|
|
169
|
+
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour').value, 10);
|
|
170
|
+
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour').value, 10);
|
|
171
|
+
if (min === 0 && max === 23) {
|
|
172
|
+
return 'h23';
|
|
173
|
+
}
|
|
174
|
+
if (min === 24 && max === 23) {
|
|
175
|
+
return 'h24';
|
|
176
|
+
}
|
|
177
|
+
if (min === 0 && max === 11) {
|
|
178
|
+
return 'h11';
|
|
179
|
+
}
|
|
180
|
+
if (min === 12 && max === 11) {
|
|
181
|
+
return 'h12';
|
|
182
|
+
}
|
|
183
|
+
throw new Error('Unexpected hour cycle result');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export { DateFormatter };
|
|
187
|
+
//# sourceMappingURL=DateFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateFormatter.js","sources":["../../../../src/react-aria/internationalized/date/DateFormatter.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {\n hourCycle?: Intl.DateTimeFormatOptions['hourCycle'];\n}\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared';\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map((p) => ({ ...p, source: 'startRange' } as DateRangeFormatPart)),\n { type: 'literal', value: ' – ', source: 'shared' },\n ...endParts.map((p) => ({ ...p, source: 'endRange' } as DateRangeFormatPart)),\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11',\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n },\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = { ...options };\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior =\n new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false,\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle =\n (\n new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false,\n }).resolvedOptions() as ResolvedDateTimeFormatOptions\n ).hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined, // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":["formatterCache","Map","DateFormatter","constructor","locale","options","arguments","length","undefined","_defineProperty","formatter","getCachedDateFormatter","format","value","formatToParts","formatRange","start","end","RangeError","formatRangeToParts","startParts","endParts","map","p","_objectSpread","source","type","resolvedOptions","hasBuggyResolvedHourCycle","resolvedHourCycle","getResolvedHourCycle","hourCycle","hour12","calendar","hour12Preferences","true","ja","false","hasBuggyHour12Behavior","pref","String","split","defaultHourCycle","cacheKey","Object","entries","sort","a","b","join","has","get","numberFormatter","Intl","DateTimeFormat","set","_hasBuggyHour12Behavior","hour","Date","_hasBuggyResolvedHourCycle","timeStyle","replace","includes","timeZone","min","parseInt","find","max","Error"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,cAAc,GAAG,IAAIC,GAAG,EAA+B,CAAA;AAU3D;AACO,MAAMC,aAAa,CAAgC;EAKxDC,WAAWA,CAACC,MAAc,EAA4C;AAAA,IAAA,IAA1CC,OAAmC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;IAAAG,eAAA,CAAA,IAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,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AAM,CAAC,CAAEb,KAAK,EAAE,EAAE,CAAC,CAAA;AAE/G,EAAA,IAAImD,GAAG,KAAK,CAAC,IAAIG,GAAG,KAAK,EAAE,EAAE;AAC3B,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,IAAIH,GAAG,KAAK,EAAE,IAAIG,GAAG,KAAK,EAAE,EAAE;AAC5B,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,IAAIH,GAAG,KAAK,CAAC,IAAIG,GAAG,KAAK,EAAE,EAAE;AAC3B,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,IAAIH,GAAG,KAAK,EAAE,IAAIG,GAAG,KAAK,EAAE,EAAE;AAC5B,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAA;AACjD;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable prefer-const */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Stores a mapping of localized strings. Can be used to find the
|
|
19
|
+
* closest available string for a given locale.
|
|
20
|
+
*/
|
|
21
|
+
class MessageDictionary {
|
|
22
|
+
constructor(messages) {
|
|
23
|
+
let defaultLocale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
24
|
+
_defineProperty(this, "messages", void 0);
|
|
25
|
+
_defineProperty(this, "defaultLocale", void 0);
|
|
26
|
+
// Clone messages so we don't modify the original object.
|
|
27
|
+
// Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.
|
|
28
|
+
this.messages = Object.fromEntries(Object.entries(messages).filter(_ref => {
|
|
29
|
+
let [, v] = _ref;
|
|
30
|
+
return v;
|
|
31
|
+
}));
|
|
32
|
+
this.defaultLocale = defaultLocale;
|
|
33
|
+
}
|
|
34
|
+
getStringForLocale(key, locale) {
|
|
35
|
+
let strings = this.messages[locale];
|
|
36
|
+
if (!strings) {
|
|
37
|
+
strings = getStringsForLocale(locale, this.messages, this.defaultLocale);
|
|
38
|
+
this.messages[locale] = strings;
|
|
39
|
+
}
|
|
40
|
+
let string = strings[key];
|
|
41
|
+
if (!string) {
|
|
42
|
+
throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
|
43
|
+
}
|
|
44
|
+
return string;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function getStringsForLocale(locale, strings) {
|
|
48
|
+
let defaultLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'en-US';
|
|
49
|
+
// If there is an exact match, use it.
|
|
50
|
+
if (strings[locale]) {
|
|
51
|
+
return strings[locale];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Attempt to find the closest match by language.
|
|
55
|
+
// For example, if the locale is fr-CA (French Canadian), but there is only
|
|
56
|
+
// an fr-FR (France) set of strings, use that.
|
|
57
|
+
// This could be replaced with Intl.LocaleMatcher once it is supported.
|
|
58
|
+
// https://github.com/tc39/proposal-intl-localematcher
|
|
59
|
+
let language = getLanguage(locale);
|
|
60
|
+
if (strings[language]) {
|
|
61
|
+
return strings[language];
|
|
62
|
+
}
|
|
63
|
+
for (let key in strings) {
|
|
64
|
+
if (key.startsWith(language + '-')) {
|
|
65
|
+
return strings[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Nothing close, use english.
|
|
70
|
+
return strings[defaultLocale];
|
|
71
|
+
}
|
|
72
|
+
function getLanguage(locale) {
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
if (Intl.Locale) {
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
return new Intl.Locale(locale).language;
|
|
77
|
+
}
|
|
78
|
+
return locale.split('-')[0];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { MessageDictionary };
|
|
82
|
+
//# sourceMappingURL=MessageDictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageDictionary.js","sources":["../../../../src/react-aria/internationalized/message/MessageDictionary.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type LocalizedStrings = {\n [lang: string]: {\n [key: string]: string;\n };\n};\n\n/**\n * Stores a mapping of localized strings. Can be used to find the\n * closest available string for a given locale.\n */\nexport class MessageDictionary {\n private messages: LocalizedStrings;\n private defaultLocale: string;\n\n constructor(messages: LocalizedStrings, defaultLocale: string = 'en-US') {\n // Clone messages so we don't modify the original object.\n // Filter out entries with falsy values which may have been caused by applying optimize-locales-plugin.\n this.messages = Object.fromEntries(Object.entries(messages).filter(([, v]) => v));\n this.defaultLocale = defaultLocale;\n }\n\n getStringForLocale(key: string, locale: string) {\n let strings = this.messages[locale];\n if (!strings) {\n strings = getStringsForLocale(locale, this.messages, this.defaultLocale);\n this.messages[locale] = strings;\n }\n\n let string = strings[key];\n if (!string) {\n throw new Error(`Could not find intl message ${key} in ${locale} locale`);\n }\n\n return string;\n }\n}\n\nfunction getStringsForLocale(locale: string, strings: LocalizedStrings, defaultLocale = 'en-US') {\n // If there is an exact match, use it.\n if (strings[locale]) {\n return strings[locale];\n }\n\n // Attempt to find the closest match by language.\n // For example, if the locale is fr-CA (French Canadian), but there is only\n // an fr-FR (France) set of strings, use that.\n // This could be replaced with Intl.LocaleMatcher once it is supported.\n // https://github.com/tc39/proposal-intl-localematcher\n let language = getLanguage(locale);\n if (strings[language]) {\n return strings[language];\n }\n\n for (let key in strings) {\n if (key.startsWith(language + '-')) {\n return strings[key];\n }\n }\n\n // Nothing close, use english.\n return strings[defaultLocale];\n}\n\nfunction getLanguage(locale: string) {\n // @ts-ignore\n if (Intl.Locale) {\n // @ts-ignore\n return new Intl.Locale(locale).language;\n }\n\n return locale.split('-')[0];\n}\n"],"names":["MessageDictionary","constructor","messages","defaultLocale","arguments","length","undefined","_defineProperty","Object","fromEntries","entries","filter","_ref","v","getStringForLocale","key","locale","strings","getStringsForLocale","string","Error","language","getLanguage","startsWith","Intl","Locale","split"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,CAAC;EAI7BC,WAAWA,CAACC,QAA0B,EAAmC;AAAA,IAAA,IAAjCC,aAAqB,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,OAAO,CAAA;IAAAG,eAAA,CAAA,IAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA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C,CAAA;AACxB,GAAA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIK,QAAQ,GAAGC,WAAW,CAACN,MAAM,CAAC,CAAA;AAClC,EAAA,IAAIC,OAAO,CAACI,QAAQ,CAAC,EAAE;IACrB,OAAOJ,OAAO,CAACI,QAAQ,CAAC,CAAA;AAC1B,GAAA;AAEA,EAAA,KAAK,IAAIN,GAAG,IAAIE,OAAO,EAAE;IACvB,IAAIF,GAAG,CAACQ,UAAU,CAACF,QAAQ,GAAG,GAAG,CAAC,EAAE;MAClC,OAAOJ,OAAO,CAACF,GAAG,CAAC,CAAA;AACrB,KAAA;AACF,GAAA;;AAEA;EACA,OAAOE,OAAO,CAACd,aAAa,CAAC,CAAA;AAC/B,CAAA;AAEA,SAASmB,WAAWA,CAACN,MAAc,EAAE;AACnC;EACA,IAAIQ,IAAI,CAACC,MAAM,EAAE;AACf;IACA,OAAO,IAAID,IAAI,CAACC,MAAM,CAACT,MAAM,CAAC,CAACK,QAAQ,CAAA;AACzC,GAAA;EAEA,OAAOL,MAAM,CAACU,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7B;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import IntlMessageFormat from 'intl-messageformat';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Formats ICU Message strings to create localized strings from a MessageDictionary.
|
|
6
|
+
*/
|
|
7
|
+
class MessageFormatter {
|
|
8
|
+
constructor(locale, messages) {
|
|
9
|
+
_defineProperty(this, "locale", void 0);
|
|
10
|
+
_defineProperty(this, "messages", void 0);
|
|
11
|
+
_defineProperty(this, "cache", void 0);
|
|
12
|
+
this.locale = locale;
|
|
13
|
+
this.messages = messages;
|
|
14
|
+
this.cache = {};
|
|
15
|
+
}
|
|
16
|
+
format(key, variables) {
|
|
17
|
+
let message = this.cache[key];
|
|
18
|
+
if (!message) {
|
|
19
|
+
let msg = this.messages.getStringForLocale(key, this.locale);
|
|
20
|
+
if (!msg) {
|
|
21
|
+
throw new Error(`Could not find intl message ${key} in ${this.locale} locale`);
|
|
22
|
+
}
|
|
23
|
+
message = new IntlMessageFormat(msg, this.locale);
|
|
24
|
+
this.cache[key] = message;
|
|
25
|
+
}
|
|
26
|
+
let varCopy;
|
|
27
|
+
if (variables) {
|
|
28
|
+
varCopy = Object.keys(variables).reduce((acc, key) => {
|
|
29
|
+
acc[key] = variables[key] == null ? false : variables[key];
|
|
30
|
+
return acc;
|
|
31
|
+
}, {});
|
|
32
|
+
}
|
|
33
|
+
return message.format(varCopy);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { MessageFormatter };
|
|
38
|
+
//# sourceMappingURL=MessageFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageFormatter.js","sources":["../../../../src/react-aria/internationalized/message/MessageFormatter.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { FormatXMLElementFn, PrimitiveType } from 'intl-messageformat/src/formatters';\nimport IntlMessageFormat from 'intl-messageformat';\nimport { MessageDictionary } from './MessageDictionary';\n\n/**\n * Formats ICU Message strings to create localized strings from a MessageDictionary.\n */\nexport class MessageFormatter {\n private locale: string;\n private messages: MessageDictionary;\n private cache: { [key: string]: IntlMessageFormat };\n\n constructor(locale: string, messages: MessageDictionary) {\n this.locale = locale;\n this.messages = messages;\n this.cache = {};\n }\n\n format<T = void>(\n key: string,\n variables: Record<string, PrimitiveType | T | FormatXMLElementFn<T, string | T | (string | T)[]>> | undefined\n ) {\n let message = this.cache[key];\n if (!message) {\n let msg = this.messages.getStringForLocale(key, this.locale);\n if (!msg) {\n throw new Error(`Could not find intl message ${key} in ${this.locale} locale`);\n }\n\n message = new IntlMessageFormat(msg, this.locale);\n this.cache[key] = message;\n }\n let varCopy: Record<string, PrimitiveType | T | FormatXMLElementFn<T, string | T | (string | T)[]>> | undefined;\n if (variables) {\n varCopy = Object.keys(variables).reduce((acc, key) => {\n acc[key] = variables[key] == null ? false : variables[key];\n return acc;\n }, {});\n }\n\n return message.format(varCopy);\n }\n}\n"],"names":["MessageFormatter","constructor","locale","messages","_defineProperty","cache","format","key","variables","message","msg","getStringForLocale","Error","IntlMessageFormat","varCopy","Object","keys","reduce","acc"],"mappings":";;;AAkBA;AACA;AACA;AACO,MAAMA,gBAAgB,CAAC;AAK5BC,EAAAA,WAAWA,CAACC,MAAc,EAAEC,QAA2B,EAAE;IAAAC,eAAA,CAAA,IAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IACvD,IAAI,CAACF,MAAM,GAAGA,MAAM,CAAA;IACpB,IAAI,CAACC,QAAQ,GAAGA,QAAQ,CAAA;AACxB,IAAA,IAAI,CAACE,KAAK,GAAG,EAAE,CAAA;AACjB,GAAA;AAEAC,EAAAA,MAAMA,CACJC,GAAW,EACXC,SAA6G,EAC7G;AACA,IAAA,IAAIC,OAAO,GAAG,IAAI,CAACJ,KAAK,CAACE,GAAG,CAAC,CAAA;IAC7B,IAAI,CAACE,OAAO,EAAE;AACZ,MAAA,IAAIC,GAAG,GAAG,IAAI,CAACP,QAAQ,CAACQ,kBAAkB,CAACJ,GAAG,EAAE,IAAI,CAACL,MAAM,CAAC,CAAA;MAC5D,IAAI,CAACQ,GAAG,EAAE;QACR,MAAM,IAAIE,KAAK,CAAE,CAA8BL,4BAAAA,EAAAA,GAAI,OAAM,IAAI,CAACL,MAAO,CAAA,OAAA,CAAQ,CAAC,CAAA;AAChF,OAAA;MAEAO,OAAO,GAAG,IAAII,iBAAiB,CAACH,GAAG,EAAE,IAAI,CAACR,MAAM,CAAC,CAAA;AACjD,MAAA,IAAI,CAACG,KAAK,CAACE,GAAG,CAAC,GAAGE,OAAO,CAAA;AAC3B,KAAA;AACA,IAAA,IAAIK,OAA2G,CAAA;AAC/G,IAAA,IAAIN,SAAS,EAAE;AACbM,MAAAA,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACR,SAAS,CAAC,CAACS,MAAM,CAAC,CAACC,GAAG,EAAEX,GAAG,KAAK;AACpDW,QAAAA,GAAG,CAACX,GAAG,CAAC,GAAGC,SAAS,CAACD,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,GAAGC,SAAS,CAACD,GAAG,CAAC,CAAA;AAC1D,QAAA,OAAOW,GAAG,CAAA;OACX,EAAE,EAAE,CAAC,CAAA;AACR,KAAA;AAEA,IAAA,OAAOT,OAAO,CAACH,MAAM,CAACQ,OAAO,CAAC,CAAA;AAChC,GAAA;AACF;;;;"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable prefer-const */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
let formatterCache = new Map();
|
|
19
|
+
let supportsSignDisplay = false;
|
|
20
|
+
try {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
supportsSignDisplay = new Intl.NumberFormat('de-DE', {
|
|
23
|
+
signDisplay: 'exceptZero'
|
|
24
|
+
}).resolvedOptions().signDisplay === 'exceptZero';
|
|
25
|
+
// eslint-disable-next-line no-empty
|
|
26
|
+
} catch (e) {}
|
|
27
|
+
let supportsUnit = false;
|
|
28
|
+
try {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
supportsUnit = new Intl.NumberFormat('de-DE', {
|
|
31
|
+
style: 'unit',
|
|
32
|
+
unit: 'degree'
|
|
33
|
+
}).resolvedOptions().style === 'unit';
|
|
34
|
+
// eslint-disable-next-line no-empty
|
|
35
|
+
} catch (e) {}
|
|
36
|
+
|
|
37
|
+
// Polyfill for units since Safari doesn't support them yet. See https://bugs.webkit.org/show_bug.cgi?id=215438.
|
|
38
|
+
// Currently only polyfilling the unit degree in narrow format for ColorSlider in our supported locales.
|
|
39
|
+
// Values were determined by switching to each locale manually in Chrome.
|
|
40
|
+
const UNITS = {
|
|
41
|
+
degree: {
|
|
42
|
+
narrow: {
|
|
43
|
+
default: '°',
|
|
44
|
+
'ja-JP': ' 度',
|
|
45
|
+
'zh-TW': '度',
|
|
46
|
+
'sl-SI': ' °'
|
|
47
|
+
// Arabic?? But Safari already doesn't use Arabic digits so might be ok...
|
|
48
|
+
// https://bugs.webkit.org/show_bug.cgi?id=218139
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A wrapper around Intl.NumberFormat providing additional options, polyfills, and caching for performance.
|
|
55
|
+
*/
|
|
56
|
+
class NumberFormatter {
|
|
57
|
+
constructor(locale) {
|
|
58
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
59
|
+
_defineProperty(this, "numberFormatter", void 0);
|
|
60
|
+
_defineProperty(this, "options", void 0);
|
|
61
|
+
this.numberFormatter = getCachedNumberFormatter(locale, options);
|
|
62
|
+
this.options = options;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Formats a number value as a string, according to the locale and options provided to the constructor. */
|
|
66
|
+
format(value) {
|
|
67
|
+
let res = '';
|
|
68
|
+
if (!supportsSignDisplay && this.options.signDisplay != null) {
|
|
69
|
+
res = numberFormatSignDisplayPolyfill(this.numberFormatter, this.options.signDisplay, value);
|
|
70
|
+
} else {
|
|
71
|
+
res = this.numberFormatter.format(value);
|
|
72
|
+
}
|
|
73
|
+
if (this.options.style === 'unit' && !supportsUnit) {
|
|
74
|
+
var _UNITS$unit;
|
|
75
|
+
let {
|
|
76
|
+
unit,
|
|
77
|
+
unitDisplay = 'short',
|
|
78
|
+
locale
|
|
79
|
+
} = this.resolvedOptions();
|
|
80
|
+
if (!unit) {
|
|
81
|
+
return res;
|
|
82
|
+
}
|
|
83
|
+
let values = (_UNITS$unit = UNITS[unit]) === null || _UNITS$unit === void 0 ? void 0 : _UNITS$unit[unitDisplay];
|
|
84
|
+
res += values[locale] || values.default;
|
|
85
|
+
}
|
|
86
|
+
return res;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
|
|
90
|
+
formatToParts(value) {
|
|
91
|
+
// TODO: implement signDisplay for formatToParts
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
return this.numberFormatter.formatToParts(value);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Formats a number range as a string. */
|
|
97
|
+
formatRange(start, end) {
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
if (typeof this.numberFormatter.formatRange === 'function') {
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
return this.numberFormatter.formatRange(start, end);
|
|
102
|
+
}
|
|
103
|
+
if (end < start) {
|
|
104
|
+
throw new RangeError('End date must be >= start date');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Very basic fallback for old browsers.
|
|
108
|
+
return `${this.format(start)} – ${this.format(end)}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Formats a number range as an array of parts. */
|
|
112
|
+
formatRangeToParts(start, end) {
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
if (typeof this.numberFormatter.formatRangeToParts === 'function') {
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
return this.numberFormatter.formatRangeToParts(start, end);
|
|
117
|
+
}
|
|
118
|
+
if (end < start) {
|
|
119
|
+
throw new RangeError('End date must be >= start date');
|
|
120
|
+
}
|
|
121
|
+
let startParts = this.numberFormatter.formatToParts(start);
|
|
122
|
+
let endParts = this.numberFormatter.formatToParts(end);
|
|
123
|
+
return [...startParts.map(p => _objectSpread2(_objectSpread2({}, p), {}, {
|
|
124
|
+
source: 'startRange'
|
|
125
|
+
})), {
|
|
126
|
+
type: 'literal',
|
|
127
|
+
value: ' – ',
|
|
128
|
+
source: 'shared'
|
|
129
|
+
}, ...endParts.map(p => _objectSpread2(_objectSpread2({}, p), {}, {
|
|
130
|
+
source: 'endRange'
|
|
131
|
+
}))];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
135
|
+
resolvedOptions() {
|
|
136
|
+
let options = this.numberFormatter.resolvedOptions();
|
|
137
|
+
if (!supportsSignDisplay && this.options.signDisplay != null) {
|
|
138
|
+
options = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
139
|
+
signDisplay: this.options.signDisplay
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (!supportsUnit && this.options.style === 'unit') {
|
|
143
|
+
options = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
144
|
+
style: 'unit',
|
|
145
|
+
unit: this.options.unit,
|
|
146
|
+
unitDisplay: this.options.unitDisplay
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return options;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function getCachedNumberFormatter(locale) {
|
|
153
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
154
|
+
let {
|
|
155
|
+
numberingSystem
|
|
156
|
+
} = options;
|
|
157
|
+
if (numberingSystem && locale.includes('-nu-')) {
|
|
158
|
+
if (!locale.includes('-u-')) {
|
|
159
|
+
locale += '-u-';
|
|
160
|
+
}
|
|
161
|
+
locale += `-nu-${numberingSystem}`;
|
|
162
|
+
}
|
|
163
|
+
if (options.style === 'unit' && !supportsUnit) {
|
|
164
|
+
var _UNITS$unit2;
|
|
165
|
+
let {
|
|
166
|
+
unit,
|
|
167
|
+
unitDisplay = 'short'
|
|
168
|
+
} = options;
|
|
169
|
+
if (!unit) {
|
|
170
|
+
throw new Error('unit option must be provided with style: "unit"');
|
|
171
|
+
}
|
|
172
|
+
if (!((_UNITS$unit2 = UNITS[unit]) !== null && _UNITS$unit2 !== void 0 && _UNITS$unit2[unitDisplay])) {
|
|
173
|
+
throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);
|
|
174
|
+
}
|
|
175
|
+
options = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
176
|
+
style: 'decimal'
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');
|
|
180
|
+
if (formatterCache.has(cacheKey)) {
|
|
181
|
+
return formatterCache.get(cacheKey);
|
|
182
|
+
}
|
|
183
|
+
let numberFormatter = new Intl.NumberFormat(locale, options);
|
|
184
|
+
formatterCache.set(cacheKey, numberFormatter);
|
|
185
|
+
return numberFormatter;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** @private - exported for tests */
|
|
189
|
+
function numberFormatSignDisplayPolyfill(numberFormat, signDisplay, num) {
|
|
190
|
+
if (signDisplay === 'auto') {
|
|
191
|
+
return numberFormat.format(num);
|
|
192
|
+
} else if (signDisplay === 'never') {
|
|
193
|
+
return numberFormat.format(Math.abs(num));
|
|
194
|
+
} else {
|
|
195
|
+
let needsPositiveSign = false;
|
|
196
|
+
if (signDisplay === 'always') {
|
|
197
|
+
needsPositiveSign = num > 0 || Object.is(num, 0);
|
|
198
|
+
} else if (signDisplay === 'exceptZero') {
|
|
199
|
+
if (Object.is(num, -0) || Object.is(num, 0)) {
|
|
200
|
+
num = Math.abs(num);
|
|
201
|
+
} else {
|
|
202
|
+
needsPositiveSign = num > 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (needsPositiveSign) {
|
|
206
|
+
let negative = numberFormat.format(-num);
|
|
207
|
+
let noSign = numberFormat.format(num);
|
|
208
|
+
// ignore RTL/LTR marker character
|
|
209
|
+
let minus = negative.replace(noSign, '').replace(/\u200e|\u061C/, '');
|
|
210
|
+
if ([...minus].length !== 1) {
|
|
211
|
+
console.warn('@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case');
|
|
212
|
+
}
|
|
213
|
+
let positive = negative.replace(noSign, '!!!').replace(minus, '+').replace('!!!', noSign);
|
|
214
|
+
return positive;
|
|
215
|
+
} else {
|
|
216
|
+
return numberFormat.format(num);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { NumberFormatter, numberFormatSignDisplayPolyfill };
|
|
222
|
+
//# sourceMappingURL=NumberFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberFormatter.js","sources":["../../../../src/react-aria/internationalized/number/NumberFormatter.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nlet formatterCache = new Map<string, Intl.NumberFormat>();\n\nlet supportsSignDisplay = false;\ntry {\n // @ts-ignore\n supportsSignDisplay =\n new Intl.NumberFormat('de-DE', { signDisplay: 'exceptZero' }).resolvedOptions().signDisplay === 'exceptZero';\n // eslint-disable-next-line no-empty\n} catch (e) {}\n\nlet supportsUnit = false;\ntry {\n // @ts-ignore\n supportsUnit = new Intl.NumberFormat('de-DE', { style: 'unit', unit: 'degree' }).resolvedOptions().style === 'unit';\n // eslint-disable-next-line no-empty\n} catch (e) {}\n\n// Polyfill for units since Safari doesn't support them yet. See https://bugs.webkit.org/show_bug.cgi?id=215438.\n// Currently only polyfilling the unit degree in narrow format for ColorSlider in our supported locales.\n// Values were determined by switching to each locale manually in Chrome.\nconst UNITS = {\n degree: {\n narrow: {\n default: '°',\n 'ja-JP': ' 度',\n 'zh-TW': '度',\n 'sl-SI': ' °',\n // Arabic?? But Safari already doesn't use Arabic digits so might be ok...\n // https://bugs.webkit.org/show_bug.cgi?id=218139\n },\n },\n};\n\nexport interface NumberFormatOptions extends Intl.NumberFormatOptions {\n /** Overrides default numbering system for the current locale. */\n numberingSystem?: string;\n}\n\ninterface NumberRangeFormatPart extends Intl.NumberFormatPart {\n source: 'startRange' | 'endRange' | 'shared';\n}\n\n/**\n * A wrapper around Intl.NumberFormat providing additional options, polyfills, and caching for performance.\n */\nexport class NumberFormatter implements Intl.NumberFormat {\n private numberFormatter: Intl.NumberFormat;\n private options: NumberFormatOptions;\n\n constructor(locale: string, options: NumberFormatOptions = {}) {\n this.numberFormatter = getCachedNumberFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a number value as a string, according to the locale and options provided to the constructor. */\n format(value: number): string {\n let res = '';\n if (!supportsSignDisplay && this.options.signDisplay != null) {\n res = numberFormatSignDisplayPolyfill(this.numberFormatter, this.options.signDisplay, value);\n } else {\n res = this.numberFormatter.format(value);\n }\n\n if (this.options.style === 'unit' && !supportsUnit) {\n let { unit, unitDisplay = 'short', locale } = this.resolvedOptions();\n if (!unit) {\n return res;\n }\n let values = UNITS[unit]?.[unitDisplay];\n res += values[locale] || values.default;\n }\n\n return res;\n }\n\n /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */\n formatToParts(value: number): Intl.NumberFormatPart[] {\n // TODO: implement signDisplay for formatToParts\n // @ts-ignore\n return this.numberFormatter.formatToParts(value);\n }\n\n /** Formats a number range as a string. */\n formatRange(start: number, end: number): string {\n // @ts-ignore\n if (typeof this.numberFormatter.formatRange === 'function') {\n // @ts-ignore\n return this.numberFormatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.format(start)} – ${this.format(end)}`;\n }\n\n /** Formats a number range as an array of parts. */\n formatRangeToParts(start: number, end: number): NumberRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.numberFormatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.numberFormatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.numberFormatter.formatToParts(start);\n let endParts = this.numberFormatter.formatToParts(end);\n return [\n ...startParts.map((p) => ({ ...p, source: 'startRange' } as NumberRangeFormatPart)),\n { type: 'literal', value: ' – ', source: 'shared' },\n ...endParts.map((p) => ({ ...p, source: 'endRange' } as NumberRangeFormatPart)),\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): Intl.ResolvedNumberFormatOptions {\n let options = this.numberFormatter.resolvedOptions();\n if (!supportsSignDisplay && this.options.signDisplay != null) {\n options = { ...options, signDisplay: this.options.signDisplay };\n }\n\n if (!supportsUnit && this.options.style === 'unit') {\n options = { ...options, style: 'unit', unit: this.options.unit, unitDisplay: this.options.unitDisplay };\n }\n\n return options;\n }\n}\n\nfunction getCachedNumberFormatter(locale: string, options: NumberFormatOptions = {}): Intl.NumberFormat {\n let { numberingSystem } = options;\n if (numberingSystem && locale.includes('-nu-')) {\n if (!locale.includes('-u-')) {\n locale += '-u-';\n }\n locale += `-nu-${numberingSystem}`;\n }\n\n if (options.style === 'unit' && !supportsUnit) {\n let { unit, unitDisplay = 'short' } = options;\n if (!unit) {\n throw new Error('unit option must be provided with style: \"unit\"');\n }\n if (!UNITS[unit]?.[unitDisplay]) {\n throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);\n }\n options = { ...options, style: 'decimal' };\n }\n\n let cacheKey =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.NumberFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\n/** @private - exported for tests */\nexport function numberFormatSignDisplayPolyfill(numberFormat: Intl.NumberFormat, signDisplay: string, num: number) {\n if (signDisplay === 'auto') {\n return numberFormat.format(num);\n } else if (signDisplay === 'never') {\n return numberFormat.format(Math.abs(num));\n } else {\n let needsPositiveSign = false;\n if (signDisplay === 'always') {\n needsPositiveSign = num > 0 || Object.is(num, 0);\n } else if (signDisplay === 'exceptZero') {\n if (Object.is(num, -0) || Object.is(num, 0)) {\n num = Math.abs(num);\n } else {\n needsPositiveSign = num > 0;\n }\n }\n\n if (needsPositiveSign) {\n let negative = numberFormat.format(-num);\n let noSign = numberFormat.format(num);\n // ignore RTL/LTR marker character\n let minus = negative.replace(noSign, '').replace(/\\u200e|\\u061C/, '');\n if ([...minus].length !== 1) {\n console.warn('@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case');\n }\n let positive = negative.replace(noSign, '!!!').replace(minus, '+').replace('!!!', noSign);\n return positive;\n } else {\n return numberFormat.format(num);\n }\n }\n}\n"],"names":["formatterCache","Map","supportsSignDisplay","Intl","NumberFormat","signDisplay","resolvedOptions","e","supportsUnit","style","unit","UNITS","degree","narrow","default","NumberFormatter","constructor","locale","options","arguments","length","undefined","_defineProperty","numberFormatter","getCachedNumberFormatter","format","value","res","numberFormatSignDisplayPolyfill","_UNITS$unit","unitDisplay","values","formatToParts","formatRange","start","end","RangeError","formatRangeToParts","startParts","endParts","map","p","_objectSpread","source","type","numberingSystem","includes","_UNITS$unit2","Error","cacheKey","Object","entries","sort","a","b","join","has","get","set","numberFormat","num","Math","abs","needsPositiveSign","is","negative","noSign","minus","replace","console","warn","positive"],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,cAAc,GAAG,IAAIC,GAAG,EAA6B,CAAA;AAEzD,IAAIC,mBAAmB,GAAG,KAAK,CAAA;AAC/B,IAAI;AACF;AACAA,EAAAA,mBAAmB,GACjB,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;AAAEC,IAAAA,WAAW,EAAE,YAAA;GAAc,CAAC,CAACC,eAAe,EAAE,CAACD,WAAW,KAAK,YAAY,CAAA;AAC9G;AACF,CAAC,CAAC,OAAOE,CAAC,EAAE,EAAC;AAEb,IAAIC,YAAY,GAAG,KAAK,CAAA;AACxB,IAAI;AACF;AACAA,EAAAA,YAAY,GAAG,IAAIL,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;AAAEK,IAAAA,KAAK,EAAE,MAAM;AAAEC,IAAAA,IAAI,EAAE,QAAA;GAAU,CAAC,CAACJ,eAAe,EAAE,CAACG,KAAK,KAAK,MAAM,CAAA;AACnH;AACF,CAAC,CAAC,OAAOF,CAAC,EAAE,EAAC;;AAEb;AACA;AACA;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