@pega/cosmos-react-core 2.0.0-dev.19.0 → 2.0.0-dev.21.0
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/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.js +1 -1
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +44 -30
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +4 -11
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +102 -89
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +2 -2
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +2 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +1 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.js +6 -6
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.js +2 -2
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.js +3 -3
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +2 -2
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/Avatar/Avatar.js +1 -1
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +1 -1
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Alert.js +1 -1
- package/lib/components/Badges/Alert.js.map +1 -1
- package/lib/components/Badges/Count.js +1 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Badges/Selection.js +1 -1
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Status.js +1 -1
- package/lib/components/Badges/Status.js.map +1 -1
- package/lib/components/Badges/Tag.js +1 -1
- package/lib/components/Badges/Tag.js.map +1 -1
- package/lib/components/Banner/Banner.js +3 -3
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +1 -1
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +5 -5
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/BareButton.js +2 -2
- package/lib/components/Button/BareButton.js.map +1 -1
- package/lib/components/Button/BareRoleButton.d.ts +12 -0
- package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
- package/lib/components/Button/BareRoleButton.js +20 -0
- package/lib/components/Button/BareRoleButton.js.map +1 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.js +1 -1
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.js +2 -2
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.js +1 -1
- package/lib/components/Card/CardHeader.js.map +1 -1
- package/lib/components/Card/CardMedia.js +1 -1
- package/lib/components/Card/CardMedia.js.map +1 -1
- package/lib/components/Card/CollapsibleCard.js +1 -1
- package/lib/components/Card/CollapsibleCard.js.map +1 -1
- package/lib/components/Card/SelectableCard.js +1 -1
- package/lib/components/Card/SelectableCard.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +3 -3
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +15 -15
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBoxInput.js +4 -4
- package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +14 -10
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +15 -11
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +5 -5
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts +3 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +11 -16
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +14 -14
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +3 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/Currency/utils.d.ts +12 -1
- package/lib/components/Currency/utils.d.ts.map +1 -1
- package/lib/components/Currency/utils.js +30 -2
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +2 -1
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +11 -6
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +6 -6
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +13 -2
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +9 -9
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js +2 -2
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.js +2 -2
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +2 -2
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.js +2 -2
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +6 -6
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +1 -1
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.js +6 -6
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +9 -9
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +6 -6
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +11 -11
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +7 -9
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +7 -9
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +4 -4
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +4 -4
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts +1 -0
- package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/utils.js +3 -0
- package/lib/components/DateTime/Picker/utils.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +1 -1
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Email/EmailDisplay.js +2 -2
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.js +1 -1
- package/lib/components/EmptyState/EmptyState.js.map +1 -1
- package/lib/components/ErrorState/ErrorState.js +1 -1
- package/lib/components/ErrorState/ErrorState.js.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +3 -3
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +4 -4
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +5 -5
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.js +7 -7
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.js +9 -9
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileItem.js +1 -1
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileUploadItem.js +4 -4
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/File/FileVisual.js +4 -4
- package/lib/components/File/FileVisual.js.map +1 -1
- package/lib/components/Flex/Flex.js +1 -1
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.js +1 -1
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.js +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.js +7 -7
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.js +1 -1
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Icon/Icon.js +1 -1
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Input/Input.js +11 -11
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Label/Label.js +1 -1
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Link/Link.js +1 -1
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.js +3 -3
- package/lib/components/List/CommaSeparatedList.js.map +1 -1
- package/lib/components/List/List.js +1 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/List/OrderedList.js +1 -1
- package/lib/components/List/OrderedList.js.map +1 -1
- package/lib/components/List/UnorderedList.js +1 -1
- package/lib/components/List/UnorderedList.js.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +1 -1
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/LocationDisplay.js +7 -7
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.js +19 -19
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.js +1 -1
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +3 -3
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +4 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +2 -0
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/MenuGroup.js +2 -2
- package/lib/components/Menu/MenuGroup.js.map +1 -1
- package/lib/components/Menu/MenuItem.js +11 -11
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.js +5 -5
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +2 -2
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +3 -3
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MetaList/MetaList.js +4 -4
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +4 -6
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +37 -34
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +26 -21
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/ModalManager.js +6 -6
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +7 -7
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/Number/NumberDisplay.js +1 -1
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.js +5 -5
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +7 -7
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +9 -9
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +20 -20
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.js +3 -3
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +7 -1
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/PopoverManager.js +2 -2
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Progress/Bar.js +1 -1
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.js +1 -1
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.js +2 -2
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Ring.js +1 -1
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +2 -2
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +10 -10
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.js +2 -2
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +2 -2
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Option.js +1 -1
- package/lib/components/Select/Option.js.map +1 -1
- package/lib/components/Select/Select.js +13 -13
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -1
- package/lib/components/Sentiment/Sentiment.js.map +1 -1
- package/lib/components/Skeleton/LineSkeleton.js +1 -1
- package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
- package/lib/components/Slider/Slider.js +5 -5
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/SliderTicks.js +4 -4
- package/lib/components/Slider/SliderTicks.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +2 -2
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +3 -3
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +1 -1
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +13 -8
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/Tab.js +1 -1
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.js +1 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +4 -4
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.js +23 -23
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Toaster.js +4 -4
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tree/StandardTree.js +6 -6
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/Tree.js +3 -3
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/helpers.d.ts +1 -0
- package/lib/components/Tree/helpers.d.ts.map +1 -1
- package/lib/components/Tree/helpers.js +20 -0
- package/lib/components/Tree/helpers.js.map +1 -1
- package/lib/components/URL/URLDisplay.js +2 -2
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/index.d.ts +6 -6
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +6 -5
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +1 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useTransitionState.d.ts +39 -0
- package/lib/hooks/useTransitionState.d.ts.map +1 -0
- package/lib/hooks/useTransitionState.js +56 -0
- package/lib/hooks/useTransitionState.js.map +1 -0
- package/lib/i18n/default.json +1 -0
- package/lib/i18n/i18n.d.ts +2 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/buildTheme.json +2 -1
- package/package.json +2 -2
|
@@ -86,59 +86,59 @@ const PageLayout = forwardRef(({ regions, cols = `repeat(${regions.length}, minm
|
|
|
86
86
|
scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;
|
|
87
87
|
scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;
|
|
88
88
|
useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);
|
|
89
|
-
return (_jsxs(Flex,
|
|
89
|
+
return (_jsxs(Flex, { ...restProps, container: {
|
|
90
90
|
direction: 'column',
|
|
91
91
|
gap: 2
|
|
92
|
-
}, scrollContent: scrollContent, as: StyledPageLayout, forwardedAs: as, ref: ref
|
|
93
|
-
cols: '1fr',
|
|
92
|
+
}, scrollContent: scrollContent, as: StyledPageLayout, forwardedAs: as, ref: ref, children: [_jsxs(Flex, { container: { direction: 'column', pad: [2, 2, 0] }, item: { grow: 0, shrink: 0 }, as: StyledPageHeader, children: [path && path.length > 0 && _jsx(Breadcrumbs, { path: path }, void 0), header || (_jsx(SummaryItem, { visual: icon && (_jsx(StyledPageIcon, { container: { alignItems: 'center', justify: 'center' }, children: _jsx(Icon, { name: icon }, void 0) }, void 0)), primary: _jsx(Text, { variant: 'h1', children: title }, void 0), actions: actions }, void 0)), banners, tabs] }, void 0), _jsx(Flex, { container: true, item: { grow: 1 }, as: StyledContent, ref: scrollContent ? setContentEl : undefined, children: _jsx(Grid, { container: {
|
|
93
|
+
cols: 'minmax(0, 1fr)',
|
|
94
94
|
alignItems: 'start',
|
|
95
95
|
gap: 2,
|
|
96
96
|
pad: [0, 2, 2]
|
|
97
|
-
}, md: { container: { cols } }, as: StyledRegions, ref: regionsRef
|
|
98
|
-
return (_jsx(Flex,
|
|
97
|
+
}, md: { container: { cols } }, as: StyledRegions, ref: regionsRef, children: regions.map((colItems, i) => {
|
|
98
|
+
return (_jsx(Flex, { container: {
|
|
99
99
|
direction: 'column',
|
|
100
100
|
gap: 2
|
|
101
101
|
}, as: StyledRegion, ref: (el) => {
|
|
102
102
|
if (el) {
|
|
103
103
|
scrollStickOptions.current.elements[i] = el;
|
|
104
104
|
}
|
|
105
|
-
}
|
|
106
|
-
}) }
|
|
105
|
+
}, children: colItems }, i));
|
|
106
|
+
}) }, void 0) }, void 0)] }, void 0));
|
|
107
107
|
});
|
|
108
108
|
export const TabbedPage = forwardRef(({ tabs, a, ...restProps }, ref) => {
|
|
109
109
|
const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);
|
|
110
|
-
return (_jsx(PageLayout,
|
|
110
|
+
return (_jsx(PageLayout, { ...restProps, tabs: _jsx(Tabs, { ...tabs, onTabClick: (id, e) => {
|
|
111
111
|
setTabId(id);
|
|
112
112
|
tabs.onTabClick?.(id, e);
|
|
113
|
-
} }
|
|
114
|
-
_jsx(Flex,
|
|
115
|
-
], ref: ref }
|
|
113
|
+
} }, void 0), regions: [
|
|
114
|
+
_jsx(Flex, { container: { direction: 'column', gap: 2 }, as: TabPanel, tabId: tabId, children: a }, void 0)
|
|
115
|
+
], ref: ref }, void 0));
|
|
116
116
|
});
|
|
117
117
|
export const OneColumnPage = forwardRef(({ a, ...restProps }, ref) => {
|
|
118
|
-
return _jsx(PageLayout,
|
|
118
|
+
return _jsx(PageLayout, { regions: [a], ref: ref, ...restProps }, void 0);
|
|
119
119
|
});
|
|
120
120
|
export const TwoColumnPage = forwardRef(({ a, b, ...restProps }, ref) => {
|
|
121
|
-
return _jsx(PageLayout,
|
|
121
|
+
return _jsx(PageLayout, { regions: [a, b], ref: ref, ...restProps }, void 0);
|
|
122
122
|
});
|
|
123
123
|
export const ThreeColumnPage = forwardRef(({ a, b, c, ...restProps }, ref) => {
|
|
124
|
-
return _jsx(PageLayout,
|
|
124
|
+
return _jsx(PageLayout, { regions: [a, b, c], ref: ref, ...restProps }, void 0);
|
|
125
125
|
});
|
|
126
126
|
export const FourColumnPage = forwardRef(({ a, b, c, d, ...restProps }, ref) => {
|
|
127
|
-
return _jsx(PageLayout,
|
|
127
|
+
return _jsx(PageLayout, { regions: [a, b, c, d], ref: ref, ...restProps }, void 0);
|
|
128
128
|
});
|
|
129
129
|
export const WideNarrowPage = forwardRef(({ a, b, ...restProps }, ref) => {
|
|
130
|
-
return _jsx(PageLayout,
|
|
130
|
+
return _jsx(PageLayout, { regions: [a, b], cols: '2fr 1fr', ref: ref, ...restProps }, void 0);
|
|
131
131
|
});
|
|
132
132
|
export const NarrowWidePage = forwardRef(({ a, b, ...restProps }, ref) => {
|
|
133
|
-
return _jsx(PageLayout,
|
|
133
|
+
return _jsx(PageLayout, { regions: [a, b], cols: '1fr 2fr', ref: ref, ...restProps }, void 0);
|
|
134
134
|
});
|
|
135
135
|
export const WideWideNarrowPage = forwardRef(({ a, b, c, ...restProps }, ref) => {
|
|
136
|
-
return _jsx(PageLayout,
|
|
136
|
+
return _jsx(PageLayout, { regions: [a, b, c], cols: '2fr 2fr 1fr', ref: ref, ...restProps }, void 0);
|
|
137
137
|
});
|
|
138
138
|
export const NarrowWideWidePage = forwardRef(({ a, b, c, ...restProps }, ref) => {
|
|
139
|
-
return _jsx(PageLayout,
|
|
139
|
+
return _jsx(PageLayout, { regions: [a, b, c], cols: '1fr 2fr 2fr', ref: ref, ...restProps }, void 0);
|
|
140
140
|
});
|
|
141
141
|
export const NarrowWideNarrowPage = forwardRef(({ a, b, c, ...restProps }, ref) => {
|
|
142
|
-
return _jsx(PageLayout,
|
|
142
|
+
return _jsx(PageLayout, { regions: [a, b, c], cols: '1fr 3fr 1fr', ref: ref, ...restProps }, void 0);
|
|
143
143
|
});
|
|
144
144
|
//# sourceMappingURL=PageTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAKR,MAAM,EAEN,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAa,MAAM,SAAS,CAAC;AACpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,WAAW,EAAE,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO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AM,SAAS,UAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAC7B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA4C,EACnE,GAAwB,EACxB,EAAE;IACF,OAAO,KAAC,UAAU,kBAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,IAAM,SAAS,UAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,KAAC,UAAU,kBAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,IAAM,SAAS,UAAI,CAAC;AACxF,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: TabsProps;\n a: ReactNode;\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div``;\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div`\n flex-grow: 1;\n`;\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n}>(\n ({ theme, scrollContent }) => css`\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `\n);\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n <Grid\n container={{\n cols: '1fr',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={regionsRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n />\n }\n regions={[\n <Flex container={{ direction: 'column', gap: 2 }} as={TabPanel} tabId={tabId}>\n {a}\n </Flex>\n ]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} ref={ref} {...restProps} />;\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b, c]} ref={ref} {...restProps} />;\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c, d]} ref={ref} {...restProps} />;\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} cols='2fr 1fr' ref={ref} {...restProps} />;\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} cols='1fr 2fr' ref={ref} {...restProps} />;\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='2fr 2fr 1fr' ref={ref} {...restProps} />;\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='1fr 2fr 2fr' ref={ref} {...restProps} />;\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='1fr 3fr 1fr' ref={ref} {...restProps} />;\n }\n );\n"]}
|
|
1
|
+
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAKR,MAAM,EAEN,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,QAAQ,EAA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EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA4C,EACnE,GAAwB,EACxB,EAAE;IACF,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,KAAM,SAAS,WAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAC7B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA4C,EACnE,GAAwB,EACxB,EAAE;IACF,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,KAAM,SAAS,WAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,KAAM,SAAS,WAAI,CAAC;AACxF,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: TabsProps;\n a: ReactNode;\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div``;\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div`\n flex-grow: 1;\n`;\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n}>(\n ({ theme, scrollContent }) => css`\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `\n);\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n <Grid\n container={{\n cols: 'minmax(0, 1fr)',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={regionsRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n />\n }\n regions={[\n <Flex container={{ direction: 'column', gap: 2 }} as={TabPanel} tabId={tabId}>\n {a}\n </Flex>\n ]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} ref={ref} {...restProps} />;\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b, c]} ref={ref} {...restProps} />;\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c, d]} ref={ref} {...restProps} />;\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} cols='2fr 1fr' ref={ref} {...restProps} />;\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a, b]} cols='1fr 2fr' ref={ref} {...restProps} />;\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='2fr 2fr 1fr' ref={ref} {...restProps} />;\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='1fr 2fr 2fr' ref={ref} {...restProps} />;\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return <PageLayout regions={[a, b, c]} cols='1fr 3fr 1fr' ref={ref} {...restProps} />;\n }\n );\n"]}
|
|
@@ -26,11 +26,11 @@ const Pagination = (props) => {
|
|
|
26
26
|
onPageChange(currentValue);
|
|
27
27
|
}, [onPageChange]);
|
|
28
28
|
const { start, end } = useDirection();
|
|
29
|
-
return (_jsxs(Flex,
|
|
29
|
+
return (_jsxs(Flex, { container: {
|
|
30
30
|
gap: 1
|
|
31
|
-
}, "aria-label": t('pagination_page_of', [pageNumber, pageCount]), role: 'tablist', total: total
|
|
31
|
+
}, "aria-label": t('pagination_page_of', [pageNumber, pageCount]), role: 'tablist', total: total, ...restProps, children: [_jsx(Flex, { container: { alignItems: 'center' }, "aria-hidden": 'true', children: t('pagination_page_of', [pageNumber, pageCount]) }, void 0), _jsxs(Flex, { container: {
|
|
32
32
|
gap: 1
|
|
33
|
-
}, role: 'group'
|
|
33
|
+
}, role: 'group', children: [_jsx(Button, { variant: 'simple', label: t('pagination_prev'), disabled: pageNumber === 1, onClick: () => handlePageChange(pageNumber - 1), icon: true, children: _jsx(Icon, { name: `caret-${start}` }, void 0) }, void 0), _jsx(Button, { variant: 'simple', label: t('pagination_next'), disabled: pageNumber === pageCount, onClick: () => handlePageChange(pageNumber + 1), icon: true, children: _jsx(Icon, { name: `caret-${end}` }, void 0) }, void 0)] }, void 0)] }, void 0));
|
|
34
34
|
};
|
|
35
35
|
Pagination.defaultProps = defaultProps;
|
|
36
36
|
export default Pagination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAmB5C,MAAM,YAAY,GAA6B;IAC7C,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,UAAU,GAAsD,CAAC,KAAsB,EAAE,EAAE;IAC/F,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACpD,IAAI,EAAE,QAAQ,GAAG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AAK,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAC3B,QAAQ,EAAE,UAAU,KAAK,CAAC,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAAC,CAAC,EAC/C,IAAI,kBAEJ,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,KAAK,EAAE,WAAI,WACzB,EACT,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAC3B,QAAQ,EAAE,UAAU,KAAK,SAAS,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAAC,CAAC,EAC/C,IAAI,kBAEJ,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,GAAG,EAAE,WAAI,WACvB,YACJ,YACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;AAEvC,eAAe,UAAU,CAAC","sourcesContent":["import { FunctionComponent, useCallback } from 'react';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useDirection, useI18n } from '../../hooks';\nimport Icon, { registerIcon } from '../Icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport Button from '../Button';\nimport Flex from '../Flex';\n\nregisterIcon(caretLeftIcon, caretRightIcon);\n\nexport interface PaginationProps extends BaseProps {\n /** Total number of items. */\n total: number;\n /**\n * Size of each page.\n * @default 10\n */\n pageSize?: number;\n /**\n * Current page number.\n * @default 1\n */\n pageNumber?: number;\n /** Function to handle page change. */\n onPageChange?: (pageNumber: number) => void;\n}\n\nconst defaultProps: Partial<PaginationProps> = {\n pageNumber: 1,\n pageSize: 10\n};\n\nconst Pagination: FunctionComponent<PaginationProps & ForwardProps> = (props: PaginationProps) => {\n const { total, onPageChange, ...restProps } = props;\n let { pageSize = 10, pageNumber = 1 } = props;\n\n const t = useI18n();\n\n pageSize = Math.max(1, pageSize);\n const pageCount = Math.ceil(total / pageSize);\n if (pageNumber < 1) pageNumber = 1;\n if (pageNumber > pageCount) pageNumber = pageCount;\n\n const handlePageChange = useCallback(\n (currentValue: number) => {\n if (onPageChange) onPageChange(currentValue);\n },\n [onPageChange]\n );\n\n const { start, end } = useDirection();\n\n return (\n <Flex\n container={{\n gap: 1\n }}\n aria-label={t('pagination_page_of', [pageNumber, pageCount])}\n role='tablist'\n total={total}\n {...restProps}\n >\n <Flex container={{ alignItems: 'center' }} aria-hidden='true'>\n {t('pagination_page_of', [pageNumber, pageCount])}\n </Flex>\n <Flex\n container={{\n gap: 1\n }}\n role='group'\n >\n <Button\n variant='simple'\n label={t('pagination_prev')}\n disabled={pageNumber === 1}\n onClick={() => handlePageChange(pageNumber - 1)}\n icon\n >\n <Icon name={`caret-${start}`} />\n </Button>\n <Button\n variant='simple'\n label={t('pagination_next')}\n disabled={pageNumber === pageCount}\n onClick={() => handlePageChange(pageNumber + 1)}\n icon\n >\n <Icon name={`caret-${end}`} />\n </Button>\n </Flex>\n </Flex>\n );\n};\n\nPagination.defaultProps = defaultProps;\n\nexport default Pagination;\n"]}
|
|
@@ -3,8 +3,8 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import parsePhoneNumber from 'libphonenumber-js';
|
|
4
4
|
import Link from '../Link';
|
|
5
5
|
const PhoneDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
|
|
6
|
-
const displayValue = value ? (displayText || parsePhoneNumber(value || '')?.formatInternational() || value) : (_jsx("span",
|
|
7
|
-
return variant === 'text' || !value ? (_jsx("span",
|
|
6
|
+
const displayValue = value ? (displayText || parsePhoneNumber(value || '')?.formatInternational() || value) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0));
|
|
7
|
+
return variant === 'text' || !value ? (_jsx("span", { ref: ref, ...restProps, children: displayValue }, void 0)) : (_jsx(Link, { ref: ref, ...restProps, href: `tel:${value}`, children: displayValue }, void 0));
|
|
8
8
|
});
|
|
9
9
|
export default PhoneDisplay;
|
|
10
10
|
//# sourceMappingURL=PhoneDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneDisplay.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AAGjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAgB3B,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAsC,EAC1F,GAA6B,EAC7B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,KAAK,CAC7E,CAAC,CAAC,CAAC,CACF,
|
|
1
|
+
{"version":3,"file":"PhoneDisplay.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AAGjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAgB3B,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAsC,EAC1F,GAA6B,EAC7B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,KAAK,CAC7E,CAAC,CAAC,CAAC,CACF,8BAAkB,MAAM,qCAAsB,CAC/C,CAAC;IAEF,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,WACR,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,YAC1E,YAAY,WACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport parsePhoneNumber from 'libphonenumber-js';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport Link from '../Link';\n\nexport interface PhoneDisplayProps extends BaseProps {\n /** Phone number, no 'tel:' scheme, '+18887342669' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default \"link\"\n */\n variant?: 'link' | 'text';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst PhoneDisplay: FunctionComponent<PhoneDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<PhoneDisplayProps>,\n ref: PhoneDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || parsePhoneNumber(value || '')?.formatInternational() || value\n ) : (\n <span aria-hidden='true'>––</span>\n );\n\n return variant === 'text' || !value ? (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n ) : (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={`tel:${value}`}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default PhoneDisplay;\n"]}
|
|
@@ -72,9 +72,9 @@ const PhoneInput = forwardRef((props, ref) => {
|
|
|
72
72
|
setPhoneNumber(formatPhoneNumber(phoneNumber, selectValue));
|
|
73
73
|
onChange?.(convertToCallbackParameter(selectValue, phoneNumber));
|
|
74
74
|
};
|
|
75
|
-
const codesOptions = (_jsx(_Fragment, { children: callingCodesList.map(code => (_jsx(Option,
|
|
76
|
-
const Comp = (_jsxs(StyledPhoneInput,
|
|
77
|
-
return label ? (_jsx(FormField,
|
|
75
|
+
const codesOptions = (_jsx(_Fragment, { children: callingCodesList.map(code => (_jsx(Option, { value: code, children: code }, code))) }, void 0));
|
|
76
|
+
const Comp = (_jsxs(StyledPhoneInput, { as: StyledFormControl, forwardedAs: Flex, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, readOnly: readOnly, disabled: disabled, children: [showCountryCode && (_jsx(Select, { value: countryCode, onChange: onSelectChange, required: required, status: status, readOnly: readOnly, disabled: disabled, children: codesOptions }, void 0)), _jsx(Input, { ...restProps, inputMode: 'tel', ref: inputRef, value: phoneNumber, onChange: onInputChange, required: required, status: status, readOnly: readOnly, disabled: disabled }, void 0)] }, void 0));
|
|
77
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, ref, status, required, disabled }, children: Comp }, void 0)) : (Comp);
|
|
78
78
|
});
|
|
79
79
|
export default PhoneInput;
|
|
80
80
|
//# sourceMappingURL=PhoneInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAA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J,CAAC;IAEF,MAAM,IAAI,GAAG,CACX,MAAC,gBAAgB,kBACf,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,IAAW,EACxB,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,iBAEjB,eAAe,IAAI,CAClB,KAAC,MAAM,kBACL,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,gBAEjB,YAAY,YACN,CACV,EACD,KAAC,KAAK,oBACA,SAAS,IACb,SAAS,EAAC,KAAK,EACf,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,YAClB,aACe,CACpB,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,kBACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,IACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAEpE,IAAI,YACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useAfterInitialEffect, useDirection, useFocusWithin } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\n\nimport callingCodes from './callingCodes';\nimport {\n calculateCursorPosition,\n convertToCallbackParameter,\n formatPhoneNumber,\n getPhoneNumberParts\n} from './utils';\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n const { start, end } = useDirection();\n return css`\n border: 0;\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: FunctionComponent<PhoneInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<PhoneInputProps>, ref: PhoneInputProps['ref']) => {\n const {\n defaultValue,\n value = defaultValue,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n ...restProps\n } = props;\n\n const phoneNumberParts = useMemo(() => {\n return value ? getPhoneNumberParts(value, callingCodesList) : undefined;\n }, [callingCodesList, value]);\n\n const [countryCode, setCountryCode] = useState(\n showCountryCode ? phoneNumberParts?.[0] || callingCodesList[0] : phoneNumberParts?.[0]\n );\n\n const [phoneNumber, setPhoneNumber] = useState(\n phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : ''\n );\n\n useAfterInitialEffect(() => {\n setCountryCode(phoneNumberParts?.[0]);\n setPhoneNumber(phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : '');\n }, [phoneNumberParts]);\n\n const [cursor, setCursor] = useState<number | undefined>(undefined);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (cursor !== undefined) inputRef.current?.setSelectionRange(cursor, cursor);\n }, [cursor, inputRef.current]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, phoneNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n const selectionStart = e.target.selectionStart;\n const formatted = formatPhoneNumber(inputValue, countryCode);\n setPhoneNumber(formatted);\n if (countryCode) {\n setCursor(calculateCursorPosition(formatted, phoneNumber, countryCode, selectionStart));\n }\n onChange?.(convertToCallbackParameter(countryCode, formatted));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n const selectValue = e.target.value;\n setCountryCode(selectValue);\n setPhoneNumber(formatPhoneNumber(phoneNumber, selectValue));\n onChange?.(convertToCallbackParameter(selectValue, phoneNumber));\n };\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n as={StyledFormControl}\n forwardedAs={Flex as any}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {showCountryCode && (\n <Select\n value={countryCode}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {codesOptions}\n </Select>\n )}\n <Input\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={phoneNumber}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n />\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, ref, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default PhoneInput;\n"]}
|
|
1
|
+
{"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB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,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,YAEjB,YAAY,WACN,CACV,EACD,KAAC,KAAK,OACA,SAAS,EACb,SAAS,EAAC,KAAK,EACf,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,WAClB,YACe,CACpB,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAEpE,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useAfterInitialEffect, useDirection, useFocusWithin } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\n\nimport callingCodes from './callingCodes';\nimport {\n calculateCursorPosition,\n convertToCallbackParameter,\n formatPhoneNumber,\n getPhoneNumberParts\n} from './utils';\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n const { start, end } = useDirection();\n return css`\n border: 0;\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: FunctionComponent<PhoneInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<PhoneInputProps>, ref: PhoneInputProps['ref']) => {\n const {\n defaultValue,\n value = defaultValue,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n ...restProps\n } = props;\n\n const phoneNumberParts = useMemo(() => {\n return value ? getPhoneNumberParts(value, callingCodesList) : undefined;\n }, [callingCodesList, value]);\n\n const [countryCode, setCountryCode] = useState(\n showCountryCode ? phoneNumberParts?.[0] || callingCodesList[0] : phoneNumberParts?.[0]\n );\n\n const [phoneNumber, setPhoneNumber] = useState(\n phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : ''\n );\n\n useAfterInitialEffect(() => {\n setCountryCode(phoneNumberParts?.[0]);\n setPhoneNumber(phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : '');\n }, [phoneNumberParts]);\n\n const [cursor, setCursor] = useState<number | undefined>(undefined);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (cursor !== undefined) inputRef.current?.setSelectionRange(cursor, cursor);\n }, [cursor, inputRef.current]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, phoneNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n const selectionStart = e.target.selectionStart;\n const formatted = formatPhoneNumber(inputValue, countryCode);\n setPhoneNumber(formatted);\n if (countryCode) {\n setCursor(calculateCursorPosition(formatted, phoneNumber, countryCode, selectionStart));\n }\n onChange?.(convertToCallbackParameter(countryCode, formatted));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n const selectValue = e.target.value;\n setCountryCode(selectValue);\n setPhoneNumber(formatPhoneNumber(phoneNumber, selectValue));\n onChange?.(convertToCallbackParameter(selectValue, phoneNumber));\n };\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n as={StyledFormControl}\n forwardedAs={Flex as any}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {showCountryCode && (\n <Select\n value={countryCode}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {codesOptions}\n </Select>\n )}\n <Input\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={phoneNumber}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n />\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, ref, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default PhoneInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,GAAG,EAEH,YAAY,EAEZ,SAAS,EAIV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOtD,oBAAY,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9C,MAAM,WAAW,YAAY,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS;IAChF,2IAA2I;IAC3I,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yGAAyG;IACzG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;I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C,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yGAAyG;IACzG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kCAAkC;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAQD,QAAA,MAAM,OAAO,EAAE,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,EAC/C,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,YAAY,KAC1C,YAAY,GAAG,IAmHnB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -30,6 +30,12 @@ const Popover = forwardRef(({ show = true, portal = false, target, placement, st
|
|
|
30
30
|
},
|
|
31
31
|
{ name: 'hide', enabled: hideOnTargetHidden },
|
|
32
32
|
{ name: 'arrow', enabled: arrow, options: { element: arrowRef.current } },
|
|
33
|
+
{
|
|
34
|
+
name: 'computeStyles',
|
|
35
|
+
options: {
|
|
36
|
+
gpuAcceleration: windowIsAvailable && Number.isInteger(window.devicePixelRatio)
|
|
37
|
+
}
|
|
38
|
+
},
|
|
33
39
|
...modifiers
|
|
34
40
|
], [modifiers, arrow, hideOnTargetHidden]);
|
|
35
41
|
const offset = useMemo(() => {
|
|
@@ -76,7 +82,7 @@ const Popover = forwardRef(({ show = true, portal = false, target, placement, st
|
|
|
76
82
|
useEffect(() => {
|
|
77
83
|
return () => clearTimeout(timeout.current);
|
|
78
84
|
}, []);
|
|
79
|
-
const content = (_jsxs(StyledPopover,
|
|
85
|
+
const content = (_jsxs(StyledPopover, { ...restProps, offset: offset, ref: popperRef, style: { ...style, ...styles.popper }, ...attributes.popper, children: [arrow && _jsx(StyledPopoverArrow, { ref: arrowRef, style: { ...styles.arrow } }, void 0), children] }, void 0));
|
|
80
86
|
if (!target || !showPopover || (groupId && !checkActive(uid, groupId)))
|
|
81
87
|
return null;
|
|
82
88
|
return portal && portalTarget ? createPortal(content, portalTarget) : content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAKV,MAAM,EAEN,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA0DrE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,MAAM,OAAO,GAEc,UAAU,CACnC,CACE,EACE,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,KAAK,EACd,MAAM,EACN,SAAS,EACT,QAAQ,GAAG,OAAO,EAClB,KAAK,EACL,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,KAAK,EACb,OAAO,EACP,SAAS,GAAG,MAAM,EAClB,SAAS,GAAG,MAAM,EAClB,kBAAkB,GAAG,KAAK,EAC1B,QAAQ,EACR,GAAG,SAAS,EAC8C,EAC5D,GAAwB,EACxB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC5C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GA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C,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;SAC1C;aAAM;YACL,cAAc,CAAC,IAAI,CAAC,CAAC;SACtB;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,CACd,MAAC,aAAa,oBACR,SAAS,IACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,IACjC,UAAU,CAAC,MAAM,eAEpB,KAAK,IAAI,KAAC,kBAAkB,IAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,WAAI,EAC1E,QAAQ,aACK,CACjB,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAEpF,OAAO,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n PropsWithoutRef,\n Ref,\n CSSProperties,\n ReactElement,\n useRef,\n ReactNode,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { usePopper, PopperProps } from 'react-popper';\nimport { VirtualElement } from '@popperjs/core';\nimport { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useConsolidatedRef, useElement, useUID } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nimport { PopoverManagerContext } from './PopoverContext';\nimport { StyledPopover, StyledPopoverArrow } from './Popover.styles';\n\nexport type Delay = 'none' | 'short' | 'long';\nexport interface PopoverProps<Modifiers extends string = string> extends BaseProps {\n /** The DOM element or [virtual element](https://popper.js.org/docs/v2/virtual-elements) that the Popover is positioned in reference to. */\n target: Element | VirtualElement | null;\n /**\n * If true, the Popover will be visible.\n * @default true\n */\n show?: boolean;\n /**\n * If true, the Popover will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default false\n */\n portal?: boolean;\n /**\n * Delay on showing the Popover.\n * @default \"none\"\n */\n showDelay?: Delay;\n /**\n * Delay on hiding the Popover.\n * @default \"none\"\n */\n hideDelay?: Delay;\n /**\n * [React Popper Placement](https://popper.js.org/react-popper/v2/render-props/#placement)\n */\n placement?: PopperProps<Modifiers>['placement'];\n /**\n * [React Popper Strategy](https://popper.js.org/react-popper/v2/render-props/#strategy)\n * @default \"absolute\"\n */\n strategy?: PopperProps<Modifiers>['strategy'];\n /**\n * [React Popper Modifiers](https://popper.js.org/react-popper/v2/render-props/#modifiers)\n * @default []\n */\n modifiers?: PopperProps<Modifiers>['modifiers'];\n /**\n * If true, an arrow will visually identify from which element the Popover is rendered.\n * @default false\n */\n arrow?: boolean;\n /** The group that the Popover belongs to. Popovers in the same group will be closed when others open. */\n groupId?: string;\n /**\n * If true, the Popover will be visibly hidden when its target leaves the viewport.\n * @default false\n */\n hideOnTargetHidden?: boolean;\n /** The content of the Popover. */\n children: ReactNode;\n /** The ref of the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst delays = {\n none: 0,\n short: 500,\n long: 1000\n};\n\nconst Popover: <Modifiers extends string = string>(\n props: PopoverProps<Modifiers> & ForwardProps\n) => ReactElement | null = forwardRef(\n (\n {\n show = true,\n portal = false,\n target,\n placement,\n strategy = 'fixed',\n style,\n modifiers = [],\n arrow = false,\n groupId,\n showDelay = 'none',\n hideDelay = 'none',\n hideOnTargetHidden = false,\n children,\n ...restProps\n }: PropsWithoutRef<PopoverProps> & { style?: CSSProperties },\n ref: PopoverProps['ref']\n ) => {\n const { portalTarget } = useConfiguration();\n const { checkActive, setActive } = useContext(PopoverManagerContext);\n const [, setPopperEl] = useElement<HTMLDivElement>();\n const popperRef = useConsolidatedRef<HTMLDivElement>(ref, setPopperEl);\n const arrowRef = useRef<HTMLDivElement>(null);\n const forceUpdateRef = useRef<() => void>();\n const [showPopover, setShowPopover] = useState(show);\n const timeout = useRef<number>();\n const uid = useUID();\n\n const memoedModifiers = useMemo(\n () => [\n {\n name: 'offset',\n options: {\n offset: [0, arrow ? 5.5 : 2]\n }\n },\n { name: 'hide', enabled: hideOnTargetHidden },\n { name: 'arrow', enabled: arrow, options: { element: arrowRef.current } },\n ...modifiers\n ],\n [modifiers, arrow, hideOnTargetHidden]\n );\n\n const offset = useMemo(() => {\n const offsetModifier = [...memoedModifiers]\n .reverse()\n .find(m => m.name === 'offset' && m.enabled !== false) as OffsetModifier | undefined;\n return Array.isArray(offsetModifier?.options?.offset)\n ? offsetModifier?.options?.offset[1] ?? 0\n : 0;\n }, [memoedModifiers]);\n\n const { styles, attributes, forceUpdate } = usePopper(target, popperRef.current, {\n placement,\n strategy,\n modifiers: memoedModifiers\n });\n\n if (forceUpdate) forceUpdateRef.current = forceUpdate;\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n forceUpdateRef.current?.();\n });\n\n if (popperRef.current) observer.observe(popperRef.current);\n if (target instanceof Element) observer.observe(target);\n\n return () => {\n observer.disconnect();\n };\n }, [forceUpdate, popperRef.current, target]);\n\n useEffect(() => {\n if (groupId && show) setActive(uid, groupId);\n\n if (windowIsAvailable) {\n if (timeout.current) clearTimeout(timeout.current);\n timeout.current = window.setTimeout(() => {\n setShowPopover(show);\n }, delays[show ? showDelay : hideDelay]);\n } else {\n setShowPopover(show);\n }\n }, [show]);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n const content = (\n <StyledPopover\n {...restProps}\n offset={offset}\n ref={popperRef}\n style={{ ...style, ...styles.popper }}\n {...attributes.popper}\n >\n {arrow && <StyledPopoverArrow ref={arrowRef} style={{ ...styles.arrow }} />}\n {children}\n </StyledPopover>\n );\n\n if (!target || !showPopover || (groupId && !checkActive(uid, groupId))) return null;\n\n return portal && portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default Popover;\n"]}
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAKV,MAAM,EAEN,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA0DrE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,MAAM,OAAO,GAEc,UAAU,CACnC,CACE,EACE,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,KAAK,EACd,MAAM,EACN,SAAS,EACT,QAAQ,GAAG,OAAO,EAClB,KAAK,EACL,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,KAAK,EACb,OAAO,EACP,SAAS,GAAG,MAAM,EAClB,SAAS,GAAG,MAAM,EAClB,kBAAkB,GAAG,KAAK,EAC1B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,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n PropsWithoutRef,\n Ref,\n CSSProperties,\n ReactElement,\n useRef,\n ReactNode,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { usePopper, PopperProps } from 'react-popper';\nimport { VirtualElement } from '@popperjs/core';\nimport { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useConsolidatedRef, useElement, useUID } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nimport { PopoverManagerContext } from './PopoverContext';\nimport { StyledPopover, StyledPopoverArrow } from './Popover.styles';\n\nexport type Delay = 'none' | 'short' | 'long';\nexport interface PopoverProps<Modifiers extends string = string> extends BaseProps {\n /** The DOM element or [virtual element](https://popper.js.org/docs/v2/virtual-elements) that the Popover is positioned in reference to. */\n target: Element | VirtualElement | null;\n /**\n * If true, the Popover will be visible.\n * @default true\n */\n show?: boolean;\n /**\n * If true, the Popover will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default false\n */\n portal?: boolean;\n /**\n * Delay on showing the Popover.\n * @default \"none\"\n */\n showDelay?: Delay;\n /**\n * Delay on hiding the Popover.\n * @default \"none\"\n */\n hideDelay?: Delay;\n /**\n * [React Popper Placement](https://popper.js.org/react-popper/v2/render-props/#placement)\n */\n placement?: PopperProps<Modifiers>['placement'];\n /**\n * [React Popper Strategy](https://popper.js.org/react-popper/v2/render-props/#strategy)\n * @default \"absolute\"\n */\n strategy?: PopperProps<Modifiers>['strategy'];\n /**\n * [React Popper Modifiers](https://popper.js.org/react-popper/v2/render-props/#modifiers)\n * @default []\n */\n modifiers?: PopperProps<Modifiers>['modifiers'];\n /**\n * If true, an arrow will visually identify from which element the Popover is rendered.\n * @default false\n */\n arrow?: boolean;\n /** The group that the Popover belongs to. Popovers in the same group will be closed when others open. */\n groupId?: string;\n /**\n * If true, the Popover will be visibly hidden when its target leaves the viewport.\n * @default false\n */\n hideOnTargetHidden?: boolean;\n /** The content of the Popover. */\n children: ReactNode;\n /** The ref of the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst delays = {\n none: 0,\n short: 500,\n long: 1000\n};\n\nconst Popover: <Modifiers extends string = string>(\n props: PopoverProps<Modifiers> & ForwardProps\n) => ReactElement | null = forwardRef(\n (\n {\n show = true,\n portal = false,\n target,\n placement,\n strategy = 'fixed',\n style,\n modifiers = [],\n arrow = false,\n groupId,\n showDelay = 'none',\n hideDelay = 'none',\n hideOnTargetHidden = false,\n children,\n ...restProps\n }: PropsWithoutRef<PopoverProps> & { style?: CSSProperties },\n ref: PopoverProps['ref']\n ) => {\n const { portalTarget } = useConfiguration();\n const { checkActive, setActive } = useContext(PopoverManagerContext);\n const [, setPopperEl] = useElement<HTMLDivElement>();\n const popperRef = useConsolidatedRef<HTMLDivElement>(ref, setPopperEl);\n const arrowRef = useRef<HTMLDivElement>(null);\n const forceUpdateRef = useRef<() => void>();\n const [showPopover, setShowPopover] = useState(show);\n const timeout = useRef<number>();\n const uid = useUID();\n\n const memoedModifiers = useMemo(\n () => [\n {\n name: 'offset',\n options: {\n offset: [0, arrow ? 5.5 : 2]\n }\n },\n { name: 'hide', enabled: hideOnTargetHidden },\n { name: 'arrow', enabled: arrow, options: { element: arrowRef.current } },\n {\n name: 'computeStyles',\n options: {\n gpuAcceleration: windowIsAvailable && Number.isInteger(window.devicePixelRatio)\n }\n },\n ...modifiers\n ],\n [modifiers, arrow, hideOnTargetHidden]\n );\n\n const offset = useMemo(() => {\n const offsetModifier = [...memoedModifiers]\n .reverse()\n .find(m => m.name === 'offset' && m.enabled !== false) as OffsetModifier | undefined;\n return Array.isArray(offsetModifier?.options?.offset)\n ? offsetModifier?.options?.offset[1] ?? 0\n : 0;\n }, [memoedModifiers]);\n\n const { styles, attributes, forceUpdate } = usePopper(target, popperRef.current, {\n placement,\n strategy,\n modifiers: memoedModifiers\n });\n\n if (forceUpdate) forceUpdateRef.current = forceUpdate;\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n forceUpdateRef.current?.();\n });\n\n if (popperRef.current) observer.observe(popperRef.current);\n if (target instanceof Element) observer.observe(target);\n\n return () => {\n observer.disconnect();\n };\n }, [forceUpdate, popperRef.current, target]);\n\n useEffect(() => {\n if (groupId && show) setActive(uid, groupId);\n\n if (windowIsAvailable) {\n if (timeout.current) clearTimeout(timeout.current);\n timeout.current = window.setTimeout(() => {\n setShowPopover(show);\n }, delays[show ? showDelay : hideDelay]);\n } else {\n setShowPopover(show);\n }\n }, [show]);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n const content = (\n <StyledPopover\n {...restProps}\n offset={offset}\n ref={popperRef}\n style={{ ...style, ...styles.popper }}\n {...attributes.popper}\n >\n {arrow && <StyledPopoverArrow ref={arrowRef} style={{ ...styles.arrow }} />}\n {children}\n </StyledPopover>\n );\n\n if (!target || !showPopover || (groupId && !checkActive(uid, groupId))) return null;\n\n return portal && portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default Popover;\n"]}
|
|
@@ -11,10 +11,10 @@ const PopoverManager = ({ children }) => {
|
|
|
11
11
|
return { ...curr, [groupId]: id };
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(PopoverManagerContext.Provider,
|
|
14
|
+
return (_jsx(PopoverManagerContext.Provider, { value: {
|
|
15
15
|
checkActive,
|
|
16
16
|
setActive
|
|
17
|
-
}
|
|
17
|
+
}, children: children }, void 0));
|
|
18
18
|
};
|
|
19
19
|
export default PopoverManager;
|
|
20
20
|
//# sourceMappingURL=PopoverManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverManager.js","sourceRoot":"","sources":["../../../src/components/Popover/PopoverManager.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAk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AC,CAAC;IAEF,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAC7B,KAAK,EAAE;YACL,WAAW;YACX,SAAS;SACV,YAEA,QAAQ,WACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, useState } from 'react';\n\nimport { PopoverManagerContext } from './PopoverContext';\n\nconst PopoverManager: FunctionComponent<{ children: ReactNode }> = ({ children }) => {\n const [popovers, setPopovers] = useState<Record<string, string>>({});\n\n const checkActive = (id: string, groupId: string): boolean => {\n return popovers[groupId] === id;\n };\n\n const setActive = (id: string, groupId: string) => {\n setPopovers(curr => {\n return { ...curr, [groupId]: id };\n });\n };\n\n return (\n <PopoverManagerContext.Provider\n value={{\n checkActive,\n setActive\n }}\n >\n {children}\n </PopoverManagerContext.Provider>\n );\n};\n\nexport default PopoverManager;\n"]}
|
|
@@ -64,7 +64,7 @@ const Bar = forwardRef(({ value, minValue = 0, maxValue = 100, message, placemen
|
|
|
64
64
|
else
|
|
65
65
|
percentage = (1 - (value - minValue) / (maxValue - minValue)) * -100;
|
|
66
66
|
}
|
|
67
|
-
return (_jsx(StyledProgressBar,
|
|
67
|
+
return (_jsx(StyledProgressBar, { ref: ref, role: 'progressbar', "aria-valuemin": minValue, "aria-valuemax": maxValue, "aria-valuenow": value, placement: placement, determinate: typeof value === 'number', style: { ...style, '--progress': percentage ? `${percentage}%` : '' }, ...restProps }, void 0));
|
|
68
68
|
});
|
|
69
69
|
export default Bar;
|
|
70
70
|
//# sourceMappingURL=Bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.js","sourceRoot":"","sources":["../../../src/components/Progress/Bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAkC,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,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AAG,gBAAgB,CAAC;AAElD,MAAM,GAAG,GAAqC,UAAU,CACtD,CACE,EACE,KAAK,EACL,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EAC+C,EAC7D,GAAyB,EACzB,EAAE;IACF,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI,KAAK,GAAG,QAAQ,IAAI,QAAQ,GAAG,QAAQ;YAAE,UAAU,GAAG,CAAC,CAAC;aACvD,IAAI,KAAK,GAAG,QAAQ;YAAE,UAAU,GAAG,GAAG,CAAC;;YACvC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;KAC3E;IAED,OAAO,CACL,KAAC,iBAAiB,IAChB,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,aAAa,mBACH,QAAQ,mBACR,QAAQ,mBACR,KAAK,EACpB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,OAAO,KAAK,KAAK,QAAQ,EACtC,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,EAAmB,KAClF,SAAS,WACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { FC, forwardRef, PropsWithoutRef, CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps } from '../../types';\n\nimport { ProgressProps } from './Progress.types';\n\nexport const StyledProgressBar = styled.div<ProgressProps & { determinate: boolean }>(\n ({ theme, placement, determinate }) => {\n return css`\n height: 0.375rem;\n background-color: ${theme.base.colors.gray['extra-light']};\n border-radius: ${theme.base['border-radius']};\n min-width: 2rem;\n overflow: hidden;\n\n @keyframes LoadingBar {\n 0% {\n transform: translateX(-100%);\n }\n\n 100% {\n transform: translateX(200%);\n }\n }\n\n ::before {\n content: '';\n display: block;\n height: 100%;\n width: 100%;\n left: 0;\n border-radius: ${theme.base['border-radius']};\n background-color: ${theme.components.progress['progress-color']};\n ${determinate &&\n css`\n transform: translateX(var(--progress, 0));\n transform-origin: 0 50%;\n transition: transform calc(0.5 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n `}\n\n ${!determinate &&\n css`\n animation: LoadingBar calc(8 * ${theme.base.animation.speed}) linear infinite;\n width: 50%;\n `}\n }\n\n ${placement === 'inline'\n ? css`\n display: inline-block;\n position: relative;\n `\n : css`\n width: 50%;\n `}\n `;\n }\n);\n\nStyledProgressBar.defaultProps = defaultThemeProp;\n\nconst Bar: FC<ProgressProps & ForwardProps> = forwardRef(\n (\n {\n value,\n minValue = 0,\n maxValue = 100,\n message,\n placement,\n style,\n ...restProps\n }: PropsWithoutRef<ProgressProps & { style?: CSSProperties }>,\n ref: ProgressProps['ref']\n ) => {\n let percentage = value;\n\n if (typeof value === 'number') {\n if (value > maxValue || minValue > maxValue) percentage = 0;\n else if (value < minValue) percentage = 100;\n else percentage = (1 - (value - minValue) / (maxValue - minValue)) * -100;\n }\n\n return (\n <StyledProgressBar\n ref={ref}\n role='progressbar'\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n aria-valuenow={value}\n placement={placement}\n determinate={typeof value === 'number'}\n style={{ ...style, '--progress': percentage ? `${percentage}%` : '' } as CSSProperties}\n {...restProps}\n />\n );\n }\n);\n\nexport default Bar;\n"]}
|
|
@@ -73,7 +73,7 @@ export const StyledProgressEllipsis = styled.div(({ theme, placement }) => {
|
|
|
73
73
|
});
|
|
74
74
|
StyledProgressEllipsis.defaultProps = defaultThemeProp;
|
|
75
75
|
const Ellipsis = forwardRef(({ message, placement, ...restProps }, ref) => {
|
|
76
|
-
return (_jsx(StyledProgressEllipsis,
|
|
76
|
+
return (_jsx(StyledProgressEllipsis, { ref: ref, role: 'progressbar', placement: placement, ...restProps, children: _jsxs("span", { children: [_jsx("span", {}, void 0), _jsx("span", {}, void 0), _jsx("span", {}, void 0)] }, void 0) }, void 0));
|
|
77
77
|
});
|
|
78
78
|
export default Ellipsis;
|
|
79
79
|
//# sourceMappingURL=Ellipsis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsis.js","sourceRoot":"","sources":["../../../src/components/Progress/Ellipsis.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAmB,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAgB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IACvF,OAAO,GAAG,CAAA;;eAEG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;QAuBvD,SAAS,KAAK,QAAQ;QACxB,GAAG,CAAA;;;OAGF;;;;;oBAKa,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC;;4CAEnB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;;QAE9D,SAAS,KAAK,QAAQ;QACxB,GAAG,CAAA;;;OAGF;;QAEC,SAAS,KAAK,OAAO;QACvB,GAAG,CAAA;;;OAGF;;QAEC,SAAS,KAAK,QAAQ;QACxB,GAAG,CAAA;;;;uCAI8B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;OAC1D;;;;;;;2BAOoB,MAAM,GAAG,CAAC;;;GAGlC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAA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E,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAkC,EACpE,GAAyB,EACzB,EAAE;IACF,OAAO,CACL,KAAC,sBAAsB,IAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,aAAa,EAAC,SAAS,EAAE,SAAS,KAAM,SAAS,YACtF,2BACE,wBAAQ,EACR,wBAAQ,EACR,wBAAQ,YACH,WACgB,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { FC, forwardRef, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps } from '../../types';\n\nimport { ProgressProps } from './Progress.types';\n\nexport const StyledProgressEllipsis = styled.div<ProgressProps>(({ theme, placement }) => {\n return css`\n line-height: 1;\n display: ${placement === 'inline' ? 'inline-flex' : 'block'};\n\n @keyframes LoadingEllipsis {\n 0% {\n transform: scale(0);\n opacity: 0;\n }\n\n 50% {\n transform: scale(1);\n opacity: 1;\n }\n\n 100% {\n transform: scale(0);\n opacity: 0;\n }\n }\n\n > span {\n display: flex;\n mix-blend-mode: multiply;\n\n ${placement === 'inline' &&\n css`\n display: inline-flex;\n margin-left: 0.1875rem;\n `}\n }\n\n > span span {\n margin: 0 0.3125rem;\n background: ${theme.components.progress['progress-color']};\n border-radius: 50%;\n animation: LoadingEllipsis calc(4 * ${theme.base.animation.speed}) infinite;\n\n ${placement === 'global' &&\n css`\n width: 1.25rem;\n height: 1.25rem;\n `}\n\n ${placement === 'local' &&\n css`\n width: 0.625rem;\n height: 0.625rem;\n `}\n\n ${placement === 'inline' &&\n css`\n width: 0.1875rem;\n height: 0.1875rem;\n margin: 0 0.1875rem;\n animation-duration: calc(4 * ${theme.base.animation.speed});\n `}\n\n &:nth-child(2) {\n animation-delay: 0.1667s;\n }\n\n &:nth-child(3) {\n animation-delay: ${0.1667 * 2}s;\n }\n }\n `;\n});\n\nStyledProgressEllipsis.defaultProps = defaultThemeProp;\n\nconst Ellipsis: FC<ProgressProps & ForwardProps> = forwardRef(\n (\n { message, placement, ...restProps }: PropsWithoutRef<ProgressProps>,\n ref: ProgressProps['ref']\n ) => {\n return (\n <StyledProgressEllipsis ref={ref} role='progressbar' placement={placement} {...restProps}>\n <span>\n <span />\n <span />\n <span />\n </span>\n </StyledProgressEllipsis>\n );\n }\n);\n\nexport default Ellipsis;\n"]}
|
|
@@ -73,8 +73,8 @@ const Progress = forwardRef(({ variant = 'ring', placement = 'global', visible =
|
|
|
73
73
|
}, []);
|
|
74
74
|
if (isNull)
|
|
75
75
|
return null;
|
|
76
|
-
const comp = (_jsx(Comp,
|
|
77
|
-
const content = placement === 'inline' ? (comp) : (_jsxs(Backdrop,
|
|
76
|
+
const comp = (_jsx(Comp, { ...restProps, placement: placement, value: value, "aria-valuetext": message && typeof value === 'number' ? `${message} - ${value}` : message, ref: ref }, void 0));
|
|
77
|
+
const content = placement === 'inline' ? (comp) : (_jsxs(Backdrop, { open: isVisible, container: { direction: 'column' }, position: placement === 'global' ? 'fixed' : 'absolute', variant: 'light', alpha: 0.5, onAfterTransitionIn: onTransitionEndIn, onAfterTransitionOut: onBackdropTransitionEnd, children: [comp, !!message && (_jsx(Text, { as: StyledMessage, variant: 'secondary', "aria-hidden": 'true', children: message }, void 0))] }, void 0));
|
|
78
78
|
return placement === 'global' && portalTarget ? createPortal(content, portalTarget) : content;
|
|
79
79
|
});
|
|
80
80
|
export default Progress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","sourceRoot":"","sources":["../../../src/components/Progress/Progress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,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sourcesContent":["import { forwardRef, PropsWithoutRef, FC, useState, useEffect, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport styled, { css } from 'styled-components';\nimport { readableColor, rgba } from 'polished';\n\nimport { ForwardProps } from '../../types';\nimport Backdrop from '../Backdrop';\nimport Text from '../Text';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { tryCatch } from '../../utils';\nimport { useConfiguration } from '../../hooks';\n\nimport { ProgressProps } from './Progress.types';\nimport Bar from './Bar';\nimport Ellipsis from './Ellipsis';\nimport Ring from './Ring';\n\nconst StyledMessage = styled.span(({ theme }) => {\n const color = tryCatch(() => {\n return rgba(\n readableColor(theme.base.palette['primary-background']),\n theme.base.transparency['transparent-3']\n );\n });\n\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n margin-top: 0.5rem;\n font-size: ${fontSize[theme.components.label['font-size'] as FontSize]};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n color: ${color};\n `;\n});\n\nconst Progress: FC<ProgressProps & ForwardProps> = forwardRef(\n (\n {\n variant = 'ring',\n placement = 'global',\n visible = true,\n onTransitionEndIn,\n onTransitionEndOut,\n value,\n message,\n ...restProps\n }: PropsWithoutRef<ProgressProps>,\n ref: ProgressProps['ref']\n ) => {\n const [isVisible, setIsVisible] = useState(visible);\n const [isNull, setIsNull] = useState(!visible);\n const { portalTarget } = useConfiguration();\n const showTime = useRef<number>();\n const showTimeout = useRef<number>();\n const hideTimeout = useRef<number>();\n\n let Comp = Ring;\n if (variant === 'bar') Comp = Bar;\n else if (variant === 'ellipsis') Comp = Ellipsis;\n\n const onBackdropTransitionEnd = () => {\n setIsNull(true);\n onTransitionEndOut?.();\n };\n\n useEffect(() => {\n if (visible) {\n clearTimeout(hideTimeout.current);\n showTime.current = Date.now();\n showTimeout.current = window.setTimeout(() => {\n setIsVisible(true);\n setIsNull(false);\n }, 100);\n } else {\n clearTimeout(showTimeout.current);\n\n if (typeof showTime.current === 'number') {\n const minimumDuration = 1000;\n const timeElapsed = Date.now() - showTime.current;\n\n if (timeElapsed > minimumDuration) setIsVisible(false);\n else {\n hideTimeout.current = window.setTimeout(() => {\n setIsVisible(false);\n }, minimumDuration - timeElapsed);\n }\n } else setIsVisible(false);\n }\n }, [visible]);\n\n useEffect(() => {\n return () => {\n clearTimeout(showTimeout.current);\n clearTimeout(hideTimeout.current);\n };\n }, []);\n\n if (isNull) return null;\n\n const comp = (\n <Comp\n {...restProps}\n placement={placement}\n value={value}\n aria-valuetext={message && typeof value === 'number' ? `${message} - ${value}` : message}\n ref={ref}\n />\n );\n\n const content =\n placement === 'inline' ? (\n comp\n ) : (\n <Backdrop\n open={isVisible}\n container={{ direction: 'column' }}\n position={placement === 'global' ? 'fixed' : 'absolute'}\n variant='light'\n alpha={0.5}\n onAfterTransitionIn={onTransitionEndIn}\n onAfterTransitionOut={onBackdropTransitionEnd}\n >\n {comp}\n {!!message && (\n <Text as={StyledMessage} variant='secondary' aria-hidden='true'>\n {message}\n </Text>\n )}\n </Backdrop>\n );\n\n return placement === 'global' && portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default Progress;\n"]}
|
|
@@ -69,7 +69,7 @@ const Ring = forwardRef(({ value, minValue = 0, maxValue = 100, placement, ...re
|
|
|
69
69
|
strokeDashoffset = circumference;
|
|
70
70
|
else
|
|
71
71
|
strokeDashoffset = (1 - (value - minValue) / (maxValue - minValue)) * circumference;
|
|
72
|
-
return (_jsx(StyledProgressRing,
|
|
72
|
+
return (_jsx(StyledProgressRing, { ref: ref, role: 'progressbar', "aria-valuemin": minValue, "aria-valuemax": maxValue, "aria-valuenow": value, placement: placement, determinate: typeof value === 'number', ...restProps, children: _jsxs("svg", { viewBox: '0 0 20 20', children: [_jsx("circle", {}, void 0), _jsx("circle", { strokeDasharray: circumference, style: { strokeDashoffset } }, void 0)] }, void 0) }, void 0));
|
|
73
73
|
});
|
|
74
74
|
export default Ring;
|
|
75
75
|
//# sourceMappingURL=Ring.js.map
|