@pega/cosmos-react-core 2.0.0-dev.19.0 → 2.0.0-dev.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.js +1 -1
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +44 -30
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +4 -11
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +102 -89
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +2 -2
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +2 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +1 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.js +6 -6
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.js +2 -2
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.js +3 -3
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +2 -2
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/Avatar/Avatar.js +1 -1
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +1 -1
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Alert.js +1 -1
- package/lib/components/Badges/Alert.js.map +1 -1
- package/lib/components/Badges/Count.js +1 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Badges/Selection.js +1 -1
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Status.js +1 -1
- package/lib/components/Badges/Status.js.map +1 -1
- package/lib/components/Badges/Tag.js +1 -1
- package/lib/components/Badges/Tag.js.map +1 -1
- package/lib/components/Banner/Banner.js +3 -3
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +1 -1
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +5 -5
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/BareButton.js +2 -2
- package/lib/components/Button/BareButton.js.map +1 -1
- package/lib/components/Button/BareRoleButton.d.ts +12 -0
- package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
- package/lib/components/Button/BareRoleButton.js +20 -0
- package/lib/components/Button/BareRoleButton.js.map +1 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.js +1 -1
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.js +2 -2
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.js +1 -1
- package/lib/components/Card/CardHeader.js.map +1 -1
- package/lib/components/Card/CardMedia.js +1 -1
- package/lib/components/Card/CardMedia.js.map +1 -1
- package/lib/components/Card/CollapsibleCard.js +1 -1
- package/lib/components/Card/CollapsibleCard.js.map +1 -1
- package/lib/components/Card/SelectableCard.js +1 -1
- package/lib/components/Card/SelectableCard.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +3 -3
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +15 -15
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBoxInput.js +4 -4
- package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +14 -10
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +15 -11
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +5 -5
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts +3 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +11 -16
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +14 -14
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +3 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/Currency/utils.d.ts +12 -1
- package/lib/components/Currency/utils.d.ts.map +1 -1
- package/lib/components/Currency/utils.js +30 -2
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +2 -1
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +11 -6
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +6 -6
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +13 -2
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +9 -9
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js +2 -2
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.js +2 -2
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +2 -2
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.js +2 -2
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +6 -6
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +1 -1
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.js +6 -6
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +9 -9
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +6 -6
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +11 -11
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +7 -9
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +7 -9
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +4 -4
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +4 -4
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts +1 -0
- package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/utils.js +3 -0
- package/lib/components/DateTime/Picker/utils.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +1 -1
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Email/EmailDisplay.js +2 -2
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.js +1 -1
- package/lib/components/EmptyState/EmptyState.js.map +1 -1
- package/lib/components/ErrorState/ErrorState.js +1 -1
- package/lib/components/ErrorState/ErrorState.js.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +3 -3
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +4 -4
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +5 -5
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.js +7 -7
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.js +9 -9
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileItem.js +1 -1
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileUploadItem.js +4 -4
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/File/FileVisual.js +4 -4
- package/lib/components/File/FileVisual.js.map +1 -1
- package/lib/components/Flex/Flex.js +1 -1
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.js +1 -1
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.js +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.js +7 -7
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.js +1 -1
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Icon/Icon.js +1 -1
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Input/Input.js +11 -11
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Label/Label.js +1 -1
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Link/Link.js +1 -1
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.js +3 -3
- package/lib/components/List/CommaSeparatedList.js.map +1 -1
- package/lib/components/List/List.js +1 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/List/OrderedList.js +1 -1
- package/lib/components/List/OrderedList.js.map +1 -1
- package/lib/components/List/UnorderedList.js +1 -1
- package/lib/components/List/UnorderedList.js.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +1 -1
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/LocationDisplay.js +7 -7
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.js +19 -19
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.js +1 -1
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +3 -3
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +4 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +2 -0
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/MenuGroup.js +2 -2
- package/lib/components/Menu/MenuGroup.js.map +1 -1
- package/lib/components/Menu/MenuItem.js +11 -11
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.js +5 -5
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +2 -2
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +3 -3
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MetaList/MetaList.js +4 -4
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +4 -6
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +37 -34
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +26 -21
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/ModalManager.js +6 -6
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +7 -7
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/Number/NumberDisplay.js +1 -1
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.js +5 -5
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +7 -7
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +9 -9
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +20 -20
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.js +3 -3
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +7 -1
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/PopoverManager.js +2 -2
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Progress/Bar.js +1 -1
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.js +1 -1
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.js +2 -2
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Ring.js +1 -1
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +2 -2
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +10 -10
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.js +2 -2
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +2 -2
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Option.js +1 -1
- package/lib/components/Select/Option.js.map +1 -1
- package/lib/components/Select/Select.js +13 -13
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -1
- package/lib/components/Sentiment/Sentiment.js.map +1 -1
- package/lib/components/Skeleton/LineSkeleton.js +1 -1
- package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
- package/lib/components/Slider/Slider.js +5 -5
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/SliderTicks.js +4 -4
- package/lib/components/Slider/SliderTicks.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +2 -2
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +3 -3
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +1 -1
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +13 -8
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/Tab.js +1 -1
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.js +1 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +4 -4
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.js +23 -23
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Toaster.js +4 -4
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tree/StandardTree.js +6 -6
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/Tree.js +3 -3
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/helpers.d.ts +1 -0
- package/lib/components/Tree/helpers.d.ts.map +1 -1
- package/lib/components/Tree/helpers.js +20 -0
- package/lib/components/Tree/helpers.js.map +1 -1
- package/lib/components/URL/URLDisplay.js +2 -2
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/index.d.ts +6 -6
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +6 -5
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +1 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useTransitionState.d.ts +39 -0
- package/lib/hooks/useTransitionState.d.ts.map +1 -0
- package/lib/hooks/useTransitionState.js +56 -0
- package/lib/hooks/useTransitionState.js.map +1 -0
- package/lib/i18n/default.json +1 -0
- package/lib/i18n/i18n.d.ts +2 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/buildTheme.json +2 -1
- package/package.json +2 -2
|
@@ -61,6 +61,26 @@ const helpers = {
|
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
return [...nodes, ...newNodes];
|
|
64
|
+
},
|
|
65
|
+
expandTo(nodes, id) {
|
|
66
|
+
return nodes.map(node => {
|
|
67
|
+
// leaf node
|
|
68
|
+
if (node.id === id) {
|
|
69
|
+
return {
|
|
70
|
+
...node,
|
|
71
|
+
expanded: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// parent node
|
|
75
|
+
if (node.nodes && !!this.getNode(node.nodes, id)) {
|
|
76
|
+
return {
|
|
77
|
+
...node,
|
|
78
|
+
nodes: this.expandTo(node.nodes, id),
|
|
79
|
+
expanded: true
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return { ...node, expanded: false };
|
|
83
|
+
});
|
|
64
84
|
}
|
|
65
85
|
};
|
|
66
86
|
export default helpers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceR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":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n }\n};\n\nexport default helpers;\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../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,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACtB,YAAY;YACZ,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;gBAClB,OAAO;oBACL,GAAG,IAAI;oBACP,QAAQ,EAAE,IAAI;iBACf,CAAC;aACH;YAED,cAAc;YACd,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE;gBAChD,OAAO;oBACL,GAAG,IAAI;oBACP,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBACpC,QAAQ,EAAE,IAAI;iBACf,CAAC;aACH;YAED,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n },\n\n expandTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T[] {\n return nodes.map(node => {\n // leaf node\n if (node.id === id) {\n return {\n ...node,\n expanded: true\n };\n }\n\n // parent node\n if (node.nodes && !!this.getNode(node.nodes, id)) {\n return {\n ...node,\n nodes: this.expandTo(node.nodes, id),\n expanded: true\n };\n }\n\n return { ...node, expanded: false };\n });\n }\n};\n\nexport default helpers;\n"]}
|
|
@@ -26,8 +26,8 @@ const generateUrlMarkup = (url) => {
|
|
|
26
26
|
}, []);
|
|
27
27
|
};
|
|
28
28
|
const URLDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
|
|
29
|
-
const displayValue = value ? (displayText || generateUrlMarkup(value)) : (_jsx("span",
|
|
30
|
-
return variant === 'text' || !value ? (_jsx("span",
|
|
29
|
+
const displayValue = value ? (displayText || generateUrlMarkup(value)) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0));
|
|
30
|
+
return variant === 'text' || !value ? (_jsx("span", { ref: ref, ...restProps, children: displayValue }, void 0)) : (_jsx(Link, { ref: ref, ...restProps, href: value, children: displayValue }, void 0));
|
|
31
31
|
});
|
|
32
32
|
export default URLDisplay;
|
|
33
33
|
//# sourceMappingURL=URLDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAiB3B;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,6EAA6E;SAC5E,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,GAAG;aACP,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;aACzB,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;aACrC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;IAElB,+HAA+H;IAC/H,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAc,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;QACxE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAU,YAAY,CAAC,MAAM,CAAI,CAAC,CAAC;QAC3D,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,UAAU,GAAsD,UAAU,CAC9E,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAoC,EACxF,GAA2B,EAC3B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,iBAAiB,CAAC,KAAK,CAAC,CACxC,CAAC,CAAC,CAAC,CACF,
|
|
1
|
+
{"version":3,"file":"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YAClD,YAAY,WACR,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,KAAK,YACjE,YAAY,WACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps } from '../../types';\n\nexport interface URLDisplayProps extends BaseProps {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default \"link\"\n */\n variant?: 'link' | 'text';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n /* Insert \\x1f (unit separator) char as a placeholder at correct position. */\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n /* Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping. */\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || generateUrlMarkup(value)\n ) : (\n <span aria-hidden='true'>––</span>\n );\n return variant === 'text' || !value ? (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n ) : (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
export { default as useActiveDescendant, UseActiveDescendantConfig } from './useActiveDescendant';
|
|
1
2
|
export { default as useAfterInitialEffect } from './useAfterInitialEffect';
|
|
2
3
|
export { default as useArrows } from './useArrows';
|
|
3
4
|
export { default as useAutoResize } from './useAutoResize';
|
|
4
5
|
export { default as useBreakpoint } from './useBreakpoint';
|
|
5
6
|
export { default as useConfiguration } from './useConfiguration';
|
|
6
7
|
export { default as useConsolidatedRef } from './useConsolidatedRef';
|
|
8
|
+
export { default as useDirection } from './useDirection';
|
|
9
|
+
export { default as useDraggable } from './useDraggable';
|
|
7
10
|
export { default as useElement } from './useElement';
|
|
8
11
|
export { default as useFocusWithin } from './useFocusWithin';
|
|
9
12
|
export { default as useI18n } from './useI18n';
|
|
13
|
+
export { default as useItemIntersection } from './useItemIntersection';
|
|
14
|
+
export { default as useLongPress } from './useLongPress';
|
|
10
15
|
export { default as useOuterEvent } from './useOuterEvent';
|
|
11
16
|
export { default as useOverride } from './useOverride';
|
|
12
17
|
export { default as usePrevious } from './usePrevious';
|
|
13
18
|
export { default as useScrollStick } from './useScrollStick';
|
|
14
19
|
export { default as useTheme } from './useTheme';
|
|
20
|
+
export { default as useTransitionState } from './useTransitionState';
|
|
15
21
|
export { default as useTriggerableEffect } from './useTriggerableEffect';
|
|
16
22
|
export { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';
|
|
17
|
-
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
23
|
export { default as useUID } from './useUID';
|
|
19
|
-
export { default as useDirection } from './useDirection';
|
|
20
|
-
export { default as useActiveDescendant } from './useActiveDescendant';
|
|
21
|
-
export { default as useLongPress } from './useLongPress';
|
|
22
|
-
export { default as useDraggable } from './useDraggable';
|
|
23
|
-
export { UseActiveDescendantConfig } from './useActiveDescendant';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/hooks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
export { default as useActiveDescendant } from './useActiveDescendant';
|
|
1
2
|
export { default as useAfterInitialEffect } from './useAfterInitialEffect';
|
|
2
3
|
export { default as useArrows } from './useArrows';
|
|
3
4
|
export { default as useAutoResize } from './useAutoResize';
|
|
4
5
|
export { default as useBreakpoint } from './useBreakpoint';
|
|
5
6
|
export { default as useConfiguration } from './useConfiguration';
|
|
6
7
|
export { default as useConsolidatedRef } from './useConsolidatedRef';
|
|
8
|
+
export { default as useDirection } from './useDirection';
|
|
9
|
+
export { default as useDraggable } from './useDraggable';
|
|
7
10
|
export { default as useElement } from './useElement';
|
|
8
11
|
export { default as useFocusWithin } from './useFocusWithin';
|
|
9
12
|
export { default as useI18n } from './useI18n';
|
|
13
|
+
export { default as useItemIntersection } from './useItemIntersection';
|
|
14
|
+
export { default as useLongPress } from './useLongPress';
|
|
10
15
|
export { default as useOuterEvent } from './useOuterEvent';
|
|
11
16
|
export { default as useOverride } from './useOverride';
|
|
12
17
|
export { default as usePrevious } from './usePrevious';
|
|
13
18
|
export { default as useScrollStick } from './useScrollStick';
|
|
14
19
|
export { default as useTheme } from './useTheme';
|
|
20
|
+
export { default as useTransitionState } from './useTransitionState';
|
|
15
21
|
export { default as useTriggerableEffect } from './useTriggerableEffect';
|
|
16
22
|
export { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';
|
|
17
|
-
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
23
|
export { default as useUID } from './useUID';
|
|
19
|
-
export { default as useDirection } from './useDirection';
|
|
20
|
-
export { default as useActiveDescendant } from './useActiveDescendant';
|
|
21
|
-
export { default as useLongPress } from './useLongPress';
|
|
22
|
-
export { default as useDraggable } from './useDraggable';
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,O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AiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { default as useActiveDescendant, UseActiveDescendantConfig } from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as useOverride } from './useOverride';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useTheme } from './useTheme';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -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"}
|
|
@@ -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,WAAW;IAChB,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,YAAY;CACb,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CACV,CAAC,CAAC;AAEZ,MAAM,kBAAkB,GAAG,CAKzB,EACA,GAAG,EACH,QAAQ,EACR,MAAM,GAAG;IACP,GAAG,EAAE,KAAY;IACjB,MAAM,EAAE,QAAkB;IAC1B,IAAI,EAAE,MAAc;IACpB,OAAO,EAAE,SAAoB;CAC9B,EACD,YAAY,GAAG,MAAM,CAAC,GAAG,EAa1B,EAAE,EAAE;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAsB,GAAG,EAAE,CAC3D,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEF,MAAM,eAAe,GAAG,WAAW,CACjC,CAA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O,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"]}
|
package/lib/i18n/default.json
CHANGED
package/lib/i18n/i18n.d.ts
CHANGED
|
@@ -333,6 +333,7 @@ declare const create: (translations?: Partial<{
|
|
|
333
333
|
edit: string;
|
|
334
334
|
edit_noun: string;
|
|
335
335
|
edited: string;
|
|
336
|
+
edit_details: string;
|
|
336
337
|
preview: string;
|
|
337
338
|
delete: string;
|
|
338
339
|
delete_noun: string;
|
|
@@ -896,6 +897,7 @@ export declare const DefaultTranslation: Readonly<Readonly<{
|
|
|
896
897
|
edit: string;
|
|
897
898
|
edit_noun: string;
|
|
898
899
|
edited: string;
|
|
900
|
+
edit_details: string;
|
|
899
901
|
preview: string;
|
|
900
902
|
delete: string;
|
|
901
903
|
delete_noun: string;
|
package/lib/i18n/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,gBAAgB,CAAC;AAEhD,oBAAY,eAAe,GAAG,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAClE,oBAAY,WAAW,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,QAAA,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,gBAAgB,CAAC;AAEhD,oBAAY,eAAe,GAAG,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAClE,oBAAY,WAAW,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAW,CAAC;AAiB3C,eAAO,MAAM,SAAS,cAAe,MAAM,KAAG,KAAK,GAAG,KAErD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-core",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.21.0",
|
|
4
4
|
"description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"@storybook/testing-react": "0.0.18",
|
|
44
44
|
"@storybook/theming": "^6.3.8",
|
|
45
45
|
"enzyme": "^3.11.0",
|
|
46
|
-
"typescript": "~4.
|
|
46
|
+
"typescript": "~4.5.2"
|
|
47
47
|
}
|
|
48
48
|
}
|