@neo4j-ndl/react 4.1.5 → 4.1.6
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/cjs/_common/CodeBlockWrapper.js +5 -4
- package/lib/cjs/_common/CodeBlockWrapper.js.map +1 -1
- package/lib/cjs/_common/utils.js +4 -2
- package/lib/cjs/_common/utils.js.map +1 -1
- package/lib/cjs/accordion/Accordion.js +9 -6
- package/lib/cjs/accordion/Accordion.js.map +1 -1
- package/lib/cjs/accordion/accordion-types.js.map +1 -1
- package/lib/cjs/accordion/stories/accordion.stories.js +1 -1
- package/lib/cjs/accordion/stories/accordion.stories.js.map +1 -1
- package/lib/cjs/avatar/Avatar.js +1 -1
- package/lib/cjs/avatar/Avatar.js.map +1 -1
- package/lib/cjs/banner/Banner.js +3 -2
- package/lib/cjs/banner/Banner.js.map +1 -1
- package/lib/cjs/banner/stories/banner.stories.js +1 -1
- package/lib/cjs/banner/stories/banner.stories.js.map +1 -1
- package/lib/cjs/box/Box.js +14 -2
- package/lib/cjs/box/Box.js.map +1 -1
- package/lib/cjs/box/stories/box.stories.js +2 -2
- package/lib/cjs/box/stories/box.stories.js.map +1 -1
- package/lib/cjs/breadcrumbs/Breadcrumbs.js +10 -7
- package/lib/cjs/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/cjs/button/stories/button.stories.js +2 -2
- package/lib/cjs/button/stories/button.stories.js.map +1 -1
- package/lib/cjs/checkbox/Checkbox.js +2 -1
- package/lib/cjs/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/checkbox/stories/checkbox.stories.js +1 -1
- package/lib/cjs/checkbox/stories/checkbox.stories.js.map +1 -1
- package/lib/cjs/clipboard-button/ClipboardButton.js +6 -3
- package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
- package/lib/cjs/color-picker/ColorPicker.js +2 -1
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +9 -6
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/DataGrid.js +16 -4
- package/lib/cjs/data-grid/DataGrid.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +28 -14
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js +2 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-component-overriding.story.js +1 -3
- package/lib/cjs/data-grid/stories/datagrid-component-overriding.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +2 -1
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +2 -1
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-kitchen-sink.story.js +1 -2
- package/lib/cjs/data-grid/stories/datagrid-kitchen-sink.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +13 -10
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/cjs/date-picker/DatePicker.js +2 -1
- package/lib/cjs/date-picker/DatePicker.js.map +1 -1
- package/lib/cjs/date-picker/stories/date-picker-range.story.js +1 -1
- package/lib/cjs/date-picker/stories/date-picker-range.story.js.map +1 -1
- package/lib/cjs/date-picker/stories/date-picker.stories.js +1 -1
- package/lib/cjs/date-picker/stories/date-picker.stories.js.map +1 -1
- package/lib/cjs/dialog/Dialog.js +20 -13
- package/lib/cjs/dialog/Dialog.js.map +1 -1
- package/lib/cjs/dialog/dialog-context.js +35 -6
- package/lib/cjs/dialog/dialog-context.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog.stories.js +1 -1
- package/lib/cjs/dialog/stories/dialog.stories.js.map +1 -1
- package/lib/cjs/divider/stories/divider.stories.js +1 -1
- package/lib/cjs/divider/stories/divider.stories.js.map +1 -1
- package/lib/cjs/drawer/Drawer.js +9 -8
- package/lib/cjs/drawer/Drawer.js.map +1 -1
- package/lib/cjs/dropdown-button/DropdownButton.js +14 -2
- package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/cjs/dropzone/Dropzone.js +3 -2
- package/lib/cjs/dropzone/Dropzone.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-csv-files.story.js +1 -3
- package/lib/cjs/dropzone/stories/dropzone-csv-files.story.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-custom-extensions.story.js +1 -3
- package/lib/cjs/dropzone/stories/dropzone-custom-extensions.story.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-default.story.js +1 -3
- package/lib/cjs/dropzone/stories/dropzone-default.story.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-disabled.story.js +1 -3
- package/lib/cjs/dropzone/stories/dropzone-disabled.story.js.map +1 -1
- package/lib/cjs/flex/Flex.js +14 -2
- package/lib/cjs/flex/Flex.js.map +1 -1
- package/lib/cjs/graph-label/GraphLabel.js +18 -4
- package/lib/cjs/graph-label/GraphLabel.js.map +1 -1
- package/lib/cjs/icon-button/stories/icon-button.stories.js +1 -1
- package/lib/cjs/icon-button/stories/icon-button.stories.js.map +1 -1
- package/lib/cjs/icon-button-array/IconButtonArray.js +14 -2
- package/lib/cjs/icon-button-array/IconButtonArray.js.map +1 -1
- package/lib/cjs/icon-button-array/index.js +1 -1
- package/lib/cjs/icon-button-array/index.js.map +1 -1
- package/lib/cjs/icon-button-array/stories/icon-button-array.stories.js +1 -1
- package/lib/cjs/icon-button-array/stories/icon-button-array.stories.js.map +1 -1
- package/lib/cjs/icons/wrapIcon.js +1 -1
- package/lib/cjs/icons/wrapIcon.js.map +1 -1
- package/lib/cjs/inline-edit/InlineEdit.js +18 -6
- package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
- package/lib/cjs/kbd/Kbd.js +5 -3
- package/lib/cjs/kbd/Kbd.js.map +1 -1
- package/lib/cjs/kbd/stories/kbd.stories.js +1 -1
- package/lib/cjs/kbd/stories/kbd.stories.js.map +1 -1
- package/lib/cjs/loading-bar/LoadingBar.js +14 -2
- package/lib/cjs/loading-bar/LoadingBar.js.map +1 -1
- package/lib/cjs/loading-spinner/LoadingSpinner.js +1 -1
- package/lib/cjs/loading-spinner/LoadingSpinner.js.map +1 -1
- package/lib/cjs/logo/stories/logo.stories.js +1 -1
- package/lib/cjs/logo/stories/logo.stories.js.map +1 -1
- package/lib/cjs/menu/Menu.js +9 -6
- package/lib/cjs/menu/Menu.js.map +1 -1
- package/lib/cjs/popover/Popover.js +6 -4
- package/lib/cjs/popover/Popover.js.map +1 -1
- package/lib/cjs/popover/stories/popover-custom-offset.story.js +2 -1
- package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/cjs/popover/stories/popover-separate-anchor.story.js +1 -1
- package/lib/cjs/popover/stories/popover-separate-anchor.story.js.map +1 -1
- package/lib/cjs/progress-bar/ProgressBar.js +1 -1
- package/lib/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/lib/cjs/radio/Radio.js +2 -1
- package/lib/cjs/radio/Radio.js.map +1 -1
- package/lib/cjs/radio/stories/radio.stories.js +1 -1
- package/lib/cjs/radio/stories/radio.stories.js.map +1 -1
- package/lib/cjs/select/Overrides.js +1 -1
- package/lib/cjs/select/Overrides.js.map +1 -1
- package/lib/cjs/select/Select.js +18 -6
- package/lib/cjs/select/Select.js.map +1 -1
- package/lib/cjs/side-navigation/SideNavigation.js +5 -4
- package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
- package/lib/cjs/skeleton/Skeleton.js +14 -2
- package/lib/cjs/skeleton/Skeleton.js.map +1 -1
- package/lib/cjs/skeleton/stories/skeleton.stories.js +1 -1
- package/lib/cjs/skeleton/stories/skeleton.stories.js.map +1 -1
- package/lib/cjs/spotlight/Spotlight.js +33 -14
- package/lib/cjs/spotlight/Spotlight.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightProvider.js +6 -3
- package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightTarget.js +14 -2
- package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightTour.js +1 -1
- package/lib/cjs/spotlight/SpotlightTour.js.map +1 -1
- package/lib/cjs/spotlight/stories/spotlight.stories.js +1 -1
- package/lib/cjs/spotlight/stories/spotlight.stories.js.map +1 -1
- package/lib/cjs/spotlight/use-indicator.js +2 -1
- package/lib/cjs/spotlight/use-indicator.js.map +1 -1
- package/lib/cjs/status-label/StatusLabel.js +1 -1
- package/lib/cjs/status-label/StatusLabel.js.map +1 -1
- package/lib/cjs/switch/Switch.js +2 -1
- package/lib/cjs/switch/Switch.js.map +1 -1
- package/lib/cjs/switch/stories/switch.stories.js +1 -1
- package/lib/cjs/switch/stories/switch.stories.js.map +1 -1
- package/lib/cjs/tabs/stories/tabs-disabled.story.js +1 -1
- package/lib/cjs/tabs/stories/tabs-disabled.story.js.map +1 -1
- package/lib/cjs/tabs/stories/tabs-fill-variants.story.js +1 -1
- package/lib/cjs/tabs/stories/tabs-fill-variants.story.js.map +1 -1
- package/lib/cjs/tabs/stories/tabs-overflow.story.js +1 -1
- package/lib/cjs/tabs/stories/tabs-overflow.story.js.map +1 -1
- package/lib/cjs/tabs/stories/tabs-sizes.story.js +1 -1
- package/lib/cjs/tabs/stories/tabs-sizes.story.js.map +1 -1
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js +8 -4
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/cjs/tag/Tag.js +14 -2
- package/lib/cjs/tag/Tag.js.map +1 -1
- package/lib/cjs/text-area/TextArea.js +14 -2
- package/lib/cjs/text-area/TextArea.js.map +1 -1
- package/lib/cjs/text-area/stories/text-area.stories.js +1 -1
- package/lib/cjs/text-area/stories/text-area.stories.js.map +1 -1
- package/lib/cjs/text-input/TextInput.js +14 -2
- package/lib/cjs/text-input/TextInput.js.map +1 -1
- package/lib/cjs/text-link/TextLink.js +14 -2
- package/lib/cjs/text-link/TextLink.js.map +1 -1
- package/lib/cjs/text-overflow/TextOverflow.js +2 -1
- package/lib/cjs/text-overflow/TextOverflow.js.map +1 -1
- package/lib/cjs/text-overflow/stories/text-overflow.stories.js +1 -1
- package/lib/cjs/text-overflow/stories/text-overflow.stories.js.map +1 -1
- package/lib/cjs/text-overflow/text-overflow-utils.js +12 -6
- package/lib/cjs/text-overflow/text-overflow-utils.js.map +1 -1
- package/lib/cjs/text-overflow/use-ellipsis-observer.js +2 -1
- package/lib/cjs/text-overflow/use-ellipsis-observer.js.map +1 -1
- package/lib/cjs/text-overflow/use-truncate-with-button.js +4 -2
- package/lib/cjs/text-overflow/use-truncate-with-button.js.map +1 -1
- package/lib/cjs/theme/ThemeProvider.js +2 -1
- package/lib/cjs/theme/ThemeProvider.js.map +1 -1
- package/lib/cjs/time-picker/TimePicker.js +22 -8
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/time-picker/stories/time-picker.stories.js +1 -1
- package/lib/cjs/time-picker/stories/time-picker.stories.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +8 -4
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/generate-timezone-options.js +15 -9
- package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js.map +1 -1
- package/lib/cjs/toast/Toast.js +11 -6
- package/lib/cjs/toast/Toast.js.map +1 -1
- package/lib/cjs/tooltip/Tooltip.js +35 -15
- package/lib/cjs/tooltip/Tooltip.js.map +1 -1
- package/lib/cjs/tree-view/TreeItemWrapper.js +3 -1
- package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/cjs/tree-view/TreeView.js +2 -1
- package/lib/cjs/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/tree-view/TreeViewItem.js +3 -1
- package/lib/cjs/tree-view/TreeViewItem.js.map +1 -1
- package/lib/cjs/tree-view/TreeViewTextItem.js +1 -2
- package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/cjs/tree-view/TreeViewTrail.js +14 -2
- package/lib/cjs/tree-view/TreeViewTrail.js.map +1 -1
- package/lib/cjs/wizard/Wizard.js +3 -2
- package/lib/cjs/wizard/Wizard.js.map +1 -1
- package/lib/esm/_common/CodeBlockWrapper.js +5 -4
- package/lib/esm/_common/CodeBlockWrapper.js.map +1 -1
- package/lib/esm/_common/utils.js +4 -2
- package/lib/esm/_common/utils.js.map +1 -1
- package/lib/esm/accordion/Accordion.js +9 -6
- package/lib/esm/accordion/Accordion.js.map +1 -1
- package/lib/esm/accordion/accordion-types.js.map +1 -1
- package/lib/esm/accordion/stories/accordion.stories.js +1 -1
- package/lib/esm/accordion/stories/accordion.stories.js.map +1 -1
- package/lib/esm/avatar/Avatar.js +1 -1
- package/lib/esm/avatar/Avatar.js.map +1 -1
- package/lib/esm/banner/Banner.js +3 -2
- package/lib/esm/banner/Banner.js.map +1 -1
- package/lib/esm/banner/stories/banner.stories.js +1 -1
- package/lib/esm/banner/stories/banner.stories.js.map +1 -1
- package/lib/esm/box/Box.js +14 -2
- package/lib/esm/box/Box.js.map +1 -1
- package/lib/esm/box/stories/box.stories.js +2 -2
- package/lib/esm/box/stories/box.stories.js.map +1 -1
- package/lib/esm/breadcrumbs/Breadcrumbs.js +10 -7
- package/lib/esm/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/esm/button/stories/button.stories.js +1 -1
- package/lib/esm/button/stories/button.stories.js.map +1 -1
- package/lib/esm/checkbox/Checkbox.js +2 -1
- package/lib/esm/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/checkbox/stories/checkbox.stories.js +1 -1
- package/lib/esm/checkbox/stories/checkbox.stories.js.map +1 -1
- package/lib/esm/clipboard-button/ClipboardButton.js +6 -3
- package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +2 -1
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/data-grid/Components.js +9 -6
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/DataGrid.js +16 -4
- package/lib/esm/data-grid/DataGrid.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +28 -14
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js +2 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-component-overriding.story.js +1 -3
- package/lib/esm/data-grid/stories/datagrid-component-overriding.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +2 -1
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +2 -1
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-kitchen-sink.story.js +1 -2
- package/lib/esm/data-grid/stories/datagrid-kitchen-sink.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +9 -6
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/esm/date-picker/DatePicker.js +2 -1
- package/lib/esm/date-picker/DatePicker.js.map +1 -1
- package/lib/esm/date-picker/stories/date-picker-range.story.js +1 -1
- package/lib/esm/date-picker/stories/date-picker-range.story.js.map +1 -1
- package/lib/esm/date-picker/stories/date-picker.stories.js +1 -1
- package/lib/esm/date-picker/stories/date-picker.stories.js.map +1 -1
- package/lib/esm/dialog/Dialog.js +20 -13
- package/lib/esm/dialog/Dialog.js.map +1 -1
- package/lib/esm/dialog/dialog-context.js +1 -2
- package/lib/esm/dialog/dialog-context.js.map +1 -1
- package/lib/esm/dialog/stories/dialog.stories.js +1 -1
- package/lib/esm/dialog/stories/dialog.stories.js.map +1 -1
- package/lib/esm/divider/stories/divider.stories.js +1 -1
- package/lib/esm/divider/stories/divider.stories.js.map +1 -1
- package/lib/esm/drawer/Drawer.js +9 -8
- package/lib/esm/drawer/Drawer.js.map +1 -1
- package/lib/esm/dropdown-button/DropdownButton.js +14 -2
- package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/esm/dropzone/Dropzone.js +3 -2
- package/lib/esm/dropzone/Dropzone.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-csv-files.story.js +1 -3
- package/lib/esm/dropzone/stories/dropzone-csv-files.story.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-custom-extensions.story.js +1 -3
- package/lib/esm/dropzone/stories/dropzone-custom-extensions.story.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-default.story.js +1 -3
- package/lib/esm/dropzone/stories/dropzone-default.story.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-disabled.story.js +1 -3
- package/lib/esm/dropzone/stories/dropzone-disabled.story.js.map +1 -1
- package/lib/esm/flex/Flex.js +14 -2
- package/lib/esm/flex/Flex.js.map +1 -1
- package/lib/esm/graph-label/GraphLabel.js +18 -4
- package/lib/esm/graph-label/GraphLabel.js.map +1 -1
- package/lib/esm/icon-button/stories/icon-button.stories.js +1 -1
- package/lib/esm/icon-button/stories/icon-button.stories.js.map +1 -1
- package/lib/esm/icon-button-array/IconButtonArray.js +14 -2
- package/lib/esm/icon-button-array/IconButtonArray.js.map +1 -1
- package/lib/esm/icon-button-array/index.js +1 -1
- package/lib/esm/icon-button-array/index.js.map +1 -1
- package/lib/esm/icon-button-array/stories/icon-button-array.stories.js +1 -1
- package/lib/esm/icon-button-array/stories/icon-button-array.stories.js.map +1 -1
- package/lib/esm/icons/wrapIcon.js +1 -1
- package/lib/esm/icons/wrapIcon.js.map +1 -1
- package/lib/esm/inline-edit/InlineEdit.js +18 -6
- package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
- package/lib/esm/kbd/Kbd.js +5 -3
- package/lib/esm/kbd/Kbd.js.map +1 -1
- package/lib/esm/kbd/stories/kbd.stories.js +1 -1
- package/lib/esm/kbd/stories/kbd.stories.js.map +1 -1
- package/lib/esm/loading-bar/LoadingBar.js +14 -2
- package/lib/esm/loading-bar/LoadingBar.js.map +1 -1
- package/lib/esm/loading-spinner/LoadingSpinner.js +1 -1
- package/lib/esm/loading-spinner/LoadingSpinner.js.map +1 -1
- package/lib/esm/logo/stories/logo.stories.js +1 -1
- package/lib/esm/logo/stories/logo.stories.js.map +1 -1
- package/lib/esm/menu/Menu.js +9 -6
- package/lib/esm/menu/Menu.js.map +1 -1
- package/lib/esm/popover/Popover.js +6 -4
- package/lib/esm/popover/Popover.js.map +1 -1
- package/lib/esm/popover/stories/popover-custom-offset.story.js +2 -1
- package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/esm/popover/stories/popover-separate-anchor.story.js +1 -1
- package/lib/esm/popover/stories/popover-separate-anchor.story.js.map +1 -1
- package/lib/esm/progress-bar/ProgressBar.js +1 -1
- package/lib/esm/progress-bar/ProgressBar.js.map +1 -1
- package/lib/esm/radio/Radio.js +2 -1
- package/lib/esm/radio/Radio.js.map +1 -1
- package/lib/esm/radio/stories/radio.stories.js +1 -1
- package/lib/esm/radio/stories/radio.stories.js.map +1 -1
- package/lib/esm/select/Overrides.js +1 -1
- package/lib/esm/select/Overrides.js.map +1 -1
- package/lib/esm/select/Select.js +18 -6
- package/lib/esm/select/Select.js.map +1 -1
- package/lib/esm/side-navigation/SideNavigation.js +5 -4
- package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
- package/lib/esm/skeleton/Skeleton.js +14 -2
- package/lib/esm/skeleton/Skeleton.js.map +1 -1
- package/lib/esm/skeleton/stories/skeleton.stories.js +1 -1
- package/lib/esm/skeleton/stories/skeleton.stories.js.map +1 -1
- package/lib/esm/spotlight/Spotlight.js +33 -14
- package/lib/esm/spotlight/Spotlight.js.map +1 -1
- package/lib/esm/spotlight/SpotlightProvider.js +6 -3
- package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/esm/spotlight/SpotlightTarget.js +14 -2
- package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/esm/spotlight/SpotlightTour.js +1 -1
- package/lib/esm/spotlight/SpotlightTour.js.map +1 -1
- package/lib/esm/spotlight/stories/spotlight.stories.js +1 -1
- package/lib/esm/spotlight/stories/spotlight.stories.js.map +1 -1
- package/lib/esm/spotlight/use-indicator.js +2 -1
- package/lib/esm/spotlight/use-indicator.js.map +1 -1
- package/lib/esm/status-label/StatusLabel.js +1 -1
- package/lib/esm/status-label/StatusLabel.js.map +1 -1
- package/lib/esm/switch/Switch.js +2 -1
- package/lib/esm/switch/Switch.js.map +1 -1
- package/lib/esm/switch/stories/switch.stories.js +1 -1
- package/lib/esm/switch/stories/switch.stories.js.map +1 -1
- package/lib/esm/tabs/stories/tabs-disabled.story.js +1 -1
- package/lib/esm/tabs/stories/tabs-disabled.story.js.map +1 -1
- package/lib/esm/tabs/stories/tabs-fill-variants.story.js +1 -1
- package/lib/esm/tabs/stories/tabs-fill-variants.story.js.map +1 -1
- package/lib/esm/tabs/stories/tabs-overflow.story.js +1 -1
- package/lib/esm/tabs/stories/tabs-overflow.story.js.map +1 -1
- package/lib/esm/tabs/stories/tabs-sizes.story.js +1 -1
- package/lib/esm/tabs/stories/tabs-sizes.story.js.map +1 -1
- package/lib/esm/tabs/use-tabs-scroll-overflow.js +8 -4
- package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/esm/tag/Tag.js +14 -2
- package/lib/esm/tag/Tag.js.map +1 -1
- package/lib/esm/text-area/TextArea.js +14 -2
- package/lib/esm/text-area/TextArea.js.map +1 -1
- package/lib/esm/text-area/stories/text-area.stories.js +1 -1
- package/lib/esm/text-area/stories/text-area.stories.js.map +1 -1
- package/lib/esm/text-input/TextInput.js +14 -2
- package/lib/esm/text-input/TextInput.js.map +1 -1
- package/lib/esm/text-link/TextLink.js +14 -2
- package/lib/esm/text-link/TextLink.js.map +1 -1
- package/lib/esm/text-overflow/TextOverflow.js +2 -1
- package/lib/esm/text-overflow/TextOverflow.js.map +1 -1
- package/lib/esm/text-overflow/stories/text-overflow.stories.js +1 -1
- package/lib/esm/text-overflow/stories/text-overflow.stories.js.map +1 -1
- package/lib/esm/text-overflow/text-overflow-utils.js +12 -6
- package/lib/esm/text-overflow/text-overflow-utils.js.map +1 -1
- package/lib/esm/text-overflow/use-ellipsis-observer.js +2 -1
- package/lib/esm/text-overflow/use-ellipsis-observer.js.map +1 -1
- package/lib/esm/text-overflow/use-truncate-with-button.js +4 -2
- package/lib/esm/text-overflow/use-truncate-with-button.js.map +1 -1
- package/lib/esm/theme/ThemeProvider.js +2 -1
- package/lib/esm/theme/ThemeProvider.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +22 -8
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/time-picker/stories/time-picker.stories.js +1 -1
- package/lib/esm/time-picker/stories/time-picker.stories.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +8 -4
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/esm/timezone-picker/generate-timezone-options.js +15 -9
- package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker.stories.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker.stories.js.map +1 -1
- package/lib/esm/toast/Toast.js +11 -6
- package/lib/esm/toast/Toast.js.map +1 -1
- package/lib/esm/tooltip/Tooltip.js +35 -15
- package/lib/esm/tooltip/Tooltip.js.map +1 -1
- package/lib/esm/tree-view/TreeItemWrapper.js +3 -1
- package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/esm/tree-view/TreeView.js +2 -1
- package/lib/esm/tree-view/TreeView.js.map +1 -1
- package/lib/esm/tree-view/TreeViewItem.js +3 -1
- package/lib/esm/tree-view/TreeViewItem.js.map +1 -1
- package/lib/esm/tree-view/TreeViewTextItem.js +1 -2
- package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/esm/tree-view/TreeViewTrail.js +14 -2
- package/lib/esm/tree-view/TreeViewTrail.js.map +1 -1
- package/lib/esm/wizard/Wizard.js +3 -2
- package/lib/esm/wizard/Wizard.js.map +1 -1
- package/lib/types/_common/CodeBlockWrapper.d.ts +1 -1
- package/lib/types/_common/CodeBlockWrapper.d.ts.map +1 -1
- package/lib/types/_common/utils.d.ts.map +1 -1
- package/lib/types/accordion/Accordion.d.ts +4 -4
- package/lib/types/accordion/Accordion.d.ts.map +1 -1
- package/lib/types/accordion/accordion-types.d.ts +1 -1
- package/lib/types/accordion/accordion-types.d.ts.map +1 -1
- package/lib/types/accordion/stories/accordion.stories.d.ts +4 -4
- package/lib/types/avatar/Avatar.d.ts.map +1 -1
- package/lib/types/banner/Banner.d.ts +1 -1
- package/lib/types/banner/Banner.d.ts.map +1 -1
- package/lib/types/box/Box.d.ts +1 -1
- package/lib/types/box/Box.d.ts.map +1 -1
- package/lib/types/box/stories/box.stories.d.ts +1 -1
- package/lib/types/breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/lib/types/breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/types/breadcrumbs/stories/breadcrumbs.stories.d.ts +3 -3
- package/lib/types/button/stories/button.stories.d.ts +1 -1
- package/lib/types/button/stories/button.stories.d.ts.map +1 -1
- package/lib/types/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/types/clipboard-button/ClipboardButton.d.ts.map +1 -1
- package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/DataGrid.d.ts +23 -23
- package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
- package/lib/types/data-grid/data-grid-nav/helpers.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-component-overriding.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-kitchen-sink.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +1 -1
- package/lib/types/data-grid/stories/datagrid-placeholder-states.stories.d.ts +1 -1
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +1 -1
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts.map +1 -1
- package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
- package/lib/types/date-picker/stories/date-picker-range.story.d.ts.map +1 -1
- package/lib/types/dialog/Dialog.d.ts +6 -6
- package/lib/types/dialog/Dialog.d.ts.map +1 -1
- package/lib/types/dialog/dialog-context.d.ts.map +1 -1
- package/lib/types/drawer/Drawer.d.ts +3 -3
- package/lib/types/drawer/Drawer.d.ts.map +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
- package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
- package/lib/types/flex/Flex.d.ts +1 -1
- package/lib/types/flex/Flex.d.ts.map +1 -1
- package/lib/types/flex/stories/flex.stories.d.ts +1 -1
- package/lib/types/graph-label/GraphLabel.d.ts +1 -1
- package/lib/types/graph-label/GraphLabel.d.ts.map +1 -1
- package/lib/types/icon-button-array/IconButtonArray.d.ts +2 -2
- package/lib/types/icon-button-array/IconButtonArray.d.ts.map +1 -1
- package/lib/types/icon-button-array/index.d.ts +1 -1
- package/lib/types/icon-button-array/index.d.ts.map +1 -1
- package/lib/types/inline-edit/InlineEdit.d.ts +1 -1
- package/lib/types/inline-edit/InlineEdit.d.ts.map +1 -1
- package/lib/types/kbd/Kbd.d.ts.map +1 -1
- package/lib/types/loading-bar/LoadingBar.d.ts +1 -1
- package/lib/types/loading-bar/LoadingBar.d.ts.map +1 -1
- package/lib/types/menu/Menu.d.ts +2 -2
- package/lib/types/menu/Menu.d.ts.map +1 -1
- package/lib/types/popover/Popover.d.ts +1 -1
- package/lib/types/popover/Popover.d.ts.map +1 -1
- package/lib/types/popover/stories/popover-custom-offset.story.d.ts.map +1 -1
- package/lib/types/radio/Radio.d.ts.map +1 -1
- package/lib/types/select/Overrides.d.ts +1 -2
- package/lib/types/select/Overrides.d.ts.map +1 -1
- package/lib/types/select/Select.d.ts +1 -1
- package/lib/types/select/Select.d.ts.map +1 -1
- package/lib/types/side-navigation/SideNavigation.d.ts +1 -1
- package/lib/types/side-navigation/SideNavigation.d.ts.map +1 -1
- package/lib/types/side-navigation/stories/side-nav.stories.d.ts +1 -1
- package/lib/types/skeleton/Skeleton.d.ts +1 -1
- package/lib/types/skeleton/Skeleton.d.ts.map +1 -1
- package/lib/types/skeleton/stories/skeleton.stories.d.ts +1 -1
- package/lib/types/spotlight/Spotlight.d.ts +6 -6
- package/lib/types/spotlight/Spotlight.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightTarget.d.ts +1 -1
- package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
- package/lib/types/spotlight/use-indicator.d.ts.map +1 -1
- package/lib/types/switch/Switch.d.ts.map +1 -1
- package/lib/types/tabs/use-tabs-scroll-overflow.d.ts.map +1 -1
- package/lib/types/tag/Tag.d.ts +1 -1
- package/lib/types/tag/Tag.d.ts.map +1 -1
- package/lib/types/text-area/TextArea.d.ts +1 -1
- package/lib/types/text-area/TextArea.d.ts.map +1 -1
- package/lib/types/text-input/TextInput.d.ts +1 -1
- package/lib/types/text-input/TextInput.d.ts.map +1 -1
- package/lib/types/text-link/TextLink.d.ts +1 -1
- package/lib/types/text-link/TextLink.d.ts.map +1 -1
- package/lib/types/text-overflow/TextOverflow.d.ts.map +1 -1
- package/lib/types/text-overflow/text-overflow-utils.d.ts.map +1 -1
- package/lib/types/text-overflow/use-ellipsis-observer.d.ts.map +1 -1
- package/lib/types/text-overflow/use-truncate-with-button.d.ts.map +1 -1
- package/lib/types/theme/ThemeProvider.d.ts.map +1 -1
- package/lib/types/time-picker/TimePicker.d.ts +1 -1
- package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
- package/lib/types/time-picker/stories/time-picker.stories.d.ts +1 -1
- package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -1
- package/lib/types/timezone-picker/generate-timezone-options.d.ts.map +1 -1
- package/lib/types/toast/Toast.d.ts +1 -1
- package/lib/types/toast/Toast.d.ts.map +1 -1
- package/lib/types/tooltip/Tooltip.d.ts +8 -7
- package/lib/types/tooltip/Tooltip.d.ts.map +1 -1
- package/lib/types/tree-view/TreeItemWrapper.d.ts.map +1 -1
- package/lib/types/tree-view/TreeView.d.ts.map +1 -1
- package/lib/types/tree-view/TreeViewItem.d.ts.map +1 -1
- package/lib/types/tree-view/TreeViewTrail.d.ts +2 -1
- package/lib/types/tree-view/TreeViewTrail.d.ts.map +1 -1
- package/lib/types/wizard/Wizard.d.ts +1 -1
- package/lib/types/wizard/Wizard.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/dropdown-button/avatar-test.stories.tsx.js +0 -31
- package/lib/cjs/dropdown-button/avatar-test.stories.tsx.js.map +0 -1
- package/lib/esm/dropdown-button/avatar-test.stories.tsx.js +0 -27
- package/lib/esm/dropdown-button/avatar-test.stories.tsx.js.map +0 -1
- package/lib/types/dropdown-button/avatar-test.stories.tsx.d.ts +0 -24
- package/lib/types/dropdown-button/avatar-test.stories.tsx.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","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,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,YAE7C,KAAC,UAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,0BAA0B,EACpC,EAAE,EAAC,KAAK,YAEP,QAAQ,GACE,GACT,GACF,EACL,UAAU,IAAI,KAAC,OAAO,KAAG,KAChB,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAGpB,EAG+C,EAAE,EAAE;QAHnD,EACA,SAAS,OAEsC,EAD5C,SAAS,cAFZ,aAGD,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;IAEpE,OAAO,KAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,IAAI,CAAC;AAClE,CAAC,CAAC;AACF,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAO7C,MAAM,SAAS,GAAG,CAGhB,EAG6C,EAAE,EAAE;QAHjD,EACA,SAAS,OAEoC,EAD1C,SAAS,cAFZ,aAGD,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,KAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAC5E,CAAC;AACJ,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAE9C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { findUntil } from '../_common/utils';\nimport { Divider } from '../divider';\nimport { ChevronDownIconOutline } from '../icons';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionIsMultiple,\n type AccordionIsNotMultiple,\n type AccordionItemId,\n type AccordionItemProps,\n type AccordionProps,\n type ClassicItemProps,\n type IsMultiple,\n type IsNotMultiple,\n} from './accordion-types';\n\nenum AccordionSelector {\n Item = '.ndl-accordion-item',\n ItemNotDisabled = '.ndl-accordion-item:not(.ndl-accordion-item-disabled)',\n}\n\nconst getAccordionItem = (\n accordionElement: Element,\n selector: string,\n direction: 'next' | 'prev' = 'next',\n): Element | null => {\n const itemParent = accordionElement.closest(AccordionSelector.Item);\n if (!itemParent) return null;\n\n return findUntil(direction, itemParent, selector);\n};\n\nconst AccordionComponent = function AccordionComponent<\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n children,\n as,\n isMultiple,\n onChange,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, AccordionProps<T>>) {\n const accordionRef = useRef<U>(null);\n\n useImperativeHandle(ref, () => accordionRef.current!);\n\n const Component: React.ElementType = as || 'div';\n\n // The following function includes code needed to be\n // able to navigate with the arrow keys (not tab).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const accordionElement = accordionRef.current;\n if (!accordionElement) {\n return;\n }\n const activeElement = document.activeElement as HTMLElement;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'next',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'prev',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n activeElement.click();\n }\n };\n\n const focusAccordionItem = (accordionHtmlElement: HTMLElement) => {\n const accordionButton = accordionHtmlElement\n .getElementsByClassName('ndl-accordion-item-header-button')\n .item(0);\n\n if (accordionButton !== null && accordionButton instanceof HTMLElement) {\n accordionButton.focus();\n }\n };\n\n const classes = classNames('ndl-accordion', className);\n\n const { expandedItemIds } = restProps as AccordionIsMultiple<T>;\n const { expandedItemId } = restProps as AccordionIsNotMultiple<T>;\n\n const contextValue = isMultiple\n ? ({\n onChange,\n isMultiple,\n expandedItemIds,\n } as IsMultiple<T>)\n : ({\n onChange,\n isMultiple,\n expandedItemId,\n } as IsNotMultiple<T>);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={accordionRef}\n onKeyDown={handleKeyDown}\n role=\"presentation\"\n {...htmlAttributes}\n >\n <AccordionContext.Provider value={contextValue}>\n {children}\n </AccordionContext.Provider>\n </Component>\n );\n};\n\nconst createItemId = (type: string, id: AccordionItemId) =>\n `ndl-accordionitem${type}id-${id}`;\n\nconst BaseAccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n itemId,\n children,\n title,\n className = '',\n arrowPosition = 'leading',\n isDisabled = false,\n onExpandedChange,\n htmlAttributes,\n style,\n as,\n titleTypographyVariant = 'subheading-medium',\n hasDivider = true,\n trailingContent,\n}: PolymorphicCommonProps<U, AccordionItemProps<T>>) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const innerContentRef = useRef<HTMLDivElement>(null);\n const itemElementId = createItemId('item', itemId);\n const headerElementId = createItemId('header', itemId);\n const buttonElementId = createItemId('button', itemId);\n const panelElementId = createItemId('panel', itemId);\n const Component: React.ElementType = as || 'div';\n\n const context = useAccordionContext();\n const { isMultiple } = context;\n\n const isExpanded = isMultiple\n ? context.expandedItemIds.includes(itemId)\n : context.expandedItemId === itemId;\n\n const handleOnClick = useCallback(() => {\n if (isDisabled) return;\n\n // Custom callback to call.\n if (onExpandedChange !== undefined) onExpandedChange(!isExpanded);\n\n if (isMultiple) {\n const { expandedItemIds, onChange }: IsMultiple<T> = context;\n // Multiple expanded.\n if (isExpanded) {\n // Remove from list.\n const newArray: T[] = expandedItemIds.filter(\n (activeId) => activeId !== itemId,\n );\n onChange(newArray);\n } else if (!isExpanded) {\n // Add to list.\n const newArray = [...expandedItemIds];\n newArray.push(itemId);\n onChange(newArray);\n }\n } else {\n const { onChange }: IsNotMultiple<T> = context;\n // Single expanded.\n if (isExpanded) {\n // Set null.\n onChange(null);\n } else if (!isExpanded) {\n // Set to id.\n onChange(itemId);\n }\n }\n\n // The W3 WAI-ARIA states that focus can only happen on the header not the header button.\n document.activeElement?.parentElement?.focus();\n }, [isExpanded, isMultiple, isDisabled, itemId, onExpandedChange, context]);\n\n const classes = classNames('ndl-accordion-item', className, {\n 'ndl-accordion-item-disabled': isDisabled,\n 'ndl-accordion-item-expanded': isExpanded,\n });\n\n const headerClasses = classNames('ndl-accordion-item-header', {\n 'ndl-accordion-item-header-disabled': isDisabled,\n });\n\n const iconClasses = classNames('ndl-accordion-item-header-icon-wrapper', {\n 'ndl-accordion-item-header-icon-wrapper-leading':\n arrowPosition === 'leading',\n });\n\n const buttonClasses = classNames('ndl-accordion-item-header-button', {\n 'ndl-accordion-item-header-button-disabled': isDisabled,\n });\n\n const titleClasses = classNames('ndl-accordion-item-header-button-title', {\n 'ndl-accordion-item-header-button-title': isDisabled,\n 'ndl-accordion-item-header-button-title-leading':\n arrowPosition === 'leading',\n });\n\n const contentClasses = classNames('ndl-accordion-item-content', {\n 'ndl-accordion-item-content-expanded': isExpanded,\n 'ndl-accordion-item-content-leading': arrowPosition === 'leading',\n });\n\n return (\n <Component\n {...htmlAttributes}\n className={classes}\n style={style}\n id={itemElementId}\n >\n <div className={headerClasses} id={headerElementId}>\n <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n role: 'heading',\n 'aria-level': 2,\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\n {trailingContent && (\n <Typography as=\"div\" variant=\"body-medium\">\n {trailingContent}\n </Typography>\n )}\n </div>\n\n <div\n id={panelElementId}\n ref={contentRef}\n className={contentClasses}\n aria-hidden={!isExpanded}\n aria-labelledby={buttonElementId}\n role=\"region\"\n >\n {/* The <div> element has a child <button> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={innerContentRef}\n className=\"ndl-accordion-item-content-inner\"\n onKeyDown={(event) => event.stopPropagation()}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weak\"\n as=\"div\"\n >\n {children}\n </Typography>\n </div>\n </div>\n {hasDivider && <Divider />}\n </Component>\n );\n};\n\nconst AccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, ClassicItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-classic', className);\n\n return <BaseAccordionItem {...restProps} className={classes} />;\n};\nAccordionItem.displayName = 'Accordion.Item';\n\ntype CleanItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider'\n>;\n\nconst CleanItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, CleanItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-clean', className);\n\n return (\n <BaseAccordionItem {...restProps} className={classes} hasDivider={false} />\n );\n};\nCleanItem.displayName = 'Accordion.CleanItem';\n\nconst Accordion = Object.assign(AccordionComponent, {\n Item: AccordionItem,\n CleanItem: CleanItem,\n});\n\nexport { Accordion };\n"]}
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY5E,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,iDAA4B,CAAA;IAC5B,8FAAyE,CAAA;AAC3E,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAM,gBAAgB,GAAG,CACvB,gBAAyB,EACzB,QAAgB,EAChB,YAA6B,MAAM,EACnB,EAAE;IAClB,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,C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;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,KAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAE9C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,aAAa;CACpB,CAAC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { findUntil } from '../_common/utils';\nimport { Divider } from '../divider';\nimport { ChevronDownIconOutline } from '../icons';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionIsMultiple,\n type AccordionIsNotMultiple,\n type AccordionItemId,\n type AccordionItemProps,\n type AccordionProps,\n type ClassicItemProps,\n type IsMultiple,\n type IsNotMultiple,\n} from './accordion-types';\n\nenum AccordionSelector {\n Item = '.ndl-accordion-item',\n ItemNotDisabled = '.ndl-accordion-item:not(.ndl-accordion-item-disabled)',\n}\n\nconst getAccordionItem = (\n accordionElement: Element,\n selector: string,\n direction: 'next' | 'prev' = 'next',\n): Element | null => {\n const itemParent = accordionElement.closest(AccordionSelector.Item);\n if (!itemParent) {\n return null;\n }\n\n return findUntil(direction, itemParent, selector);\n};\n\nconst AccordionComponent = function AccordionComponent<\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n children,\n as,\n isMultiple,\n onChange,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, AccordionProps<T>>) {\n const accordionRef = useRef<U>(null);\n\n useImperativeHandle(ref, () => accordionRef.current!);\n\n const Component: React.ElementType = as || 'div';\n\n // The following function includes code needed to be\n // able to navigate with the arrow keys (not tab).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const accordionElement = accordionRef.current;\n if (!accordionElement) {\n return;\n }\n const activeElement = document.activeElement as HTMLElement;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'next',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'prev',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n activeElement.click();\n }\n };\n\n const focusAccordionItem = (accordionHtmlElement: HTMLElement) => {\n const accordionButton = accordionHtmlElement\n .getElementsByClassName('ndl-accordion-item-header-button')\n .item(0);\n\n if (accordionButton !== null && accordionButton instanceof HTMLElement) {\n accordionButton.focus();\n }\n };\n\n const classes = classNames('ndl-accordion', className);\n\n const { expandedItemIds } = restProps as AccordionIsMultiple<T>;\n const { expandedItemId } = restProps as AccordionIsNotMultiple<T>;\n\n const contextValue = isMultiple\n ? ({\n onChange,\n isMultiple,\n expandedItemIds,\n } as IsMultiple<T>)\n : ({\n onChange,\n isMultiple,\n expandedItemId,\n } as IsNotMultiple<T>);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={accordionRef}\n onKeyDown={handleKeyDown}\n role=\"presentation\"\n {...restProps}\n {...htmlAttributes}\n >\n <AccordionContext.Provider value={contextValue}>\n {children}\n </AccordionContext.Provider>\n </Component>\n );\n};\n\nconst createItemId = (type: string, id: AccordionItemId) =>\n `ndl-accordionitem${type}id-${id}`;\n\nconst BaseAccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n itemId,\n children,\n title,\n className = '',\n arrowPosition = 'leading',\n isDisabled = false,\n onExpandedChange,\n htmlAttributes,\n style,\n as,\n titleTypographyVariant = 'subheading-medium',\n hasDivider = true,\n trailingContent,\n}: PolymorphicCommonProps<U, AccordionItemProps<T>>) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const innerContentRef = useRef<HTMLDivElement>(null);\n const itemElementId = createItemId('item', itemId);\n const headerElementId = createItemId('header', itemId);\n const buttonElementId = createItemId('button', itemId);\n const panelElementId = createItemId('panel', itemId);\n const Component: React.ElementType = as || 'div';\n\n const context = useAccordionContext();\n const { isMultiple } = context;\n\n const isExpanded = isMultiple\n ? context.expandedItemIds.includes(itemId)\n : context.expandedItemId === itemId;\n\n const handleOnClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n // Custom callback to call.\n if (onExpandedChange !== undefined) {\n onExpandedChange(!isExpanded);\n }\n\n if (isMultiple) {\n const { expandedItemIds, onChange }: IsMultiple<T> = context;\n // Multiple expanded.\n if (isExpanded) {\n // Remove from list.\n const newArray: T[] = expandedItemIds.filter(\n (activeId) => activeId !== itemId,\n );\n onChange(newArray);\n } else if (!isExpanded) {\n // Add to list.\n const newArray = [...expandedItemIds];\n newArray.push(itemId);\n onChange(newArray);\n }\n } else {\n const { onChange }: IsNotMultiple<T> = context;\n // Single expanded.\n if (isExpanded) {\n // Set null.\n onChange(null);\n } else if (!isExpanded) {\n // Set to id.\n onChange(itemId);\n }\n }\n\n // The W3 WAI-ARIA states that focus can only happen on the header not the header button.\n document.activeElement?.parentElement?.focus();\n }, [isExpanded, isMultiple, isDisabled, itemId, onExpandedChange, context]);\n\n const classes = classNames('ndl-accordion-item', className, {\n 'ndl-accordion-item-disabled': isDisabled,\n 'ndl-accordion-item-expanded': isExpanded,\n });\n\n const headerClasses = classNames('ndl-accordion-item-header', {\n 'ndl-accordion-item-header-disabled': isDisabled,\n });\n\n const iconClasses = classNames('ndl-accordion-item-header-icon-wrapper', {\n 'ndl-accordion-item-header-icon-wrapper-leading':\n arrowPosition === 'leading',\n });\n\n const buttonClasses = classNames('ndl-accordion-item-header-button', {\n 'ndl-accordion-item-header-button-disabled': isDisabled,\n });\n\n const titleClasses = classNames('ndl-accordion-item-header-button-title', {\n 'ndl-accordion-item-header-button-title': isDisabled,\n 'ndl-accordion-item-header-button-title-leading':\n arrowPosition === 'leading',\n });\n\n const contentClasses = classNames('ndl-accordion-item-content', {\n 'ndl-accordion-item-content-expanded': isExpanded,\n 'ndl-accordion-item-content-leading': arrowPosition === 'leading',\n });\n\n return (\n <Component\n className={classes}\n style={style}\n id={itemElementId}\n {...htmlAttributes}\n >\n <div className={headerClasses} id={headerElementId}>\n <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n role: 'heading',\n 'aria-level': 2,\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\n {trailingContent && (\n <Typography as=\"div\" variant=\"body-medium\">\n {trailingContent}\n </Typography>\n )}\n </div>\n\n <div\n id={panelElementId}\n ref={contentRef}\n className={contentClasses}\n aria-hidden={!isExpanded}\n aria-labelledby={buttonElementId}\n role=\"region\"\n >\n {/* The <div> element has a child <button> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={innerContentRef}\n className=\"ndl-accordion-item-content-inner\"\n onKeyDown={(event) => event.stopPropagation()}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weak\"\n as=\"div\"\n >\n {children}\n </Typography>\n </div>\n </div>\n {hasDivider && <Divider />}\n </Component>\n );\n};\n\nconst AccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, ClassicItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-classic', className);\n\n return <BaseAccordionItem {...restProps} className={classes} />;\n};\nAccordionItem.displayName = 'Accordion.Item';\n\ntype CleanItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider'\n>;\n\nconst CleanItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, CleanItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-clean', className);\n\n return (\n <BaseAccordionItem {...restProps} className={classes} hasDivider={false} />\n );\n};\n\nCleanItem.displayName = 'Accordion.CleanItem';\n\nconst Accordion = Object.assign(AccordionComponent, {\n CleanItem: CleanItem,\n Item: AccordionItem,\n});\n\nexport { Accordion };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-types.js","sourceRoot":"","sources":["../../../src/accordion/accordion-types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type
|
|
1
|
+
{"version":3,"file":"accordion-types.js","sourceRoot":"","sources":["../../../src/accordion/accordion-types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type HtmlAttributes } from '../_common/types';\nimport { type TypographyVariants } from '../typography';\n\nexport type AccordionItemId = string | number | undefined;\n\ninterface AccordionBase {\n /** The content to display inside the accordion. Should only be `<Accordion.Item>` or `<Accordion.CleanItem>`. */\n children: React.ReactNode;\n}\n\nexport interface IsNotMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: false | undefined;\n /** The id of the expanded accordion item. Only applicable if `isMultiple` is `false`. */\n expandedItemId: T | null;\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemId: T | null) => void;\n}\n\nexport interface IsMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: true;\n /** The ids of the expanded accordion items. Only applicable if `isMultiple` is `true`. */\n expandedItemIds: T[];\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemIds: T[]) => void;\n}\n\nexport type AccordionIsMultiple<T extends AccordionItemId> = AccordionBase &\n IsMultiple<T>;\nexport type AccordionIsNotMultiple<T extends AccordionItemId> = AccordionBase &\n IsNotMultiple<T>;\n\nexport type AccordionProps<T extends AccordionItemId> =\n | AccordionIsMultiple<T>\n | AccordionIsNotMultiple<T>;\n\nexport interface AccordionItemProps<T extends AccordionItemId> {\n /** The id of the accordion item. */\n itemId: T;\n /** The title of the accordion item. */\n title: string;\n /** Callback function on accordion item expand/collapse change. */\n onExpandedChange?: (expanded: boolean) => void;\n /** The position of the arrow. */\n arrowPosition?: 'leading' | 'trailing';\n /** Whether the accordion item is disabled. */\n isDisabled?: boolean;\n htmlAttributes?: HtmlAttributes<'div'>;\n children?: React.ReactNode;\n className?: string;\n /** The typography variant for the title. */\n titleTypographyVariant?: TypographyVariants;\n /** Whether the accordion item has a divider. */\n hasDivider?: boolean;\n /** The content to display on the trailing side of accordion item. */\n trailingContent?: React.ReactNode;\n}\n\nexport type ClassicItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider' | 'trailingContent' | 'titleTypographyVariant'\n>;\n"]}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { Accordion } from '../../index';
|
|
23
|
-
import { AccordionCleanItems, AccordionCleanItemsSrc, AccordionDefault, AccordionDefaultSrc, AccordionFull, AccordionFullSrc, AccordionMultipleExpanded, AccordionMultipleExpandedSrc, AccordionRightContent, AccordionRightContentSrc, AccordionSingleExpanded, AccordionSingleExpandedSrc, } from '
|
|
23
|
+
import { AccordionCleanItems, AccordionCleanItemsSrc, AccordionDefault, AccordionDefaultSrc, AccordionFull, AccordionFullSrc, AccordionMultipleExpanded, AccordionMultipleExpandedSrc, AccordionRightContent, AccordionRightContentSrc, AccordionSingleExpanded, AccordionSingleExpandedSrc, } from '.';
|
|
24
24
|
const componentMeta = {
|
|
25
25
|
title: 'Components/Accordion',
|
|
26
26
|
id: 'components-accordion',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.stories.js","sourceRoot":"","sources":["../../../../src/accordion/stories/accordion.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"accordion.stories.js","sourceRoot":"","sources":["../../../../src/accordion/stories/accordion.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,sBAAsB;IAC7B,EAAE,EAAE,sBAAsB;IAC1B,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;CAC+B,CAAC;AAEnC,eAAe,aAAa,CAAC;AAG7B,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B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E,sBAAsB;aAC7B;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B;IACD,MAAM,EAAE,qBAAqB;IAC7B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,wBAAwB;aAC/B;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE;QACJ,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;aACvB;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Accordion } from '../../index';\nimport {\n AccordionCleanItems,\n AccordionCleanItemsSrc,\n AccordionDefault,\n AccordionDefaultSrc,\n AccordionFull,\n AccordionFullSrc,\n AccordionMultipleExpanded,\n AccordionMultipleExpandedSrc,\n AccordionRightContent,\n AccordionRightContentSrc,\n AccordionSingleExpanded,\n AccordionSingleExpandedSrc,\n} from '.';\n\nconst componentMeta = {\n title: 'Components/Accordion',\n id: 'components-accordion',\n component: Accordion,\n tags: ['docsPage'],\n parameters: {\n controls: { disable: true },\n },\n} satisfies Meta<typeof Accordion>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n render: AccordionDefault,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionDefaultSrc,\n },\n },\n },\n};\n\nexport const SingleExpanded: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n render: AccordionSingleExpanded,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionSingleExpandedSrc,\n },\n },\n },\n};\n\nexport const MultipleExpanded: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n render: AccordionMultipleExpanded,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionMultipleExpandedSrc,\n },\n },\n },\n};\n\nexport const CleanItems: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n render: AccordionCleanItems,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionCleanItemsSrc,\n },\n },\n },\n};\n\nexport const RightContent: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n render: AccordionRightContent,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionRightContentSrc,\n },\n },\n },\n};\n\nexport const Full: Story = {\n args: {\n children: undefined,\n isMultiple: undefined,\n expandedItemId: null,\n onChange: () => undefined,\n },\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: AccordionFullSrc,\n },\n },\n },\n render: AccordionFull,\n};\n"]}
|
package/lib/esm/avatar/Avatar.js
CHANGED
|
@@ -76,7 +76,7 @@ export const Avatar = (_a) => {
|
|
|
76
76
|
const renderImageType = () => (_jsxs(_Fragment, { children: [_jsx("img", { "data-testid": "ndl-avatar-image", src: source, alt: name }), _jsx("div", { "data-testid": "ndl-avatar-image-overlay", className: `${shapeClasses} ndl-avatar-image-overlay` })] }));
|
|
77
77
|
const renderIconType = () => _jsx(UserIconOutline, {});
|
|
78
78
|
const renderLettersType = () => {
|
|
79
|
-
return (_jsx(Typography, { variant:
|
|
79
|
+
return (_jsx(Typography, { variant: "subheading-small", className: "ndl-avatar-typography", children: name }));
|
|
80
80
|
};
|
|
81
81
|
const TypeComponent = type === 'image'
|
|
82
82
|
? renderImageType()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/avatar/Avatar.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAgB3C,SAAS,iBAAiB,CAAC,IAAc;IACvC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC;QACf,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ;YACX,OAAO;gBACL,OAAO,EAAE,GAAG;gBACZ,QAAQ,EAAE,CAAC;gBACX,MAAM,EAAE,CAAC;gBACT,MAAM,EAAE,GAAG;aACZ,CAAC;QACJ,KAAK,OAAO,CAAC;QACb,KAAK,SAAS,CAAC;QACf;YACE,OAAO;gB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,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAC,eAAe,KAAG,CAAC;IAEjD,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,OAAO,CACL,KAAC,UAAU,IAAC,OAAO,EAAC,kBAAkB,EAAC,SAAS,EAAC,uBAAuB,YACrE,IAAI,GACM,CACd,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,aAAa,GACjB,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,eAAe,EAAE;QACnB,CAAC,CAAC,IAAI,KAAK,MAAM;YACf,CAAC,CAAC,cAAc,EAAE;YAClB,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;gBACnC,CAAC,CAAC,iBAAiB,EAAE;gBACrB,CAAC,CAAC,IAAI,CAAC;IAEf,MAAM,wBAAwB,GAC5B,SAAS,IAAI,CAAC,UAAU,IAAI,MAAM,KAAK,SAAS,CAAC;IAEnD,OAAO,CACL,MAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,iBACC,CAAC,QAAQ,IAClB,CAAC,QAAQ,IAAI;QACf,QAAQ,EAAE,UAAU;KACrB,CAAC,kBACU,UAAU,IAAI,EAAE,IACxB,SAAS,EACT,cAAc,eAElB,cAAK,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,YAAG,aAAa,GAAO,EACzE,wBAAwB,IAAI,CAC3B,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,CAChD,KACS,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { UserIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype SizeType = AvatarProps['size'];\ntype StatusType = NonNullable<AvatarProps['status']>;\n\ninterface CircleProperties {\n /** Center coordinates of the circles */\n cxAndCy: number;\n /** Diameter of the circles */\n diameter: number;\n /** Radius of the inner circle */\n rInner: number;\n /** Radius of the outer circle */\n rOuter: number;\n}\n\nfunction circleSizeFactory(size: SizeType): CircleProperties {\n switch (size) {\n case 'x-small':\n case 'small':\n case 'medium':\n return {\n cxAndCy: 4.5,\n diameter: 9,\n rInner: 3,\n rOuter: 4.5,\n };\n case 'large':\n case 'x-large':\n default:\n return {\n cxAndCy: 6,\n diameter: 12,\n rInner: 4,\n rOuter: 6,\n };\n }\n}\n\nfunction StatusIndicator({\n size,\n status,\n}: {\n size: SizeType;\n status: StatusType;\n}) {\n const { cxAndCy, diameter, rInner, rOuter } = circleSizeFactory(size);\n const statusClasses = `ndl-avatar-status ndl-avatar-status-${status}`;\n\n return (\n <div\n className={statusClasses}\n title={status.charAt(0).toUpperCase() + status.slice(1)}\n role=\"presentation\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height={diameter}\n width={diameter}\n viewBox={`0 0 ${diameter} ${diameter}`}\n fill=\"none\"\n >\n <circle\n cx={cxAndCy}\n cy={cxAndCy}\n r={rOuter}\n className=\"ndl-avatar-status-circle-outer\"\n />\n <circle\n cx={cxAndCy}\n cy={cxAndCy}\n r={status === 'unknown' ? rInner - 1 : rInner}\n className=\"ndl-avatar-status-circle-inner\"\n />\n </svg>\n </div>\n );\n}\n\ntype AvatarProps = {\n /** Whether to display a status indicator */\n hasStatus?: boolean;\n /** Whether the avatar is disabled. When disabled, status indicators are hidden and `onClick` handlers are disabled when cast as a button */\n isDisabled?: boolean;\n /** The name associated with the avatar. Used for alt text and aria-label. For letters type, this text is displayed */\n name?: string;\n /** The shape of the avatar */\n shape?: 'circle' | 'square';\n /** The size of the avatar */\n size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';\n /** Source URI for the image. When provided with `type=\"image`\", displays the image */\n source?: string;\n /** The status to display. Only shown when `hasStatus` is `true` and component is not disabled */\n status?: 'offline' | 'online' | 'unknown';\n /** The type of avatar content. If `type=\"image\"` and no source is provided, automatically falls back to `icon` */\n type?: 'icon' | 'image' | 'letters';\n} & (\n | {\n as: 'button';\n onClick: () => void;\n }\n | {\n as?: React.ElementType;\n }\n);\n\nexport const Avatar = <T extends React.ElementType = 'div'>({\n as,\n hasStatus = false,\n isDisabled = false,\n name,\n shape = 'circle',\n size = 'medium',\n source,\n status,\n type: initialType = 'image',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, AvatarProps>) => {\n // If source is not provided, fallback to icon\n const type =\n initialType === 'image' && (source === undefined || source === '')\n ? 'icon'\n : initialType;\n\n const Component: React.ElementType = as ?? 'div';\n const isButton = Component === 'button';\n const classes = classNames(\n `ndl-avatar ndl-avatar-${shape} ndl-avatar-${size}`,\n className,\n );\n const shapeClasses = classNames(\n `ndl-avatar-shape ndl-avatar-${shape} ndl-avatar-${shape}-${size}`,\n {\n 'ndl-avatar-disabled': isDisabled,\n },\n );\n\n const typeClass = `ndl-avatar-${type}`;\n\n const renderImageType = () => (\n <>\n <img data-testid=\"ndl-avatar-image\" src={source} alt={name} />\n <div\n data-testid=\"ndl-avatar-image-overlay\"\n className={`${shapeClasses} ndl-avatar-image-overlay`}\n />\n </>\n );\n\n const renderIconType = () => <UserIconOutline />;\n\n const renderLettersType = () => {\n return (\n <Typography variant=\"subheading-small\" className=\"ndl-avatar-typography\">\n {name}\n </Typography>\n );\n };\n\n const TypeComponent =\n type === 'image'\n ? renderImageType()\n : type === 'icon'\n ? renderIconType()\n : type === 'letters' && Boolean(name)\n ? renderLettersType()\n : null;\n\n const isStatusIndicatorVisible =\n hasStatus && !isDisabled && status !== undefined;\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-hidden={!isButton}\n {...(isButton && {\n disabled: isDisabled,\n })}\n aria-label={`Avatar ${name}`}\n {...restProps}\n {...htmlAttributes}\n >\n <div className={classNames(shapeClasses, typeClass)}>{TypeComponent}</div>\n {isStatusIndicatorVisible && (\n <StatusIndicator size={size} status={status} />\n )}\n </Component>\n );\n};\n"]}
|
package/lib/esm/banner/Banner.js
CHANGED
|
@@ -68,7 +68,8 @@ const BannerActions = (_a) => {
|
|
|
68
68
|
const classes = classNames('ndl-banner-actions', className);
|
|
69
69
|
return (_jsx("div", Object.assign({ className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: children })));
|
|
70
70
|
};
|
|
71
|
-
const BannerComponent = (
|
|
71
|
+
const BannerComponent = (_a) => {
|
|
72
|
+
var { as, variant = 'info', hasIcon = false, onClose, className, children, isCloseable = false, usage = 'inline', htmlAttributes, isAlert = false, ref } = _a, restProps = __rest(_a, ["as", "variant", "hasIcon", "onClose", "className", "children", "isCloseable", "usage", "htmlAttributes", "isAlert", "ref"]);
|
|
72
73
|
const Element = as !== null && as !== void 0 ? as : 'section';
|
|
73
74
|
const classes = classNames('ndl-banner', className, {
|
|
74
75
|
'ndl-danger': variant === 'danger',
|
|
@@ -84,7 +85,7 @@ const BannerComponent = ({ as, variant = 'info', hasIcon = false, onClose, class
|
|
|
84
85
|
onClose(e);
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
|
-
return (_jsxs(Element, Object.assign({ className: classes, role: isAlert ? (isCloseable ? 'alertdialog' : 'alert') : undefined, ref: ref }, htmlAttributes, { children: [hasIcon && _jsx(StatusIcon, { variant: variant }), _jsx("div", { className: "ndl-banner-content", children: children }), isCloseable && (_jsx(CleanIconButton, { size: "small", onClick: handleClose, description: "Close", children: _jsx(XMarkIconOutline, {}) }))] })));
|
|
88
|
+
return (_jsxs(Element, Object.assign({ className: classes, role: isAlert ? (isCloseable ? 'alertdialog' : 'alert') : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && _jsx(StatusIcon, { variant: variant }), _jsx("div", { className: "ndl-banner-content", children: children }), isCloseable && (_jsx(CleanIconButton, { size: "small", onClick: handleClose, description: "Close", children: _jsx(XMarkIconOutline, {}) }))] })));
|
|
88
89
|
};
|
|
89
90
|
const Banner = Object.assign(BannerComponent, {
|
|
90
91
|
Actions: BannerActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8C3C,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAA8B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO,KAAC,oBAAoB,KAAG,CAAC;YAClC,KAAK,SAAS;gBACZ,OAAO,KAAC,4BAA4B,KAAG,CAAC;YAC1C,KAAK,QAAQ;gBACX,OAAO,KAAC,0BAA0B,KAAG,CAAC;YACxC,KAAK,MAAM;gBACT,OAAO,KAAC,0BAA0B,KAAG,CAAC;YACxC,KAAK,SAAS;gBACZ,OAAO,KAAC,eAAe,KAAG,CAAC;YAC7B;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CAAC,SAAS,EACnE,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,eAEjB,OAAO,IAAI,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,GAAI,EAC5C,cAAK,SAAS,EAAC,oBAAoB,YAAE,QAAQ,GAAO,EACnD,WAAW,IAAI,CACd,KAAC,eAAe,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAC,OAAO,YACrE,KAAC,gBAAgB,KAAG,GACJ,CACnB,KACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport {\n BoltIconOutline,\n CheckCircleIconSolid,\n ExclamationCircleIconSolid,\n ExclamationTriangleIconSolid,\n InformationCircleIconSolid,\n XMarkIconOutline,\n} from '../icons';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert or alertdialog, based on the value of `isCloseable` */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n e:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(e);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? (isCloseable ? 'alertdialog' : 'alert') : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {hasIcon && <StatusIcon variant={variant} />}\n <div className=\"ndl-banner-content\">{children}</div>\n {isCloseable && (\n <CleanIconButton size=\"small\" onClick={handleClose} description=\"Close\">\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Element>\n );\n};\n\nconst Banner = Object.assign(BannerComponent, {\n Actions: BannerActions,\n Description: BannerDescription,\n Header: BannerHeader,\n});\n\nexport { Banner };\n"]}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { Banner } from '../../index';
|
|
22
|
-
import { BannerCloseable, BannerCloseableSrc, BannerGlobal, BannerGlobalSrc, BannerVariants, BannerVariantsSrc, BannerWithActions, BannerWithActionsSrc, BannerWithIcons, BannerWithIconsSrc, BannerWithoutTitle, BannerWithoutTitleSrc, } from '
|
|
22
|
+
import { BannerCloseable, BannerCloseableSrc, BannerGlobal, BannerGlobalSrc, BannerVariants, BannerVariantsSrc, BannerWithActions, BannerWithActionsSrc, BannerWithIcons, BannerWithIconsSrc, BannerWithoutTitle, BannerWithoutTitleSrc, } from '.';
|
|
23
23
|
const componentMeta = {
|
|
24
24
|
component: Banner,
|
|
25
25
|
id: 'components-banner',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.stories.js","sourceRoot":"","sources":["../../../../src/banner/stories/banner.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"banner.stories.js","sourceRoot":"","sources":["../../../../src/banner/stories/banner.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,mBAAmB;IACvB,U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AChE,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,oBAAoB;gBAC1B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAiB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,gEAAgE;IAChE,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,kBAAkB;CAC3B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Banner } from '../../index';\nimport {\n BannerCloseable,\n BannerCloseableSrc,\n BannerGlobal,\n BannerGlobalSrc,\n BannerVariants,\n BannerVariantsSrc,\n BannerWithActions,\n BannerWithActionsSrc,\n BannerWithIcons,\n BannerWithIconsSrc,\n BannerWithoutTitle,\n BannerWithoutTitleSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Banner> = {\n component: Banner,\n id: 'components-banner',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/Banner',\n} satisfies Meta<React.ComponentProps<typeof Banner>>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Variants: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerVariantsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerVariants,\n};\n\nexport const WithIcons: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerWithIconsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerWithIcons,\n};\n\nexport const Closeable: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerCloseableSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerCloseable,\n};\n\nexport const Global: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerGlobalSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerGlobal,\n};\n\nexport const WithActions: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerWithActionsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerWithActions,\n};\n\nexport const WithoutTitle: Story = {\n // @ts-expect-error We don't want to pass any args to this story\n args: {},\n parameters: {\n docs: {\n source: {\n code: BannerWithoutTitleSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BannerWithoutTitle,\n};\n"]}
|
package/lib/esm/box/Box.js
CHANGED
|
@@ -19,9 +19,21 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
23
|
+
var t = {};
|
|
24
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
25
|
+
t[p] = s[p];
|
|
26
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
27
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
29
|
+
t[p[i]] = s[p[i]];
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
22
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
34
|
import { getRadius, getSpacing } from '../_common/utils';
|
|
24
|
-
export const Box = (
|
|
35
|
+
export const Box = (_a) => {
|
|
36
|
+
var { as = 'div', padding, paddingInline, paddingInlineStart, paddingInlineEnd, paddingBlockEnd, paddingBlockStart, borderRadius, children, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "padding", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlockEnd", "paddingBlockStart", "borderRadius", "children", "style", "htmlAttributes", "ref"]);
|
|
25
37
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
26
38
|
const additionalStyle = {
|
|
27
39
|
borderRadius: getRadius(borderRadius, 'borderRadius'),
|
|
@@ -32,6 +44,6 @@ export const Box = ({ as = 'div', padding, paddingInline, paddingInlineStart, pa
|
|
|
32
44
|
paddingInlineEnd: getSpacing(paddingInlineEnd, 'paddingInlineEnd'),
|
|
33
45
|
paddingInlineStart: getSpacing(paddingInlineStart, 'paddingInlineStart'),
|
|
34
46
|
};
|
|
35
|
-
return (_jsx(Component, Object.assign({ ref: ref, style: Object.assign(Object.assign({}, additionalStyle), style) }, htmlAttributes, { children: children })));
|
|
47
|
+
return (_jsx(Component, Object.assign({ ref: ref, style: Object.assign(Object.assign({}, additionalStyle), style) }, restProps, htmlAttributes, { children: children })));
|
|
36
48
|
};
|
|
37
49
|
//# sourceMappingURL=Box.js.map
|
package/lib/esm/box/Box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/box/Box.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/box/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;AA2BA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAmCzD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAsC,EAcf,EAAE,EAAE;QAdW,EACvD,EAAE,GAAG,KAAU,EACf,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,cAAc,EACd,GAAG,OAEqC,EADrC,SAAS,cAb2C,kLAcxD,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,CAAC;IAEjD,MAAM,eAAe,GAAG;QACtB,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,cAAc,CAAC;QACrD,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC;QACvC,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,iBAAiB,CAAC;QAC/D,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;QACrE,aAAa,EAAE,UAAU,CAAC,aAAa,EAAE,eAAe,CAAC;QACzD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAClE,kBAAkB,EAAE,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;KACzE,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,KAAK,kCAAO,eAAe,GAAK,KAAK,KACjC,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type Radius,\n type Spacing,\n} from '../_common/types';\nimport { getRadius, getSpacing } from '../_common/utils';\n\ntype BaseBoxProps = {\n /**\n * @default tokens.space['4']\n */\n padding?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockStart?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockEnd?: Spacing;\n /**\n * @default undefined\n */\n paddingInline?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineStart?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineEnd?: Spacing;\n /**\n * @default undefined\n */\n borderRadius?: Radius;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n};\n\nexport const Box = <T extends React.ElementType = 'div'>({\n as = 'div' as T,\n padding,\n paddingInline,\n paddingInlineStart,\n paddingInlineEnd,\n paddingBlockEnd,\n paddingBlockStart,\n borderRadius,\n children,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BaseBoxProps>) => {\n const Component: React.ElementType = as ?? 'div';\n\n const additionalStyle = {\n borderRadius: getRadius(borderRadius, 'borderRadius'),\n padding: getSpacing(padding, 'padding'),\n paddingBlockEnd: getSpacing(paddingBlockEnd, 'paddingBlockEnd'),\n paddingBlockStart: getSpacing(paddingBlockStart, 'paddingBlockStart'),\n paddingInline: getSpacing(paddingInline, 'paddingInline'),\n paddingInlineEnd: getSpacing(paddingInlineEnd, 'paddingInlineEnd'),\n paddingInlineStart: getSpacing(paddingInlineStart, 'paddingInlineStart'),\n };\n\n return (\n <Component\n ref={ref}\n style={{ ...additionalStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n"]}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { Box } from '
|
|
23
|
-
import { BoxDefault, BoxDefaultSrc } from '
|
|
22
|
+
import { Box } from '../..';
|
|
23
|
+
import { BoxDefault, BoxDefaultSrc } from '.';
|
|
24
24
|
const componentMeta = {
|
|
25
25
|
component: Box,
|
|
26
26
|
id: 'components-box',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.stories.js","sourceRoot":"","sources":["../../../../src/box/stories/box.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"box.stories.js","sourceRoot":"","sources":["../../../../src/box/stories/box.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAE9C,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,GAAG;IACd,EAAE,EAAE,gBAAgB;IACpB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,gBAAgB;CACG,CAAC;AAE7B,eAAe,aAAa,CAAC;AAG7B,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,8DAA8D;QACzE,OAAO,EAAE,GAAG;KACb;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,aAAa;gBACnB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,UAAU;CACnB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Box } from '../..';\nimport { BoxDefault, BoxDefaultSrc } from '.';\n\nconst componentMeta = {\n component: Box,\n id: 'components-box',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/Box',\n} satisfies Meta<typeof Box>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {\n children: 'Box',\n className: 'n-bg-primary-bg-weak n-border n-border-primary-border-strong',\n padding: '8',\n },\n parameters: {\n docs: {\n source: {\n code: BoxDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BoxDefault,\n};\n"]}
|
|
@@ -33,12 +33,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';
|
|
34
34
|
import classNames from 'classnames';
|
|
35
35
|
import { createContext, useContext } from 'react';
|
|
36
|
-
const BreadcrumbsComponent = (
|
|
36
|
+
const BreadcrumbsComponent = (_a) => {
|
|
37
|
+
var { children, className, htmlAttributes, style, ref, shouldWrap = true } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes", "style", "ref", "shouldWrap"]);
|
|
37
38
|
const classes = classNames('ndl-breadcrumbs', className);
|
|
38
39
|
const listClasses = classNames('ndl-breadcrumbs-list', {
|
|
39
40
|
'ndl-breadcrumbs-wrap': shouldWrap,
|
|
40
41
|
});
|
|
41
|
-
return (_jsx("nav", Object.assign({ "aria-label": "Breadcrumb", ref: ref, className: classes, style: style }, htmlAttributes, { children: _jsx("ol", { className: listClasses, children: children }) })));
|
|
42
|
+
return (_jsx("nav", Object.assign({ "aria-label": "Breadcrumb", ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: _jsx("ol", { className: listClasses, children: children }) })));
|
|
42
43
|
};
|
|
43
44
|
const BreadcrumbsItemContext = createContext(null);
|
|
44
45
|
export const useBreadcrumbsItemContext = () => {
|
|
@@ -48,21 +49,23 @@ export const useBreadcrumbsItemContext = () => {
|
|
|
48
49
|
}
|
|
49
50
|
return context;
|
|
50
51
|
};
|
|
51
|
-
const BreadcrumbsItem = (
|
|
52
|
+
const BreadcrumbsItem = (_a) => {
|
|
53
|
+
var { children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "ref"]);
|
|
52
54
|
const classes = classNames('ndl-breadcrumbs-item', className);
|
|
53
|
-
return (_jsx(BreadcrumbsItemContext.Provider, { value: { isInBreadcrumbsItem: true }, children: _jsx("li", Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, { children: _jsx("div", { className: "ndl-breadcrumbs-item-inner", children: children }) })) }));
|
|
55
|
+
return (_jsx(BreadcrumbsItemContext.Provider, { value: { isInBreadcrumbsItem: true }, children: _jsx("li", Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, restProps, { children: _jsx("div", { className: "ndl-breadcrumbs-item-inner", children: children }) })) }));
|
|
54
56
|
};
|
|
55
57
|
const BreadcrumbsButton = (_a) => {
|
|
56
58
|
var { children, as, className, style, htmlAttributes, ref, leadingElement, trailingElement } = _a, restProps = __rest(_a, ["children", "as", "className", "style", "htmlAttributes", "ref", "leadingElement", "trailingElement"]);
|
|
57
59
|
useBreadcrumbsItemContext();
|
|
58
60
|
const Component = as !== null && as !== void 0 ? as : 'button';
|
|
59
61
|
const classes = classNames('ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover', className);
|
|
60
|
-
return (_jsxs(Component, Object.assign({ ref: ref, className: classes, style: style },
|
|
62
|
+
return (_jsxs(Component, Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, restProps, { children: [Boolean(leadingElement) && (_jsx("div", { className: "ndl-breadcrumbs-button-leading-element", children: leadingElement })), _jsx("div", { className: "ndl-breadcrumbs-button-content", children: children }), Boolean(trailingElement) && (_jsx("div", { className: "ndl-breadcrumbs-button-trailing-element", children: trailingElement }))] })));
|
|
61
63
|
};
|
|
62
|
-
const BreadcrumbsSelectButton = (
|
|
64
|
+
const BreadcrumbsSelectButton = (_a) => {
|
|
65
|
+
var { onClick, children, className, style, htmlAttributes, ariaLabel, ref } = _a, restProps = __rest(_a, ["onClick", "children", "className", "style", "htmlAttributes", "ariaLabel", "ref"]);
|
|
63
66
|
useBreadcrumbsItemContext();
|
|
64
67
|
const classes = classNames('ndl-breadcrumbs-select', className);
|
|
65
|
-
return (_jsx(BreadcrumbsButton, { ref: ref, as: "button", className: classes, style: style, onClick: onClick, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { 'aria-label': ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-label'] }), leadingElement: _jsx(ChevronDownIconOutline, {}), children: children }));
|
|
68
|
+
return (_jsx(BreadcrumbsButton, Object.assign({ ref: ref, as: "button", className: classes, style: style, onClick: onClick, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { 'aria-label': ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-label'] }), leadingElement: _jsx(ChevronDownIconOutline, {}) }, restProps, { children: children })));
|
|
66
69
|
};
|
|
67
70
|
const BreadcrumbsLink = (_a) => {
|
|
68
71
|
var { children, as, className, style, htmlAttributes, ariaCurrent = false, ref } = _a, restProps = __rest(_a, ["children", "as", "className", "style", "htmlAttributes", "ariaCurrent", "ref"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAelD,MAAM,oBAAoB,GAAG,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,EACH,UAAU,GAAG,IAAI,GACoB,EAAE,EAAE;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,UAAU,CAAC,sBAAsB,EAAE;QACrD,sBAAsB,EAAE,UAAU;KACnC,CAAC,CAAC;IACH,OAAO,CACL,0CACa,YAAY,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,cAAc,cAElB,aAAI,SAAS,EAAE,WAAW,YAAG,QAAQ,GAAM,IACvC,CACP,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,sBAAsB,GAAG,aAAa,CAC1C,IAAI,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAA+B,EAAE;IACxE,MAAM,OAAO,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAOF,MAAM,eAAe,GAA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B;IACzB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,uBAAuB;CACtC,CAAC,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li ref={ref} className={classes} style={style} {...htmlAttributes}>\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Additional classnames. */\n className?: string;\n /** Additional css styling. */\n style?: React.CSSProperties;\n /** HTML attributes. */\n htmlAttributes?: HtmlAttributes<'button'>;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames('ndl-breadcrumbs-select', className);\n\n return (\n <BreadcrumbsButton\n ref={ref}\n as=\"button\"\n className={classes}\n style={style}\n onClick={onClick}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': ariaLabel ?? htmlAttributes?.['aria-label'],\n }}\n leadingElement={<ChevronDownIconOutline />}\n >\n {children}\n </BreadcrumbsButton>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"]}
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAelD,MAAM,oBAAoB,GAAG,CAAC,EAQS,EAAE,EAAE;QARb,EAC5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,EACH,UAAU,GAAG,IAAI,OAEoB,EADlC,SAAS,cAPgB,yEAQ7B,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,UAAU,CAAC,sBAAsB,EAAE;QACrD,sBAAsB,EAAE,UAAU;KACnC,CAAC,CAAC;IACH,OAAO,CACL,0CACa,YAAY,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cA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7C,SAAS,cAR8C,gFAS3D,CADa;IAEZ,yBAAyB,EAAE,CAAC;IAE5B,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,GAAG,CAAC;IAE/C,MAAM,OAAO,GAAG,UAAU,CACxB,sBAAsB,EACtB;QACE,8BAA8B,EAAE,OAAO,CAAC,WAAW,CAAC;KACrD,EACD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,kBACE,WAAW,IACrB,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE;IACtD,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,uBAAuB;CACtC,CAAC,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Additional classnames. */\n className?: string;\n /** Additional css styling. */\n style?: React.CSSProperties;\n /** HTML attributes. */\n htmlAttributes?: HtmlAttributes<'button'>;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames('ndl-breadcrumbs-select', className);\n\n return (\n <BreadcrumbsButton\n ref={ref}\n as=\"button\"\n className={classes}\n style={style}\n onClick={onClick}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': ariaLabel ?? htmlAttributes?.['aria-label'],\n }}\n leadingElement={<ChevronDownIconOutline />}\n {...restProps}\n >\n {children}\n </BreadcrumbsButton>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"]}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
import { ButtonBase } from '
|
|
23
|
+
import { ButtonBase } from '..';
|
|
24
24
|
import { ButtonDisabled, ButtonDisabledSrc, ButtonFloating, ButtonFloatingSrc, ButtonFluid, ButtonFluidSrc, ButtonLeadingIcon, ButtonLeadingIconSrc, ButtonLoading, ButtonLoadingSrc, ButtonSizes, ButtonSizesSrc, ButtonVariants, ButtonVariantsSrc, } from '.';
|
|
25
25
|
const componentMeta = {
|
|
26
26
|
component: ButtonBase,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.stories.js","sourceRoot":"","sources":["../../../../src/button/stories/button.stories.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"button.stories.js","sourceRoot":"","sources":["../../../../src/button/stories/button.stories.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,cAAK,SAAS,EAAC,kCAAkC,YAC/C,KAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,EAAE,EAAE,mBAAmB;IACvB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,KAAK,EAAE,mBAAmB;CACO,CAAC;AAEpC,eAAe,aAAa,CAAC;AAG7B,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,KAAK;gBACf,IAAI,E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,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,cAAc;CACvB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { ButtonBase } from '..';\nimport {\n ButtonDisabled,\n ButtonDisabledSrc,\n ButtonFloating,\n ButtonFloatingSrc,\n ButtonFluid,\n ButtonFluidSrc,\n ButtonLeadingIcon,\n ButtonLeadingIconSrc,\n ButtonLoading,\n ButtonLoadingSrc,\n ButtonSizes,\n ButtonSizesSrc,\n ButtonVariants,\n ButtonVariantsSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof ButtonBase> = {\n component: ButtonBase,\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center n-w-full\">\n <Story />\n </div>\n ),\n ],\n id: 'components-button',\n parameters: {\n controls: { disable: true },\n },\n title: 'Components/Button',\n} satisfies Meta<typeof ButtonBase>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Sizes: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonSizesSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonSizes,\n};\n\nexport const WithLeadingVisual: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLeadingIconSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLeadingIcon,\n};\n\nexport const Fluid: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFluidSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFluid,\n};\n\nexport const Variants: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonVariantsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonVariants,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLoadingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLoading,\n};\n\nexport const Disabled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonDisabledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonDisabled,\n};\n\nexport const Floating: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFloatingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFloating,\n};\n"]}
|
|
@@ -60,8 +60,9 @@ export const Checkbox = (_a) => {
|
|
|
60
60
|
}, [isIndeterminate]);
|
|
61
61
|
/** TODO: Label handling. We can get rid of this annoying stuff as soon as we do proper form control. */
|
|
62
62
|
const labelContent = useMemo(() => {
|
|
63
|
-
if (Boolean(label) === false)
|
|
63
|
+
if (Boolean(label) === false) {
|
|
64
64
|
return null;
|
|
65
|
+
}
|
|
65
66
|
if (typeof label === 'string') {
|
|
66
67
|
return (_jsx("span", { title: label, className: "ndl-checkbox-label-text", children: label }));
|
|
67
68
|
}
|