@mantine/core 9.0.0-alpha.6 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Autocomplete/Autocomplete.cjs +1 -0
- package/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/cjs/components/Badge/Badge.module.cjs.map +1 -1
- package/cjs/components/Button/Button.module.cjs.map +1 -1
- package/cjs/components/Checkbox/Checkbox.cjs +2 -1
- package/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
- package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs +2 -1
- package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs.map +1 -1
- package/cjs/components/Chip/Chip.module.cjs.map +1 -1
- package/cjs/components/Combobox/use-combobox-target-props/use-combobox-target-props.cjs +1 -0
- package/cjs/components/Combobox/use-combobox-target-props/use-combobox-target-props.cjs.map +1 -1
- package/cjs/components/MultiSelect/MultiSelect.cjs +1 -0
- package/cjs/components/MultiSelect/MultiSelect.cjs.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.cjs +2 -0
- package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
- package/cjs/components/Pill/Pill.module.cjs.map +1 -1
- package/cjs/components/Popover/PopoverTarget/PopoverTarget.cjs +2 -2
- package/cjs/components/Popover/PopoverTarget/PopoverTarget.cjs.map +1 -1
- package/cjs/components/Radio/Radio.cjs +1 -1
- package/cjs/components/Radio/Radio.cjs.map +1 -1
- package/cjs/components/SegmentedControl/SegmentedControl.module.cjs.map +1 -1
- package/cjs/components/Select/Select.cjs +7 -6
- package/cjs/components/Select/Select.cjs.map +1 -1
- package/cjs/components/Stepper/Stepper.cjs.map +1 -1
- package/cjs/components/Stepper/Stepper.module.cjs +1 -0
- package/cjs/components/Stepper/Stepper.module.cjs.map +1 -1
- package/cjs/components/Stepper/StepperStep/StepperStep.cjs +8 -5
- package/cjs/components/Stepper/StepperStep/StepperStep.cjs.map +1 -1
- package/cjs/components/TagsInput/TagsInput.cjs +1 -0
- package/cjs/components/TagsInput/TagsInput.cjs.map +1 -1
- package/cjs/components/Timeline/TimelineItem/TimelineItem.cjs +1 -1
- package/cjs/components/Timeline/TimelineItem/TimelineItem.cjs.map +1 -1
- package/cjs/core/MantineProvider/default-theme.cjs +1 -1
- package/cjs/core/MantineProvider/default-theme.cjs.map +1 -1
- package/esm/components/Autocomplete/Autocomplete.mjs +1 -0
- package/esm/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/esm/components/Badge/Badge.module.mjs.map +1 -1
- package/esm/components/Button/Button.module.mjs.map +1 -1
- package/esm/components/Checkbox/Checkbox.mjs +2 -1
- package/esm/components/Checkbox/Checkbox.mjs.map +1 -1
- package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs +2 -1
- package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs.map +1 -1
- package/esm/components/Chip/Chip.module.mjs.map +1 -1
- package/esm/components/Combobox/use-combobox-target-props/use-combobox-target-props.mjs +1 -0
- package/esm/components/Combobox/use-combobox-target-props/use-combobox-target-props.mjs.map +1 -1
- package/esm/components/MultiSelect/MultiSelect.mjs +1 -0
- package/esm/components/MultiSelect/MultiSelect.mjs.map +1 -1
- package/esm/components/PasswordInput/PasswordInput.mjs +2 -0
- package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
- package/esm/components/Pill/Pill.module.mjs.map +1 -1
- package/esm/components/Popover/PopoverTarget/PopoverTarget.mjs +2 -2
- package/esm/components/Popover/PopoverTarget/PopoverTarget.mjs.map +1 -1
- package/esm/components/Radio/Radio.mjs +1 -1
- package/esm/components/Radio/Radio.mjs.map +1 -1
- package/esm/components/SegmentedControl/SegmentedControl.module.mjs.map +1 -1
- package/esm/components/Select/Select.mjs +7 -6
- package/esm/components/Select/Select.mjs.map +1 -1
- package/esm/components/Stepper/Stepper.mjs.map +1 -1
- package/esm/components/Stepper/Stepper.module.mjs +1 -0
- package/esm/components/Stepper/Stepper.module.mjs.map +1 -1
- package/esm/components/Stepper/StepperStep/StepperStep.mjs +8 -5
- package/esm/components/Stepper/StepperStep/StepperStep.mjs.map +1 -1
- package/esm/components/TagsInput/TagsInput.mjs +1 -0
- package/esm/components/TagsInput/TagsInput.mjs.map +1 -1
- package/esm/components/Timeline/TimelineItem/TimelineItem.mjs +1 -1
- package/esm/components/Timeline/TimelineItem/TimelineItem.mjs.map +1 -1
- package/esm/core/MantineProvider/default-theme.mjs +1 -1
- package/esm/core/MantineProvider/default-theme.mjs.map +1 -1
- package/esm/core/utils/get-env/get-env.mjs +1 -1
- package/esm/core/utils/get-env/get-env.mjs.map +1 -1
- package/lib/components/Combobox/use-combobox-target-props/use-combobox-target-props.d.ts +0 -16
- package/lib/components/Input/InputClearSection/InputClearSection.d.ts +1 -1
- package/lib/components/Input/use-input-props.d.ts +18 -18
- package/lib/components/Popover/use-popover.d.ts +2 -2
- package/lib/components/Stepper/Stepper.d.ts +1 -1
- package/lib/components/Stepper/StepperStep/StepperStep.d.ts +1 -1
- package/lib/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.d.ts +2 -2
- package/package.json +4 -4
- package/styles/Badge.css +2 -0
- package/styles/Badge.layer.css +2 -0
- package/styles/Button.css +2 -0
- package/styles/Button.layer.css +2 -0
- package/styles/Chip.css +2 -0
- package/styles/Chip.layer.css +2 -0
- package/styles/Pill.css +5 -2
- package/styles/Pill.layer.css +5 -2
- package/styles/SegmentedControl.css +3 -3
- package/styles/SegmentedControl.layer.css +3 -3
- package/styles/Stepper.css +4 -0
- package/styles/Stepper.layer.css +4 -0
- package/styles/default-css-variables.css +1 -1
- package/styles/default-css-variables.layer.css +1 -1
- package/styles.css +19 -6
- package/styles.layer.css +19 -6
- package/cjs/components/MaskInput/MaskInput.cjs +0 -24
- package/cjs/components/MaskInput/MaskInput.cjs.map +0 -1
- package/cjs/components/MaskInput/use-mask-input-props.cjs +0 -29
- package/cjs/components/MaskInput/use-mask-input-props.cjs.map +0 -1
- package/cjs/components/Pagination/PaginationLabel/PaginationLabel.cjs +0 -33
- package/cjs/components/Pagination/PaginationLabel/PaginationLabel.cjs.map +0 -1
- package/cjs/components/RollingNumber/DigitColumn.cjs +0 -41
- package/cjs/components/RollingNumber/DigitColumn.cjs.map +0 -1
- package/cjs/components/RollingNumber/RollingNumber.cjs +0 -100
- package/cjs/components/RollingNumber/RollingNumber.cjs.map +0 -1
- package/cjs/components/RollingNumber/RollingNumber.module.cjs +0 -12
- package/cjs/components/RollingNumber/RollingNumber.module.cjs.map +0 -1
- package/cjs/components/RollingNumber/build-value.cjs +0 -22
- package/cjs/components/RollingNumber/build-value.cjs.map +0 -1
- package/cjs/components/RollingNumber/get-digit-parts.cjs +0 -40
- package/cjs/components/RollingNumber/get-digit-parts.cjs.map +0 -1
- package/cjs/components/RollingNumber/get-render-slots.cjs +0 -78
- package/cjs/components/RollingNumber/get-render-slots.cjs.map +0 -1
- package/cjs/components/Tree/FlatTreeNode.cjs +0 -102
- package/cjs/components/Tree/FlatTreeNode.cjs.map +0 -1
- package/cjs/components/Tree/filter-tree-data/filter-tree-data.cjs +0 -23
- package/cjs/components/Tree/filter-tree-data/filter-tree-data.cjs.map +0 -1
- package/cjs/components/Tree/flatten-tree-data/flatten-tree-data.cjs +0 -28
- package/cjs/components/Tree/flatten-tree-data/flatten-tree-data.cjs.map +0 -1
- package/cjs/components/Tree/merge-async-children/merge-async-children.cjs +0 -32
- package/cjs/components/Tree/merge-async-children/merge-async-children.cjs.map +0 -1
- package/cjs/components/Tree/move-tree-node/move-tree-node.cjs +0 -78
- package/cjs/components/Tree/move-tree-node/move-tree-node.cjs.map +0 -1
- package/cjs/components/Tree/use-tree-node-drag-drop.cjs +0 -96
- package/cjs/components/Tree/use-tree-node-drag-drop.cjs.map +0 -1
- package/cjs/components/TreeSelect/TreeSelect.cjs +0 -594
- package/cjs/components/TreeSelect/TreeSelect.cjs.map +0 -1
- package/cjs/components/TreeSelect/TreeSelect.module.cjs +0 -16
- package/cjs/components/TreeSelect/TreeSelect.module.cjs.map +0 -1
- package/cjs/components/TreeSelect/TreeSelectOption.cjs +0 -91
- package/cjs/components/TreeSelect/TreeSelectOption.cjs.map +0 -1
- package/cjs/components/TreeSelect/flatten-tree-select-data.cjs +0 -34
- package/cjs/components/TreeSelect/flatten-tree-select-data.cjs.map +0 -1
- package/cjs/components/TreeSelect/get-checked-values-by-strategy.cjs +0 -30
- package/cjs/components/TreeSelect/get-checked-values-by-strategy.cjs.map +0 -1
- package/esm/components/MaskInput/MaskInput.mjs +0 -23
- package/esm/components/MaskInput/MaskInput.mjs.map +0 -1
- package/esm/components/MaskInput/use-mask-input-props.mjs +0 -28
- package/esm/components/MaskInput/use-mask-input-props.mjs.map +0 -1
- package/esm/components/Pagination/PaginationLabel/PaginationLabel.mjs +0 -32
- package/esm/components/Pagination/PaginationLabel/PaginationLabel.mjs.map +0 -1
- package/esm/components/RollingNumber/DigitColumn.mjs +0 -40
- package/esm/components/RollingNumber/DigitColumn.mjs.map +0 -1
- package/esm/components/RollingNumber/RollingNumber.mjs +0 -99
- package/esm/components/RollingNumber/RollingNumber.mjs.map +0 -1
- package/esm/components/RollingNumber/RollingNumber.module.mjs +0 -12
- package/esm/components/RollingNumber/RollingNumber.module.mjs.map +0 -1
- package/esm/components/RollingNumber/build-value.mjs +0 -22
- package/esm/components/RollingNumber/build-value.mjs.map +0 -1
- package/esm/components/RollingNumber/get-digit-parts.mjs +0 -40
- package/esm/components/RollingNumber/get-digit-parts.mjs.map +0 -1
- package/esm/components/RollingNumber/get-render-slots.mjs +0 -78
- package/esm/components/RollingNumber/get-render-slots.mjs.map +0 -1
- package/esm/components/Tree/FlatTreeNode.mjs +0 -101
- package/esm/components/Tree/FlatTreeNode.mjs.map +0 -1
- package/esm/components/Tree/filter-tree-data/filter-tree-data.mjs +0 -22
- package/esm/components/Tree/filter-tree-data/filter-tree-data.mjs.map +0 -1
- package/esm/components/Tree/flatten-tree-data/flatten-tree-data.mjs +0 -28
- package/esm/components/Tree/flatten-tree-data/flatten-tree-data.mjs.map +0 -1
- package/esm/components/Tree/merge-async-children/merge-async-children.mjs +0 -32
- package/esm/components/Tree/merge-async-children/merge-async-children.mjs.map +0 -1
- package/esm/components/Tree/move-tree-node/move-tree-node.mjs +0 -78
- package/esm/components/Tree/move-tree-node/move-tree-node.mjs.map +0 -1
- package/esm/components/Tree/use-tree-node-drag-drop.mjs +0 -96
- package/esm/components/Tree/use-tree-node-drag-drop.mjs.map +0 -1
- package/esm/components/TreeSelect/TreeSelect.mjs +0 -593
- package/esm/components/TreeSelect/TreeSelect.mjs.map +0 -1
- package/esm/components/TreeSelect/TreeSelect.module.mjs +0 -16
- package/esm/components/TreeSelect/TreeSelect.module.mjs.map +0 -1
- package/esm/components/TreeSelect/TreeSelectOption.mjs +0 -90
- package/esm/components/TreeSelect/TreeSelectOption.mjs.map +0 -1
- package/esm/components/TreeSelect/flatten-tree-select-data.mjs +0 -34
- package/esm/components/TreeSelect/flatten-tree-select-data.mjs.map +0 -1
- package/esm/components/TreeSelect/get-checked-values-by-strategy.mjs +0 -29
- package/esm/components/TreeSelect/get-checked-values-by-strategy.mjs.map +0 -1
- package/lib/components/MaskInput/MaskInput.d.ts +0 -68
- package/lib/components/MaskInput/index.d.ts +0 -7
- package/lib/components/MaskInput/use-mask-input-props.d.ts +0 -428
- package/lib/components/Pagination/PaginationLabel/PaginationLabel.d.ts +0 -22
- package/lib/components/RollingNumber/DigitColumn.d.ts +0 -10
- package/lib/components/RollingNumber/RollingNumber.d.ts +0 -39
- package/lib/components/RollingNumber/build-value.d.ts +0 -10
- package/lib/components/RollingNumber/get-digit-parts.d.ts +0 -12
- package/lib/components/RollingNumber/get-render-slots.d.ts +0 -35
- package/lib/components/RollingNumber/index.d.ts +0 -9
- package/lib/components/Tree/FlatTreeNode.d.ts +0 -34
- package/lib/components/Tree/filter-tree-data/filter-tree-data.d.ts +0 -4
- package/lib/components/Tree/flatten-tree-data/flatten-tree-data.d.ts +0 -15
- package/lib/components/Tree/merge-async-children/merge-async-children.d.ts +0 -2
- package/lib/components/Tree/move-tree-node/move-tree-node.d.ts +0 -11
- package/lib/components/Tree/use-tree-node-drag-drop.d.ts +0 -18
- package/lib/components/TreeSelect/TreeSelect.d.ts +0 -122
- package/lib/components/TreeSelect/TreeSelectOption.d.ts +0 -29
- package/lib/components/TreeSelect/flatten-tree-select-data.d.ts +0 -12
- package/lib/components/TreeSelect/get-checked-values-by-strategy.d.ts +0 -4
- package/lib/components/TreeSelect/index.d.ts +0 -13
- package/styles/RollingNumber.css +0 -50
- package/styles/RollingNumber.layer.css +0 -51
- package/styles/TreeSelect.css +0 -113
- package/styles/TreeSelect.layer.css +0 -114
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.module.mjs","names":[],"sources":["../../../src/components/SegmentedControl/SegmentedControl.module.css"],"sourcesContent":[".root {\n --sc-padding-xs: 2px 6px;\n --sc-padding-sm: 3px 10px;\n --sc-padding-md: 4px 14px;\n --sc-padding-lg: 7px 16px;\n --sc-padding-xl: 10px 20px;\n\n --sc-transition-duration: 200ms;\n --sc-padding: var(--sc-padding-sm);\n --sc-transition-timing-function: ease;\n --sc-font-size: var(--mantine-font-size-sm);\n\n position: relative;\n display: inline-flex;\n flex-direction: row;\n width: auto;\n border-radius: var(--sc-radius, var(--mantine-radius-default));\n overflow: hidden;\n padding: 4px;\n\n &:where([data-full-width]) {\n display: flex;\n }\n\n &:where([data-orientation='vertical']) {\n display: flex;\n flex-direction: column;\n width: max-content;\n\n &:where([data-full-width]) {\n width: auto;\n }\n }\n\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-8);\n }\n}\n\n.indicator {\n position: absolute;\n display: block;\n z-index: 1;\n border-radius: var(--sc-radius, var(--mantine-radius-default));\n\n @mixin where-light {\n box-shadow: var(--sc-shadow, none);\n background-color: var(--sc-color, var(--mantine-color-white));\n }\n\n @mixin where-dark {\n box-shadow: none;\n background-color: var(--sc-color, var(--mantine-color-dark-5));\n }\n}\n\n.label {\n -webkit-tap-highlight-color: transparent;\n font-weight: var(--mantine-font-weight-medium);\n display: block;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n user-select: none;\n border-radius: var(--sc-radius, var(--mantine-radius-default));\n font-size: var(--sc-font-size);\n padding: var(--sc-padding);\n transition: color var(--sc-transition-duration) var(--sc-transition-timing-function);\n cursor: pointer;\n\n /* outline is controlled by .input */\n outline: var(--segmented-control-outline, none);\n\n @mixin where-light {\n color: var(--mantine-color-gray-7);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-dark-1);\n }\n\n &:where([data-read-only]) {\n cursor: default;\n }\n\n fieldset:disabled &,\n &:where([data-disabled]) {\n cursor: not-allowed;\n color: var(--mantine-color-disabled-color);\n }\n\n &:where([data-active]) {\n @mixin where-light {\n color: var(--sc-label-color, var(--mantine-color-black));\n }\n\n @mixin where-dark {\n color: var(--sc-label-color, var(--mantine-color-white));\n }\n\n &::before {\n .root:where([data-initialized]) & {\n display: none;\n }\n content: '';\n inset: 0;\n z-index: 0;\n position: absolute;\n border-radius: var(--sc-radius, var(--mantine-radius-default));\n\n @mixin where-light {\n box-shadow: var(--sc-shadow, none);\n background-color: var(--sc-color, var(--mantine-color-white));\n }\n\n @mixin where-dark {\n box-shadow: none;\n background-color: var(--sc-color, var(--mantine-color-dark-5));\n }\n }\n }\n\n &:where(:not([data-disabled], [data-active], [data-read-only])) {\n @mixin hover {\n @mixin where-light {\n color: var(--mantine-color-black);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-white);\n }\n }\n }\n\n fieldset:disabled & {\n @mixin hover {\n color: var(--mantine-color-disabled-color) !important;\n }\n }\n}\n\n.input {\n height: 0;\n width: 0;\n position: absolute;\n overflow: hidden;\n white-space: nowrap;\n opacity: 0;\n\n &[data-focus-ring='auto'] {\n &:focus:focus-visible {\n & + .label {\n --segmented-control-outline: 2px solid var(--mantine-primary-color-filled);\n }\n }\n }\n\n &[data-focus-ring='always'] {\n &:focus {\n & + .label {\n --segmented-control-outline: 2px solid var(--mantine-primary-color-filled);\n }\n }\n }\n}\n\n.control {\n position: relative;\n flex: 1;\n z-index: 2;\n transition: border-color var(--sc-transition-duration) var(--sc-transition-timing-function);\n\n .root[data-with-items-borders] :where(&)::before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n inset-inline-start: 0;\n background-color: var(--separator-color);\n width: 1px;\n transition: background-color var(--sc-transition-duration) var(--sc-transition-timing-function);\n }\n\n &[data-orientation='vertical'] {\n &::before {\n top: 0;\n inset-inline: 0;\n bottom: auto;\n height: 1px;\n width: auto;\n }\n }\n\n @mixin where-light {\n --separator-color: var(--mantine-color-gray-3);\n }\n\n @mixin where-dark {\n --separator-color: var(--mantine-color-dark-4);\n }\n\n &:first-of-type {\n &::before {\n --separator-color: transparent;\n }\n }\n\n &[data-active] {\n [data-mantine-color-scheme] & {\n &,\n & + .control {\n &::before {\n --separator-color: transparent;\n }\n }\n }\n }\n}\n\n.innerLabel {\n position: relative;\n z-index: 2;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"SegmentedControl.module.mjs","names":[],"sources":["../../../src/components/SegmentedControl/SegmentedControl.module.css"],"sourcesContent":[".root {\n --sc-padding-xs: 2px 6px;\n --sc-padding-sm: 3px 10px;\n --sc-padding-md: 4px 14px;\n --sc-padding-lg: 7px 16px;\n --sc-padding-xl: 10px 20px;\n\n --sc-transition-duration: 200ms;\n --sc-padding: var(--sc-padding-sm);\n --sc-transition-timing-function: ease;\n --sc-font-size: var(--mantine-font-size-sm);\n\n position: relative;\n display: inline-flex;\n flex-direction: row;\n width: auto;\n border-radius: var(--sc-radius, var(--mantine-radius-default));\n overflow: hidden;\n padding: 4px;\n\n &:where([data-full-width]) {\n display: flex;\n }\n\n &:where([data-orientation='vertical']) {\n display: flex;\n flex-direction: column;\n width: max-content;\n\n &:where([data-full-width]) {\n width: auto;\n }\n }\n\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-8);\n }\n}\n\n.indicator {\n position: absolute;\n display: block;\n z-index: 1;\n border-radius: calc(var(--sc-radius, var(--mantine-radius-default)) - 4px);\n\n @mixin where-light {\n box-shadow: var(--sc-shadow, none);\n background-color: var(--sc-color, var(--mantine-color-white));\n }\n\n @mixin where-dark {\n box-shadow: none;\n background-color: var(--sc-color, var(--mantine-color-dark-5));\n }\n}\n\n.label {\n -webkit-tap-highlight-color: transparent;\n font-weight: var(--mantine-font-weight-medium);\n display: block;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n user-select: none;\n border-radius: calc(var(--sc-radius, var(--mantine-radius-default)) - 4px);\n font-size: var(--sc-font-size);\n padding: var(--sc-padding);\n transition: color var(--sc-transition-duration) var(--sc-transition-timing-function);\n cursor: pointer;\n\n /* outline is controlled by .input */\n outline: var(--segmented-control-outline, none);\n\n @mixin where-light {\n color: var(--mantine-color-gray-7);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-dark-1);\n }\n\n &:where([data-read-only]) {\n cursor: default;\n }\n\n fieldset:disabled &,\n &:where([data-disabled]) {\n cursor: not-allowed;\n color: var(--mantine-color-disabled-color);\n }\n\n &:where([data-active]) {\n @mixin where-light {\n color: var(--sc-label-color, var(--mantine-color-black));\n }\n\n @mixin where-dark {\n color: var(--sc-label-color, var(--mantine-color-white));\n }\n\n &::before {\n .root:where([data-initialized]) & {\n display: none;\n }\n content: '';\n inset: 0;\n z-index: 0;\n position: absolute;\n border-radius: calc(var(--sc-radius, var(--mantine-radius-default)) - 4px);\n\n @mixin where-light {\n box-shadow: var(--sc-shadow, none);\n background-color: var(--sc-color, var(--mantine-color-white));\n }\n\n @mixin where-dark {\n box-shadow: none;\n background-color: var(--sc-color, var(--mantine-color-dark-5));\n }\n }\n }\n\n &:where(:not([data-disabled], [data-active], [data-read-only])) {\n @mixin hover {\n @mixin where-light {\n color: var(--mantine-color-black);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-white);\n }\n }\n }\n\n fieldset:disabled & {\n @mixin hover {\n color: var(--mantine-color-disabled-color) !important;\n }\n }\n}\n\n.input {\n height: 0;\n width: 0;\n position: absolute;\n overflow: hidden;\n white-space: nowrap;\n opacity: 0;\n\n &[data-focus-ring='auto'] {\n &:focus:focus-visible {\n & + .label {\n --segmented-control-outline: 2px solid var(--mantine-primary-color-filled);\n }\n }\n }\n\n &[data-focus-ring='always'] {\n &:focus {\n & + .label {\n --segmented-control-outline: 2px solid var(--mantine-primary-color-filled);\n }\n }\n }\n}\n\n.control {\n position: relative;\n flex: 1;\n z-index: 2;\n transition: border-color var(--sc-transition-duration) var(--sc-transition-timing-function);\n\n .root[data-with-items-borders] :where(&)::before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n inset-inline-start: 0;\n background-color: var(--separator-color);\n width: 1px;\n transition: background-color var(--sc-transition-duration) var(--sc-transition-timing-function);\n }\n\n &[data-orientation='vertical'] {\n &::before {\n top: 0;\n inset-inline: 0;\n bottom: auto;\n height: 1px;\n width: auto;\n }\n }\n\n @mixin where-light {\n --separator-color: var(--mantine-color-gray-3);\n }\n\n @mixin where-dark {\n --separator-color: var(--mantine-color-dark-4);\n }\n\n &:first-of-type {\n &::before {\n --separator-color: transparent;\n }\n }\n\n &[data-active] {\n [data-mantine-color-scheme] & {\n &,\n & + .control {\n &::before {\n --separator-color: transparent;\n }\n }\n }\n }\n}\n\n.innerLabel {\n position: relative;\n z-index: 2;\n}\n"],"mappings":""}
|
|
@@ -31,7 +31,7 @@ const Select = genericFactory((_props) => {
|
|
|
31
31
|
finalValue: null,
|
|
32
32
|
onChange
|
|
33
33
|
});
|
|
34
|
-
const selectedOption =
|
|
34
|
+
const selectedOption = _value != null ? `${_value}` in optionsLockup ? optionsLockup[`${_value}`] : retainedSelectedOptions.current[`${_value}`] : void 0;
|
|
35
35
|
const previousSelectedOption = usePrevious(selectedOption);
|
|
36
36
|
const [search, setSearch, searchControlled] = useUncontrolled({
|
|
37
37
|
value: searchValue,
|
|
@@ -66,10 +66,10 @@ const Select = genericFactory((_props) => {
|
|
|
66
66
|
}, [selectFirstOptionOnChange, search]);
|
|
67
67
|
useEffect(() => {
|
|
68
68
|
if (value === null) handleSearchChange("");
|
|
69
|
-
if (
|
|
69
|
+
if (value != null && selectedOption && (previousSelectedOption?.value !== selectedOption.value || previousSelectedOption?.label !== selectedOption.label)) handleSearchChange(selectedOption.label);
|
|
70
70
|
}, [value, selectedOption]);
|
|
71
71
|
useEffect(() => {
|
|
72
|
-
if (!controlled && !searchControlled) handleSearchChange(
|
|
72
|
+
if (!controlled && !searchControlled) handleSearchChange(_value != null ? `${_value}` in optionsLockup ? optionsLockup[`${_value}`]?.label : retainedSelectedOptions.current[`${_value}`]?.label || "" : "");
|
|
73
73
|
}, [optionsLockup, _value]);
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (_value) {
|
|
@@ -97,16 +97,17 @@ const Select = genericFactory((_props) => {
|
|
|
97
97
|
keepMounted: autoSelectOnBlur,
|
|
98
98
|
onOptionSubmit: (val) => {
|
|
99
99
|
onOptionSubmit?.(val);
|
|
100
|
-
const optionLockup = allowDeselect ? optionsLockup[val].value === _value ? null : optionsLockup[val] : optionsLockup[val];
|
|
100
|
+
const optionLockup = allowDeselect ? `${optionsLockup[val].value}` === `${_value}` ? null : optionsLockup[val] : optionsLockup[val];
|
|
101
101
|
const nextValue = optionLockup ? optionLockup.value : null;
|
|
102
102
|
nextValue !== _value && setValue(nextValue, optionLockup);
|
|
103
|
-
!controlled && handleSearchChange(
|
|
103
|
+
!controlled && handleSearchChange(nextValue != null ? optionLockup?.label || "" : "");
|
|
104
104
|
combobox.closeDropdown();
|
|
105
105
|
},
|
|
106
106
|
...comboboxProps,
|
|
107
107
|
children: [/* @__PURE__ */ jsx(Combobox.Target, {
|
|
108
108
|
targetType: searchable ? "input" : "button",
|
|
109
109
|
autoComplete,
|
|
110
|
+
withExpandedAttribute: true,
|
|
110
111
|
children: /* @__PURE__ */ jsx(InputBase, {
|
|
111
112
|
id: _id,
|
|
112
113
|
__defaultRightSection: /* @__PURE__ */ jsx(Combobox.Chevron, {
|
|
@@ -138,7 +139,7 @@ const Select = genericFactory((_props) => {
|
|
|
138
139
|
onBlur: (event) => {
|
|
139
140
|
if (autoSelectOnBlur) combobox.clickSelectedOption();
|
|
140
141
|
searchable && combobox.closeDropdown();
|
|
141
|
-
const optionLockup =
|
|
142
|
+
const optionLockup = _value != null && (`${_value}` in optionsLockup ? optionsLockup[`${_value}`] : retainedSelectedOptions.current[`${_value}`]);
|
|
142
143
|
handleSearchChange(optionLockup ? optionLockup.label || "" : "");
|
|
143
144
|
onBlur?.(event);
|
|
144
145
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.mjs","names":["useId"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps('Select', defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n typeof _value === 'string'\n ? _value in optionsLockup\n ? optionsLockup[_value]\n : retainedSelectedOptions.current[_value]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n typeof value === 'string' &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n typeof _value === 'string'\n ? _value in optionsLockup\n ? optionsLockup[_value]?.label\n : retainedSelectedOptions.current[_value]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && !!_value && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? optionsLockup[val].value === _value\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled &&\n handleSearchChange(typeof nextValue === 'string' ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target targetType={searchable ? 'input' : 'button'} autoComplete={autoComplete}>\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n typeof _value === 'string' &&\n (_value in optionsLockup\n ? optionsLockup[_value]\n : retainedSelectedOptions.current[_value]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe;CACnB,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;CACd;AAED,MAAa,SAAS,gBAA+B,WAAW;CAC9D,MAAM,QAAQ,SAAS,UAAU,cAAc,OAAO;CACtD,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,aAAa,cAAc,sBAAsB,KAAK,EAAE,CAAC,KAAK,CAAC;CACrE,MAAM,0BAA0B,OAAgD,EAAE,CAAC;CACnF,MAAM,gBAAgB,cAAc,iBAAiB,WAAW,EAAE,CAAC,WAAW,CAAC;CAC/E,MAAM,MAAMA,QAAM,GAAG;CAErB,MAAM,CAAC,QAAQ,UAAU,cAAc,gBAAgB;EACrD;EACA;EACA,YAAY;EACZ;EACD,CAAC;CAEF,MAAM,iBACJ,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AAG;AAChE,cAAS,MAAM;;IAEjB,UAAU,UAAU;AAClB,kBAAa,SAAS,cAAc,GAAG,SAAS,gBAAgB;AAChE,eAAU,MAAM;;IAElB,YAAY;IACZ,QAAQ;IACE;IACV,SAAS,CAAC;IACH;IACK;IACZ,CAAA;GACc,CAAA,EAClB,oBAAC,iBAAD;GACE,MAAM;GACN,QAAQ,YAAY;GACZ;GACA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;GACjB,CAAA,CACO;KACX,oBAAC,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;EACJ,CAAA,CACD,EAAA,CAAA;EAEL;AAEF,OAAO,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS;AAC9D,OAAO,cAAc"}
|
|
1
|
+
{"version":3,"file":"Select.mjs","names":["useId"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps('Select', defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && !!_value && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\n >\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe;CACnB,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;CACd;AAED,MAAa,SAAS,gBAA+B,WAAW;CAC9D,MAAM,QAAQ,SAAS,UAAU,cAAc,OAAO;CACtD,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,aAAa,cAAc,sBAAsB,KAAK,EAAE,CAAC,KAAK,CAAC;CACrE,MAAM,0BAA0B,OAAgD,EAAE,CAAC;CACnF,MAAM,gBAAgB,cAAc,iBAA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AU,MAAM;;IAElB,SAAS,UAAU;AACjB,SAAI,iBACF,UAAS,qBAAqB;AAG9B,mBAAc,SAAS,eAAe;KACxC,MAAM,eACJ,UAAU,SACT,GAAG,YAAY,gBACZ,cAAc,GAAG,YACjB,wBAAwB,QAAQ,GAAG;AACzC,wBAAmB,eAAe,aAAa,SAAS,KAAK,GAAG;AAChE,cAAS,MAAM;;IAEjB,UAAU,UAAU;AAClB,kBAAa,SAAS,cAAc,GAAG,SAAS,gBAAgB;AAChE,eAAU,MAAM;;IAElB,YAAY;IACZ,QAAQ;IACE;IACV,SAAS,CAAC;IACH;IACK;IACZ,CAAA;GACc,CAAA,EAClB,oBAAC,iBAAD;GACE,MAAM;GACN,QAAQ,YAAY;GACZ;GACA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;GACjB,CAAA,CACO;KACX,oBAAC,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;EACJ,CAAA,CACD,EAAA,CAAA;EAEL;AAEF,OAAO,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS;AAC9D,OAAO,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.mjs","names":["classes"],"sources":["../../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { Activity, Children, cloneElement } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getFontSize,\n getRadius,\n getSize,\n getSpacing,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n MantineSpacing,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { StepperProvider } from './Stepper.context';\nimport { StepperCompleted, StepperCompletedProps } from './StepperCompleted/StepperCompleted';\nimport { StepperStep, StepperStepProps } from './StepperStep/StepperStep';\nimport classes from './Stepper.module.css';\n\nexport type StepFragmentComponent = React.FC<{ step: number }>;\n\nexport type StepperStylesNames =\n | 'root'\n | 'separator'\n | 'steps'\n | 'content'\n | 'step'\n | 'stepLoader'\n | 'verticalSeparator'\n | 'stepWrapper'\n | 'stepIcon'\n | 'stepCompletedIcon'\n | 'stepBody'\n | 'stepLabel'\n | 'stepDescription';\n\nexport type StepperCssVariables = {\n root:\n | '--stepper-color'\n | '--stepper-icon-color'\n | '--stepper-icon-size'\n | '--stepper-content-padding'\n | '--stepper-radius'\n | '--stepper-fz'\n | '--stepper-spacing';\n};\n\nexport interface StepperProps\n extends BoxProps, StylesApiProps<StepperFactory>, ElementProps<'div'> {\n /** `Stepper.Step` components */\n children: React.ReactNode;\n\n /** Called when a clickable step is clicked with its 0-based index. Not called for the currently active step. */\n onStepClick?: (stepIndex: number) => void;\n\n /** Index of the active step */\n active: number;\n\n /** Step icon @default step index + 1 */\n icon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is completed @default CheckIcon */\n completedIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is in progress @default step index + 1 */\n progressIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Key of `theme.colors` or any valid CSS color, controls colors of active and progress steps @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the step icon, by default icon size is inferred from `size` prop */\n iconSize?: number | string;\n\n /** Key of `theme.spacing` or any valid CSS value to set `padding-top` of the content @default 'md' */\n contentPadding?: MantineSpacing;\n\n /** Stepper orientation @default 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n\n /** Icon position relative to the step body @default 'left' */\n iconPosition?: 'right' | 'left';\n\n /** Controls size of various Stepper elements */\n size?: MantineSize;\n\n /** Key of `theme.radius` or any valid CSS value to set steps border-radius @default \"xl\" */\n radius?: MantineRadius;\n\n /** When true, users can click and jump to any step. When false, users can only navigate to completed steps @default true */\n allowNextStepsSelect?: boolean;\n\n /** Determines whether steps should wrap to the next line if no space is available @default true */\n wrap?: boolean;\n\n /** When true, automatically adjusts the icon color in completed steps to ensure sufficient contrast against the step background color */\n autoContrast?: boolean;\n\n /** If set, all step content is kept mounted. React 19 `Activity` is used to preserve state while content is hidden. @default false */\n keepMounted?: boolean;\n}\n\nexport type StepperFactory = Factory<{\n props: StepperProps;\n ref: HTMLDivElement;\n stylesNames: StepperStylesNames;\n vars: StepperCssVariables;\n staticComponents: {\n Step: typeof StepperStep;\n Completed: typeof StepperCompleted;\n };\n}>;\n\nconst defaultProps = {\n orientation: 'horizontal',\n iconPosition: 'left',\n allowNextStepsSelect: true,\n wrap: true,\n} satisfies Partial<StepperProps>;\n\nconst varsResolver = createVarsResolver<StepperFactory>(\n (theme, { color, iconSize, size, contentPadding, radius, autoContrast }) => ({\n root: {\n '--stepper-color': color ? getThemeColor(color, theme) : undefined,\n '--stepper-icon-color': getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n '--stepper-icon-size':\n iconSize === undefined ? getSize(size, 'stepper-icon-size') : rem(iconSize),\n '--stepper-content-padding': getSpacing(contentPadding),\n '--stepper-radius': radius === undefined ? undefined : getRadius(radius),\n '--stepper-fz': getFontSize(size),\n '--stepper-spacing': getSpacing(size),\n },\n })\n);\n\nexport const Stepper = factory<StepperFactory>((_props) => {\n const props = useProps('Stepper', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n children,\n onStepClick,\n active,\n icon,\n completedIcon,\n progressIcon,\n color,\n iconSize,\n contentPadding,\n orientation,\n iconPosition,\n size,\n radius,\n allowNextStepsSelect,\n wrap,\n autoContrast,\n keepMounted,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<StepperFactory>({\n name: 'Stepper',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const convertedChildren = Children.toArray(children) as React.ReactElement[];\n const _children = convertedChildren.filter(\n (child) => child.type !== StepperCompleted\n ) as React.ReactElement<StepperStepProps>[];\n const completedStep = convertedChildren.find(\n (item) => item.type === StepperCompleted\n ) as React.ReactElement<StepperCompletedProps>;\n\n const items = _children.reduce<React.ReactElement<StepperStepProps>[]>(\n (acc, item: React.ReactElement<StepperStepProps>, index) => {\n const state =\n active === index ? 'stepProgress' : active > index ? 'stepCompleted' : 'stepInactive';\n\n const shouldAllowSelect = () => {\n if (typeof onStepClick !== 'function') {\n return false;\n }\n\n if (typeof item.props.allowStepSelect === 'boolean') {\n return item.props.allowStepSelect;\n }\n\n return state === 'stepCompleted' || allowNextStepsSelect;\n };\n\n const isStepSelectionEnabled = shouldAllowSelect();\n\n acc.push(\n cloneElement(item, {\n icon: item.props.icon || icon || index + 1,\n key: index,\n step: index,\n state,\n onClick: () => isStepSelectionEnabled && onStepClick?.(index),\n allowStepClick: isStepSelectionEnabled,\n completedIcon: item.props.completedIcon || completedIcon,\n progressIcon: item.props.progressIcon || progressIcon,\n color: item.props.color || color,\n iconSize,\n iconPosition: item.props.iconPosition || iconPosition,\n orientation,\n })\n );\n\n if (orientation === 'horizontal' && index !== _children.length - 1) {\n acc.push(\n <div\n {...getStyles('separator')}\n data-active={index < active || undefined}\n data-orientation={orientation}\n key={`separator-${index}`}\n />\n );\n }\n\n return acc;\n },\n []\n );\n\n const stepContent = _children[active]?.props?.children;\n const completedContent = completedStep?.props?.children;\n const content = active > _children.length - 1 ? completedContent : stepContent;\n\n const contentSection = keepMounted ? (\n <>\n {_children.map((child, index) => (\n <Activity key={index} mode={active === index ? 'visible' : 'hidden'}>\n <div {...getStyles('content')}>{child.props.children}</div>\n </Activity>\n ))}\n {completedStep && (\n <Activity mode={active > _children.length - 1 ? 'visible' : 'hidden'}>\n <div {...getStyles('content')}>{completedStep.props.children}</div>\n </Activity>\n )}\n </>\n ) : (\n content && <div {...getStyles('content')}>{content}</div>\n );\n\n return (\n <StepperProvider value={{ getStyles, orientation, iconPosition }}>\n <Box {...getStyles('root')} size={size} {...others}>\n <Box\n {...getStyles('steps')}\n mod={{\n orientation,\n 'icon-position': iconPosition,\n wrap: wrap && orientation !== 'vertical',\n }}\n >\n {items}\n </Box>\n {contentSection}\n </Box>\n </StepperProvider>\n );\n});\n\nStepper.classes = classes;\nStepper.varsResolver = varsResolver;\nStepper.displayName = '@mantine/core/Stepper';\nStepper.Completed = StepperCompleted;\nStepper.Step = StepperStep;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0HA,MAAM,eAAe;CACnB,aAAa;CACb,cAAc;CACd,sBAAsB;CACtB,MAAM;CACP;AAED,MAAM,eAAe,oBAClB,OAAO,EAAE,OAAO,UAAU,MAAM,gBAAgB,QAAQ,oBAAoB,EAC3E,MAAM;CACJ,mBAAmB,QAAQ,cAAc,OAAO,MAAM,GAAG,KAAA;CACzD,wBAAwB,qBAAqB,cAAc,MAAM,GAC7D,iBAAiB;EAAE;EAAO;EAAO;EAAc,CAAC,GAChD,KAAA;CACJ,uBACE,aAAa,KAAA,IAAY,QAAQ,MAAM,oBAAoB,GAAG,IAAI,SAAS;CAC7E,6BAA6B,WAAW,eAAe;CACvD,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,OAAO;CACxE,gBAAgB,YAAY,KAAK;CACjC,qBAAqB,WAAW,KAAK;CACtC,EACF,EACF;AAED,MAAa,UAAU,SAAyB,WAAW;CACzD,MAAM,QAAQ,SAAS,WAAW,cAAc,OAAO;CACvD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,aACA,QACA,MACA,eACA,cACA,OACA,UACA,gBACA,aACA,cACA,MACA,QACA,sBACA,MACA,cACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAA0B;EAC1C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,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AK,GAAI,UAAU,UAAU;aAAG,MAAM,MAAM;GAAe,CAAA;EAClD,EAFI,MAEJ,CACX,EACD,iBACC,oBAAC,UAAD;EAAU,MAAM,SAAS,UAAU,SAAS,IAAI,YAAY;YAC1D,oBAAC,OAAD;GAAK,GAAI,UAAU,UAAU;aAAG,cAAc,MAAM;GAAe,CAAA;EAC1D,CAAA,CAEZ,EAAA,CAAA,GAEH,WAAW,oBAAC,OAAD;EAAK,GAAI,UAAU,UAAU;YAAG;EAAc,CAAA;AAG3D,QACE,oBAAC,iBAAD;EAAiB,OAAO;GAAE;GAAW;GAAa;GAAc;YAC9D,qBAAC,KAAD;GAAK,GAAI,UAAU,OAAO;GAAQ;GAAM,GAAI;aAA5C,CACE,oBAAC,KAAD;IACE,GAAI,UAAU,QAAQ;IACtB,KAAK;KACH;KACA,iBAAiB;KACjB,MAAM,QAAQ,gBAAgB;KAC/B;cAEA;IACG,CAAA,EACL,eACG;;EACU,CAAA;EAEpB;AAEF,QAAQ,UAAUA;AAClB,QAAQ,eAAe;AACvB,QAAQ,cAAc;AACtB,QAAQ,YAAY;AACpB,QAAQ,OAAO"}
|
|
1
|
+
{"version":3,"file":"Stepper.mjs","names":["classes"],"sources":["../../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { Activity, Children, cloneElement } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getFontSize,\n getRadius,\n getSize,\n getSpacing,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n MantineSpacing,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { StepperProvider } from './Stepper.context';\nimport { StepperCompleted, StepperCompletedProps } from './StepperCompleted/StepperCompleted';\nimport { StepperStep, StepperStepProps } from './StepperStep/StepperStep';\nimport classes from './Stepper.module.css';\n\nexport type StepFragmentComponent = React.FC<{ step: number }>;\n\nexport type StepperStylesNames =\n | 'root'\n | 'separator'\n | 'steps'\n | 'content'\n | 'step'\n | 'stepLoader'\n | 'verticalSeparator'\n | 'stepWrapper'\n | 'stepIcon'\n | 'stepCompletedIcon'\n | 'stepIconContent'\n | 'stepBody'\n | 'stepLabel'\n | 'stepDescription';\n\nexport type StepperCssVariables = {\n root:\n | '--stepper-color'\n | '--stepper-icon-color'\n | '--stepper-icon-size'\n | '--stepper-content-padding'\n | '--stepper-radius'\n | '--stepper-fz'\n | '--stepper-spacing';\n};\n\nexport interface StepperProps\n extends BoxProps, StylesApiProps<StepperFactory>, ElementProps<'div'> {\n /** `Stepper.Step` components */\n children: React.ReactNode;\n\n /** Called when a clickable step is clicked with its 0-based index. Not called for the currently active step. */\n onStepClick?: (stepIndex: number) => void;\n\n /** Index of the active step */\n active: number;\n\n /** Step icon @default step index + 1 */\n icon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is completed @default CheckIcon */\n completedIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is in progress @default step index + 1 */\n progressIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Key of `theme.colors` or any valid CSS color, controls colors of active and progress steps @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the step icon, by default icon size is inferred from `size` prop */\n iconSize?: number | string;\n\n /** Key of `theme.spacing` or any valid CSS value to set `padding-top` of the content @default 'md' */\n contentPadding?: MantineSpacing;\n\n /** Stepper orientation @default 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n\n /** Icon position relative to the step body @default 'left' */\n iconPosition?: 'right' | 'left';\n\n /** Controls size of various Stepper elements */\n size?: MantineSize;\n\n /** Key of `theme.radius` or any valid CSS value to set steps border-radius @default \"xl\" */\n radius?: MantineRadius;\n\n /** When true, users can click and jump to any step. When false, users can only navigate to completed steps @default true */\n allowNextStepsSelect?: boolean;\n\n /** Determines whether steps should wrap to the next line if no space is available @default true */\n wrap?: boolean;\n\n /** When true, automatically adjusts the icon color in completed steps to ensure sufficient contrast against the step background color */\n autoContrast?: boolean;\n\n /** If set, all step content is kept mounted. React 19 `Activity` is used to preserve state while content is hidden. @default false */\n keepMounted?: boolean;\n}\n\nexport type StepperFactory = Factory<{\n props: StepperProps;\n ref: HTMLDivElement;\n stylesNames: StepperStylesNames;\n vars: StepperCssVariables;\n staticComponents: {\n Step: typeof StepperStep;\n Completed: typeof StepperCompleted;\n };\n}>;\n\nconst defaultProps = {\n orientation: 'horizontal',\n iconPosition: 'left',\n allowNextStepsSelect: true,\n wrap: true,\n} satisfies Partial<StepperProps>;\n\nconst varsResolver = createVarsResolver<StepperFactory>(\n (theme, { color, iconSize, size, contentPadding, radius, autoContrast }) => ({\n root: {\n '--stepper-color': color ? getThemeColor(color, theme) : undefined,\n '--stepper-icon-color': getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n '--stepper-icon-size':\n iconSize === undefined ? getSize(size, 'stepper-icon-size') : rem(iconSize),\n '--stepper-content-padding': getSpacing(contentPadding),\n '--stepper-radius': radius === undefined ? undefined : getRadius(radius),\n '--stepper-fz': getFontSize(size),\n '--stepper-spacing': getSpacing(size),\n },\n })\n);\n\nexport const Stepper = factory<StepperFactory>((_props) => {\n const props = useProps('Stepper', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n children,\n onStepClick,\n active,\n icon,\n completedIcon,\n progressIcon,\n color,\n iconSize,\n contentPadding,\n orientation,\n iconPosition,\n size,\n radius,\n allowNextStepsSelect,\n wrap,\n autoContrast,\n keepMounted,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<StepperFactory>({\n name: 'Stepper',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const convertedChildren = Children.toArray(children) as React.ReactElement[];\n const _children = convertedChildren.filter(\n (child) => child.type !== StepperCompleted\n ) as React.ReactElement<StepperStepProps>[];\n const completedStep = convertedChildren.find(\n (item) => item.type === StepperCompleted\n ) as React.ReactElement<StepperCompletedProps>;\n\n const items = _children.reduce<React.ReactElement<StepperStepProps>[]>(\n (acc, item: React.ReactElement<StepperStepProps>, index) => {\n const state =\n active === index ? 'stepProgress' : active > index ? 'stepCompleted' : 'stepInactive';\n\n const shouldAllowSelect = () => {\n if (typeof onStepClick !== 'function') {\n return false;\n }\n\n if (typeof item.props.allowStepSelect === 'boolean') {\n return item.props.allowStepSelect;\n }\n\n return state === 'stepCompleted' || allowNextStepsSelect;\n };\n\n const isStepSelectionEnabled = shouldAllowSelect();\n\n acc.push(\n cloneElement(item, {\n icon: item.props.icon || icon || index + 1,\n key: index,\n step: index,\n state,\n onClick: () => isStepSelectionEnabled && onStepClick?.(index),\n allowStepClick: isStepSelectionEnabled,\n completedIcon: item.props.completedIcon || completedIcon,\n progressIcon: item.props.progressIcon || progressIcon,\n color: item.props.color || color,\n iconSize,\n iconPosition: item.props.iconPosition || iconPosition,\n orientation,\n })\n );\n\n if (orientation === 'horizontal' && index !== _children.length - 1) {\n acc.push(\n <div\n {...getStyles('separator')}\n data-active={index < active || undefined}\n data-orientation={orientation}\n key={`separator-${index}`}\n />\n );\n }\n\n return acc;\n },\n []\n );\n\n const stepContent = _children[active]?.props?.children;\n const completedContent = completedStep?.props?.children;\n const content = active > _children.length - 1 ? completedContent : stepContent;\n\n const contentSection = keepMounted ? (\n <>\n {_children.map((child, index) => (\n <Activity key={index} mode={active === index ? 'visible' : 'hidden'}>\n <div {...getStyles('content')}>{child.props.children}</div>\n </Activity>\n ))}\n {completedStep && (\n <Activity mode={active > _children.length - 1 ? 'visible' : 'hidden'}>\n <div {...getStyles('content')}>{completedStep.props.children}</div>\n </Activity>\n )}\n </>\n ) : (\n content && <div {...getStyles('content')}>{content}</div>\n );\n\n return (\n <StepperProvider value={{ getStyles, orientation, iconPosition }}>\n <Box {...getStyles('root')} size={size} {...others}>\n <Box\n {...getStyles('steps')}\n mod={{\n orientation,\n 'icon-position': iconPosition,\n wrap: wrap && orientation !== 'vertical',\n }}\n >\n {items}\n </Box>\n {contentSection}\n </Box>\n </StepperProvider>\n );\n});\n\nStepper.classes = classes;\nStepper.varsResolver = varsResolver;\nStepper.displayName = '@mantine/core/Stepper';\nStepper.Completed = StepperCompleted;\nStepper.Step = StepperStep;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2HA,MAAM,eAAe;CACnB,aAAa;CACb,cAAc;CACd,sBAAsB;CACtB,MAAM;CACP;AAED,MAAM,eAAe,oBAClB,OAAO,EAAE,OAAO,UAAU,MAAM,gBAAgB,QAAQ,oBAAoB,EAC3E,MAAM;CACJ,mBAAmB,QAAQ,cAAc,OAAO,MAAM,GAAG,KAAA;CACzD,wBAAwB,qBAAqB,cAAc,MAAM,GAC7D,iBAAiB;EAAE;EAAO;EAAO;EAAc,CAAC,GAChD,KAAA;CACJ,uBACE,aAAa,KAAA,IAAY,QAAQ,MAAM,oBAAoB,GAAG,IAAI,SAAS;CAC7E,6BAA6B,WAAW,eAAe;CACvD,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,OAAO;CACxE,gBAAgB,YAAY,KAAK;CACjC,qBAAqB,WAAW,KAAK;CACtC,EACF,EACF;AAED,MAAa,UAAU,SAAyB,WAAW;CACzD,MAAM,QAAQ,SAAS,WAAW,cAAc,OAAO;CACvD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,aACA,QACA,MACA,eACA,cACA,OACA,UACA,gBACA,aACA,cACA,MACA,QACA,sBACA,MACA,cACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAA0B;EAC1C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,oBAAoB,SAAS,QAAQ,SAAS;CACpD,MAAM,YAAY,kBAAkB,QACjC,UAAU,MAAM,SAAS,iBAC3B;CACD,MAAM,gBAAgB,kBAAkB,MACrC,SAAS,KAAK,SAAS,iBACzB;CAED,MAAM,QAAQ,UAAU,QAC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U,UAAU;aAAG,cAAc,MAAM;GAAe,CAAA;EAC1D,CAAA,CAEZ,EAAA,CAAA,GAEH,WAAW,oBAAC,OAAD;EAAK,GAAI,UAAU,UAAU;YAAG;EAAc,CAAA;AAG3D,QACE,oBAAC,iBAAD;EAAiB,OAAO;GAAE;GAAW;GAAa;GAAc;YAC9D,qBAAC,KAAD;GAAK,GAAI,UAAU,OAAO;GAAQ;GAAM,GAAI;aAA5C,CACE,oBAAC,KAAD;IACE,GAAI,UAAU,QAAQ;IACtB,KAAK;KACH;KACA,iBAAiB;KACjB,MAAM,QAAQ,gBAAgB;KAC/B;cAEA;IACG,CAAA,EACL,eACG;;EACU,CAAA;EAEpB;AAEF,QAAQ,UAAUA;AAClB,QAAQ,eAAe;AACvB,QAAQ,cAAc;AACtB,QAAQ,YAAY;AACpB,QAAQ,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.module.mjs","names":[],"sources":["../../../src/components/Stepper/Stepper.module.css"],"sourcesContent":[".root {\n --stepper-icon-size-xs: 34px;\n --stepper-icon-size-sm: 36px;\n --stepper-icon-size-md: 42px;\n --stepper-icon-size-lg: 48px;\n --stepper-icon-size-xl: 52px;\n\n --stepper-icon-size: var(--stepper-icon-size-md);\n --stepper-color: var(--mantine-primary-color-filled);\n --stepper-content-padding: var(--mantine-spacing-md);\n --stepper-spacing: var(--mantine-spacing-md);\n --stepper-radius: 1000px;\n --stepper-fz: var(--mantine-font-size-md);\n --stepper-outline-thickness: 2px;\n\n @mixin light {\n --stepper-outline-color: var(--mantine-color-gray-2);\n }\n\n @mixin dark {\n --stepper-outline-color: var(--mantine-color-dark-5);\n }\n}\n\n.steps {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n\n &:where([data-wrap]) {\n flex-wrap: wrap;\n gap: var(--mantine-spacing-md) 0;\n }\n\n &:where([data-orientation='vertical']) {\n flex-direction: column;\n\n &:where([data-icon-position='left']) {\n align-items: flex-start;\n }\n\n &:where([data-icon-position='right']) {\n align-items: flex-end;\n }\n }\n\n &:where([data-orientation='horizontal']) {\n flex-direction: row;\n }\n}\n\n.separator {\n transition: background-color 150ms ease;\n flex: 1;\n height: var(--stepper-outline-thickness);\n margin-inline: var(--mantine-spacing-md);\n background-color: var(--stepper-outline-color);\n\n &:where([data-active]) {\n background-color: var(--stepper-color);\n }\n}\n\n.content {\n padding-top: var(--stepper-content-padding);\n}\n\n.step {\n --step-color: var(--stepper-color);\n\n display: flex;\n cursor: default;\n\n &:where([data-allow-click]) {\n cursor: pointer;\n }\n\n &:where([data-icon-position='left']) {\n flex-direction: row;\n }\n\n &:where([data-icon-position='right']) {\n flex-direction: row-reverse;\n }\n}\n\n.step--horizontal {\n align-items: center;\n}\n\n.step--vertical {\n --separator-spacing: calc(var(--mantine-spacing-xs) / 2);\n\n justify-content: flex-start;\n min-height: calc(var(--stepper-icon-size) + var(--mantine-spacing-xl) + var(--separator-spacing));\n margin-top: var(--separator-spacing);\n overflow: hidden;\n\n &:where(:first-of-type) {\n margin-top: 0;\n }\n\n &:where(:last-of-type) {\n min-height: auto;\n\n & .verticalSeparator {\n display: none;\n }\n }\n}\n\n.stepWrapper {\n position: relative;\n}\n\n.verticalSeparator {\n top: calc(var(--stepper-icon-size) + var(--separator-spacing));\n inset-inline-start: calc(var(--stepper-icon-size) / 2);\n height: 100vh;\n position: absolute;\n border-inline-start: var(--stepper-outline-thickness) solid var(--stepper-outline-color);\n\n &:where([data-active]) {\n border-color: var(--stepper-color);\n }\n}\n\n.stepIcon {\n height: var(--stepper-icon-size);\n width: var(--stepper-icon-size);\n min-height: var(--stepper-icon-size);\n min-width: var(--stepper-icon-size);\n border-radius: var(--stepper-radius);\n font-size: var(--stepper-fz);\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n font-weight: bold;\n transition:\n background-color 150ms ease,\n border-color 150ms ease;\n border: var(--stepper-outline-thickness) solid var(--stepper-outline-color);\n background-color: var(--stepper-outline-color);\n\n @mixin where-light {\n color: var(--mantine-color-gray-7);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-dark-1);\n }\n\n &:where([data-progress]) {\n border-color: var(--step-color);\n }\n\n &:where([data-completed]) {\n color: var(--stepper-icon-color, var(--mantine-color-white));\n background-color: var(--step-color);\n border-color: var(--step-color);\n }\n}\n\n.stepCompletedIcon {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--stepper-icon-color, var(--mantine-color-white));\n}\n\n.stepBody {\n display: flex;\n flex-direction: column;\n\n &:where([data-icon-position='left']) {\n margin-inline-start: var(--mantine-spacing-sm);\n }\n\n &:where([data-icon-position='right']) {\n text-align: right;\n margin-inline-end: var(--mantine-spacing-sm);\n\n @mixin where-rtl {\n text-align: left;\n }\n }\n}\n\n.stepLabel {\n font-weight: var(--mantine-font-weight-medium);\n font-size: var(--stepper-fz);\n line-height: 1;\n}\n\n.stepDescription {\n margin-top: calc(var(--stepper-spacing) / 3);\n margin-bottom: calc(var(--stepper-spacing) / 3);\n font-size: calc(var(--stepper-fz) - rem(2px));\n line-height: 1;\n color: var(--mantine-color-dimmed);\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Stepper.module.mjs","names":[],"sources":["../../../src/components/Stepper/Stepper.module.css"],"sourcesContent":[".root {\n --stepper-icon-size-xs: 34px;\n --stepper-icon-size-sm: 36px;\n --stepper-icon-size-md: 42px;\n --stepper-icon-size-lg: 48px;\n --stepper-icon-size-xl: 52px;\n\n --stepper-icon-size: var(--stepper-icon-size-md);\n --stepper-color: var(--mantine-primary-color-filled);\n --stepper-content-padding: var(--mantine-spacing-md);\n --stepper-spacing: var(--mantine-spacing-md);\n --stepper-radius: 1000px;\n --stepper-fz: var(--mantine-font-size-md);\n --stepper-outline-thickness: 2px;\n\n @mixin light {\n --stepper-outline-color: var(--mantine-color-gray-2);\n }\n\n @mixin dark {\n --stepper-outline-color: var(--mantine-color-dark-5);\n }\n}\n\n.steps {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n\n &:where([data-wrap]) {\n flex-wrap: wrap;\n gap: var(--mantine-spacing-md) 0;\n }\n\n &:where([data-orientation='vertical']) {\n flex-direction: column;\n\n &:where([data-icon-position='left']) {\n align-items: flex-start;\n }\n\n &:where([data-icon-position='right']) {\n align-items: flex-end;\n }\n }\n\n &:where([data-orientation='horizontal']) {\n flex-direction: row;\n }\n}\n\n.separator {\n transition: background-color 150ms ease;\n flex: 1;\n height: var(--stepper-outline-thickness);\n margin-inline: var(--mantine-spacing-md);\n background-color: var(--stepper-outline-color);\n\n &:where([data-active]) {\n background-color: var(--stepper-color);\n }\n}\n\n.content {\n padding-top: var(--stepper-content-padding);\n}\n\n.step {\n --step-color: var(--stepper-color);\n\n display: flex;\n cursor: default;\n\n &:where([data-allow-click]) {\n cursor: pointer;\n }\n\n &:where([data-icon-position='left']) {\n flex-direction: row;\n }\n\n &:where([data-icon-position='right']) {\n flex-direction: row-reverse;\n }\n}\n\n.step--horizontal {\n align-items: center;\n}\n\n.step--vertical {\n --separator-spacing: calc(var(--mantine-spacing-xs) / 2);\n\n justify-content: flex-start;\n min-height: calc(var(--stepper-icon-size) + var(--mantine-spacing-xl) + var(--separator-spacing));\n margin-top: var(--separator-spacing);\n overflow: hidden;\n\n &:where(:first-of-type) {\n margin-top: 0;\n }\n\n &:where(:last-of-type) {\n min-height: auto;\n\n & .verticalSeparator {\n display: none;\n }\n }\n}\n\n.stepWrapper {\n position: relative;\n}\n\n.verticalSeparator {\n top: calc(var(--stepper-icon-size) + var(--separator-spacing));\n inset-inline-start: calc(var(--stepper-icon-size) / 2);\n height: 100vh;\n position: absolute;\n border-inline-start: var(--stepper-outline-thickness) solid var(--stepper-outline-color);\n\n &:where([data-active]) {\n border-color: var(--stepper-color);\n }\n}\n\n.stepIcon {\n height: var(--stepper-icon-size);\n width: var(--stepper-icon-size);\n min-height: var(--stepper-icon-size);\n min-width: var(--stepper-icon-size);\n border-radius: var(--stepper-radius);\n font-size: var(--stepper-fz);\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n font-weight: bold;\n transition:\n background-color 150ms ease,\n border-color 150ms ease;\n border: var(--stepper-outline-thickness) solid var(--stepper-outline-color);\n background-color: var(--stepper-outline-color);\n\n @mixin where-light {\n color: var(--mantine-color-gray-7);\n }\n\n @mixin where-dark {\n color: var(--mantine-color-dark-1);\n }\n\n &:where([data-progress]) {\n border-color: var(--step-color);\n }\n\n &:where([data-completed]) {\n color: var(--stepper-icon-color, var(--mantine-color-white));\n background-color: var(--step-color);\n border-color: var(--step-color);\n }\n}\n\n.stepIconContent {\n display: flex;\n}\n\n.stepCompletedIcon {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--stepper-icon-color, var(--mantine-color-white));\n}\n\n.stepBody {\n display: flex;\n flex-direction: column;\n\n &:where([data-icon-position='left']) {\n margin-inline-start: var(--mantine-spacing-sm);\n }\n\n &:where([data-icon-position='right']) {\n text-align: right;\n margin-inline-end: var(--mantine-spacing-sm);\n\n @mixin where-rtl {\n text-align: left;\n }\n }\n}\n\n.stepLabel {\n font-weight: var(--mantine-font-weight-medium);\n font-size: var(--stepper-fz);\n line-height: 1;\n}\n\n.stepDescription {\n margin-top: calc(var(--stepper-spacing) / 3);\n margin-bottom: calc(var(--stepper-spacing) / 3);\n font-size: calc(var(--stepper-fz) - rem(2px));\n line-height: 1;\n color: var(--mantine-color-dimmed);\n}\n"],"mappings":""}
|
|
@@ -68,11 +68,14 @@ const StepperStep = factory((props) => {
|
|
|
68
68
|
...ctx.getStyles("stepLoader", stylesApi)
|
|
69
69
|
}) : getStepFragment(completedIcon, step) || /* @__PURE__ */ jsx(CheckIcon, { size: "60%" })
|
|
70
70
|
})
|
|
71
|
-
}), state !== "stepCompleted" ? /* @__PURE__ */ jsx("span", {
|
|
72
|
-
...ctx.getStyles("
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
}), state !== "stepCompleted" ? /* @__PURE__ */ jsx("span", {
|
|
72
|
+
...ctx.getStyles("stepIconContent", stylesApi),
|
|
73
|
+
children: loading ? /* @__PURE__ */ jsx(Loader, {
|
|
74
|
+
...ctx.getStyles("stepLoader", stylesApi),
|
|
75
|
+
size: "calc(var(--stepper-icon-size) / 2)",
|
|
76
|
+
color
|
|
77
|
+
}) : getStepFragment(_icon || icon, step)
|
|
78
|
+
}) : null]
|
|
76
79
|
}), orientation === "vertical" && /* @__PURE__ */ jsx("span", {
|
|
77
80
|
...ctx.getStyles("verticalSeparator", stylesApi),
|
|
78
81
|
"data-active": state === "stepCompleted" || void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperStep.mjs","names":["classes"],"sources":["../../../../src/components/Stepper/StepperStep/StepperStep.tsx"],"sourcesContent":["import {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n useMantineTheme,\n useProps,\n} from '../../../core';\nimport { CheckIcon } from '../../Checkbox';\nimport { Loader } from '../../Loader';\nimport { Transition } from '../../Transition';\nimport { UnstyledButton } from '../../UnstyledButton';\nimport type { StepFragmentComponent } from '../Stepper';\nimport { useStepperContext } from '../Stepper.context';\nimport classes from '../Stepper.module.css';\n\nconst getStepFragment = (\n Fragment: StepFragmentComponent | React.ReactNode,\n step: number | undefined\n) => {\n if (typeof Fragment === 'function') {\n return <Fragment step={step || 0} />;\n }\n\n return Fragment;\n};\n\nexport type StepperStepStylesNames =\n | 'step'\n | 'stepLoader'\n | 'verticalSeparator'\n | 'stepWrapper'\n | 'stepIcon'\n | 'stepCompletedIcon'\n | 'stepBody'\n | 'stepLabel'\n | 'stepDescription';\n\nexport interface StepperStepProps\n extends BoxProps, CompoundStylesApiProps<StepperStepFactory>, ElementProps<'button'> {\n /** 0-based step index, automatically set by Stepper component */\n step?: number;\n\n /** Step state, automatically set by Stepper component based on active prop. stepInactive: not reached, stepProgress: current, stepCompleted: passed */\n state?: 'stepInactive' | 'stepProgress' | 'stepCompleted';\n\n /** Key of `theme.colors`, by default controlled by Stepper component */\n color?: MantineColor;\n\n /** When false, hides the step icon. Useful for creating compact steppers with only labels @default true */\n withIcon?: boolean;\n\n /** Step icon, defaults to `step index + 1` when rendered within Stepper */\n icon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is completed */\n completedIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is in progress */\n progressIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step label, render after icon */\n label?: React.ReactNode | StepFragmentComponent;\n\n /** Step description */\n description?: React.ReactNode | StepFragmentComponent;\n\n /** Icon wrapper size */\n iconSize?: string | number;\n\n /** Icon position relative to step body, controlled by Stepper component */\n iconPosition?: 'right' | 'left';\n\n /** Indicates loading state of the step */\n loading?: boolean;\n\n /** Set to false to disable clicks on step */\n allowStepClick?: boolean;\n\n /** Should step selection be allowed */\n allowStepSelect?: boolean;\n\n /** Static selector base */\n __staticSelector?: string;\n\n /** Component orientation */\n orientation?: 'vertical' | 'horizontal';\n}\n\nexport type StepperStepFactory = Factory<{\n props: StepperStepProps;\n ref: HTMLButtonElement;\n stylesNames: StepperStepStylesNames;\n compound: true;\n}>;\n\nconst defaultProps = {\n withIcon: true,\n allowStepClick: true,\n iconPosition: 'left',\n} satisfies Partial<StepperStepProps>;\n\nexport const StepperStep = factory<StepperStepFactory>((props) => {\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n step,\n state,\n color,\n icon,\n completedIcon,\n progressIcon,\n label,\n description,\n withIcon,\n iconSize,\n loading,\n allowStepClick,\n allowStepSelect,\n iconPosition,\n orientation,\n mod,\n ...others\n } = useProps('StepperStep', defaultProps, props);\n\n const ctx = useStepperContext();\n const theme = useMantineTheme();\n const stylesApi = { classNames, styles };\n\n const _icon = state === 'stepCompleted' ? null : state === 'stepProgress' ? progressIcon : icon;\n const dataAttributes = {\n 'data-progress': state === 'stepProgress' || undefined,\n 'data-completed': state === 'stepCompleted' || undefined,\n };\n\n return (\n <UnstyledButton\n {...ctx.getStyles('step', { className, style, variant: ctx.orientation, ...stylesApi })}\n mod={[\n { 'icon-position': iconPosition || ctx.iconPosition, 'allow-click': allowStepClick },\n mod,\n ]}\n {...dataAttributes}\n {...others}\n __vars={{ '--step-color': color ? getThemeColor(color, theme) : undefined }}\n tabIndex={allowStepClick ? 0 : -1}\n >\n {withIcon && (\n <span {...ctx.getStyles('stepWrapper', stylesApi)}>\n <span {...ctx.getStyles('stepIcon', stylesApi)} {...dataAttributes}>\n <Transition mounted={state === 'stepCompleted'} transition=\"pop\" duration={200}>\n {(transitionStyles) => (\n <span\n {...ctx.getStyles('stepCompletedIcon', { style: transitionStyles, ...stylesApi })}\n >\n {loading ? (\n <Loader\n color=\"var(--mantine-color-white)\"\n size=\"calc(var(--stepper-icon-size) / 2)\"\n {...ctx.getStyles('stepLoader', stylesApi)}\n />\n ) : (\n getStepFragment(completedIcon, step) || <CheckIcon size=\"60%\" />\n )}\n </span>\n )}\n </Transition>\n\n {state !== 'stepCompleted' ? (\n <span>\n {loading ? (\n <Loader\n {...ctx.getStyles('stepLoader', stylesApi)}\n size=\"calc(var(--stepper-icon-size) / 2)\"\n color={color}\n />\n ) : (\n getStepFragment(_icon || icon, step)\n )}\n </span>\n ) : null}\n </span>\n {orientation === 'vertical' && (\n <span\n {...ctx.getStyles('verticalSeparator', stylesApi)}\n data-active={state === 'stepCompleted' || undefined}\n />\n )}\n </span>\n )}\n\n {(label || description) && (\n <span\n {...ctx.getStyles('stepBody', stylesApi)}\n data-orientation={ctx.orientation}\n data-icon-position={iconPosition || ctx.iconPosition}\n >\n {label && (\n <span {...ctx.getStyles('stepLabel', stylesApi)}>{getStepFragment(label, step)}</span>\n )}\n {description && (\n <span {...ctx.getStyles('stepDescription', stylesApi)}>\n {getStepFragment(description, step)}\n </span>\n )}\n </span>\n )}\n </UnstyledButton>\n );\n});\n\nStepperStep.classes = classes;\nStepperStep.displayName = '@mantine/core/StepperStep';\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,mBACJ,UACA,SACG;AACH,KAAI,OAAO,aAAa,WACtB,QAAO,oBAAC,UAAD,EAAU,MAAM,QAAQ,GAAK,CAAA;AAGtC,QAAO;;
|
|
1
|
+
{"version":3,"file":"StepperStep.mjs","names":["classes"],"sources":["../../../../src/components/Stepper/StepperStep/StepperStep.tsx"],"sourcesContent":["import {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n useMantineTheme,\n useProps,\n} from '../../../core';\nimport { CheckIcon } from '../../Checkbox';\nimport { Loader } from '../../Loader';\nimport { Transition } from '../../Transition';\nimport { UnstyledButton } from '../../UnstyledButton';\nimport type { StepFragmentComponent } from '../Stepper';\nimport { useStepperContext } from '../Stepper.context';\nimport classes from '../Stepper.module.css';\n\nconst getStepFragment = (\n Fragment: StepFragmentComponent | React.ReactNode,\n step: number | undefined\n) => {\n if (typeof Fragment === 'function') {\n return <Fragment step={step || 0} />;\n }\n\n return Fragment;\n};\n\nexport type StepperStepStylesNames =\n | 'step'\n | 'stepLoader'\n | 'verticalSeparator'\n | 'stepWrapper'\n | 'stepIcon'\n | 'stepCompletedIcon'\n | 'stepIconContent'\n | 'stepBody'\n | 'stepLabel'\n | 'stepDescription';\n\nexport interface StepperStepProps\n extends BoxProps, CompoundStylesApiProps<StepperStepFactory>, ElementProps<'button'> {\n /** 0-based step index, automatically set by Stepper component */\n step?: number;\n\n /** Step state, automatically set by Stepper component based on active prop. stepInactive: not reached, stepProgress: current, stepCompleted: passed */\n state?: 'stepInactive' | 'stepProgress' | 'stepCompleted';\n\n /** Key of `theme.colors`, by default controlled by Stepper component */\n color?: MantineColor;\n\n /** When false, hides the step icon. Useful for creating compact steppers with only labels @default true */\n withIcon?: boolean;\n\n /** Step icon, defaults to `step index + 1` when rendered within Stepper */\n icon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is completed */\n completedIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step icon displayed when step is in progress */\n progressIcon?: React.ReactNode | StepFragmentComponent;\n\n /** Step label, render after icon */\n label?: React.ReactNode | StepFragmentComponent;\n\n /** Step description */\n description?: React.ReactNode | StepFragmentComponent;\n\n /** Icon wrapper size */\n iconSize?: string | number;\n\n /** Icon position relative to step body, controlled by Stepper component */\n iconPosition?: 'right' | 'left';\n\n /** Indicates loading state of the step */\n loading?: boolean;\n\n /** Set to false to disable clicks on step */\n allowStepClick?: boolean;\n\n /** Should step selection be allowed */\n allowStepSelect?: boolean;\n\n /** Static selector base */\n __staticSelector?: string;\n\n /** Component orientation */\n orientation?: 'vertical' | 'horizontal';\n}\n\nexport type StepperStepFactory = Factory<{\n props: StepperStepProps;\n ref: HTMLButtonElement;\n stylesNames: StepperStepStylesNames;\n compound: true;\n}>;\n\nconst defaultProps = {\n withIcon: true,\n allowStepClick: true,\n iconPosition: 'left',\n} satisfies Partial<StepperStepProps>;\n\nexport const StepperStep = factory<StepperStepFactory>((props) => {\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n step,\n state,\n color,\n icon,\n completedIcon,\n progressIcon,\n label,\n description,\n withIcon,\n iconSize,\n loading,\n allowStepClick,\n allowStepSelect,\n iconPosition,\n orientation,\n mod,\n ...others\n } = useProps('StepperStep', defaultProps, props);\n\n const ctx = useStepperContext();\n const theme = useMantineTheme();\n const stylesApi = { classNames, styles };\n\n const _icon = state === 'stepCompleted' ? null : state === 'stepProgress' ? progressIcon : icon;\n const dataAttributes = {\n 'data-progress': state === 'stepProgress' || undefined,\n 'data-completed': state === 'stepCompleted' || undefined,\n };\n\n return (\n <UnstyledButton\n {...ctx.getStyles('step', { className, style, variant: ctx.orientation, ...stylesApi })}\n mod={[\n { 'icon-position': iconPosition || ctx.iconPosition, 'allow-click': allowStepClick },\n mod,\n ]}\n {...dataAttributes}\n {...others}\n __vars={{ '--step-color': color ? getThemeColor(color, theme) : undefined }}\n tabIndex={allowStepClick ? 0 : -1}\n >\n {withIcon && (\n <span {...ctx.getStyles('stepWrapper', stylesApi)}>\n <span {...ctx.getStyles('stepIcon', stylesApi)} {...dataAttributes}>\n <Transition mounted={state === 'stepCompleted'} transition=\"pop\" duration={200}>\n {(transitionStyles) => (\n <span\n {...ctx.getStyles('stepCompletedIcon', { style: transitionStyles, ...stylesApi })}\n >\n {loading ? (\n <Loader\n color=\"var(--mantine-color-white)\"\n size=\"calc(var(--stepper-icon-size) / 2)\"\n {...ctx.getStyles('stepLoader', stylesApi)}\n />\n ) : (\n getStepFragment(completedIcon, step) || <CheckIcon size=\"60%\" />\n )}\n </span>\n )}\n </Transition>\n\n {state !== 'stepCompleted' ? (\n <span {...ctx.getStyles('stepIconContent', stylesApi)}>\n {loading ? (\n <Loader\n {...ctx.getStyles('stepLoader', stylesApi)}\n size=\"calc(var(--stepper-icon-size) / 2)\"\n color={color}\n />\n ) : (\n getStepFragment(_icon || icon, step)\n )}\n </span>\n ) : null}\n </span>\n {orientation === 'vertical' && (\n <span\n {...ctx.getStyles('verticalSeparator', stylesApi)}\n data-active={state === 'stepCompleted' || undefined}\n />\n )}\n </span>\n )}\n\n {(label || description) && (\n <span\n {...ctx.getStyles('stepBody', stylesApi)}\n data-orientation={ctx.orientation}\n data-icon-position={iconPosition || ctx.iconPosition}\n >\n {label && (\n <span {...ctx.getStyles('stepLabel', stylesApi)}>{getStepFragment(label, step)}</span>\n )}\n {description && (\n <span {...ctx.getStyles('stepDescription', stylesApi)}>\n {getStepFragment(description, step)}\n </span>\n )}\n </span>\n )}\n </UnstyledButton>\n );\n});\n\nStepperStep.classes = classes;\nStepperStep.displayName = '@mantine/core/StepperStep';\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,mBACJ,UACA,SACG;AACH,KAAI,OAAO,aAAa,WACtB,QAAO,oBAAC,UAAD,EAAU,MAAM,QAAQ,GAAK,CAAA;AAGtC,QAAO;;AAyET,MAAM,eAAe;CACnB,UAAU;CACV,gBAAgB;CAChB,cAAc;CACf;AAED,MAAa,cAAc,SAA6B,UAAU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BAAC,QAAD;KAAM,GAAI,IAAI,UAAU,mBAAmB,UAAU;eAClD,UACC,oBAAC,QAAD;MACE,GAAI,IAAI,UAAU,cAAc,UAAU;MAC1C,MAAK;MACE;MACP,CAAA,GAEF,gBAAgB,SAAS,MAAM,KAAK;KAEjC,CAAA,GACL,KACC;OACN,gBAAgB,cACf,oBAAC,QAAD;IACE,GAAI,IAAI,UAAU,qBAAqB,UAAU;IACjD,eAAa,UAAU,mBAAmB,KAAA;IAC1C,CAAA,CAEC;OAGP,SAAS,gBACT,qBAAC,QAAD;GACE,GAAI,IAAI,UAAU,YAAY,UAAU;GACxC,oBAAkB,IAAI;GACtB,sBAAoB,gBAAgB,IAAI;aAH1C,CAKG,SACC,oBAAC,QAAD;IAAM,GAAI,IAAI,UAAU,aAAa,UAAU;cAAG,gBAAgB,OAAO,KAAK;IAAQ,CAAA,EAEvF,eACC,oBAAC,QAAD;IAAM,GAAI,IAAI,UAAU,mBAAmB,UAAU;cAClD,gBAAgB,aAAa,KAAK;IAC9B,CAAA,CAEJ;KAEM;;EAEnB;AAEF,YAAY,UAAUA;AACtB,YAAY,cAAc"}
|
|
@@ -245,6 +245,7 @@ const TagsInput = factory((_props) => {
|
|
|
245
245
|
...getStyles("pillsList"),
|
|
246
246
|
children: [values, /* @__PURE__ */ jsx(Combobox.EventsTarget, {
|
|
247
247
|
autoComplete,
|
|
248
|
+
withExpandedAttribute: true,
|
|
248
249
|
children: /* @__PURE__ */ jsx(PillsInput.Field, {
|
|
249
250
|
...rest,
|
|
250
251
|
ref: _ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.mjs","names":["useId"],"sources":["../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxGenericData,\n ComboboxGenericItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxRenderPillInput,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollAreaProps } from '../ScrollArea';\nimport { filterPickedTags } from './filter-picked-tags';\nimport { getSplittedTags } from './get-splitted-tags';\n\nexport type TagsInputStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface TagsInputProps\n extends\n BoxProps,\n __BaseInputProps,\n Omit<ComboboxLikeProps, 'data'>,\n StylesApiProps<TagsInputFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Data displayed in the dropdown. Values must be unique. */\n data?: ComboboxGenericData;\n\n /** Controlled component value */\n value?: string[];\n\n /** Uncontrolled component default value */\n defaultValue?: string[];\n\n /** Called when value changes */\n onChange?: (value: string[]) => void;\n\n /** Called when tag is removed */\n onRemove?: (value: string) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Maximum number of tags @default Infinity */\n maxTags?: number;\n\n /** Called when user tries to add more tags than maxTags */\n onMaxTags?: (value: string) => void;\n\n /** If set, duplicate tags are allowed @default false */\n allowDuplicates?: boolean;\n\n /** Called when user tries to submit a duplicated tag */\n onDuplicate?: (value: string) => void;\n\n /** Characters that should trigger tags split, `[',']` by default */\n splitChars?: string[];\n\n /** If set, the clear button is displayed in the right section when the component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider used to separate values in the hidden input `value` attribute @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (input: ComboboxLikeRenderOptionInput<ComboboxGenericItem>) => React.ReactNode;\n\n /** A function to render content of the pill, replaces the default content of the pill */\n renderPill?: (props: ComboboxRenderPillInput) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** If set, the value typed in by the user but not submitted is accepted when the input is blurred @default true */\n acceptValueOnBlur?: boolean;\n\n /** Custom function to determine if a tag is duplicate. Accepts tag value and array of current values. By default, checks if the tag exists case-insensitively. */\n isDuplicate?: (value: string, currentValues: string[]) => boolean;\n\n /** If set, the dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n}\n\nexport type TagsInputFactory = Factory<{\n props: TagsInputProps;\n ref: HTMLInputElement;\n stylesNames: TagsInputStylesNames;\n}>;\n\nconst defaultProps = {\n maxTags: Infinity,\n acceptValueOnBlur: true,\n splitChars: [','],\n hiddenInputValuesDivider: ',',\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<TagsInputProps>;\n\nexport const TagsInput = factory<TagsInputFactory>((_props) => {\n const props = useProps('TagsInput', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n value,\n defaultValue,\n onChange,\n onKeyDown,\n maxTags,\n allowDuplicates,\n onDuplicate,\n variant,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n readOnly,\n disabled,\n splitChars,\n onFocus,\n onBlur,\n onPaste,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n rightSectionProps,\n leftSection,\n leftSectionWidth,\n leftSectionPointerEvents,\n leftSectionProps,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n required,\n labelProps,\n descriptionProps,\n errorProps,\n wrapperProps,\n description,\n label,\n error,\n withErrorStyles,\n name,\n form,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n hiddenInputValuesDivider,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxTags,\n scrollAreaProps,\n acceptValueOnBlur,\n isDuplicate,\n openOnFocus,\n attributes,\n ref,\n ...others\n } = props;\n\n const _id = useId(id);\n const parsedData = getParsedComboboxData(data);\n const optionsLockup = getOptionsLockup(parsedData);\n const inputRef = useRef<HTMLInputElement>(null);\n const _ref = useMergedRef(inputRef, ref);\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n onChange,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (value: string) => {\n setSearchValue(value);\n combobox.resetSelectedOption();\n };\n\n const getStyles = useStyles<TagsInputFactory>({\n name: 'TagsInput',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TagsInputFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleValueSelect = (val: string) => {\n const isDuplicated = isDuplicate\n ? isDuplicate(val, _value)\n : _value.some((tag) => tag.toLowerCase() === val.toLowerCase());\n\n if (isDuplicated) {\n onDuplicate?.(val);\n if (!allowDuplicates) {\n handleSearchChange('');\n return;\n }\n }\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n return;\n }\n\n onOptionSubmit?.(val);\n handleSearchChange('');\n if (val.length > 0) {\n setValue([..._value, val]);\n }\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n const inputValue = _searchValue.trim();\n const { length } = inputValue;\n\n if (splitChars.includes(event.key) && length > 0) {\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: _searchValue,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n event.preventDefault();\n }\n\n if (event.key === 'Enter' && length > 0 && !event.nativeEvent.isComposing) {\n event.preventDefault();\n\n const hasActiveSelection = !!document.querySelector<HTMLDivElement>(\n `#${combobox.listId} [data-combobox-option][data-combobox-selected]`\n );\n\n if (hasActiveSelection) {\n return;\n }\n\n handleValueSelect(inputValue);\n }\n\n if (\n event.key === 'Backspace' &&\n length === 0 &&\n _value.length > 0 &&\n !event.nativeEvent.isComposing &&\n !readOnly\n ) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n event.preventDefault();\n\n if (event.clipboardData) {\n const pastedText = event.clipboardData.getData('text/plain');\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: `${_searchValue}${pastedText}`,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n }\n };\n\n const values = _value.map((item, index) => {\n const onRemoveItem = () => {\n const next_value = _value.slice();\n next_value.splice(index, 1);\n setValue(next_value);\n onRemove?.(item);\n };\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionsLockup[item] || { value: item, label: item, disabled: false },\n value: item,\n onRemove: onRemoveItem,\n disabled: disabled || readOnly,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={onRemoveItem}\n unstyled={unstyled}\n disabled={disabled}\n attributes={attributes}\n {...getStyles('pill')}\n >\n {item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _value, _searchValue]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue([]);\n handleSearchChange('');\n inputRef.current?.focus();\n combobox.openDropdown();\n onClear?.();\n }}\n />\n );\n\n return (\n <>\n <Combobox\n store={combobox}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n readOnly={readOnly}\n __staticSelector=\"TagsInput\"\n attributes={attributes}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val);\n handleSearchChange('');\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n } else {\n setValue([..._value, optionsLockup[val].value]);\n }\n\n combobox.resetSelectedOption();\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TagsInput\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n rightSection={rightSection}\n __clearSection={clearButton}\n __clearable={clearable && _value.length > 0 && !disabled && !readOnly}\n __clearSectionMode={clearSectionMode}\n rightSectionWidth={rightSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n required={required}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n withErrorStyles={withErrorStyles}\n __stylesApiProps={{ ...props, multiline: true }}\n id={_id}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group disabled={disabled} unstyled={unstyled} {...getStyles('pillsList')}>\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete}>\n <PillsInput.Field\n {...rest}\n ref={_ref}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onKeyDown={handleInputKeydown}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n acceptValueOnBlur && handleValueSelect(_searchValue);\n combobox.closeDropdown();\n }}\n onPaste={handlePaste}\n value={_searchValue}\n onChange={(event) => handleSearchChange(event.currentTarget.value)}\n required={required && _value.length === 0}\n disabled={disabled}\n readOnly={readOnly}\n id={_id}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={filterPickedTags({ data: parsedData, value: _value })}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n unstyled={unstyled}\n labelId={label ? `${_id}-label` : undefined}\n aria-label={label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n form={form}\n value={_value}\n valuesDivider={hiddenInputValuesDivider}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTagsInput.classes = { ...InputBase.classes, ...Combobox.classes };\nTagsInput.displayName = '@mantine/core/TagsInput';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyIA,MAAM,eAAe;CACnB,SAAS;CACT,mBAAmB;CACnB,YAAY,CAAC,IAAI;CACjB,0BAA0B;CAC1B,aAAa;CACb,MAAM;CACP;AAED,MAAa,YAAY,SAA2B,WAAW;CAC7D,MAAM,QAAQ,SAAS,aAAa,cAAc,OAAO;CACzD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,iBACA,aACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,aACA,oBACA,gBACA,UACA,UACA,YACA,SACA,QACA,SACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,UACA,YACA,kBACA,YACA,cACA,aACA,OACA,OACA,iBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,0BACA,KACA,cACA,YACA,UACA,SACA,WACA,iBACA,mBACA,aACA,aACA,YACA,KACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,GAAG;CACrB,MAAM,aAAa,sBAAsB,KAAK;CAC9C,MAAM,gBAAgB,iBAAiB,WAAW;CAClD,MAAM,WAAW,OAAyB,KAAK;CAC/C,MAAM,OAAO,aAAa,UAAU,IAAI;CAExC,MAAM,WAAW,YAAY;EAC3B,QAAQ;EACR,eAAe;EACf,sBAAsB;AACpB,qBAAkB;AAClB,OAAI,gCACF,UAAS,mBAAmB;;EAGhC,uBAAuB;AACrB,sBAAmB;AACnB,YAAS,qBAAqB;;EAEjC,CAAC;CAEF,MAAM,EACJ,YACA,MAAM,EAAE,MAAM,cAAc,GAAG,WAC7B,kBAAkB,OAAO;CAE7B,MAAM,CAAC,QAAQ,YAAY,gBAAgB;EACzC;EACA;EACA,YAAY,EAAE;EACd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CAAC;GAC3D,QAAQ,YAAY;GACZ;GACR,QAAQ;GACD;GACP,iBAAA;GACgB;GACG;GACT;GACV,SAAS,QAAQ,GAAG,IAAI,UAAU,KAAA;GAClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;GACjB,CAAA,CACO;KACX,oBAAC,SAAS,aAAV;EACQ;EACA;EACN,OAAO;EACP,eAAe;EACL;EACV,GAAI;EACJ,CAAA,CACD,EAAA,CAAA;EAEL;AAEF,UAAU,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS;AACjE,UAAU,cAAc"}
|
|
1
|
+
{"version":3,"file":"TagsInput.mjs","names":["useId"],"sources":["../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxGenericData,\n ComboboxGenericItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxRenderPillInput,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollAreaProps } from '../ScrollArea';\nimport { filterPickedTags } from './filter-picked-tags';\nimport { getSplittedTags } from './get-splitted-tags';\n\nexport type TagsInputStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface TagsInputProps\n extends\n BoxProps,\n __BaseInputProps,\n Omit<ComboboxLikeProps, 'data'>,\n StylesApiProps<TagsInputFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Data displayed in the dropdown. Values must be unique. */\n data?: ComboboxGenericData;\n\n /** Controlled component value */\n value?: string[];\n\n /** Uncontrolled component default value */\n defaultValue?: string[];\n\n /** Called when value changes */\n onChange?: (value: string[]) => void;\n\n /** Called when tag is removed */\n onRemove?: (value: string) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Maximum number of tags @default Infinity */\n maxTags?: number;\n\n /** Called when user tries to add more tags than maxTags */\n onMaxTags?: (value: string) => void;\n\n /** If set, duplicate tags are allowed @default false */\n allowDuplicates?: boolean;\n\n /** Called when user tries to submit a duplicated tag */\n onDuplicate?: (value: string) => void;\n\n /** Characters that should trigger tags split, `[',']` by default */\n splitChars?: string[];\n\n /** If set, the clear button is displayed in the right section when the component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider used to separate values in the hidden input `value` attribute @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (input: ComboboxLikeRenderOptionInput<ComboboxGenericItem>) => React.ReactNode;\n\n /** A function to render content of the pill, replaces the default content of the pill */\n renderPill?: (props: ComboboxRenderPillInput) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** If set, the value typed in by the user but not submitted is accepted when the input is blurred @default true */\n acceptValueOnBlur?: boolean;\n\n /** Custom function to determine if a tag is duplicate. Accepts tag value and array of current values. By default, checks if the tag exists case-insensitively. */\n isDuplicate?: (value: string, currentValues: string[]) => boolean;\n\n /** If set, the dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n}\n\nexport type TagsInputFactory = Factory<{\n props: TagsInputProps;\n ref: HTMLInputElement;\n stylesNames: TagsInputStylesNames;\n}>;\n\nconst defaultProps = {\n maxTags: Infinity,\n acceptValueOnBlur: true,\n splitChars: [','],\n hiddenInputValuesDivider: ',',\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<TagsInputProps>;\n\nexport const TagsInput = factory<TagsInputFactory>((_props) => {\n const props = useProps('TagsInput', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n value,\n defaultValue,\n onChange,\n onKeyDown,\n maxTags,\n allowDuplicates,\n onDuplicate,\n variant,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n readOnly,\n disabled,\n splitChars,\n onFocus,\n onBlur,\n onPaste,\n radius,\n rightSection,\n rightSectionWidth,\n rightSectionPointerEvents,\n rightSectionProps,\n leftSection,\n leftSectionWidth,\n leftSectionPointerEvents,\n leftSectionProps,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n required,\n labelProps,\n descriptionProps,\n errorProps,\n wrapperProps,\n description,\n label,\n error,\n withErrorStyles,\n name,\n form,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n hiddenInputValuesDivider,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxTags,\n scrollAreaProps,\n acceptValueOnBlur,\n isDuplicate,\n openOnFocus,\n attributes,\n ref,\n ...others\n } = props;\n\n const _id = useId(id);\n const parsedData = getParsedComboboxData(data);\n const optionsLockup = getOptionsLockup(parsedData);\n const inputRef = useRef<HTMLInputElement>(null);\n const _ref = useMergedRef(inputRef, ref);\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n onChange,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (value: string) => {\n setSearchValue(value);\n combobox.resetSelectedOption();\n };\n\n const getStyles = useStyles<TagsInputFactory>({\n name: 'TagsInput',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TagsInputFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleValueSelect = (val: string) => {\n const isDuplicated = isDuplicate\n ? isDuplicate(val, _value)\n : _value.some((tag) => tag.toLowerCase() === val.toLowerCase());\n\n if (isDuplicated) {\n onDuplicate?.(val);\n if (!allowDuplicates) {\n handleSearchChange('');\n return;\n }\n }\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n return;\n }\n\n onOptionSubmit?.(val);\n handleSearchChange('');\n if (val.length > 0) {\n setValue([..._value, val]);\n }\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n const inputValue = _searchValue.trim();\n const { length } = inputValue;\n\n if (splitChars.includes(event.key) && length > 0) {\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: _searchValue,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n event.preventDefault();\n }\n\n if (event.key === 'Enter' && length > 0 && !event.nativeEvent.isComposing) {\n event.preventDefault();\n\n const hasActiveSelection = !!document.querySelector<HTMLDivElement>(\n `#${combobox.listId} [data-combobox-option][data-combobox-selected]`\n );\n\n if (hasActiveSelection) {\n return;\n }\n\n handleValueSelect(inputValue);\n }\n\n if (\n event.key === 'Backspace' &&\n length === 0 &&\n _value.length > 0 &&\n !event.nativeEvent.isComposing &&\n !readOnly\n ) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n event.preventDefault();\n\n if (event.clipboardData) {\n const pastedText = event.clipboardData.getData('text/plain');\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: `${_searchValue}${pastedText}`,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n }\n };\n\n const values = _value.map((item, index) => {\n const onRemoveItem = () => {\n const next_value = _value.slice();\n next_value.splice(index, 1);\n setValue(next_value);\n onRemove?.(item);\n };\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionsLockup[item] || { value: item, label: item, disabled: false },\n value: item,\n onRemove: onRemoveItem,\n disabled: disabled || readOnly,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={onRemoveItem}\n unstyled={unstyled}\n disabled={disabled}\n attributes={attributes}\n {...getStyles('pill')}\n >\n {item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _value, _searchValue]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue([]);\n handleSearchChange('');\n inputRef.current?.focus();\n combobox.openDropdown();\n onClear?.();\n }}\n />\n );\n\n return (\n <>\n <Combobox\n store={combobox}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n readOnly={readOnly}\n __staticSelector=\"TagsInput\"\n attributes={attributes}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val);\n handleSearchChange('');\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n } else {\n setValue([..._value, optionsLockup[val].value]);\n }\n\n combobox.resetSelectedOption();\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TagsInput\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n rightSection={rightSection}\n __clearSection={clearButton}\n __clearable={clearable && _value.length > 0 && !disabled && !readOnly}\n __clearSectionMode={clearSectionMode}\n rightSectionWidth={rightSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n required={required}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n withErrorStyles={withErrorStyles}\n __stylesApiProps={{ ...props, multiline: true }}\n id={_id}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group disabled={disabled} unstyled={unstyled} {...getStyles('pillsList')}>\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n <PillsInput.Field\n {...rest}\n ref={_ref}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onKeyDown={handleInputKeydown}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n acceptValueOnBlur && handleValueSelect(_searchValue);\n combobox.closeDropdown();\n }}\n onPaste={handlePaste}\n value={_searchValue}\n onChange={(event) => handleSearchChange(event.currentTarget.value)}\n required={required && _value.length === 0}\n disabled={disabled}\n readOnly={readOnly}\n id={_id}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={filterPickedTags({ data: parsedData, value: _value })}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n unstyled={unstyled}\n labelId={label ? `${_id}-label` : undefined}\n aria-label={label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n form={form}\n value={_value}\n valuesDivider={hiddenInputValuesDivider}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTagsInput.classes = { ...InputBase.classes, ...Combobox.classes };\nTagsInput.displayName = '@mantine/core/TagsInput';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyIA,MAAM,eAAe;CACnB,SAAS;CACT,mBAAmB;CACnB,YAAY,CAAC,IAAI;CACjB,0BAA0B;CAC1B,aAAa;CACb,MAAM;CACP;AAED,MAAa,YAAY,SAA2B,WAAW;CAC7D,MAAM,QAAQ,SAAS,aAAa,cAAc,OAAO;CACzD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,iBACA,aACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,aACA,oBACA,gBACA,UACA,UACA,YACA,SACA,QACA,SACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,UACA,YACA,kBACA,YACA,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;IAAO,WAAW;IAAM;GAC/C,IAAI;GACC;GACO;aAEZ,qBAAC,KAAK,OAAN;IAAsB;IAAoB;IAAU,GAAI,UAAU,YAAY;cAA9E,CACG,QACD,oBAAC,SAAS,cAAV;KAAqC;KAAc,uBAAA;eACjD,oBAAC,WAAW,OAAZ;MACE,GAAI;MACJ,KAAK;MACL,GAAI,UAAU,aAAa;MACjB;MACV,WAAW;MACX,UAAU,UAAU;AAClB,iBAAU,MAAM;AAChB,sBAAe,SAAS,cAAc;;MAExC,SAAS,UAAU;AACjB,gBAAS,MAAM;AACf,4BAAqB,kBAAkB,aAAa;AACpD,gBAAS,eAAe;;MAE1B,SAAS;MACT,OAAO;MACP,WAAW,UAAU,mBAAmB,MAAM,cAAc,MAAM;MAClE,UAAU,YAAY,OAAO,WAAW;MAC9B;MACA;MACV,IAAI;MACJ,CAAA;KACoB,CAAA,CACb;;GACF,CAAA,EACW,CAAA,EAE1B,oBAAC,iBAAD;GACE,MAAM,iBAAiB;IAAE,MAAM;IAAY,OAAO;IAAQ,CAAC;GAC3D,QAAQ,YAAY;GACZ;GACR,QAAQ;GACD;GACP,iBAAA;GACgB;GACG;GACT;GACV,SAAS,QAAQ,GAAG,IAAI,UAAU,KAAA;GAClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;GACjB,CAAA,CACO;KACX,oBAAC,SAAS,aAAV;EACQ;EACA;EACN,OAAO;EACP,eAAe;EACL;EACV,GAAI;EACJ,CAAA,CACD,EAAA,CAAA;EAEL;AAEF,UAAU,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS;AACjE,UAAU,cAAc"}
|
|
@@ -28,7 +28,7 @@ const TimelineItem = factory((_props) => {
|
|
|
28
28
|
active: __active
|
|
29
29
|
}, mod],
|
|
30
30
|
__vars: {
|
|
31
|
-
"--tli-radius": radius ? getRadius(radius) : void 0,
|
|
31
|
+
"--tli-radius": radius !== void 0 ? getRadius(radius) : void 0,
|
|
32
32
|
"--tli-color": color ? getThemeColor(color, theme) : void 0,
|
|
33
33
|
"--tli-border-style": lineVariant || void 0
|
|
34
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineItem.mjs","names":["classes"],"sources":["../../../../src/components/Timeline/TimelineItem/TimelineItem.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n useMantineTheme,\n useProps,\n} from '../../../core';\nimport { useTimelineContext } from '../Timeline.context';\nimport classes from '../Timeline.module.css';\n\nexport type TimelineItemStylesNames =\n | 'itemBody'\n | 'itemContent'\n | 'itemBullet'\n | 'item'\n | 'itemTitle';\n\nexport interface TimelineItemProps\n extends BoxProps, CompoundStylesApiProps<TimelineItemFactory>, ElementProps<'div', 'title'> {\n __active?: boolean;\n __lineActive?: boolean;\n __align?: 'right' | 'left';\n\n /** Item title, displayed next to the bullet */\n title?: React.ReactNode;\n\n /** Content displayed below the title */\n children?: React.ReactNode;\n\n /** React node that should be rendered inside the bullet – icon, image, avatar, etc. By default, large white dot is displayed. */\n bullet?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius`, numbers are converted to rem @default 'xl' */\n radius?: MantineRadius;\n\n /** Key of `theme.colors` or any valid CSS color to control active item colors @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls line border style @default 'solid' */\n lineVariant?: 'solid' | 'dashed' | 'dotted';\n}\n\nexport type TimelineItemFactory = Factory<{\n props: TimelineItemProps;\n ref: HTMLDivElement;\n stylesNames: TimelineItemStylesNames;\n compound: true;\n}>;\n\nexport const TimelineItem = factory<TimelineItemFactory>((_props) => {\n const props = useProps('TimelineItem', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n __active,\n __align,\n __lineActive,\n __vars,\n bullet,\n radius,\n color,\n lineVariant,\n children,\n title,\n mod,\n ...others\n } = props;\n\n const ctx = useTimelineContext();\n const theme = useMantineTheme();\n\n const stylesApiProps = { classNames, styles };\n\n return (\n <Box\n {...ctx.getStyles('item', { ...stylesApiProps, className, style })}\n mod={[{ 'line-active': __lineActive, active: __active }, mod]}\n __vars={{\n '--tli-radius': radius ? getRadius(radius) : undefined,\n '--tli-color': color ? getThemeColor(color, theme) : undefined,\n '--tli-border-style': lineVariant || undefined,\n }}\n {...others}\n >\n <Box\n {...ctx.getStyles('itemBullet', stylesApiProps)}\n mod={{ 'with-child': !!bullet, align: __align, active: __active }}\n >\n {bullet}\n </Box>\n\n <div {...ctx.getStyles('itemBody', stylesApiProps)}>\n {title && <div {...ctx.getStyles('itemTitle', stylesApiProps)}>{title}</div>}\n <div {...ctx.getStyles('itemContent', stylesApiProps)}>{children}</div>\n </div>\n </Box>\n );\n});\n\nTimelineItem.classes = classes;\nTimelineItem.displayName = '@mantine/core/TimelineItem';\n"],"mappings":";;;;;;;;;;;AAwDA,MAAa,eAAe,SAA8B,WAAW;CAEnE,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,UACA,SACA,cACA,QACA,QACA,QACA,OACA,aACA,UACA,OACA,KACA,GAAG,WAlBS,SAAS,gBAAgB,MAAM,OAAO;CAqBpD,MAAM,MAAM,oBAAoB;CAChC,MAAM,QAAQ,iBAAiB;CAE/B,MAAM,iBAAiB;EAAE;EAAY;EAAQ;AAE7C,QACE,qBAAC,KAAD;EACE,GAAI,IAAI,UAAU,QAAQ;GAAE,GAAG;GAAgB;GAAW;GAAO,CAAC;EAClE,KAAK,CAAC;GAAE,eAAe;GAAc,QAAQ;GAAU,EAAE,IAAI;EAC7D,QAAQ;GACN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"TimelineItem.mjs","names":["classes"],"sources":["../../../../src/components/Timeline/TimelineItem/TimelineItem.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n useMantineTheme,\n useProps,\n} from '../../../core';\nimport { useTimelineContext } from '../Timeline.context';\nimport classes from '../Timeline.module.css';\n\nexport type TimelineItemStylesNames =\n | 'itemBody'\n | 'itemContent'\n | 'itemBullet'\n | 'item'\n | 'itemTitle';\n\nexport interface TimelineItemProps\n extends BoxProps, CompoundStylesApiProps<TimelineItemFactory>, ElementProps<'div', 'title'> {\n __active?: boolean;\n __lineActive?: boolean;\n __align?: 'right' | 'left';\n\n /** Item title, displayed next to the bullet */\n title?: React.ReactNode;\n\n /** Content displayed below the title */\n children?: React.ReactNode;\n\n /** React node that should be rendered inside the bullet – icon, image, avatar, etc. By default, large white dot is displayed. */\n bullet?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius`, numbers are converted to rem @default 'xl' */\n radius?: MantineRadius;\n\n /** Key of `theme.colors` or any valid CSS color to control active item colors @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls line border style @default 'solid' */\n lineVariant?: 'solid' | 'dashed' | 'dotted';\n}\n\nexport type TimelineItemFactory = Factory<{\n props: TimelineItemProps;\n ref: HTMLDivElement;\n stylesNames: TimelineItemStylesNames;\n compound: true;\n}>;\n\nexport const TimelineItem = factory<TimelineItemFactory>((_props) => {\n const props = useProps('TimelineItem', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n __active,\n __align,\n __lineActive,\n __vars,\n bullet,\n radius,\n color,\n lineVariant,\n children,\n title,\n mod,\n ...others\n } = props;\n\n const ctx = useTimelineContext();\n const theme = useMantineTheme();\n\n const stylesApiProps = { classNames, styles };\n\n return (\n <Box\n {...ctx.getStyles('item', { ...stylesApiProps, className, style })}\n mod={[{ 'line-active': __lineActive, active: __active }, mod]}\n __vars={{\n '--tli-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--tli-color': color ? getThemeColor(color, theme) : undefined,\n '--tli-border-style': lineVariant || undefined,\n }}\n {...others}\n >\n <Box\n {...ctx.getStyles('itemBullet', stylesApiProps)}\n mod={{ 'with-child': !!bullet, align: __align, active: __active }}\n >\n {bullet}\n </Box>\n\n <div {...ctx.getStyles('itemBody', stylesApiProps)}>\n {title && <div {...ctx.getStyles('itemTitle', stylesApiProps)}>{title}</div>}\n <div {...ctx.getStyles('itemContent', stylesApiProps)}>{children}</div>\n </div>\n </Box>\n );\n});\n\nTimelineItem.classes = classes;\nTimelineItem.displayName = '@mantine/core/TimelineItem';\n"],"mappings":";;;;;;;;;;;AAwDA,MAAa,eAAe,SAA8B,WAAW;CAEnE,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,UACA,SACA,cACA,QACA,QACA,QACA,OACA,aACA,UACA,OACA,KACA,GAAG,WAlBS,SAAS,gBAAgB,MAAM,OAAO;CAqBpD,MAAM,MAAM,oBAAoB;CAChC,MAAM,QAAQ,iBAAiB;CAE/B,MAAM,iBAAiB;EAAE;EAAY;EAAQ;AAE7C,QACE,qBAAC,KAAD;EACE,GAAI,IAAI,UAAU,QAAQ;GAAE,GAAG;GAAgB;GAAW;GAAO,CAAC;EAClE,KAAK,CAAC;GAAE,eAAe;GAAc,QAAQ;GAAU,EAAE,IAAI;EAC7D,QAAQ;GACN,gBAAgB,WAAW,KAAA,IAAY,UAAU,OAAO,GAAG,KAAA;GAC3D,eAAe,QAAQ,cAAc,OAAO,MAAM,GAAG,KAAA;GACrD,sBAAsB,eAAe,KAAA;GACtC;EACD,GAAI;YARN,CAUE,oBAAC,KAAD;GACE,GAAI,IAAI,UAAU,cAAc,eAAe;GAC/C,KAAK;IAAE,cAAc,CAAC,CAAC;IAAQ,OAAO;IAAS,QAAQ;IAAU;aAEhE;GACG,CAAA,EAEN,qBAAC,OAAD;GAAK,GAAI,IAAI,UAAU,YAAY,eAAe;aAAlD,CACG,SAAS,oBAAC,OAAD;IAAK,GAAI,IAAI,UAAU,aAAa,eAAe;cAAG;IAAY,CAAA,EAC5E,oBAAC,OAAD;IAAK,GAAI,IAAI,UAAU,eAAe,eAAe;IAAG;IAAe,CAAA,CACnE;KACF;;EAER;AAEF,aAAa,UAAUA;AACvB,aAAa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-theme.mjs","names":[],"sources":["../../../src/core/MantineProvider/default-theme.ts"],"sourcesContent":["import { rem } from '../utils';\nimport { defaultVariantColorsResolver } from './color-functions';\nimport { DEFAULT_COLORS } from './default-colors';\nimport type { MantineTheme } from './theme.types';\n\nconst DEFAULT_FONT_FAMILY =\n '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji';\n\nexport const DEFAULT_THEME: MantineTheme = {\n scale: 1,\n fontSmoothing: true,\n focusRing: 'auto',\n white: '#fff',\n black: '#000',\n colors: DEFAULT_COLORS,\n primaryShade: { light: 6, dark: 8 },\n primaryColor: 'blue',\n variantColorResolver: defaultVariantColorsResolver,\n autoContrast: false,\n luminanceThreshold: 0.3,\n fontFamily: DEFAULT_FONT_FAMILY,\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace',\n respectReducedMotion: false,\n cursorType: 'default',\n defaultGradient: { from: 'blue', to: 'cyan', deg: 45 },\n defaultRadius: '
|
|
1
|
+
{"version":3,"file":"default-theme.mjs","names":[],"sources":["../../../src/core/MantineProvider/default-theme.ts"],"sourcesContent":["import { rem } from '../utils';\nimport { defaultVariantColorsResolver } from './color-functions';\nimport { DEFAULT_COLORS } from './default-colors';\nimport type { MantineTheme } from './theme.types';\n\nconst DEFAULT_FONT_FAMILY =\n '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji';\n\nexport const DEFAULT_THEME: MantineTheme = {\n scale: 1,\n fontSmoothing: true,\n focusRing: 'auto',\n white: '#fff',\n black: '#000',\n colors: DEFAULT_COLORS,\n primaryShade: { light: 6, dark: 8 },\n primaryColor: 'blue',\n variantColorResolver: defaultVariantColorsResolver,\n autoContrast: false,\n luminanceThreshold: 0.3,\n fontFamily: DEFAULT_FONT_FAMILY,\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace',\n respectReducedMotion: false,\n cursorType: 'default',\n defaultGradient: { from: 'blue', to: 'cyan', deg: 45 },\n defaultRadius: 'md',\n activeClassName: 'mantine-active',\n focusClassName: '',\n\n headings: {\n fontFamily: DEFAULT_FONT_FAMILY,\n fontWeight: '700',\n textWrap: 'wrap',\n sizes: {\n h1: { fontSize: rem(34), lineHeight: '1.3' },\n h2: { fontSize: rem(26), lineHeight: '1.35' },\n h3: { fontSize: rem(22), lineHeight: '1.4' },\n h4: { fontSize: rem(18), lineHeight: '1.45' },\n h5: { fontSize: rem(16), lineHeight: '1.5' },\n h6: { fontSize: rem(14), lineHeight: '1.5' },\n },\n },\n\n fontSizes: {\n xs: rem(12),\n sm: rem(14),\n md: rem(16),\n lg: rem(18),\n xl: rem(20),\n },\n\n lineHeights: {\n xs: '1.4',\n sm: '1.45',\n md: '1.55',\n lg: '1.6',\n xl: '1.65',\n },\n\n fontWeights: {\n regular: '400',\n medium: '600',\n bold: '700',\n },\n\n radius: {\n xs: rem(2),\n sm: rem(4),\n md: rem(8),\n lg: rem(16),\n xl: rem(32),\n },\n\n spacing: {\n xs: rem(10),\n sm: rem(12),\n md: rem(16),\n lg: rem(20),\n xl: rem(32),\n },\n\n breakpoints: {\n xs: '36em',\n sm: '48em',\n md: '62em',\n lg: '75em',\n xl: '88em',\n },\n\n shadows: {\n xs: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), 0 ${rem(1)} ${rem(2)} rgba(0, 0, 0, 0.1)`,\n sm: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(10)} ${rem(\n 15\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(7)} ${rem(7)} ${rem(-5)}`,\n md: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(20)} ${rem(\n 25\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(10)} ${rem(10)} ${rem(-5)}`,\n lg: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(28)} ${rem(\n 23\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(12)} ${rem(12)} ${rem(-7)}`,\n xl: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(36)} ${rem(\n 28\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(17)} ${rem(17)} ${rem(-7)}`,\n },\n\n other: {},\n components: {},\n};\n"],"mappings":";;;;AAKA,MAAM,sBACJ;AAEF,MAAa,gBAA8B;CACzC,OAAO;CACP,eAAe;CACf,WAAW;CACX,OAAO;CACP,OAAO;CACP,QAAQ;CACR,cAAc;EAAE,OAAO;EAAG,MAAM;EAAG;CACnC,cAAc;CACd,sBAAsB;CACtB,cAAc;CACd,oBAAoB;CACpB,YAAY;CACZ,qBACE;CACF,sBAAsB;CACtB,YAAY;CACZ,iBAAiB;EAAE,MAAM;EAAQ,IAAI;EAAQ,KAAK;EAAI;CACtD,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAEhB,UAAU;EACR,YAAY;EACZ,YAAY;EACZ,UAAU;EACV,OAAO;GACL,IAAI;IAAE,UAAU,IAAI,GAAG;IAAE,YAAY;IAAO;GAC5C,IAAI;IAAE,UAAU,IAAI,GAAG;IAAE,YAAY;IAAQ;GAC7C,IAAI;IAAE,UAAU,IAAI,GAAG;IAAE,YAAY;IAAO;GAC5C,IAAI;IAAE,UAAU,IAAI,GAAG;IAAE,YAAY;IAAQ;GAC7C,IAAI;IAAE,UAAU,IAAI,GAAG;IAAE,YAAY;IAAO;GAC5C,IAAI;IAAE,UAAU,IAAI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AG,CAAC,GAAG,IACjF,GACD,CAAC,GAAG,IAAI,GAAG,CAAC,0BAA0B,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG;EACpE,IAAI,KAAK,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,8CAA8C,IAAI,GAAG,CAAC,GAAG,IACjF,GACD,CAAC,GAAG,IAAI,GAAG,CAAC,0BAA0B,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG;EACrE;CAED,OAAO,EAAE;CACT,YAAY,EAAE;CACf"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region packages/@mantine/core/src/core/utils/get-env/get-env.ts
|
|
3
3
|
function getEnv() {
|
|
4
|
-
if (typeof process !== "undefined" && process.env && "
|
|
4
|
+
if (typeof process !== "undefined" && process.env && "development") return "development";
|
|
5
5
|
return "development";
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-env.mjs","names":[],"sources":["../../../../src/core/utils/get-env/get-env.ts"],"sourcesContent":["export function getEnv() {\n if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n return 'development';\n}\n"],"mappings":";;AAAA,SAAgB,SAAS;AACvB,KAAI,OAAO,YAAY,eAAe,QAAQ,OAAA,
|
|
1
|
+
{"version":3,"file":"get-env.mjs","names":[],"sources":["../../../../src/core/utils/get-env/get-env.ts"],"sourcesContent":["export function getEnv() {\n if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV) {\n return process.env.NODE_ENV;\n }\n\n return 'development';\n}\n"],"mappings":";;AAAA,SAAgB,SAAS;AACvB,KAAI,OAAO,YAAY,eAAe,QAAQ,OAAA,cAC5C,QAAA;AAGF,QAAO"}
|
|
@@ -8,21 +8,5 @@ interface UseComboboxTargetPropsInput {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function useComboboxTargetProps({ onKeyDown, withKeyboardNavigation, withAriaAttributes, withExpandedAttribute, targetType, autoComplete, }: UseComboboxTargetPropsInput): {
|
|
10
10
|
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
11
|
-
'aria-haspopup': "listbox";
|
|
12
|
-
'aria-expanded': boolean | undefined;
|
|
13
|
-
'aria-controls': string | undefined;
|
|
14
|
-
'aria-activedescendant': string | undefined;
|
|
15
|
-
autoComplete: string | undefined;
|
|
16
|
-
'data-expanded': true | undefined;
|
|
17
|
-
'data-mantine-stop-propagation': true | undefined;
|
|
18
|
-
} | {
|
|
19
|
-
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
-
'aria-haspopup'?: undefined;
|
|
21
|
-
'aria-expanded'?: undefined;
|
|
22
|
-
'aria-controls'?: undefined;
|
|
23
|
-
'aria-activedescendant'?: undefined;
|
|
24
|
-
autoComplete?: undefined;
|
|
25
|
-
'data-expanded'?: undefined;
|
|
26
|
-
'data-mantine-stop-propagation'?: undefined;
|
|
27
11
|
};
|
|
28
12
|
export {};
|
|
@@ -8,4 +8,4 @@ export interface InputClearSectionProps {
|
|
|
8
8
|
size: MantineSize | string | undefined;
|
|
9
9
|
__clearSectionMode: ClearSectionMode | undefined;
|
|
10
10
|
}
|
|
11
|
-
export declare function InputClearSection({ __clearable, __clearSection, rightSection, __defaultRightSection, size, __clearSectionMode, }: InputClearSectionProps): string | number | bigint | boolean |
|
|
11
|
+
export declare function InputClearSection({ __clearable, __clearSection, rightSection, __defaultRightSection, size, __clearSectionMode, }: InputClearSectionProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|