@pega/cosmos-react-core 2.0.0-dev.9.2 → 2.0.0-rc.2
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/README.md +3 -3
- package/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts +2 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +4 -9
- 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 +89 -62
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +227 -173
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +7 -7
- 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 +3 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts +4 -3
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js +24 -19
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +7 -8
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.js +3 -5
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +30 -39
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +5 -4
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +7 -6
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Alert.d.ts +2 -2
- package/lib/components/Badges/Alert.d.ts.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.d.ts.map +1 -1
- package/lib/components/Badges/Selection.js +10 -9
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Status.d.ts +2 -2
- package/lib/components/Badges/Status.d.ts.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.d.ts +2 -2
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +6 -8
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
- package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +1 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/BareButton.d.ts.map +1 -1
- package/lib/components/Button/BareButton.js +21 -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.d.ts +5 -0
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +34 -10
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +3 -2
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js +5 -4
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.d.ts.map +1 -1
- package/lib/components/Card/CardFooter.js +5 -4
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.d.ts +3 -1
- package/lib/components/Card/CardHeader.d.ts.map +1 -1
- package/lib/components/Card/CardHeader.js +9 -7
- 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.d.ts.map +1 -1
- package/lib/components/Card/CollapsibleCard.js +5 -7
- 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.d.ts +2 -2
- package/lib/components/Checkbox/Checkbox.d.ts.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.d.ts +2 -2
- package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +8 -11
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +30 -33
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +2 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.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 +23 -29
- 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 +16 -12
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +11 -13
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +11 -7
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +16 -16
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
- 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/DateTime.types.d.ts +2 -1
- package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +14 -3
- 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.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +25 -27
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
- 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 +14 -3
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +42 -42
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js +7 -5
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.js +3 -3
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.js +12 -15
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +12 -17
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +3 -4
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
- package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
- package/lib/components/DateTime/Input/QuarterInput.js +102 -0
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +26 -30
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +22 -23
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.js +4 -4
- package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +7 -0
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +52 -10
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +47 -72
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +13 -17
- 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 +13 -17
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +9 -10
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +9 -11
- 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/DateTime/index.d.ts +2 -0
- package/lib/components/DateTime/index.d.ts.map +1 -1
- package/lib/components/DateTime/index.js +1 -0
- package/lib/components/DateTime/index.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +6 -6
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Email/EmailDisplay.d.ts +2 -2
- package/lib/components/Email/EmailDisplay.d.ts.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.d.ts.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 +3 -4
- package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.d.ts +14 -0
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
- package/lib/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/components/EmptyState/index.d.ts +4 -0
- package/lib/components/EmptyState/index.d.ts.map +1 -0
- package/lib/components/EmptyState/index.js +3 -0
- package/lib/components/EmptyState/index.js.map +1 -0
- package/lib/components/ErrorState/ErrorState.d.ts +16 -0
- package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
- package/lib/components/ErrorState/ErrorState.js +31 -0
- package/lib/components/ErrorState/ErrorState.js.map +1 -0
- package/lib/components/ErrorState/index.d.ts +4 -0
- package/lib/components/ErrorState/index.d.ts.map +1 -0
- package/lib/components/ErrorState/index.js +3 -0
- package/lib/components/ErrorState/index.js.map +1 -0
- package/lib/components/ExpandCollapse/ExpandCollapse.js +5 -5
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +6 -7
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +7 -6
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +5 -7
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.d.ts +6 -3
- package/lib/components/File/FileDisplay.d.ts.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.d.ts +3 -3
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +18 -19
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileItem.d.ts +0 -2
- package/lib/components/File/FileItem.d.ts.map +1 -1
- package/lib/components/File/FileItem.js +3 -4
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileUploadItem.d.ts +4 -2
- package/lib/components/File/FileUploadItem.d.ts.map +1 -1
- package/lib/components/File/FileUploadItem.js +58 -20
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/File/FileVisual.d.ts +7 -16
- package/lib/components/File/FileVisual.d.ts.map +1 -1
- package/lib/components/File/FileVisual.js +44 -47
- package/lib/components/File/FileVisual.js.map +1 -1
- package/lib/components/File/utils.js +2 -3
- package/lib/components/File/utils.js.map +1 -1
- package/lib/components/Flex/Flex.d.ts +17 -7
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js +25 -9
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.d.ts +7 -1
- package/lib/components/Form/Form.d.ts.map +1 -1
- package/lib/components/Form/Form.js +5 -4
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts.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.d.ts +5 -7
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +9 -19
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.d.ts +1 -1
- package/lib/components/Grid/Grid.d.ts.map +1 -1
- package/lib/components/Grid/Grid.js +17 -21
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Icon/Icon.js +3 -5
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
- package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
- package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
- package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/dock.icon.js +6 -0
- package/lib/components/Icon/icons/dock.icon.js.map +1 -0
- package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
- package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
- package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
- package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
- package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
- package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
- package/lib/components/Icon/icons/galaxy.icon.js +1 -3
- package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
- package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad.icon.js +1 -5
- package/lib/components/Icon/icons/grad.icon.js.map +1 -1
- package/lib/components/Icon/icons/list-number.icon.js +1 -6
- package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
- package/lib/components/Icon/icons/list.icon.js +1 -6
- package/lib/components/Icon/icons/list.icon.js.map +1 -1
- package/lib/components/Icon/icons/pin.icon.js +1 -2
- package/lib/components/Icon/icons/pin.icon.js.map +1 -1
- package/lib/components/Icon/icons/search-solid.icon.js +1 -2
- package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tracer.icon.js +1 -2
- package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
- package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox.icon.js +1 -3
- package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
- package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
- package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/undock.icon.js +6 -0
- package/lib/components/Icon/icons/undock.icon.js.map +1 -0
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/index.d.ts +1 -1
- package/lib/components/Image/index.d.ts.map +1 -1
- package/lib/components/Image/index.js +1 -0
- package/lib/components/Image/index.js.map +1 -1
- package/lib/components/Input/Input.d.ts +2 -2
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +13 -13
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.styles.js +2 -2
- package/lib/components/Input/Input.styles.js.map +1 -1
- package/lib/components/Label/Label.js +1 -1
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts +6 -0
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.js +129 -0
- package/lib/components/Lightbox/Lightbox.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.styles.js +166 -0
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.types.js +2 -0
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
- package/lib/components/Lightbox/index.d.ts +3 -0
- package/lib/components/Lightbox/index.d.ts.map +1 -0
- package/lib/components/Lightbox/index.js +2 -0
- package/lib/components/Lightbox/index.js.map +1 -0
- package/lib/components/Link/Link.js +5 -8
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.d.ts +15 -0
- package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
- package/lib/components/List/CommaSeparatedList.js +61 -0
- package/lib/components/List/CommaSeparatedList.js.map +1 -0
- package/lib/components/List/List.d.ts +30 -0
- package/lib/components/List/List.d.ts.map +1 -0
- package/lib/components/List/List.js +56 -0
- package/lib/components/List/List.js.map +1 -0
- package/lib/components/List/OrderedList.d.ts +6 -0
- package/lib/components/List/OrderedList.d.ts.map +1 -0
- package/lib/components/List/OrderedList.js +6 -0
- package/lib/components/List/OrderedList.js.map +1 -0
- package/lib/components/List/UnorderedList.d.ts +6 -0
- package/lib/components/List/UnorderedList.d.ts.map +1 -0
- package/lib/components/List/UnorderedList.js +6 -0
- package/lib/components/List/UnorderedList.js.map +1 -0
- package/lib/components/List/index.d.ts +5 -0
- package/lib/components/List/index.d.ts.map +1 -0
- package/lib/components/List/index.js +4 -0
- package/lib/components/List/index.js.map +1 -0
- package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +7 -7
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/Location.types.d.ts +2 -1
- package/lib/components/Location/Location.types.d.ts.map +1 -1
- package/lib/components/Location/Location.types.js.map +1 -1
- package/lib/components/Location/LocationDisplay.js +8 -9
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.js +27 -28
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.js +8 -13
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/utils.js +11 -15
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +12 -15
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.context.d.ts.map +1 -1
- package/lib/components/Menu/Menu.context.js +2 -0
- package/lib/components/Menu/Menu.context.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +89 -46
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +11 -0
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +202 -3
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +30 -12
- 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.d.ts +6 -0
- package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
- package/lib/components/Menu/MenuGroup.js +17 -0
- package/lib/components/Menu/MenuGroup.js.map +1 -0
- package/lib/components/Menu/MenuItem.d.ts +0 -3
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +57 -164
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +28 -30
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts +0 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +7 -55
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +2 -3
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +13 -12
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +40 -36
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/Menu/index.d.ts +2 -3
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -2
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +3 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +13 -14
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MetaList/MetaList.d.ts +13 -4
- package/lib/components/MetaList/MetaList.d.ts.map +1 -1
- package/lib/components/MetaList/MetaList.js +34 -20
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/Modal/Contexts.d.ts.map +1 -1
- package/lib/components/Modal/Contexts.js +3 -0
- package/lib/components/Modal/Contexts.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +5 -4
- 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 +53 -38
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts +1 -6
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +82 -134
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +9 -0
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
- package/lib/components/Modal/Modal.styles.js +135 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -0
- package/lib/components/Modal/Modal.types.d.ts +56 -5
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Modal/ModalManager.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js +74 -65
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +10 -12
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
- package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
- package/lib/components/Number/NumberDisplay.d.ts +2 -2
- package/lib/components/Number/NumberDisplay.d.ts.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.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +18 -25
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +2 -2
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/utils.js +2 -3
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +8 -18
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +48 -28
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +89 -79
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/index.d.ts +3 -0
- package/lib/components/PageTemplates/index.d.ts.map +1 -1
- package/lib/components/PageTemplates/index.js +1 -0
- package/lib/components/PageTemplates/index.js.map +1 -1
- package/lib/components/Pagination/Pagination.d.ts +2 -2
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +7 -6
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
- package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
- package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
- package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
- package/lib/components/Paragraph/index.d.ts +3 -0
- package/lib/components/Paragraph/index.d.ts.map +1 -0
- package/lib/components/Paragraph/index.js +2 -0
- package/lib/components/Paragraph/index.js.map +1 -0
- package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -3
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +2 -2
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +18 -17
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.js +2 -3
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +0 -4
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +11 -122
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +5 -0
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
- package/lib/components/Popover/Popover.styles.js +116 -0
- package/lib/components/Popover/Popover.styles.js.map +1 -0
- package/lib/components/Popover/PopoverManager.js +2 -2
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Popover/index.d.ts +1 -1
- package/lib/components/Popover/index.d.ts.map +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Progress/Bar.js +2 -2
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.d.ts +1 -1
- package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
- package/lib/components/Progress/Ellipsis.js +48 -50
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.js +3 -4
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Progress.types.d.ts +2 -2
- package/lib/components/Progress/Progress.types.d.ts.map +1 -1
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/Progress/Ring.d.ts +1 -1
- package/lib/components/Progress/Ring.d.ts.map +1 -1
- package/lib/components/Progress/Ring.js +40 -40
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/components/RadioButton/RadioButton.d.ts.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.d.ts +2 -2
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +7 -8
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.d.ts +2 -2
- package/lib/components/Rating/Rating.d.ts.map +1 -1
- package/lib/components/Rating/Rating.js +6 -7
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +4 -4
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +14 -14
- 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.d.ts.map +1 -1
- package/lib/components/Select/Select.js +15 -16
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.d.ts +2 -2
- package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -2
- 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.d.ts.map +1 -1
- package/lib/components/Slider/Slider.js +12 -19
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +4 -1
- package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
- package/lib/components/Slider/Slider.styles.js +17 -5
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/Slider/Slider.types.d.ts +2 -2
- package/lib/components/Slider/Slider.types.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/Slider/SliderTicks.d.ts +1 -0
- package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
- package/lib/components/Slider/SliderTicks.js +19 -12
- package/lib/components/Slider/SliderTicks.js.map +1 -1
- package/lib/components/Slider/utils.d.ts +10 -11
- package/lib/components/Slider/utils.d.ts.map +1 -1
- package/lib/components/Slider/utils.js +24 -18
- package/lib/components/Slider/utils.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
- package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +3 -5
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts +8 -2
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +10 -11
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +14 -10
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.d.ts +2 -2
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +41 -30
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.d.ts +2 -2
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +14 -13
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/Tab.d.ts +1 -1
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +9 -7
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +10 -2
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +24 -8
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts +1 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +22 -18
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/Tabs.types.d.ts +2 -2
- package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.types.js.map +1 -1
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Text/Text.js +2 -2
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts +2 -2
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +31 -30
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Toaster.d.ts +8 -36
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +97 -102
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +6 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +6 -13
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts +6 -0
- package/lib/components/Tree/StandardTree.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.js +175 -0
- package/lib/components/Tree/StandardTree.js.map +1 -0
- package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
- package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.styles.js +155 -0
- package/lib/components/Tree/StandardTree.styles.js.map +1 -0
- package/lib/components/Tree/StandardTree.types.d.ts +25 -0
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.types.js +2 -0
- package/lib/components/Tree/StandardTree.types.js.map +1 -0
- package/lib/components/Tree/Tree.d.ts +35 -49
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/Tree.js +18 -56
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/helpers.d.ts +19 -0
- package/lib/components/Tree/helpers.d.ts.map +1 -0
- package/lib/components/Tree/helpers.js +180 -0
- package/lib/components/Tree/helpers.js.map +1 -0
- package/lib/components/Tree/index.d.ts +4 -2
- package/lib/components/Tree/index.d.ts.map +1 -1
- package/lib/components/Tree/index.js +3 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts +2 -2
- package/lib/components/URL/URLDisplay.d.ts.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 +7 -4
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +7 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts +17 -3
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +86 -64
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useAutoResize.d.ts.map +1 -1
- package/lib/hooks/useAutoResize.js +6 -7
- package/lib/hooks/useAutoResize.js.map +1 -1
- package/lib/hooks/useBreakpoint.js +2 -4
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +8 -0
- package/lib/hooks/useDraggable.d.ts.map +1 -0
- package/lib/hooks/useDraggable.js +64 -0
- package/lib/hooks/useDraggable.js.map +1 -0
- package/lib/hooks/useFocusWithin.d.ts +1 -1
- package/lib/hooks/useFocusWithin.d.ts.map +1 -1
- package/lib/hooks/useFocusWithin.js +29 -24
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +505 -170
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useI18n.js +2 -2
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useLongPress.d.ts +16 -0
- package/lib/hooks/useLongPress.d.ts.map +1 -0
- package/lib/hooks/useLongPress.js +59 -0
- package/lib/hooks/useLongPress.js.map +1 -0
- package/lib/hooks/useOuterEvent.js +1 -1
- package/lib/hooks/useOuterEvent.js.map +1 -1
- package/lib/hooks/useOverride.js +1 -1
- package/lib/hooks/useOverride.js.map +1 -1
- package/lib/hooks/useScrollStick.js +14 -3
- package/lib/hooks/useScrollStick.js.map +1 -1
- package/lib/hooks/useScrollToggle.d.ts +6 -0
- package/lib/hooks/useScrollToggle.d.ts.map +1 -0
- package/lib/hooks/useScrollToggle.js +40 -0
- package/lib/hooks/useScrollToggle.js.map +1 -0
- 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.d.ts +583 -0
- package/lib/i18n/default.d.ts.map +1 -0
- package/lib/i18n/default.js +627 -0
- package/lib/i18n/default.js.map +1 -0
- package/lib/i18n/i18n.d.ts +988 -318
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/i18n.js +1 -1
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/i18n/index.d.ts +1 -0
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/translate.d.ts +29 -4
- package/lib/i18n/translate.d.ts.map +1 -1
- package/lib/i18n/translate.js +21 -8
- package/lib/i18n/translate.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +2 -26
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/ThemeMachine.js +7 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/theme/index.js +1 -0
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/theme.d.ts +83 -53
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +50 -30
- package/lib/theme/themeOverrides.schema.json +24 -3
- package/lib/theme/themes/buildTheme.json +3 -39
- package/lib/theme/themes/darkTheme.json +6 -0
- package/lib/theme/themes/legacyBuildTheme.json +50 -0
- package/lib/types/types.d.ts +6 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/utils.d.ts +41 -4
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +55 -9
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -11
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
- package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
- package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
- package/lib/components/NoItems/NoItems.d.ts +0 -14
- package/lib/components/NoItems/NoItems.d.ts.map +0 -1
- package/lib/components/NoItems/NoItems.js.map +0 -1
- package/lib/components/NoItems/index.d.ts +0 -4
- package/lib/components/NoItems/index.d.ts.map +0 -1
- package/lib/components/NoItems/index.js +0 -3
- package/lib/components/NoItems/index.js.map +0 -1
- package/lib/i18n/default.json +0 -246
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/lib/hooks/useI18n.js
CHANGED
|
@@ -5,8 +5,8 @@ import useConfiguration from './useConfiguration';
|
|
|
5
5
|
* @returns translator:: The translator function that provides translations for a given key in the translation JSON provided to the Configuration component.
|
|
6
6
|
*/
|
|
7
7
|
const useI18n = () => {
|
|
8
|
-
const { translations } = useConfiguration();
|
|
9
|
-
return translatorFor(translations);
|
|
8
|
+
const { translations, locale } = useConfiguration();
|
|
9
|
+
return translatorFor(translations, locale);
|
|
10
10
|
};
|
|
11
11
|
export default useI18n;
|
|
12
12
|
//# sourceMappingURL=useI18n.js.map
|
package/lib/hooks/useI18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,GAAG,GAAG,EAAE;IACnB,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"useI18n.js","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,GAAG,GAAG,EAAE;IACnB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACpD,OAAO,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import translatorFor from '../i18n/translate';\n\nimport useConfiguration from './useConfiguration';\n\n/**\n * @example const translator = useI18n();\n * @returns translator:: The translator function that provides translations for a given key in the translation JSON provided to the Configuration component.\n */\nconst useI18n = () => {\n const { translations, locale } = useConfiguration();\n return translatorFor(translations, locale);\n};\n\nexport default useI18n;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
key?: string;
|
|
3
|
+
delay?: number;
|
|
4
|
+
shouldPreventDefault?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const useLongPress: <T>(onLongPress: () => void, onClick?: (() => void) | undefined, { key, shouldPreventDefault, delay }?: Options) => {
|
|
7
|
+
onMouseDown: (e: import("react").MouseEvent<T, MouseEvent>) => void;
|
|
8
|
+
onTouchStart: (e: import("react").TouchEvent<T>) => void;
|
|
9
|
+
onKeyDown: (e: import("react").KeyboardEvent<T>) => void;
|
|
10
|
+
onMouseUp: () => void;
|
|
11
|
+
onKeyUp: (e: import("react").KeyboardEvent<T>) => void;
|
|
12
|
+
onMouseLeave: () => void;
|
|
13
|
+
onTouchEnd: () => void;
|
|
14
|
+
};
|
|
15
|
+
export default useLongPress;
|
|
16
|
+
//# sourceMappingURL=useLongPress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLongPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"AAcA,UAAU,OAAO;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,QAAA,MAAM,YAAY,mBACH,MAAM,IAAI,mBACP,IAAI,sDACyC,OAAO;;;;;;;;CAqDrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from 'react';
|
|
2
|
+
const isTouchEvent = (e) => {
|
|
3
|
+
return 'touches' in e;
|
|
4
|
+
};
|
|
5
|
+
const preventDefault = (e) => {
|
|
6
|
+
if (!isTouchEvent(e))
|
|
7
|
+
return;
|
|
8
|
+
if (e.touches.length < 2 && e.preventDefault) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const useLongPress = (onLongPress, onClick, { key = 'Enter', shouldPreventDefault = true, delay = 500 } = {}) => {
|
|
13
|
+
const [longPressTriggered, setLongPressTriggered] = useState(false);
|
|
14
|
+
const timeout = useRef();
|
|
15
|
+
const target = useRef();
|
|
16
|
+
const start = useCallback((event) => {
|
|
17
|
+
if (shouldPreventDefault && event.target) {
|
|
18
|
+
event.target.addEventListener('touchend', preventDefault, {
|
|
19
|
+
passive: false
|
|
20
|
+
});
|
|
21
|
+
target.current = event.target;
|
|
22
|
+
}
|
|
23
|
+
timeout.current = setTimeout(() => {
|
|
24
|
+
onLongPress();
|
|
25
|
+
setLongPressTriggered(true);
|
|
26
|
+
}, delay);
|
|
27
|
+
}, [onLongPress, delay, shouldPreventDefault]);
|
|
28
|
+
const clear = useCallback((shouldTriggerClick = true) => {
|
|
29
|
+
if (timeout.current) {
|
|
30
|
+
clearTimeout(timeout.current);
|
|
31
|
+
}
|
|
32
|
+
if (shouldTriggerClick && !longPressTriggered) {
|
|
33
|
+
onClick?.();
|
|
34
|
+
}
|
|
35
|
+
setLongPressTriggered(false);
|
|
36
|
+
if (shouldPreventDefault && target.current) {
|
|
37
|
+
target.current.removeEventListener('touchend', preventDefault);
|
|
38
|
+
}
|
|
39
|
+
}, [shouldPreventDefault, onClick, longPressTriggered]);
|
|
40
|
+
return {
|
|
41
|
+
onMouseDown: (e) => start(e),
|
|
42
|
+
onTouchStart: (e) => start(e),
|
|
43
|
+
onKeyDown: (e) => {
|
|
44
|
+
if (e.repeat || e.key !== key)
|
|
45
|
+
return;
|
|
46
|
+
start(e);
|
|
47
|
+
},
|
|
48
|
+
onMouseUp: () => clear(),
|
|
49
|
+
onKeyUp: (e) => {
|
|
50
|
+
if (e.repeat || e.key !== key)
|
|
51
|
+
return;
|
|
52
|
+
clear();
|
|
53
|
+
},
|
|
54
|
+
onMouseLeave: () => clear(false),
|
|
55
|
+
onTouchEnd: () => clear()
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export default useLongPress;
|
|
59
|
+
//# sourceMappingURL=useLongPress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLongPress.js","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,YAAY,GAAG,CAAC,CAAQ,EAAmB,EAAE;IACjD,OAAO,SAAS,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,CAAQ,EAAE,EAAE;IAClC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAAE,OAAO;IAE7B,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE;QAC5C,CAAC,CAAC,cAAc,EAAE,CAAC;KACpB;AACH,CAAC,CAAC;AAQF,MAAM,YAAY,GAAG,CACnB,WAAuB,EACvB,OAAoB,EACpB,EAAE,GAAG,GAAG,OAAO,EAAE,oBAAoB,GAAG,IAAI,EAAE,KAAK,GAAG,GAAG,KAAc,EAAE,EACzE,EAAE;IACF,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,MAAM,EAAiC,CAAC;IACxD,MAAM,MAAM,GAAG,MAAM,EAAe,CAAC;IAErC,MAAM,KAAK,GAAG,WAAW,CACvB,CAAC,KAAyE,EAAE,EAAE;QAC5E,IAAI,oBAAoB,IAAI,KAAK,CAAC,MAAM,EAAE;YACxC,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE;gB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EAAE;YACrC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;gBAAE,OAAO;YACtC,KAAK,EAAE,CAAC;QACV,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;QAChC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;KAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\nconst isTouchEvent = (e: Event): e is TouchEvent => {\n return 'touches' in e;\n};\n\nconst preventDefault = (e: Event) => {\n if (!isTouchEvent(e)) return;\n\n if (e.touches.length < 2 && e.preventDefault) {\n e.preventDefault();\n }\n};\n\ninterface Options {\n key?: string;\n delay?: number;\n shouldPreventDefault?: boolean;\n}\n\nconst useLongPress = <T>(\n onLongPress: () => void,\n onClick?: () => void,\n { key = 'Enter', shouldPreventDefault = true, delay = 500 }: Options = {}\n) => {\n const [longPressTriggered, setLongPressTriggered] = useState(false);\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n const target = useRef<EventTarget>();\n\n const start = useCallback(\n (event: React.MouseEvent<T> | React.KeyboardEvent<T> | React.TouchEvent<T>) => {\n if (shouldPreventDefault && event.target) {\n event.target.addEventListener('touchend', preventDefault, {\n passive: false\n });\n target.current = event.target;\n }\n timeout.current = setTimeout(() => {\n onLongPress();\n setLongPressTriggered(true);\n }, delay);\n },\n [onLongPress, delay, shouldPreventDefault]\n );\n\n const clear = useCallback(\n (shouldTriggerClick = true) => {\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n if (shouldTriggerClick && !longPressTriggered) {\n onClick?.();\n }\n setLongPressTriggered(false);\n if (shouldPreventDefault && target.current) {\n target.current.removeEventListener('touchend', preventDefault);\n }\n },\n [shouldPreventDefault, onClick, longPressTriggered]\n );\n\n return {\n onMouseDown: (e: React.MouseEvent<T>) => start(e),\n onTouchStart: (e: React.TouchEvent<T>) => start(e),\n onKeyDown: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n start(e);\n },\n onMouseUp: () => clear(),\n onKeyUp: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n clear();\n },\n onMouseLeave: () => clear(false),\n onTouchEnd: () => clear()\n };\n};\n\nexport default useLongPress;\n"]}
|
|
@@ -31,7 +31,7 @@ const useOuterEvent = (eventName, nodes, handler) => {
|
|
|
31
31
|
parentIdx += 1;
|
|
32
32
|
}
|
|
33
33
|
if (nodes.every(n => {
|
|
34
|
-
const node = n instanceof Node ? n : n
|
|
34
|
+
const node = n instanceof Node ? n : n?.current;
|
|
35
35
|
if (!node)
|
|
36
36
|
return true;
|
|
37
37
|
return node !== target && !node.contains(target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOuterEvent.js","sourceRoot":"","sources":["../../src/hooks/useOuterEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CACpB,SAAkC,EAClC,KAA+C,EAC/C,OAAqD,EAC/C,EAAE;IACR,MAAM,OAAO,GAAmB,WAAW,CACzC,KAAK,CAAC,EAAE;QACN,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEvB,IAAI,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC;YAAE,OAAO;QAEtC,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,EAAE;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YAE/B,IAAI,CAAC,KAAK,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EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useEffect, useCallback, RefObject } from 'react';\n\n/**\n * @example useOuterEvent(eventName, [nodes], handler = () => { doSomething; });\n * @param eventName The type of event to trigger the handler function on. Reference [DocumentEventMap](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.documenteventmap.html) for a list of valid events.\n * @param nodes An array of Nodes or Refs to Nodes to attach the eventName to.\n * @param handler The function that is called when the given event occurs.\n */\nconst useOuterEvent = <EventName extends keyof DocumentEventMap>(\n eventName: EventName | EventName[],\n nodes: (Node | null | RefObject<Node | null>)[],\n handler: (event: DocumentEventMap[EventName]) => void\n): void => {\n const onEvent: typeof handler = useCallback(\n event => {\n const path = event.composedPath();\n const target = path[0];\n\n if (!(target instanceof Node)) return;\n\n let childIdx = 0;\n let parentIdx = 1;\n while (path[childIdx] !== document) {\n const child = path[childIdx];\n const parent = path[parentIdx];\n\n if (!child || !parent) return;\n\n if (parent instanceof DocumentFragment || parent instanceof Document) {\n if (!(child instanceof Node) || !parent.contains(child)) return;\n\n childIdx = parentIdx;\n } else if (child instanceof DocumentFragment) {\n if (!(parent instanceof Element) || parent.shadowRoot !== child) return;\n\n childIdx = parentIdx;\n }\n\n parentIdx += 1;\n }\n\n if (\n nodes.every(n => {\n const node = n instanceof Node ? n : n?.current;\n\n if (!node) return true;\n return node !== target && !node.contains(target);\n })\n ) {\n handler(event);\n }\n },\n [...nodes, handler]\n );\n\n useEffect(() => {\n const eventNames = Array.isArray(eventName) ? eventName : [eventName];\n\n eventNames.forEach(event => document.addEventListener(event, onEvent));\n return () => eventNames.forEach(event => document.removeEventListener(event, onEvent));\n }, [eventName, onEvent]);\n};\n\nexport default useOuterEvent;\n"]}
|
package/lib/hooks/useOverride.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import useConfiguration from './useConfiguration';
|
|
2
|
-
export default (comp) =>
|
|
2
|
+
export default (comp) => useConfiguration().overrideMap?.[comp];
|
|
3
3
|
//# sourceMappingURL=useOverride.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverride.js","sourceRoot":"","sources":["../../src/hooks/useOverride.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAIlD,eAAe,CAA8B,IAAO,EAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"useOverride.js","sourceRoot":"","sources":["../../src/hooks/useOverride.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAIlD,eAAe,CAA8B,IAAO,EAAkB,EAAE,CACtE,gBAAgB,EAAE,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { ConfigurationProps } from '../components/Configuration';\n\nimport useConfiguration from './useConfiguration';\n\ntype OverrideMap = NonNullable<ConfigurationProps['overrideMap']>;\n\nexport default <C extends keyof OverrideMap>(comp: C): OverrideMap[C] =>\n useConfiguration().overrideMap?.[comp];\n"]}
|
|
@@ -16,6 +16,18 @@ const onBeforeunload = () => {
|
|
|
16
16
|
};
|
|
17
17
|
class Stickers {
|
|
18
18
|
constructor({ elements, scrollContainer = window, offset = 0 }) {
|
|
19
|
+
Object.defineProperty(this, "scrollContainer", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "offset", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
19
31
|
_Stickers_scrollDebounce.set(this, void 0);
|
|
20
32
|
_Stickers_resizeDebounce.set(this, void 0);
|
|
21
33
|
_Stickers_isWindowScroll.set(this, void 0);
|
|
@@ -226,12 +238,11 @@ _Stickers_scrollDebounce = new WeakMap(), _Stickers_resizeDebounce = new WeakMap
|
|
|
226
238
|
const useScrollStick = (options) => {
|
|
227
239
|
const instance = useRef();
|
|
228
240
|
useLayoutEffect(() => {
|
|
229
|
-
if (options
|
|
241
|
+
if (options?.elements) {
|
|
230
242
|
instance.current = new Stickers(options);
|
|
231
243
|
}
|
|
232
244
|
return () => {
|
|
233
|
-
|
|
234
|
-
(_a = instance.current) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
245
|
+
instance.current?.cleanup();
|
|
235
246
|
instance.current = undefined;
|
|
236
247
|
};
|
|
237
248
|
}, [options]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollStick.js","sourceRoot":"","sources":["../../src/hooks/useScrollStick.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAmBhD,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,QAAQ;IAmBZ,YAAY,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAsB;QAhBlF,2CAAwB;QACxB,2CAAwB;QACxB,2CAAyB;QACzB,gDAA6B;QAC7B,iDAA8B;QAC9B,4CAAyB;QACzB,yCAAsB;QACtB,0CAAuB;QACvB,6CAA0B;QAC1B,wCAAsB;QACtB,6CAA0B;QAC1B,6CAA0B;QAC1B,qCAAqB;QACrB,0CAA2B;QAC3B,0CAA2B;QAGzB,IAAI,CAAC,eAAe,GAAG,eAA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,EAAE;YAC3C,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;SAC7C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,uBAAA,IAAI,0BAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;CACF;;AAED;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,OAA4B,EAAQ,EAAE;IAC5D,MAAM,QAAQ,GAAG,MAAM,EAAY,CAAC;IAEpC,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAAE;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC1C;QAED,OAAO,GAAG,EAAE;;YACV,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useRef, useLayoutEffect } from 'react';\n\nexport interface ScrollStickOptions {\n elements: string | HTMLElement[];\n scrollContainer?: Stickers['scrollContainer'];\n offset?: number;\n}\n\ninterface Sticker {\n element: HTMLElement;\n top: number;\n bottom: number;\n height: number;\n isStuck: boolean;\n priorStickHeight: number;\n}\n\ntype ElementsOption = string | HTMLElement[];\n\nconst onBeforeunload = () => {\n window.scrollTo(0, 0);\n};\n\nclass Stickers {\n scrollContainer: HTMLElement | Window;\n offset: number;\n #scrollDebounce: number;\n #resizeDebounce: number;\n #isWindowScroll: boolean;\n #scrollIntervalStart: number;\n #scrollIntervalChange: number;\n #scrollDirection: number;\n #priorScrollY: number;\n #resizeTimeout: number;\n #scrollEndTimeout: number;\n #isScrolling: boolean;\n #vpHeightSnapshot: number;\n #sfHeightSnapshot: number;\n #stickers: Sticker[];\n #scrollHandler: () => void;\n #resizeHandler: () => void;\n\n constructor({ elements, scrollContainer = window, offset = 0 }: ScrollStickOptions) {\n this.scrollContainer = scrollContainer;\n this.offset = offset;\n\n this.#scrollDebounce = 100;\n this.#resizeDebounce = 300;\n this.#resizeTimeout = NaN;\n this.#scrollEndTimeout = NaN;\n this.#priorScrollY = NaN;\n this.#isScrolling = false;\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n this.#scrollHandler = () => {};\n this.#resizeHandler = () => {};\n\n this.#isWindowScroll = this.scrollContainer === window;\n\n // Only gets reset after scroll stop timeout fires\n this.#scrollIntervalStart = this.getScrollY();\n\n // Used to determine scroll change within debounced scroll handler\n this.#scrollIntervalChange = 0;\n\n // Used to determine scroll direction by +1(page down) -1(page up)\n this.#scrollDirection = 0;\n\n this.#stickers = this.setStickers(elements);\n this.snapshotItemRects();\n this.addHandlers();\n }\n\n setStickers(elements: ElementsOption) {\n this.#stickers = (\n typeof elements === 'string'\n ? Array.from(document.querySelectorAll<HTMLElement>(elements))\n : elements\n ).map(element => ({\n element,\n isStuck: false,\n top: NaN,\n bottom: NaN,\n height: NaN,\n priorStickHeight: NaN\n }));\n\n return this.#stickers;\n }\n\n addHandlers() {\n this.rmHandlers();\n this.#scrollHandler = this.onScroll.bind(this);\n this.#resizeHandler = this.onResize.bind(this);\n this.scrollContainer.addEventListener('scroll', this.#scrollHandler);\n window.addEventListener('resize', this.#resizeHandler);\n // Not sure we need this. Maybe when DOM was persisted...\n window.addEventListener('beforeunload', onBeforeunload);\n }\n\n rmHandlers() {\n this.scrollContainer.removeEventListener('scroll', this.#scrollHandler);\n window.removeEventListener('resize', this.#resizeHandler);\n window.removeEventListener('beforeunload', onBeforeunload);\n }\n\n snapshotItemRects() {\n this.#stickers.forEach(sticker => {\n const rect = sticker.element.getBoundingClientRect();\n sticker.top = rect.top;\n sticker.bottom = rect.bottom;\n sticker.height = rect.height;\n });\n }\n\n onScroll() {\n clearTimeout(this.#scrollEndTimeout);\n\n const currentScrollY = this.getScrollY();\n\n this.#priorScrollY = !Number.isNaN(this.#priorScrollY)\n ? this.#priorScrollY\n : this.#scrollIntervalStart;\n\n // Diff between priorScrollY and new currentScrollY to determine direction\n this.#scrollDirection = currentScrollY - this.#priorScrollY > 0 ? 1 : -1;\n\n // How much scroll changed + or - within the debounce interval\n this.#scrollIntervalChange = currentScrollY - this.#scrollIntervalStart;\n\n // Update old to new for next scroll event\n this.#priorScrollY = currentScrollY;\n\n // When scrolling has stopped\n this.#scrollEndTimeout = window.setTimeout(() => {\n // Reset for next scroll starting point\n this.#scrollIntervalStart = this.#priorScrollY;\n\n // Reset until next scroll\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n\n this.#isScrolling = false;\n }, this.#scrollDebounce);\n\n // Additional scroll calls always have to test for stick state change\n if (this.#isScrolling) {\n this.testForStick();\n return;\n }\n\n // Only reaches here on first call and we note as in a scrolling state\n this.#isScrolling = true;\n\n // grab the current rect points for stickers to test against while scrolling\n this.snapshotItemRects();\n\n /**\n * Get once and cache until scroll settles\n * Unlikely to change and avoids additional reflows on scroll\n */\n this.#vpHeightSnapshot = this.getViewportHeight();\n this.#sfHeightSnapshot = this.getScrollFrameHeight();\n\n this.testForStick();\n }\n\n onResize() {\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = window.setTimeout(() => {\n this.snapshotItemRects();\n this.#stickers.forEach(sticker => {\n if (sticker.isStuck) this.addStick(sticker);\n });\n }, this.#resizeDebounce);\n }\n\n getScrollY() {\n return this.#isWindowScroll\n ? (this.scrollContainer as Window).scrollY\n : (this.scrollContainer as HTMLElement).scrollTop;\n }\n\n getViewportHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#vpHeightSnapshot)) {\n return this.#vpHeightSnapshot;\n }\n\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n getScrollFrameHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#sfHeightSnapshot)) {\n return this.#sfHeightSnapshot;\n }\n\n const viewportHeight = this.getViewportHeight();\n let sfh = viewportHeight;\n\n if (!this.#isWindowScroll) {\n sfh = viewportHeight - (this.scrollContainer as HTMLElement).getBoundingClientRect().top;\n }\n\n return sfh;\n }\n\n testBottomInView(sticker: Sticker) {\n const vph = this.getViewportHeight();\n const sfh = this.getScrollFrameHeight();\n const sic = this.#scrollIntervalChange;\n\n return sfh + sic + (vph - sfh) >= sticker.bottom + this.offset;\n }\n\n testForStick() {\n // Don't do anything if scrolling up\n if (this.#scrollDirection === -1) return;\n\n this.#stickers.forEach(sticker => {\n const bottomIsInView = this.testBottomInView(sticker);\n const hasHeightChange =\n !Number.isNaN(sticker.priorStickHeight) && sticker.height !== sticker.priorStickHeight;\n\n if (bottomIsInView) {\n if (!sticker.isStuck || hasHeightChange) {\n window.requestAnimationFrame(() => this.addStick(sticker));\n }\n } else if (sticker.isStuck && hasHeightChange) {\n const marginTop = this.getScrollY() + sticker.top - this.offset;\n\n window.requestAnimationFrame(() => {\n this.removeStick(sticker);\n sticker.element.style.marginTop = `${marginTop}px`;\n });\n }\n });\n\n return this;\n }\n\n addStick(sticker: Sticker) {\n sticker.element.style.position = 'sticky';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = `${this.getStickTop(sticker)}px`;\n sticker.priorStickHeight = sticker.height;\n sticker.isStuck = true;\n return this;\n }\n\n removeStick(sticker: Sticker) {\n sticker.element.style.position = '';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = '';\n sticker.isStuck = false;\n return this;\n }\n\n getStickTop(sticker: Sticker) {\n const spHeight = this.getScrollFrameHeight();\n let offset = this.offset;\n\n if (sticker.height + this.offset > spHeight) {\n offset = spHeight - sticker.height - offset;\n }\n\n return offset;\n }\n\n cleanup() {\n this.rmHandlers();\n this.#stickers.forEach(this.removeStick);\n }\n}\n\n/**\n * @example useScrollStick({ elements: [myColumnElements] | '.my-columns', offset: 20 });\n * @param options An object to set the sticky elements, the scroll container and an stuck offset in pixels.\n * @returns void.\n */\nconst useScrollStick = (options?: ScrollStickOptions): void => {\n const instance = useRef<Stickers>();\n\n useLayoutEffect(() => {\n if (options?.elements) {\n instance.current = new Stickers(options);\n }\n\n return () => {\n instance.current?.cleanup();\n instance.current = undefined;\n };\n }, [options]);\n};\n\nexport default useScrollStick;\n"]}
|
|
1
|
+
{"version":3,"file":"useScrollStick.js","sourceRoot":"","sources":["../../src/hooks/useScrollStick.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAmBhD,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,QAAQ;IAmBZ,YAAY,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAsB;QAlBlF;;;;;WAAsC;QACtC;;;;;WAAe;QACf,2CAAwB;QACxB,2CAAwB;QACxB,2CAAyB;QACzB,gDAA6B;QAC7B,iDAA8B;QAC9B,4CAAyB;QACzB,yCAAsB;QACtB,0CAAuB;QACvB,6CAA0B;QAC1B,wCAAsB;QACtB,6CAA0B;QAC1B,6CAA0B;QAC1B,qCAAqB;QACrB,0CAA2B;QAC3B,0CAA2B;QAGzB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,uBAAA,IAAI,4BAAmB,GAAG,MAAA,CAAC;QAC3B,uBAAA,IAAI,4BAAmB,GAAG,MAAA,CAAC;QAC3B,uBAAA,IAAI,2BAAkB,GAAG,MAAA,CAAC;QAC1B,uBAAA,IAAI,8BAAqB,GAAG,MAAA,CAAC;QAC7B,uBAAA,IA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F;;AAED;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,OAA4B,EAAQ,EAAE;IAC5D,MAAM,QAAQ,GAAG,MAAM,EAAY,CAAC;IAEpC,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,EAAE,QAAQ,EAAE;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC1C;QAED,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useRef, useLayoutEffect } from 'react';\n\nexport interface ScrollStickOptions {\n elements: string | HTMLElement[];\n scrollContainer?: Stickers['scrollContainer'];\n offset?: number;\n}\n\ninterface Sticker {\n element: HTMLElement;\n top: number;\n bottom: number;\n height: number;\n isStuck: boolean;\n priorStickHeight: number;\n}\n\ntype ElementsOption = string | HTMLElement[];\n\nconst onBeforeunload = () => {\n window.scrollTo(0, 0);\n};\n\nclass Stickers {\n scrollContainer: HTMLElement | Window;\n offset: number;\n #scrollDebounce: number;\n #resizeDebounce: number;\n #isWindowScroll: boolean;\n #scrollIntervalStart: number;\n #scrollIntervalChange: number;\n #scrollDirection: number;\n #priorScrollY: number;\n #resizeTimeout: number;\n #scrollEndTimeout: number;\n #isScrolling: boolean;\n #vpHeightSnapshot: number;\n #sfHeightSnapshot: number;\n #stickers: Sticker[];\n #scrollHandler: () => void;\n #resizeHandler: () => void;\n\n constructor({ elements, scrollContainer = window, offset = 0 }: ScrollStickOptions) {\n this.scrollContainer = scrollContainer;\n this.offset = offset;\n\n this.#scrollDebounce = 100;\n this.#resizeDebounce = 300;\n this.#resizeTimeout = NaN;\n this.#scrollEndTimeout = NaN;\n this.#priorScrollY = NaN;\n this.#isScrolling = false;\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n this.#scrollHandler = () => {};\n this.#resizeHandler = () => {};\n\n this.#isWindowScroll = this.scrollContainer === window;\n\n // Only gets reset after scroll stop timeout fires\n this.#scrollIntervalStart = this.getScrollY();\n\n // Used to determine scroll change within debounced scroll handler\n this.#scrollIntervalChange = 0;\n\n // Used to determine scroll direction by +1(page down) -1(page up)\n this.#scrollDirection = 0;\n\n this.#stickers = this.setStickers(elements);\n this.snapshotItemRects();\n this.addHandlers();\n }\n\n setStickers(elements: ElementsOption) {\n this.#stickers = (\n typeof elements === 'string'\n ? Array.from(document.querySelectorAll<HTMLElement>(elements))\n : elements\n ).map(element => ({\n element,\n isStuck: false,\n top: NaN,\n bottom: NaN,\n height: NaN,\n priorStickHeight: NaN\n }));\n\n return this.#stickers;\n }\n\n addHandlers() {\n this.rmHandlers();\n this.#scrollHandler = this.onScroll.bind(this);\n this.#resizeHandler = this.onResize.bind(this);\n this.scrollContainer.addEventListener('scroll', this.#scrollHandler);\n window.addEventListener('resize', this.#resizeHandler);\n // Not sure we need this. Maybe when DOM was persisted...\n window.addEventListener('beforeunload', onBeforeunload);\n }\n\n rmHandlers() {\n this.scrollContainer.removeEventListener('scroll', this.#scrollHandler);\n window.removeEventListener('resize', this.#resizeHandler);\n window.removeEventListener('beforeunload', onBeforeunload);\n }\n\n snapshotItemRects() {\n this.#stickers.forEach(sticker => {\n const rect = sticker.element.getBoundingClientRect();\n sticker.top = rect.top;\n sticker.bottom = rect.bottom;\n sticker.height = rect.height;\n });\n }\n\n onScroll() {\n clearTimeout(this.#scrollEndTimeout);\n\n const currentScrollY = this.getScrollY();\n\n this.#priorScrollY = !Number.isNaN(this.#priorScrollY)\n ? this.#priorScrollY\n : this.#scrollIntervalStart;\n\n // Diff between priorScrollY and new currentScrollY to determine direction\n this.#scrollDirection = currentScrollY - this.#priorScrollY > 0 ? 1 : -1;\n\n // How much scroll changed + or - within the debounce interval\n this.#scrollIntervalChange = currentScrollY - this.#scrollIntervalStart;\n\n // Update old to new for next scroll event\n this.#priorScrollY = currentScrollY;\n\n // When scrolling has stopped\n this.#scrollEndTimeout = window.setTimeout(() => {\n // Reset for next scroll starting point\n this.#scrollIntervalStart = this.#priorScrollY;\n\n // Reset until next scroll\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n\n this.#isScrolling = false;\n }, this.#scrollDebounce);\n\n // Additional scroll calls always have to test for stick state change\n if (this.#isScrolling) {\n this.testForStick();\n return;\n }\n\n // Only reaches here on first call and we note as in a scrolling state\n this.#isScrolling = true;\n\n // grab the current rect points for stickers to test against while scrolling\n this.snapshotItemRects();\n\n /**\n * Get once and cache until scroll settles\n * Unlikely to change and avoids additional reflows on scroll\n */\n this.#vpHeightSnapshot = this.getViewportHeight();\n this.#sfHeightSnapshot = this.getScrollFrameHeight();\n\n this.testForStick();\n }\n\n onResize() {\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = window.setTimeout(() => {\n this.snapshotItemRects();\n this.#stickers.forEach(sticker => {\n if (sticker.isStuck) this.addStick(sticker);\n });\n }, this.#resizeDebounce);\n }\n\n getScrollY() {\n return this.#isWindowScroll\n ? (this.scrollContainer as Window).scrollY\n : (this.scrollContainer as HTMLElement).scrollTop;\n }\n\n getViewportHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#vpHeightSnapshot)) {\n return this.#vpHeightSnapshot;\n }\n\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n getScrollFrameHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#sfHeightSnapshot)) {\n return this.#sfHeightSnapshot;\n }\n\n const viewportHeight = this.getViewportHeight();\n let sfh = viewportHeight;\n\n if (!this.#isWindowScroll) {\n sfh = viewportHeight - (this.scrollContainer as HTMLElement).getBoundingClientRect().top;\n }\n\n return sfh;\n }\n\n testBottomInView(sticker: Sticker) {\n const vph = this.getViewportHeight();\n const sfh = this.getScrollFrameHeight();\n const sic = this.#scrollIntervalChange;\n\n return sfh + sic + (vph - sfh) >= sticker.bottom + this.offset;\n }\n\n testForStick() {\n // Don't do anything if scrolling up\n if (this.#scrollDirection === -1) return;\n\n this.#stickers.forEach(sticker => {\n const bottomIsInView = this.testBottomInView(sticker);\n const hasHeightChange =\n !Number.isNaN(sticker.priorStickHeight) && sticker.height !== sticker.priorStickHeight;\n\n if (bottomIsInView) {\n if (!sticker.isStuck || hasHeightChange) {\n window.requestAnimationFrame(() => this.addStick(sticker));\n }\n } else if (sticker.isStuck && hasHeightChange) {\n const marginTop = this.getScrollY() + sticker.top - this.offset;\n\n window.requestAnimationFrame(() => {\n this.removeStick(sticker);\n sticker.element.style.marginTop = `${marginTop}px`;\n });\n }\n });\n\n return this;\n }\n\n addStick(sticker: Sticker) {\n sticker.element.style.position = 'sticky';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = `${this.getStickTop(sticker)}px`;\n sticker.priorStickHeight = sticker.height;\n sticker.isStuck = true;\n return this;\n }\n\n removeStick(sticker: Sticker) {\n sticker.element.style.position = '';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = '';\n sticker.isStuck = false;\n return this;\n }\n\n getStickTop(sticker: Sticker) {\n const spHeight = this.getScrollFrameHeight();\n let offset = this.offset;\n\n if (sticker.height + this.offset > spHeight) {\n offset = spHeight - sticker.height - offset;\n }\n\n return offset;\n }\n\n cleanup() {\n this.rmHandlers();\n this.#stickers.forEach(this.removeStick);\n }\n}\n\n/**\n * @example useScrollStick({ elements: [myColumnElements] | '.my-columns', offset: 20 });\n * @param options An object to set the sticky elements, the scroll container and an stuck offset in pixels.\n * @returns void.\n */\nconst useScrollStick = (options?: ScrollStickOptions): void => {\n const instance = useRef<Stickers>();\n\n useLayoutEffect(() => {\n if (options?.elements) {\n instance.current = new Stickers(options);\n }\n\n return () => {\n instance.current?.cleanup();\n instance.current = undefined;\n };\n }, [options]);\n};\n\nexport default useScrollStick;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollToggle.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollToggle.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,eAAe,cAAc,MAAM;wBAMF,IAAI;yBAMH,IAAI;CA2B3C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { getScrollbarWidth, testElForOverflow } from '../utils';
|
|
3
|
+
import useConfiguration from './useConfiguration';
|
|
4
|
+
const useScrollToggle = (selector = ':root') => {
|
|
5
|
+
const scrollbarWidthRef = useRef(0);
|
|
6
|
+
const styleRef = useRef(null);
|
|
7
|
+
const { styleSheetTarget } = useConfiguration();
|
|
8
|
+
const disabledRef = useRef(false);
|
|
9
|
+
const enableScroll = useCallback(() => {
|
|
10
|
+
if (!disabledRef.current)
|
|
11
|
+
return;
|
|
12
|
+
styleRef.current?.remove();
|
|
13
|
+
disabledRef.current = false;
|
|
14
|
+
}, []);
|
|
15
|
+
const disableScroll = useCallback(() => {
|
|
16
|
+
const scrollEl = document.querySelector(selector);
|
|
17
|
+
if (!scrollEl)
|
|
18
|
+
return;
|
|
19
|
+
const [overflowX, overflowY] = testElForOverflow(scrollEl);
|
|
20
|
+
if (!overflowX && !overflowY)
|
|
21
|
+
return;
|
|
22
|
+
styleRef.current = document.createElement('style');
|
|
23
|
+
styleRef.current.textContent = `
|
|
24
|
+
${selector} {
|
|
25
|
+
${overflowY ? `padding-inline-end: ${scrollbarWidthRef.current}px !important` : ''};
|
|
26
|
+
${overflowX ? `padding-block-end: ${scrollbarWidthRef.current}px !important` : ''};
|
|
27
|
+
overflow: hidden !important;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
(styleSheetTarget ?? document.head).append(styleRef.current);
|
|
31
|
+
disabledRef.current = true;
|
|
32
|
+
}, [selector]);
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
scrollbarWidthRef.current = getScrollbarWidth();
|
|
35
|
+
return () => styleRef.current?.remove();
|
|
36
|
+
}, []);
|
|
37
|
+
return { enableScroll, disableScroll };
|
|
38
|
+
};
|
|
39
|
+
export default useScrollToggle;
|
|
40
|
+
//# sourceMappingURL=useScrollToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollToggle.js","sourceRoot":"","sources":["../../src/hooks/useScrollToggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEhE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,eAAe,GAAG,CAAC,WAAmB,OAAO,EAAE,EAAE;IACrD,MAAM,iBAAiB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAC;IACvD,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAElC,MAAM,YAAY,GAAG,WAAW,CAAC,GAAS,EAAE;QAC1C,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,OAAO;QACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAC3B,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,aAAa,GAAG,WAAW,CAAC,GAAS,EAAE;QAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS;YAAE,OAAO;QAErC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAEnD,QAAQ,CAAC,OAAO,CAAC,WAAW,GAAG;QAC3B,QAAQ;UACN,SAAS,CAAC,CAAC,CAAC,uBAAuB,iBAAiB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE;UAChF,SAAS,CAAC,CAAC,CAAC,sBAAsB,iBAAiB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,EAAE;;;KAGpF,CAAC;QAEF,CAAC,gBAAgB,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7D,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,eAAe,CAAC,GAAG,EAAE;QACnB,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;QAEhD,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useCallback, useLayoutEffect, useRef } from 'react';\n\nimport { getScrollbarWidth, testElForOverflow } from '../utils';\n\nimport useConfiguration from './useConfiguration';\n\nconst useScrollToggle = (selector: string = ':root') => {\n const scrollbarWidthRef = useRef(0);\n const styleRef = useRef<HTMLStyleElement | null>(null);\n const { styleSheetTarget } = useConfiguration();\n const disabledRef = useRef(false);\n\n const enableScroll = useCallback((): void => {\n if (!disabledRef.current) return;\n styleRef.current?.remove();\n disabledRef.current = false;\n }, []);\n\n const disableScroll = useCallback((): void => {\n const scrollEl = document.querySelector(selector);\n if (!scrollEl) return;\n const [overflowX, overflowY] = testElForOverflow(scrollEl);\n if (!overflowX && !overflowY) return;\n\n styleRef.current = document.createElement('style');\n\n styleRef.current.textContent = `\n ${selector} {\n ${overflowY ? `padding-inline-end: ${scrollbarWidthRef.current}px !important` : ''};\n ${overflowX ? `padding-block-end: ${scrollbarWidthRef.current}px !important` : ''};\n overflow: hidden !important;\n }\n `;\n\n (styleSheetTarget ?? document.head).append(styleRef.current);\n disabledRef.current = true;\n }, [selector]);\n\n useLayoutEffect(() => {\n scrollbarWidthRef.current = getScrollbarWidth();\n\n return () => styleRef.current?.remove();\n }, []);\n\n return { enableScroll, disableScroll };\n};\n\nexport default useScrollToggle;\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CSSProperties, RefObject } from 'react';
|
|
2
|
+
export declare const expandCollapseStates: Readonly<{
|
|
3
|
+
readonly low: "collapsed";
|
|
4
|
+
readonly rising: "expanding";
|
|
5
|
+
readonly high: "expanded";
|
|
6
|
+
readonly falling: "collapsing";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const openCloseStates: Readonly<{
|
|
9
|
+
readonly low: "closed";
|
|
10
|
+
readonly rising: "opening";
|
|
11
|
+
readonly high: "open";
|
|
12
|
+
readonly falling: "closing";
|
|
13
|
+
}>;
|
|
14
|
+
declare const useTransitionState: <Low extends string = "low", Rising extends string = "rising", High extends string = "high", Falling extends string = "falling">({ ref, property, states, defaultState }: {
|
|
15
|
+
ref: RefObject<HTMLElement>;
|
|
16
|
+
property: keyof CSSProperties;
|
|
17
|
+
} & ({
|
|
18
|
+
states: {
|
|
19
|
+
low: Low;
|
|
20
|
+
rising: Rising;
|
|
21
|
+
high: High;
|
|
22
|
+
falling: Falling;
|
|
23
|
+
};
|
|
24
|
+
defaultState?: Low | High | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
states?: {
|
|
27
|
+
low: 'low';
|
|
28
|
+
rising: 'rising';
|
|
29
|
+
high: 'high';
|
|
30
|
+
falling: 'falling';
|
|
31
|
+
} | undefined;
|
|
32
|
+
defaultState?: "high" | "low" | undefined;
|
|
33
|
+
})) => {
|
|
34
|
+
state: Low | Rising | High | Falling;
|
|
35
|
+
set: (wantsToGo: Low | High) => void;
|
|
36
|
+
toggle: () => void;
|
|
37
|
+
};
|
|
38
|
+
export default useTransitionState;
|
|
39
|
+
//# sourceMappingURL=useTransitionState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTransitionState.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransitionState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAEnF,eAAO,MAAM,oBAAoB;;;;;EAKtB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;;;EAKjB,CAAC;AAEZ,QAAA,MAAM,kBAAkB;SAgBjB,UAAU,WAAW,CAAC;cACjB,MAAM,aAAa;;;;;;;;;;;aAOT,KAAK;gBAAU,QAAQ;cAAQ,MAAM;iBAAW,SAAS;;;;;;;CA2C9E,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
export const expandCollapseStates = Object.freeze({
|
|
3
|
+
low: 'collapsed',
|
|
4
|
+
rising: 'expanding',
|
|
5
|
+
high: 'expanded',
|
|
6
|
+
falling: 'collapsing'
|
|
7
|
+
});
|
|
8
|
+
export const openCloseStates = Object.freeze({
|
|
9
|
+
low: 'closed',
|
|
10
|
+
rising: 'opening',
|
|
11
|
+
high: 'open',
|
|
12
|
+
falling: 'closing'
|
|
13
|
+
});
|
|
14
|
+
const useTransitionState = ({ ref, property, states = {
|
|
15
|
+
low: 'low',
|
|
16
|
+
rising: 'rising',
|
|
17
|
+
high: 'high',
|
|
18
|
+
falling: 'falling'
|
|
19
|
+
}, defaultState = states.low }) => {
|
|
20
|
+
const [state, setState] = useState(() => defaultState === states.high ? 'high' : 'low');
|
|
21
|
+
const onTransitionEnd = useCallback((e) => {
|
|
22
|
+
if (e.propertyName !== property || e.target !== e.currentTarget)
|
|
23
|
+
return;
|
|
24
|
+
setState(cur => (cur === 'falling' ? 'low' : 'high'));
|
|
25
|
+
}, [property]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const el = ref.current;
|
|
28
|
+
if (!el)
|
|
29
|
+
return;
|
|
30
|
+
el.addEventListener('transitionend', onTransitionEnd);
|
|
31
|
+
return () => {
|
|
32
|
+
el.removeEventListener('transitionend', onTransitionEnd);
|
|
33
|
+
};
|
|
34
|
+
}, [onTransitionEnd]);
|
|
35
|
+
const set = useCallback((wantsToGo) => {
|
|
36
|
+
setState(cur => {
|
|
37
|
+
if (wantsToGo === states.high && cur !== 'high')
|
|
38
|
+
return 'rising';
|
|
39
|
+
if (wantsToGo === states.low && cur !== 'low')
|
|
40
|
+
return 'falling';
|
|
41
|
+
return cur;
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
const toggle = useCallback(() => {
|
|
45
|
+
setState(cur => {
|
|
46
|
+
if (cur === 'low' || cur === 'falling')
|
|
47
|
+
return 'rising';
|
|
48
|
+
if (cur === 'high' || cur === 'rising')
|
|
49
|
+
return 'falling';
|
|
50
|
+
return cur;
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
return { state: states[state], set, toggle };
|
|
54
|
+
};
|
|
55
|
+
export default useTransitionState;
|
|
56
|
+
//# sourceMappingURL=useTransitionState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTransitionState.js","sourceRoot":"","sources":["../../src/hooks/useTransitionState.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE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AAE,CAAC,mBAAmB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,SAAqB,EAAE,EAAE;QAChD,QAAQ,CAAC,GAAG,CAAC,EAAE;YACb,IAAI,SAAS,KAAK,MAAM,CAAC,IAAI,IAAI,GAAG,KAAK,MAAM;gBAAE,OAAO,QAAQ,CAAC;YACjE,IAAI,SAAS,KAAK,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,KAAK;gBAAE,OAAO,SAAS,CAAC;YAChE,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE;YACb,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC;YACxD,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YACzD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAkC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAChF,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { CSSProperties, RefObject, useCallback, useEffect, useState } from 'react';\n\nexport const expandCollapseStates = Object.freeze({\n low: 'collapsed',\n rising: 'expanding',\n high: 'expanded',\n falling: 'collapsing'\n} as const);\n\nexport const openCloseStates = Object.freeze({\n low: 'closed',\n rising: 'opening',\n high: 'open',\n falling: 'closing'\n} as const);\n\nconst useTransitionState = <\n Low extends string = 'low',\n Rising extends string = 'rising',\n High extends string = 'high',\n Falling extends string = 'falling'\n>({\n ref,\n property,\n states = {\n low: 'low' as Low,\n rising: 'rising' as Rising,\n high: 'high' as High,\n falling: 'falling' as Falling\n },\n defaultState = states.low\n}: {\n ref: RefObject<HTMLElement>;\n property: keyof CSSProperties;\n} & (\n | {\n states: { low: Low; rising: Rising; high: High; falling: Falling };\n defaultState?: Low | High;\n }\n | {\n states?: { low: 'low'; rising: 'rising'; high: 'high'; falling: 'falling' };\n defaultState?: 'low' | 'high';\n }\n)) => {\n const [state, setState] = useState<keyof typeof states>(() =>\n defaultState === states.high ? 'high' : 'low'\n );\n\n const onTransitionEnd = useCallback(\n (e: TransitionEvent) => {\n if (e.propertyName !== property || e.target !== e.currentTarget) return;\n setState(cur => (cur === 'falling' ? 'low' : 'high'));\n },\n [property]\n );\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n el.addEventListener('transitionend', onTransitionEnd);\n return () => {\n el.removeEventListener('transitionend', onTransitionEnd);\n };\n }, [onTransitionEnd]);\n\n const set = useCallback((wantsToGo: Low | High) => {\n setState(cur => {\n if (wantsToGo === states.high && cur !== 'high') return 'rising';\n if (wantsToGo === states.low && cur !== 'low') return 'falling';\n return cur;\n });\n }, []);\n\n const toggle = useCallback(() => {\n setState(cur => {\n if (cur === 'low' || cur === 'falling') return 'rising';\n if (cur === 'high' || cur === 'rising') return 'falling';\n return cur;\n });\n }, []);\n\n return { state: states[state] as Low | Rising | High | Falling, set, toggle };\n};\n\nexport default useTransitionState;\n"]}
|