@neo4j-ndl/react 4.9.18 → 4.9.20
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/ButtonSpinner.js +53 -0
- package/lib/cjs/_common/ButtonSpinner.js.map +1 -0
- package/lib/cjs/button/ButtonBase.js +5 -3
- package/lib/cjs/button/ButtonBase.js.map +1 -1
- package/lib/cjs/button/stories/button-loading.story.js +1 -1
- package/lib/cjs/button/stories/button-loading.story.js.map +1 -1
- package/lib/cjs/clean-icon-button/stories/clean-icon-button-loading.story.js +1 -1
- package/lib/cjs/clean-icon-button/stories/clean-icon-button-loading.story.js.map +1 -1
- package/lib/cjs/color-picker/ColorPicker.js +1 -1
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-danger.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-danger.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-default.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-default.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-image.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-image.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-info.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-info.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-top-aligned.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-top-aligned.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-variants.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-variants.story.js.map +1 -1
- package/lib/cjs/dialog/stories/dialog-warning.story.js +1 -1
- package/lib/cjs/dialog/stories/dialog-warning.story.js.map +1 -1
- package/lib/cjs/dropdown-button/DropdownButton.js +18 -4
- package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/cjs/dropdown-button/stories/dropdown-button-loading.story.js +30 -0
- package/lib/cjs/dropdown-button/stories/dropdown-button-loading.story.js.map +1 -0
- package/lib/cjs/dropdown-button/stories/index.js +5 -1
- package/lib/cjs/dropdown-button/stories/index.js.map +1 -1
- package/lib/cjs/icon-button/stories/icon-button-loading.story.js +1 -1
- package/lib/cjs/icon-button/stories/icon-button-loading.story.js.map +1 -1
- package/lib/cjs/icon-button-base/IconButtonBase.js +7 -3
- package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/cjs/menu/stories/menu-custom-items.story.js +1 -1
- package/lib/cjs/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-default.story.js +2 -2
- package/lib/cjs/menu/stories/menu-default.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-dialog.story.js +2 -2
- package/lib/cjs/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-popover.story.js +1 -1
- package/lib/cjs/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-nested.story.js +1 -1
- package/lib/cjs/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-placements.story.js +2 -2
- package/lib/cjs/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-radio-and-normal.story.js +2 -2
- package/lib/cjs/menu/stories/menu-radio-and-normal.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-radio-items.story.js +2 -2
- package/lib/cjs/menu/stories/menu-radio-items.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-category.story.js +1 -1
- package/lib/cjs/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js +1 -1
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-divider.story.js +1 -1
- package/lib/cjs/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-icon.story.js +1 -1
- package/lib/cjs/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js +1 -1
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/cjs/select/Overrides.js +17 -2
- package/lib/cjs/select/Overrides.js.map +1 -1
- package/lib/cjs/select/Select.js +10 -5
- package/lib/cjs/select/Select.js.map +1 -1
- package/lib/cjs/select/types.js.map +1 -1
- package/lib/cjs/select-icon-button/SelectIconButton.js +16 -5
- package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/cjs/select-icon-button/stories/select-icon-button-states.story.js +1 -1
- package/lib/cjs/select-icon-button/stories/select-icon-button-states.story.js.map +1 -1
- package/lib/cjs/text-area/TextArea.js +1 -1
- package/lib/cjs/text-area/TextArea.js.map +1 -1
- package/lib/cjs/text-input/TextInput.js +1 -1
- package/lib/cjs/text-input/TextInput.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-clearable.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-clearable.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-default.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-default.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-disabled.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-disabled.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-email.story.js +1 -0
- package/lib/cjs/text-input/stories/text-input-email.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-error.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-error.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-information-icon.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-information-icon.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-loading-spinner.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-loading.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-loading.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-number.story.js +1 -0
- package/lib/cjs/text-input/stories/text-input-number.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-optional.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-optional.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-password.story.js +1 -0
- package/lib/cjs/text-input/stories/text-input-password.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-readonly.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-readonly.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-required.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-required.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-sizes.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-sizes.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/cjs/time-picker/TimePicker.js +5 -4
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/time-picker/stories/index.js +5 -1
- package/lib/cjs/time-picker/stories/index.js.map +1 -1
- package/lib/cjs/time-picker/stories/time-picker-default.story.js +1 -1
- package/lib/cjs/time-picker/stories/time-picker-default.story.js.map +1 -1
- package/lib/cjs/time-picker/stories/time-picker-error.story.js +32 -0
- package/lib/cjs/time-picker/stories/time-picker-error.story.js.map +1 -0
- package/lib/cjs/time-picker/stories/time-picker-in-dialog.story.js +1 -1
- package/lib/cjs/time-picker/stories/time-picker-in-dialog.story.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +5 -4
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/index.js +5 -1
- package/lib/cjs/timezone-picker/stories/index.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-error.story.js +35 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-error.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js +1 -1
- package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -1
- package/lib/esm/_common/ButtonSpinner.js +46 -0
- package/lib/esm/_common/ButtonSpinner.js.map +1 -0
- package/lib/esm/button/ButtonBase.js +5 -3
- package/lib/esm/button/ButtonBase.js.map +1 -1
- package/lib/esm/button/stories/button-loading.story.js +1 -1
- package/lib/esm/button/stories/button-loading.story.js.map +1 -1
- package/lib/esm/clean-icon-button/stories/clean-icon-button-loading.story.js +1 -1
- package/lib/esm/clean-icon-button/stories/clean-icon-button-loading.story.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +1 -1
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-danger.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-danger.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-default.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-default.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-image.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-image.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-info.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-info.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-top-aligned.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-top-aligned.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-variants.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-variants.story.js.map +1 -1
- package/lib/esm/dialog/stories/dialog-warning.story.js +1 -1
- package/lib/esm/dialog/stories/dialog-warning.story.js.map +1 -1
- package/lib/esm/dropdown-button/DropdownButton.js +18 -4
- package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/esm/dropdown-button/stories/dropdown-button-loading.story.js +28 -0
- package/lib/esm/dropdown-button/stories/dropdown-button-loading.story.js.map +1 -0
- package/lib/esm/dropdown-button/stories/index.js +3 -0
- package/lib/esm/dropdown-button/stories/index.js.map +1 -1
- package/lib/esm/icon-button/stories/icon-button-loading.story.js +1 -1
- package/lib/esm/icon-button/stories/icon-button-loading.story.js.map +1 -1
- package/lib/esm/icon-button-base/IconButtonBase.js +7 -3
- package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/esm/menu/stories/menu-custom-items.story.js +1 -1
- package/lib/esm/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-default.story.js +2 -2
- package/lib/esm/menu/stories/menu-default.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-dialog.story.js +2 -2
- package/lib/esm/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-popover.story.js +1 -1
- package/lib/esm/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-nested.story.js +1 -1
- package/lib/esm/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-placements.story.js +2 -2
- package/lib/esm/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-radio-and-normal.story.js +2 -2
- package/lib/esm/menu/stories/menu-radio-and-normal.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-radio-items.story.js +2 -2
- package/lib/esm/menu/stories/menu-radio-items.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-category.story.js +1 -1
- package/lib/esm/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js +1 -1
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-divider.story.js +1 -1
- package/lib/esm/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-icon.story.js +1 -1
- package/lib/esm/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js +1 -1
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/esm/select/Overrides.js +17 -2
- package/lib/esm/select/Overrides.js.map +1 -1
- package/lib/esm/select/Select.js +10 -5
- package/lib/esm/select/Select.js.map +1 -1
- package/lib/esm/select/types.js.map +1 -1
- package/lib/esm/select-icon-button/SelectIconButton.js +16 -5
- package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/esm/select-icon-button/stories/select-icon-button-states.story.js +1 -1
- package/lib/esm/select-icon-button/stories/select-icon-button-states.story.js.map +1 -1
- package/lib/esm/text-area/TextArea.js +1 -1
- package/lib/esm/text-area/TextArea.js.map +1 -1
- package/lib/esm/text-input/TextInput.js +1 -1
- package/lib/esm/text-input/TextInput.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-clearable.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-clearable.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-default.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-default.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-disabled.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-disabled.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-email.story.js +1 -0
- package/lib/esm/text-input/stories/text-input-email.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-error.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-error.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-information-icon.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-information-icon.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-loading-spinner.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-loading-spinner.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-loading.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-loading.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-number.story.js +1 -0
- package/lib/esm/text-input/stories/text-input-number.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-optional.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-optional.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-password.story.js +1 -0
- package/lib/esm/text-input/stories/text-input-password.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-readonly.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-readonly.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-required.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-required.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-sizes.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-sizes.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +6 -5
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/time-picker/stories/index.js +3 -0
- package/lib/esm/time-picker/stories/index.js.map +1 -1
- package/lib/esm/time-picker/stories/time-picker-default.story.js +1 -1
- package/lib/esm/time-picker/stories/time-picker-default.story.js.map +1 -1
- package/lib/esm/time-picker/stories/time-picker-error.story.js +30 -0
- package/lib/esm/time-picker/stories/time-picker-error.story.js.map +1 -0
- package/lib/esm/time-picker/stories/time-picker-in-dialog.story.js +1 -1
- package/lib/esm/time-picker/stories/time-picker-in-dialog.story.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +6 -5
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/esm/timezone-picker/stories/index.js +3 -0
- package/lib/esm/timezone-picker/stories/index.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-error.story.js +33 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-error.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js +1 -1
- package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -1
- package/lib/types/_common/ButtonSpinner.d.ts +29 -0
- package/lib/types/_common/ButtonSpinner.d.ts.map +1 -0
- package/lib/types/button/ButtonBase.d.ts +3 -1
- package/lib/types/button/ButtonBase.d.ts.map +1 -1
- package/lib/types/button/stories/button-loading.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-danger.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-default.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-image.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-info.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-top-aligned.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-variants.story.d.ts.map +1 -1
- package/lib/types/dialog/stories/dialog-warning.story.d.ts.map +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts +5 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
- package/lib/types/dropdown-button/stories/dropdown-button-loading.story.d.ts +24 -0
- package/lib/types/dropdown-button/stories/dropdown-button-loading.story.d.ts.map +1 -0
- package/lib/types/dropdown-button/stories/index.d.ts +2 -0
- package/lib/types/dropdown-button/stories/index.d.ts.map +1 -1
- package/lib/types/icon-button-base/IconButtonBase.d.ts +3 -1
- package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-custom-items.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-default.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-dialog.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-popover.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-nested.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-placements.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-radio-and-normal.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-radio-items.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-category.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-disabled-item.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-divider.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-icon.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-keyboard-shortcuts.story.d.ts.map +1 -1
- package/lib/types/select/Overrides.d.ts +1 -1
- package/lib/types/select/Overrides.d.ts.map +1 -1
- package/lib/types/select/Select.d.ts.map +1 -1
- package/lib/types/select/types.d.ts +4 -1
- package/lib/types/select/types.d.ts.map +1 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts +3 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts.map +1 -1
- package/lib/types/select-icon-button/stories/select-icon-button-states.story.d.ts.map +1 -1
- package/lib/types/text-area/TextArea.d.ts.map +1 -1
- package/lib/types/text-input/TextInput.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-clearable.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-default.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-disabled.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-email.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-error.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-full.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-information-icon.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-loading-spinner.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-loading.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-number.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-optional.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-password.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-readonly.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-required.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-sizes.story.d.ts.map +1 -1
- package/lib/types/text-input/stories/text-input-with-icons.story.d.ts.map +1 -1
- package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
- package/lib/types/time-picker/stories/index.d.ts +2 -0
- package/lib/types/time-picker/stories/index.d.ts.map +1 -1
- package/lib/types/time-picker/stories/time-picker-default.story.d.ts.map +1 -1
- package/lib/types/time-picker/stories/time-picker-error.story.d.ts +24 -0
- package/lib/types/time-picker/stories/time-picker-error.story.d.ts.map +1 -0
- package/lib/types/time-picker/stories/time-picker-in-dialog.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/index.d.ts +2 -0
- package/lib/types/timezone-picker/stories/index.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-both-mode.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-default.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-disabled.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-dst-aware.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-error.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-error.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-fluid.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-in-dialog.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-sizes.story.d.ts.map +1 -1
- package/lib/types/timezone-picker/stories/timezone-picker-utc-only.story.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) "Neo4j"
|
|
16
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
17
|
+
*
|
|
18
|
+
* This file is part of Neo4j.
|
|
19
|
+
*
|
|
20
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
+
*/
|
|
33
|
+
import classNames from 'classnames';
|
|
34
|
+
const RADIUS = 7;
|
|
35
|
+
const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
|
|
36
|
+
const ARC_FRACTION = 0.25;
|
|
37
|
+
export const ButtonSpinner = (_a) => {
|
|
38
|
+
var { loadingMessage, size = 'small', htmlAttributes } = _a, restProps = __rest(_a, ["loadingMessage", "size", "htmlAttributes"]);
|
|
39
|
+
const classes = classNames('ndl-btn-spin', {
|
|
40
|
+
'ndl-large': size === 'large',
|
|
41
|
+
'ndl-medium': size === 'medium',
|
|
42
|
+
'ndl-small': size === 'small',
|
|
43
|
+
});
|
|
44
|
+
return (_jsxs("div", Object.assign({ className: "ndl-btn-spinner-wrapper" }, restProps, htmlAttributes, { children: [_jsx("svg", { className: classes, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("circle", { cx: "8", cy: "8", r: RADIUS, stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeDasharray: `${CIRCUMFERENCE * ARC_FRACTION} ${CIRCUMFERENCE * (1 - ARC_FRACTION)}` }) }), _jsx("span", { className: "ndl-btn-spinner-text", role: "status", children: loadingMessage })] })));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=ButtonSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonSpinner.js","sourceRoot":"","sources":["../../../src/_common/ButtonSpinner.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC;AAC3C,MAAM,YAAY,GAAG,IAAI,CAAC;AAO1B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAKW,EAAE,EAAE;QALf,EAC5B,cAAc,EACd,IAAI,GAAG,OAAO,EACd,cAAc,OAEyB,EADpC,SAAS,cAJgB,4CAK7B,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,EAAE;QACzC,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IAEH,OAAO,CACL,6BAAK,SAAS,EAAC,yBAAyB,IAAK,SAAS,EAAM,cAAc,eACxE,cACE,SAAS,EAAE,OAAO,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,iBACC,MAAM,YAElB,iBACE,EAAE,EAAC,GAAG,EACN,EAAE,EAAC,GAAG,EACN,CAAC,EAAE,MAAM,EACT,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,eAAe,EAAE,GAAG,aAAa,GAAG,YAAY,IAAI,aAAa,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,EAAE,GACxF,GACE,EACN,eAAM,SAAS,EAAC,sBAAsB,EAAC,IAAI,EAAC,QAAQ,YACjD,cAAc,GACV,KACH,CACP,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';\n\nimport { type CommonProps } from './types';\n\nconst RADIUS = 7;\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS;\nconst ARC_FRACTION = 0.25;\n\ntype ButtonSpinnerProps = {\n loadingMessage: string;\n size?: 'small' | 'medium' | 'large';\n};\n\nexport const ButtonSpinner = ({\n loadingMessage,\n size = 'small',\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', ButtonSpinnerProps>) => {\n const classes = classNames('ndl-btn-spin', {\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n return (\n <div className=\"ndl-btn-spinner-wrapper\" {...restProps} {...htmlAttributes}>\n <svg\n className={classes}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <circle\n cx=\"8\"\n cy=\"8\"\n r={RADIUS}\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeDasharray={`${CIRCUMFERENCE * ARC_FRACTION} ${CIRCUMFERENCE * (1 - ARC_FRACTION)}`}\n />\n </svg>\n <span className=\"ndl-btn-spinner-text\" role=\"status\">\n {loadingMessage}\n </span>\n </div>\n );\n};\n"]}
|
|
@@ -31,9 +31,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
33
|
import classNames from 'classnames';
|
|
34
|
-
import {
|
|
34
|
+
import { ButtonSpinner } from '../_common/ButtonSpinner';
|
|
35
35
|
export const ButtonBase = (_a) => {
|
|
36
|
-
var { as, buttonFill = 'filled', children, className, variant = 'primary', htmlAttributes, isDisabled = false, isFloating = false, isFluid = false, isLoading = false, leadingVisual, onClick, ref, size = 'medium', style, type = 'button'
|
|
36
|
+
var { as, buttonFill = 'filled', children, className, variant = 'primary', htmlAttributes, isDisabled = false, isFloating = false, isFluid = false, isLoading = false, leadingVisual, onClick, ref, size = 'medium', style, type = 'button',
|
|
37
|
+
// TODO v5: maybe update default message to 'Loading'. This value is for backward compatibility with loading spinners old aria-label
|
|
38
|
+
loadingMessage = 'Loading content' } = _a, restProps = __rest(_a, ["as", "buttonFill", "children", "className", "variant", "htmlAttributes", "isDisabled", "isFloating", "isFluid", "isLoading", "leadingVisual", "onClick", "ref", "size", "style", "type", "loadingMessage"]);
|
|
37
39
|
const Component = as !== null && as !== void 0 ? as : 'button';
|
|
38
40
|
const isInteractable = !isDisabled && !isLoading;
|
|
39
41
|
const classes = classNames(className, 'ndl-btn', {
|
|
@@ -59,6 +61,6 @@ export const ButtonBase = (_a) => {
|
|
|
59
61
|
onClick(e);
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
|
-
return (_jsx(Component, Object.assign({ type: type, onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-btn-inner", children: [
|
|
64
|
+
return (_jsx(Component, Object.assign({ type: type, onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-btn-inner", children: [Boolean(leadingVisual) && (_jsx("div", { className: "ndl-btn-leading-element", children: leadingVisual })), Boolean(children) && (_jsx("span", { className: "ndl-btn-content", children: children })), isLoading && (_jsx(ButtonSpinner, { loadingMessage: loadingMessage, size: size }))] }) })));
|
|
63
65
|
};
|
|
64
66
|
//# sourceMappingURL=ButtonBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/button/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/button/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAgEzD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,EAoBtB,EAAE,EAAE;QApBkB,EACjE,EAAE,EACF,UAAU,GAAG,QAAQ,EACrB,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,cAAc,EACd,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,KAAK,EACjB,aAAa,EACb,OAAO,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cAAK,SAAS,EAAC,yBAAyB,YAAE,aAAa,GAAO,CAC/D,EACA,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,eAAM,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAQ,CACpD,EACA,SAAS,IAAI,CACZ,KAAC,aAAa,IAAC,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAI,CAC9D,IACG,IACI,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 { ButtonSpinner } from '../_common/ButtonSpinner';\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\n/**\n *\n * Types\n *\n */\n\ntype ButtonTypes = 'submit' | 'button' | 'reset';\nexport type ButtonSizes = 'small' | 'medium' | 'large';\nexport type ButtonVariants = 'primary' | 'danger' | 'neutral';\n\nexport type CommonButtonProps = {\n children?: React.ReactNode;\n /** Icon to display before the button content */\n leadingVisual?: React.ReactNode;\n /** If the button is doing something Async, it will display a loading spinner */\n isLoading?: boolean;\n /** If the button is in disabled state */\n isDisabled?: boolean;\n /** If the button is fluid, it will take the full width of its container */\n isFluid?: boolean;\n /** Type of button */\n type?: ButtonTypes;\n /** Size of button */\n size?: ButtonSizes;\n /** onClick callback*/\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** onKeyDown callback */\n onKeyDown?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n /** Accessible message for screen readers when the button is in a loading state */\n loadingMessage?: string;\n} /**\n * If `as=\"a\"`, `href` is required and `target` is available.\n * For all other elements, these props are not present.\n */ & (\n | {\n as: 'a';\n /** The URL to link to. Only applies when `as=\"a\"` */\n href?: HtmlAttributes<'a'>['href'];\n /**\n * The target window for the link. Only applies when `as=\"a\"`.\n * Not present or required for other element types.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n as?: React.ElementType;\n }\n);\n\ntype ButtonBaseProps = CommonButtonProps & {\n /** If the button is in floating state */\n isFloating?: boolean;\n /** variant of the button */\n variant?: ButtonVariants;\n /** fill of the button */\n buttonFill?: 'filled' | 'outlined' | 'text';\n};\n\nexport const ButtonBase = <T extends React.ElementType = 'button'>({\n as,\n buttonFill = 'filled',\n children,\n className,\n variant = 'primary',\n htmlAttributes,\n isDisabled = false,\n isFloating = false,\n isFluid = false,\n isLoading = false,\n leadingVisual,\n onClick,\n ref,\n size = 'medium',\n style,\n type = 'button',\n // TODO v5: maybe update default message to 'Loading'. This value is for backward compatibility with loading spinners old aria-label\n loadingMessage = 'Loading content',\n ...restProps\n}: PolymorphicCommonProps<T, ButtonBaseProps>) => {\n const Component: React.ElementType = as ?? 'button';\n const isInteractable = !isDisabled && !isLoading;\n\n const classes = classNames(className, 'ndl-btn', {\n 'ndl-disabled': isDisabled,\n 'ndl-floating': isFloating,\n 'ndl-fluid': isFluid,\n 'ndl-loading': isLoading,\n [`ndl-${size}`]: size,\n [`ndl-${buttonFill}-button`]: buttonFill,\n [`ndl-${variant}`]: variant,\n });\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!isInteractable) {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Component\n type={type}\n onClick={handleClick}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-btn-inner\">\n {Boolean(leadingVisual) && (\n <div className=\"ndl-btn-leading-element\">{leadingVisual}</div>\n )}\n {Boolean(children) && (\n <span className=\"ndl-btn-content\">{children}</span>\n )}\n {isLoading && (\n <ButtonSpinner loadingMessage={loadingMessage} size={size} />\n )}\n </div>\n </Component>\n );\n};\n"]}
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
23
|
import { FilledButton } from '@neo4j-ndl/react';
|
|
24
24
|
const Component = () => {
|
|
25
|
-
return _jsx(FilledButton, { isLoading: true,
|
|
25
|
+
return (_jsx(FilledButton, { isLoading: true, loadingMessage: "Loading", children: "Confirm" }));
|
|
26
26
|
};
|
|
27
27
|
export default Component;
|
|
28
28
|
//# sourceMappingURL=button-loading.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-loading.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-loading.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,KAAC,YAAY,IAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"button-loading.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-loading.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,KAAC,YAAY,IAAC,SAAS,QAAC,cAAc,EAAC,SAAS,wBAEjC,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <FilledButton isLoading loadingMessage=\"Loading\">\n Confirm\n </FilledButton>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -23,7 +23,7 @@ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
|
23
23
|
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
24
24
|
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
25
25
|
const Component = () => {
|
|
26
|
-
return (_jsx(CleanIconButton, { description: "
|
|
26
|
+
return (_jsx(CleanIconButton, { description: "Search", isLoading: true, loadingMessage: "Loading", children: _jsx(MagnifyingGlassIconOutline, {}) }));
|
|
27
27
|
};
|
|
28
28
|
export default Component;
|
|
29
29
|
//# sourceMappingURL=clean-icon-button-loading.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-icon-button-loading.story.js","sourceRoot":"","sources":["../../../../src/clean-icon-button/stories/clean-icon-button-loading.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,KAAC,eAAe,IAAC,WAAW,EAAC,
|
|
1
|
+
{"version":3,"file":"clean-icon-button-loading.story.js","sourceRoot":"","sources":["../../../../src/clean-icon-button/stories/clean-icon-button-loading.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,KAAC,eAAe,IAAC,WAAW,EAAC,QAAQ,EAAC,SAAS,QAAC,cAAc,EAAC,SAAS,YACtE,KAAC,0BAA0B,KAAG,GACd,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { CleanIconButton } from '@neo4j-ndl/react';\nimport { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <CleanIconButton description=\"Search\" isLoading loadingMessage=\"Loading\">\n <MagnifyingGlassIconOutline />\n </CleanIconButton>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -91,7 +91,7 @@ export const ColorPicker = forwardRef(function ColorPicker({ color, onChange, sw
|
|
|
91
91
|
.finally(() => {
|
|
92
92
|
setIsEyeDropperActiveState(false);
|
|
93
93
|
});
|
|
94
|
-
}, description: "Pick color", children: _jsx(EyeDropperIconOutline, {}) })), _jsx(Hue, { className: "ndl-color-picker-hue", hue: hsva.h, onChange: (newHue) => {
|
|
94
|
+
}, description: "Pick color from the screen with eye dropper tool", children: _jsx(EyeDropperIconOutline, {}) })), _jsx(Hue, { className: "ndl-color-picker-hue", hue: hsva.h, onChange: (newHue) => {
|
|
95
95
|
handleChange(Object.assign(Object.assign({}, hsva), { h: newHue.h }));
|
|
96
96
|
}, radius: tokens.borderRadius['lg'], pointer: (props) => (_jsx(Pointer, Object.assign({}, props, { hsva: {
|
|
97
97
|
a: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAEL,SAAS,EAET,SAAS,EACT,UAAU,EACV,GAAG,EAGH,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,MAAM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ACF,MAAM,OAAO,GAAG,CAAC,EACf,SAAS,EACT,IAAI,EACJ,GAAG,EACH,IAAI,GAC+B,EAAE,EAAE;IACvC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,CACL,cACE,KAAK,EAAE;YACL,eAAe,EAAE,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG;YACnE,IAAI;YACJ,GAAG;SACJ,EACD,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,0BAA0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor;\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a });\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h });\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1,\n h: hsva.h,\n s: 100,\n v: 100,\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(e.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (e) => {\n e.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b,\n g: rgba.g,\n r: rgba.r,\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b,\n g: newRgba.g,\n r: newRgba.r,\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(e.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(e) => handleChange('r', e)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(e) => handleChange('g', e)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(e) => handleChange('b', e)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAEL,SAAS,EAET,SAAS,EACT,UAAU,EACV,GAAG,EAGH,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAqB1C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,SAAS,WAAW,CAClB,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM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C,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG;YACnE,IAAI;YACJ,GAAG;SACJ,EACD,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,0BAA0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor;\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a });\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color from the screen with eye dropper tool\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h });\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1,\n h: hsva.h,\n s: 100,\n v: 100,\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(e.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (e) => {\n e.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b,\n g: rgba.g,\n r: rgba.r,\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b,\n g: newRgba.g,\n r: newRgba.r,\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(e.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(e) => handleChange('r', e)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(e) => handleChange('g', e)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(e) => handleChange('b', e)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n );\n};\n"]}
|
|
@@ -26,7 +26,7 @@ const Component = (props) => {
|
|
|
26
26
|
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
27
27
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
28
28
|
const handleClose = () => setIsOpen(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
30
30
|
id: 'danger-dialog',
|
|
31
31
|
}, variant: "danger", children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Subtitle, { children: "This is a subtitle" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-danger.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-danger.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,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AW,EACpB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE;oBACd,EAAE,EAAE,eAAe;iBACpB,EACD,OAAO,EAAC,QAAQ,aAEhB,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,QAAQ,qCAAqC,EACrD,KAAC,MAAM,CAAC,WAAW,wCAA2C,EAC9D,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n onClose={handleClose}\n isOpen={isOpen}\n htmlAttributes={{\n id: 'danger-dialog',\n }}\n variant=\"danger\"\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Subtitle>This is a subtitle</Dialog.Subtitle>\n <Dialog.Description>This is a description</Dialog.Description>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -27,7 +27,7 @@ const Component = (props) => {
|
|
|
27
27
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
28
28
|
const handleClose = () => setIsOpen(false);
|
|
29
29
|
const ref = useRef(null);
|
|
30
|
-
return (_jsxs("div", { ref: ref, className: "n-flex n-flex-col n-items-center n-justify-center n-relative n-h-[500px] n-w-full", children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, container: (ref === null || ref === void 0 ? void 0 : ref.current) || undefined, children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsx(Dialog.Content, { children: "This is where you put your content" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
30
|
+
return (_jsxs("div", { ref: ref, className: "n-flex n-flex-col n-items-center n-justify-center n-relative n-h-[500px] n-w-full", children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, container: (ref === null || ref === void 0 ? void 0 : ref.current) || undefined, htmlAttributes: { id: 'default-dialog' }, children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsx(Dialog.Content, { children: "This is where you put your content" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
31
31
|
};
|
|
32
32
|
export default Component;
|
|
33
33
|
//# sourceMappingURL=dialog-default.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-default.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,GAAG,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAEhD,OAAO,CACL,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,mFAAmF,aAE7F,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"dialog-default.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;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O,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useRef, useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n const ref = useRef<HTMLDivElement | null>(null);\n\n return (\n <div\n ref={ref}\n className=\"n-flex n-flex-col n-items-center n-justify-center n-relative n-h-[500px] n-w-full\"\n >\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n onClose={handleClose}\n isOpen={isOpen}\n container={ref?.current || undefined}\n htmlAttributes={{ id: 'default-dialog' }}\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Description>This is a description</Dialog.Description>\n <Dialog.Content>This is where you put your content</Dialog.Content>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -27,7 +27,7 @@ const Component = (props) => {
|
|
|
27
27
|
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
28
28
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
29
29
|
const handleClose = () => setIsOpen(false);
|
|
30
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: {
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: {
|
|
31
31
|
id: 'image-dialog',
|
|
32
32
|
}, onClose: handleClose, isOpen: isOpen, children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Image, { src: DialogExample, alt: "Example image" }), _jsx(Dialog.Description, { children: "This is a description." }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
33
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-image.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-image.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,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MAAM,EAAE,MAAM,aAEd,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,KAAK,IAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAC,eAAe,GAAG,EACxD,KAAC,MAAM,CAAC,WAAW,yCAA4C,EAC/D,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nimport DialogExample from './assets/DialogExample.png';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n htmlAttributes={{\n id: 'image-dialog',\n }}\n onClose={handleClose}\n isOpen={isOpen}\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Image src={DialogExample} alt=\"Example image\" />\n <Dialog.Description>This is a description.</Dialog.Description>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,7 +26,7 @@ const Component = (props) => {
|
|
|
26
26
|
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
27
27
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
28
28
|
const handleClose = () => setIsOpen(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
30
30
|
id: 'info-dialog',
|
|
31
31
|
}, variant: "info", children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Subtitle, { children: "This is a subtitle" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-info.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-info.story.tsx"],"names":[],"mappings":";AAAA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B,YACtC,KAAC,YAAY,IACX,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,4BAGhC,GACX,EACN,MAAC,MAAM,IACL,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE;oBACd,EAAE,EAAE,aAAa;iBAClB,EACD,OAAO,EAAC,MAAM,aAEd,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,QAAQ,qCAAqC,EACrD,KAAC,MAAM,CAAC,WAAW,wCAA2C,EAC9D,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n onClose={handleClose}\n isOpen={isOpen}\n htmlAttributes={{\n id: 'info-dialog',\n }}\n variant=\"info\"\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Subtitle>This is a subtitle</Dialog.Subtitle>\n <Dialog.Description>This is a description</Dialog.Description>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,7 +26,7 @@ const Component = (props) => {
|
|
|
26
26
|
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
27
27
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
28
28
|
const handleClose = () => setIsOpen(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: {
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: {
|
|
30
30
|
id: 'top-aligned-dialog',
|
|
31
31
|
}, className: "n-align-top n-mt-token-16", onClose: handleClose, isOpen: isOpen, children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Content, { children: "This is where you put your content" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-top-aligned.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-top-aligned.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"dialog-top-aligned.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-top-aligned.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,YAAY,IACX,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,4BAGhC,GACX,EACN,MAAC,MAAM,IACL,cAAc,EAAE;oBACd,EAAE,EAAE,oBAAoB;iBACzB,EACD,SAAS,EAAC,2BAA2B,EACrC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,aAEd,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,OAAO,qDAAoD,EACnE,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n htmlAttributes={{\n id: 'top-aligned-dialog',\n }}\n className=\"n-align-top n-mt-token-16\"\n onClose={handleClose}\n isOpen={isOpen}\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Content>This is where you put your content</Dialog.Content>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -30,7 +30,7 @@ const Component = (props) => {
|
|
|
30
30
|
setIsOpen((prev) => !prev);
|
|
31
31
|
};
|
|
32
32
|
const handleClose = () => setIsOpen(false);
|
|
33
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "n-flex n-justify-center n-gap-token-16", children: [_jsx(FilledButton, { onClick: () => handleClick('info'), children: "Info Dialog" }), _jsx(FilledButton, { onClick: () => handleClick('warning'), children: "Warning Dialog" }), _jsx(FilledButton, { onClick: () => handleClick('danger'), children: "Danger Dialog" })] }), _jsxs(Dialog, { htmlAttributes: {
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "n-flex n-justify-center n-gap-token-16", children: [_jsx(FilledButton, { onClick: () => handleClick('info'), htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Info Dialog" }), _jsx(FilledButton, { onClick: () => handleClick('warning'), htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Warning Dialog" }), _jsx(FilledButton, { onClick: () => handleClick('danger'), htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Danger Dialog" })] }), _jsxs(Dialog, { htmlAttributes: {
|
|
34
34
|
id: `${variant}-dialog`,
|
|
35
35
|
}, onClose: handleClose, isOpen: isOpen, variant: variant, children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Subtitle, { children: "This is a subtitle" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
36
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-variants.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-variants.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAEpC,SAAS,CAAC,CAAC;IACb,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,CAClB,OAAuD,EACvD,EAAE;QACF,UAAU,CAAC,OAAO,CAAC,CAAC;QACpB,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,wCAAwC,aACrD,KAAC,YAAY,
|
|
1
|
+
{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E;oBACd,EAAE,EAAE,GAAG,OAAO,SAAS;iBACxB,EACD,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,aAEhB,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,QAAQ,qCAAqC,EACrD,KAAC,MAAM,CAAC,WAAW,wCAA2C,EAC9D,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [variant, setVariant] = useState<\n React.ComponentProps<typeof Dialog>['variant'] | undefined\n >(undefined);\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = (\n variant: React.ComponentProps<typeof Dialog>['variant'],\n ) => {\n setVariant(variant);\n setIsOpen((prev) => !prev);\n };\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center n-gap-token-16\">\n <FilledButton\n onClick={() => handleClick('info')}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Info Dialog\n </FilledButton>\n <FilledButton\n onClick={() => handleClick('warning')}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Warning Dialog\n </FilledButton>\n <FilledButton\n onClick={() => handleClick('danger')}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Danger Dialog\n </FilledButton>\n </div>\n <Dialog\n htmlAttributes={{\n id: `${variant}-dialog`,\n }}\n onClose={handleClose}\n isOpen={isOpen}\n variant={variant}\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Subtitle>This is a subtitle</Dialog.Subtitle>\n <Dialog.Description>This is a description</Dialog.Description>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,7 +26,7 @@ const Component = (props) => {
|
|
|
26
26
|
const [isOpen, setIsOpen] = useState(props.isOpen);
|
|
27
27
|
const handleClick = () => setIsOpen((prev) => !prev);
|
|
28
28
|
const handleClose = () => setIsOpen(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }) }), _jsxs(Dialog, { onClose: handleClose, isOpen: isOpen, htmlAttributes: {
|
|
30
30
|
id: 'warning-dialog',
|
|
31
31
|
}, variant: "warning", children: [_jsx(Dialog.Header, { children: "Header" }), _jsx(Dialog.Subtitle, { children: "This is a subtitle" }), _jsx(Dialog.Description, { children: "This is a description" }), _jsxs(Dialog.Actions, { children: [_jsx(OutlinedButton, { onClick: handleClose, variant: "neutral", size: "medium", children: "Secondary" }), _jsx(FilledButton, { onClick: handleClose, size: "medium", children: "Primary" })] })] })] }));
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-warning.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-warning.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"dialog-warning.story.js","sourceRoot":"","sources":["../../../../src/dialog/stories/dialog-warning.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,YAAY,IACX,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,4BAGhC,GACX,EACN,MAAC,MAAM,IACL,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE;oBACd,EAAE,EAAE,gBAAgB;iBACrB,EACD,OAAO,EAAC,SAAS,aAEjB,KAAC,MAAM,CAAC,MAAM,yBAAuB,EACrC,KAAC,MAAM,CAAC,QAAQ,qCAAqC,EACrD,KAAC,MAAM,CAAC,WAAW,wCAA2C,EAC9D,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,cAAc,IAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,0BAEpD,EACjB,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAC,QAAQ,wBAElC,IACA,IACV,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = (props: { isOpen: boolean }) => {\n const [isOpen, setIsOpen] = useState<boolean>(props.isOpen);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n </div>\n <Dialog\n onClose={handleClose}\n isOpen={isOpen}\n htmlAttributes={{\n id: 'warning-dialog',\n }}\n variant=\"warning\"\n >\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Subtitle>This is a subtitle</Dialog.Subtitle>\n <Dialog.Description>This is a description</Dialog.Description>\n <Dialog.Actions>\n <OutlinedButton onClick={handleClose} variant=\"neutral\" size=\"medium\">\n Secondary\n </OutlinedButton>\n <FilledButton onClick={handleClose} size=\"medium\">\n Primary\n </FilledButton>\n </Dialog.Actions>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -31,6 +31,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
33
|
import classNames from 'classnames';
|
|
34
|
+
import { ButtonSpinner } from '../_common/ButtonSpinner';
|
|
34
35
|
import { ChevronDownIconOutline } from '../icons';
|
|
35
36
|
/**
|
|
36
37
|
*
|
|
@@ -40,18 +41,31 @@ import { ChevronDownIconOutline } from '../icons';
|
|
|
40
41
|
*
|
|
41
42
|
*/
|
|
42
43
|
export const DropdownButton = function DropdownButton(_a) {
|
|
43
|
-
var { as, children, size = 'medium', isDisabled = false, isFloating = false, leadingElement, isOpen = false, onClick, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "children", "size", "isDisabled", "isFloating", "leadingElement", "isOpen", "onClick", "className", "style", "htmlAttributes", "ref"]);
|
|
44
|
+
var { as, children, size = 'medium', isDisabled = false, isFloating = false, leadingElement, isOpen = false, onClick, className, style, htmlAttributes, ref, isLoading = false, loadingMessage = 'Loading' } = _a, restProps = __rest(_a, ["as", "children", "size", "isDisabled", "isFloating", "leadingElement", "isOpen", "onClick", "className", "style", "htmlAttributes", "ref", "isLoading", "loadingMessage"]);
|
|
45
|
+
const Component = as !== null && as !== void 0 ? as : 'button';
|
|
44
46
|
const classes = classNames('ndl-dropdown-btn', className, {
|
|
45
47
|
'ndl-disabled': isDisabled,
|
|
46
48
|
'ndl-floating-btn': isFloating,
|
|
47
49
|
'ndl-large': size === 'large',
|
|
50
|
+
'ndl-loading': isLoading,
|
|
48
51
|
'ndl-medium': size === 'medium',
|
|
49
52
|
'ndl-open': isOpen,
|
|
50
53
|
'ndl-small': size === 'small',
|
|
51
54
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
55
|
+
const isInteractable = !isDisabled && !isLoading;
|
|
56
|
+
const handleClick = (e) => {
|
|
57
|
+
// If the button is disabled or loading, we don't want to call the onClick handler. The loading is only aria-disabled, so we need this.
|
|
58
|
+
if (!isInteractable) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (onClick) {
|
|
64
|
+
onClick(e);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (_jsx(Component, Object.assign({ className: classes, disabled: isDisabled, "aria-disabled": !isInteractable, onClick: handleClick, "aria-expanded": isOpen, ref: ref, style: style }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-dropdown-btn-inner", children: [_jsxs("div", { className: "ndl-dropdown-btn-leading-wrapper", children: [leadingElement, _jsx("span", { className: "ndl-dropdown-btn-content", children: children })] }), _jsx(ChevronDownIconOutline, { className: classNames('ndl-dropdown-button-icon', {
|
|
54
68
|
'ndl-dropdown-button-icon-open': isOpen,
|
|
55
|
-
}) })] }) })));
|
|
69
|
+
}) }), isLoading && (_jsx(ButtonSpinner, { loadingMessage: loadingMessage, size: size }))] }) })));
|
|
56
70
|
};
|
|
57
71
|
//# sourceMappingURL=DropdownButton.js.map
|