@apipass/design-system 8.3.0 → 8.4.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/dist/lib/embedded-styles.js +2 -2
- package/dist/lib/lib.index.cjs +1 -1
- package/dist/lib/lib.index.js +798 -796
- package/dist/lib/lib.index.js.map +1 -1
- package/dist/lib/style.css +1 -1
- package/dist/lib/ui/components/ConfirmDialog/ConfirmDialog.cjs +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
- package/dist/lib/ui/components/Widget/Widget.cjs +1 -1
- package/dist/lib/ui/components/WidgetGrid/WidgetGrid.cjs +1 -1
- package/dist/lib/ui/components/charts/BarChart/BarChart.cjs +1 -1
- package/dist/lib/ui/components/charts/ChartColorPicker/ChartColorPicker.cjs +1 -1
- package/dist/lib/ui/components/charts/ChartLegend/use-chart-legend.cjs +1 -1
- package/dist/lib/ui/components/charts/PieChart/PieChart.cjs +1 -1
- package/dist/lib/ui/components/charts/TimeSeriesChart/TimeSeriesChart.cjs +1 -1
- package/dist/lib/ui/components/charts/TopList/TopList.cjs +1 -1
- package/dist/lib/ui/primitives/Avatar/Avatar.js +6 -6
- package/dist/lib/ui/primitives/BrandLoader/BrandLoader.cjs +1 -1
- package/dist/lib/ui/primitives/Button/Button.cjs.map +1 -1
- package/dist/lib/ui/primitives/Button/Button.js +6 -6
- package/dist/lib/ui/primitives/Button/Button.js.map +1 -1
- package/dist/lib/ui/primitives/CodeBlock/CodeBlock.cjs +1 -1
- package/dist/lib/ui/primitives/CodeEditor/CodeEditor.cjs +1 -1
- package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs +1 -1
- package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs.map +1 -1
- package/dist/lib/ui/primitives/ComboBox/ComboBox.js +40 -56
- package/dist/lib/ui/primitives/ComboBox/ComboBox.js.map +1 -1
- package/dist/lib/ui/primitives/ComboBox/MultiComboBox.cjs +2 -0
- package/dist/lib/ui/primitives/ComboBox/MultiComboBox.cjs.map +1 -0
- package/dist/lib/ui/primitives/ComboBox/MultiComboBox.js +179 -0
- package/dist/lib/ui/primitives/ComboBox/MultiComboBox.js.map +1 -0
- package/dist/lib/ui/primitives/ComboBox/comboBoxFocus.cjs +2 -0
- package/dist/lib/ui/primitives/ComboBox/comboBoxFocus.cjs.map +1 -0
- package/dist/lib/ui/primitives/ComboBox/comboBoxFocus.js +30 -0
- package/dist/lib/ui/primitives/ComboBox/comboBoxFocus.js.map +1 -0
- package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/lib/ui/primitives/FileUpload/FileUpload.cjs +1 -1
- package/dist/lib/ui/primitives/FileUpload/FileUpload.js +24 -24
- package/dist/lib/ui/primitives/Image/Image.cjs +1 -1
- package/dist/lib/ui/primitives/Input/Input.cjs +1 -1
- package/dist/lib/ui/primitives/Input/Input.js +2 -2
- package/dist/lib/ui/primitives/JsonViewer/JsonEditor.cjs +1 -1
- package/dist/lib/ui/primitives/Link/Link.cjs +1 -1
- package/dist/lib/ui/primitives/Link/Link.js +3 -3
- package/dist/lib/ui/primitives/Menu/Menu.cjs +1 -1
- package/dist/lib/ui/primitives/Menu/Menu.js +28 -28
- package/dist/lib/ui/primitives/Search/Search.js +8 -8
- package/dist/lib/ui/primitives/Select/MultiSelect.cjs +1 -1
- package/dist/lib/ui/primitives/Select/MultiSelect.js +17 -17
- package/dist/lib/ui/primitives/Select/MultiSelect.js.map +1 -1
- package/dist/lib/ui/primitives/Tag/Tag.cjs +1 -1
- package/dist/lib/ui/primitives/Tag/Tag.cjs.map +1 -1
- package/dist/lib/ui/primitives/Tag/Tag.js +47 -38
- package/dist/lib/ui/primitives/Tag/Tag.js.map +1 -1
- package/dist/lib/ui/primitives/Textarea/Textarea.cjs +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/lib/ui/primitives/Tooltip/Tooltip.js +29 -29
- package/dist/lib/ui/primitives/Tooltip/Tooltip.js.map +1 -1
- package/dist/lib/ui/utils/AnchorOrButton.cjs +1 -1
- package/dist/lib/ui/utils/AnchorOrButton.cjs.map +1 -1
- package/dist/lib/ui/utils/AnchorOrButton.js +10 -12
- package/dist/lib/ui/utils/AnchorOrButton.js.map +1 -1
- package/dist/lib/vendor/@monaco-editor/react/dist/index.cjs +1 -1
- package/dist/lib/vendor/@monaco-editor/react/dist/index.cjs.map +1 -1
- package/dist/lib/vendor/@monaco-editor/react/dist/index.js +41 -41
- package/dist/lib/vendor/react-aria/dist/private/interactions/createEventHandler.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createEventHandler.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createEventHandler.js +28 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createEventHandler.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createKeyboardShortcutHandler.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createKeyboardShortcutHandler.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createKeyboardShortcutHandler.js +93 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/createKeyboardShortcutHandler.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/focusSafely.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/focusSafely.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/focusSafely.js +20 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/focusSafely.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocus.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocus.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocus.js +32 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocus.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusVisible.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusVisible.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusVisible.js +94 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusVisible.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusable.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusable.cjs.map +1 -0
- package/dist/lib/vendor/{@react-aria/interactions/dist → react-aria/dist/private/interactions}/useFocusable.js +10 -10
- package/dist/lib/vendor/react-aria/dist/private/interactions/useFocusable.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useHover.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useHover.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useHover.js +82 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useHover.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useKeyboard.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useKeyboard.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useKeyboard.js +44 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/useKeyboard.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/utils.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/utils.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/utils.js +59 -0
- package/dist/lib/vendor/react-aria/dist/private/interactions/utils.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/ssr/SSRProvider.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/ssr/SSRProvider.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/ssr/SSRProvider.js +52 -0
- package/dist/lib/vendor/react-aria/dist/private/ssr/SSRProvider.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/tooltip/useTooltipTrigger.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/tooltip/useTooltipTrigger.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/tooltip/useTooltipTrigger.js +62 -0
- package/dist/lib/vendor/react-aria/dist/private/tooltip/useTooltipTrigger.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/chain.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/chain.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/chain.js +9 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/chain.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/domHelpers.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/domHelpers.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/domHelpers.js +36 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/domHelpers.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/focusWithoutScrolling.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/focusWithoutScrolling.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/focusWithoutScrolling.js +9 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/focusWithoutScrolling.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/isVirtualEvent.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/isVirtualEvent.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeProps.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeProps.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeProps.js +24 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeProps.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeRefs.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeRefs.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeRefs.js +22 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/mergeRefs.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/openLink.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/openLink.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/openLink.js +26 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/openLink.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/platform.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/platform.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/platform.js +40 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/platform.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/runAfterTransition.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/runAfterTransition.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/runAfterTransition.js +43 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/runAfterTransition.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/shadowdom/DOMFunctions.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/shadowdom/DOMFunctions.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/shadowdom/DOMFunctions.js +33 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/shadowdom/DOMFunctions.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useGlobalListeners.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useGlobalListeners.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useGlobalListeners.js +35 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useGlobalListeners.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useId.cjs +2 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useId.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useId.js +44 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useId.js.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useLayoutEffect.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useLayoutEffect.js.map +1 -0
- package/dist/lib/vendor/{@react-aria/utils/dist → react-aria/dist/private/utils}/useSyncRef.cjs +1 -1
- package/dist/lib/vendor/react-aria/dist/private/utils/useSyncRef.cjs.map +1 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useSyncRef.js +13 -0
- package/dist/lib/vendor/react-aria/dist/private/utils/useSyncRef.js.map +1 -0
- package/dist/lib/vendor/react-draggable/build/cjs/Draggable.cjs +1 -1
- package/dist/lib/vendor/react-draggable/build/cjs/Draggable.js +8 -8
- package/dist/lib/vendor/react-grid-layout/build/GridItem.cjs +1 -1
- package/dist/lib/vendor/react-grid-layout/build/GridItem.js +7 -7
- package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.cjs +1 -1
- package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.js +7 -7
- package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.js.map +1 -1
- package/dist/lib/vendor/react-grid-layout/build/ResponsiveReactGridLayout.cjs +1 -1
- package/dist/lib/vendor/react-grid-layout/build/ResponsiveReactGridLayout.js +10 -10
- package/dist/lib/vendor/react-grid-layout/build/ResponsiveReactGridLayout.js.map +1 -1
- package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.cjs +1 -1
- package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.js +8 -8
- package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.js.map +1 -1
- package/dist/lib/vendor/react-grid-layout/build/utils.cjs +1 -1
- package/dist/lib/vendor/react-grid-layout/build/utils.js +18 -18
- package/dist/lib/vendor/react-resizable/build/Resizable.cjs +1 -1
- package/dist/lib/vendor/react-resizable/build/Resizable.js +61 -61
- package/dist/lib/vendor/react-resizable/build/Resizable.js.map +1 -1
- package/dist/lib/vendor/react-resizable/build/ResizableBox.cjs +1 -1
- package/dist/lib/vendor/react-resizable/build/ResizableBox.js +7 -7
- package/dist/lib/vendor/react-resizable/build/ResizableBox.js.map +1 -1
- package/dist/lib/vendor/react-resizable/build/utils.cjs +1 -1
- package/dist/lib/vendor/react-resizable/build/utils.cjs.map +1 -1
- package/dist/lib/vendor/react-stately/dist/private/flags/flags.cjs +2 -0
- package/dist/lib/vendor/react-stately/dist/private/flags/flags.cjs.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/flags/flags.js +8 -0
- package/dist/lib/vendor/react-stately/dist/private/flags/flags.js.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/overlays/useOverlayTriggerState.cjs +2 -0
- package/dist/lib/vendor/react-stately/dist/private/overlays/useOverlayTriggerState.cjs.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/overlays/useOverlayTriggerState.js +32 -0
- package/dist/lib/vendor/react-stately/dist/private/overlays/useOverlayTriggerState.js.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/tooltip/useTooltipTriggerState.cjs +2 -0
- package/dist/lib/vendor/react-stately/dist/private/tooltip/useTooltipTriggerState.cjs.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/tooltip/useTooltipTriggerState.js +43 -0
- package/dist/lib/vendor/react-stately/dist/private/tooltip/useTooltipTriggerState.js.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/utils/useControlledState.cjs +2 -0
- package/dist/lib/vendor/react-stately/dist/private/utils/useControlledState.cjs.map +1 -0
- package/dist/lib/vendor/react-stately/dist/private/utils/useControlledState.js +29 -0
- package/dist/lib/vendor/react-stately/dist/private/utils/useControlledState.js.map +1 -0
- package/dist/lib/vendor/react-toastify/dist/index.cjs +1 -1
- package/dist/lib/vendor/react-toastify/dist/index.js +10 -10
- package/dist/types/ui/primitives/ComboBox/MultiComboBox.d.ts +28 -0
- package/dist/types/ui/primitives/ComboBox/comboBoxFocus.d.ts +3 -0
- package/dist/types/ui/primitives/Tag/Tag.d.ts +2 -1
- package/dist/types/ui/primitives/index.d.ts +1 -0
- package/dist/types/ui/utils/AnchorOrButton.d.ts +3 -1
- package/package.json +3 -3
- package/dist/lib/vendor/@react-aria/interactions/dist/createEventHandler.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/createEventHandler.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/createEventHandler.js +0 -29
- package/dist/lib/vendor/@react-aria/interactions/dist/createEventHandler.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/focusSafely.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/focusSafely.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/focusSafely.js +0 -18
- package/dist/lib/vendor/@react-aria/interactions/dist/focusSafely.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocus.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocus.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocus.js +0 -31
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocus.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusVisible.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusVisible.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusVisible.js +0 -66
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusVisible.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusable.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusable.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useFocusable.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useHover.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/useHover.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useHover.js +0 -81
- package/dist/lib/vendor/@react-aria/interactions/dist/useHover.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useKeyboard.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/useKeyboard.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/useKeyboard.js +0 -13
- package/dist/lib/vendor/@react-aria/interactions/dist/useKeyboard.js.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/utils.cjs +0 -2
- package/dist/lib/vendor/@react-aria/interactions/dist/utils.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/interactions/dist/utils.js +0 -64
- package/dist/lib/vendor/@react-aria/interactions/dist/utils.js.map +0 -1
- package/dist/lib/vendor/@react-aria/ssr/dist/SSRProvider.cjs +0 -2
- package/dist/lib/vendor/@react-aria/ssr/dist/SSRProvider.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/ssr/dist/SSRProvider.js +0 -49
- package/dist/lib/vendor/@react-aria/ssr/dist/SSRProvider.js.map +0 -1
- package/dist/lib/vendor/@react-aria/tooltip/dist/useTooltipTrigger.cjs +0 -2
- package/dist/lib/vendor/@react-aria/tooltip/dist/useTooltipTrigger.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/tooltip/dist/useTooltipTrigger.js +0 -61
- package/dist/lib/vendor/@react-aria/tooltip/dist/useTooltipTrigger.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/DOMFunctions.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/DOMFunctions.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/DOMFunctions.js +0 -28
- package/dist/lib/vendor/@react-aria/utils/dist/DOMFunctions.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/chain.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/chain.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/chain.js +0 -9
- package/dist/lib/vendor/@react-aria/utils/dist/chain.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/domHelpers.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/domHelpers.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/domHelpers.js +0 -16
- package/dist/lib/vendor/@react-aria/utils/dist/domHelpers.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/focusWithoutScrolling.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/focusWithoutScrolling.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/focusWithoutScrolling.js +0 -46
- package/dist/lib/vendor/@react-aria/utils/dist/focusWithoutScrolling.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/isVirtualEvent.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/isVirtualEvent.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/mergeProps.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/mergeProps.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/mergeProps.js +0 -23
- package/dist/lib/vendor/@react-aria/utils/dist/mergeProps.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/platform.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/platform.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/platform.js +0 -24
- package/dist/lib/vendor/@react-aria/utils/dist/platform.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/runAfterTransition.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/runAfterTransition.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/runAfterTransition.js +0 -36
- package/dist/lib/vendor/@react-aria/utils/dist/runAfterTransition.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useEffectEvent.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/useEffectEvent.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useEffectEvent.js +0 -19
- package/dist/lib/vendor/@react-aria/utils/dist/useEffectEvent.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useGlobalListeners.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/useGlobalListeners.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useGlobalListeners.js +0 -35
- package/dist/lib/vendor/@react-aria/utils/dist/useGlobalListeners.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useId.cjs +0 -2
- package/dist/lib/vendor/@react-aria/utils/dist/useId.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useId.js +0 -43
- package/dist/lib/vendor/@react-aria/utils/dist/useId.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useLayoutEffect.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useLayoutEffect.js.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useSyncRef.cjs.map +0 -1
- package/dist/lib/vendor/@react-aria/utils/dist/useSyncRef.js +0 -13
- package/dist/lib/vendor/@react-aria/utils/dist/useSyncRef.js.map +0 -1
- package/dist/lib/vendor/@react-stately/flags/dist/import.cjs +0 -2
- package/dist/lib/vendor/@react-stately/flags/dist/import.cjs.map +0 -1
- package/dist/lib/vendor/@react-stately/flags/dist/import.js +0 -8
- package/dist/lib/vendor/@react-stately/flags/dist/import.js.map +0 -1
- package/dist/lib/vendor/@react-stately/overlays/dist/useOverlayTriggerState.cjs +0 -2
- package/dist/lib/vendor/@react-stately/overlays/dist/useOverlayTriggerState.cjs.map +0 -1
- package/dist/lib/vendor/@react-stately/overlays/dist/useOverlayTriggerState.js +0 -30
- package/dist/lib/vendor/@react-stately/overlays/dist/useOverlayTriggerState.js.map +0 -1
- package/dist/lib/vendor/@react-stately/tooltip/dist/useTooltipTriggerState.cjs +0 -2
- package/dist/lib/vendor/@react-stately/tooltip/dist/useTooltipTriggerState.cjs.map +0 -1
- package/dist/lib/vendor/@react-stately/tooltip/dist/useTooltipTriggerState.js +0 -42
- package/dist/lib/vendor/@react-stately/tooltip/dist/useTooltipTriggerState.js.map +0 -1
- package/dist/lib/vendor/@react-stately/utils/dist/useControlledState.cjs +0 -2
- package/dist/lib/vendor/@react-stately/utils/dist/useControlledState.cjs.map +0 -1
- package/dist/lib/vendor/@react-stately/utils/dist/useControlledState.js +0 -30
- package/dist/lib/vendor/@react-stately/utils/dist/useControlledState.js.map +0 -1
- /package/dist/lib/vendor/{@react-aria/utils/dist → react-aria/dist/private/utils}/isVirtualEvent.cjs +0 -0
- /package/dist/lib/vendor/{@react-aria/utils/dist → react-aria/dist/private/utils}/isVirtualEvent.js +0 -0
- /package/dist/lib/vendor/{@react-aria/utils/dist → react-aria/dist/private/utils}/useLayoutEffect.cjs +0 -0
- /package/dist/lib/vendor/{@react-aria/utils/dist → react-aria/dist/private/utils}/useLayoutEffect.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),A=require("../../../vendor/clsx/dist/clsx.cjs"),f=require("react"),d=require("react-aria-components"),K=require("./comboBoxFocus.cjs");;/* empty css */const U=require("../Tag/Tag.cjs"),V=require("../../icons/IconChevronDown.cjs"),W=require("../../hooks/useOverlayPortal.cjs"),j=require("../Fieldset/Fieldset.cjs"),G=require("../ListBox/ListBox.cjs"),H=require("../Input/Input.cjs");function _(e,n){return e.length===n.length&&e.every((c,u)=>c===n[u])}function k(e,n){return e.localeCompare(n,void 0,{sensitivity:"base"})===0}function z(e,n){if(e){for(const c of e.collection)if(c.type==="item"&&k(c.textValue,n))return c.key}}function J(e){const n=new Map;return e==null||e.selectedItems.forEach(c=>n.set(c.key,c.textValue)),n}function Q({keys:e,inputValue:n,placeholder:c,canRemove:u,removeValueLabel:y,onRemoveKey:g,onSubmitText:B}){const s=f.useContext(d.ComboBoxStateContext),x=f.useRef(null),a=f.useRef(null);K.useKeepFocusOnInput(x);const C=J(s),m=o=>C.get(o)||String(o);function p(o){var i;g(o),(i=a.current)==null||i.focus()}function I(o){const i=e[e.length-1],b=u&&n===""&&i!==void 0;if(o.key==="Backspace"&&b){g(i);return}const q=(s==null?void 0:s.selectionManager.focusedKey)!=null;if(o.key!=="Enter"||q)return;const h=n.trim();h!==""&&(o.preventDefault(),B(h,z(s,h)))}return r.jsxs(d.Group,{className:"combobox combobox-multiple",children:[e.length>0&&r.jsx("span",{className:"combobox-tags",role:"list",onMouseDown:K.keepFocusOnInput,children:r.jsx(d.ButtonContext.Provider,{value:null,children:e.map(o=>r.jsx(U.Tag,{role:"listitem",scheme:"neutral",variant:"secondary",removeLabel:u?y(m(o)):void 0,onRemove:u?()=>p(o):void 0,children:m(o)},`${typeof o}:${o}`))})}),r.jsx(H.Input,{ref:a,className:"combobox-input",placeholder:e.length===0?c:void 0,onKeyDown:I,onPointerDown:K.openMenuWhenFocusedInputIsPressed(x)}),r.jsx(d.Button,{ref:x,className:"combobox-trigger",children:r.jsx(V.IconChevronDown,{"aria-hidden":"true"})})]})}function X({className:e,label:n,description:c,errorMessage:u,placeholder:y,children:g,items:B,value:s,defaultValue:x,onChange:a,removeValueLabel:C,allowsCustomValue:m,validateCustomValue:p,invalidCustomValueMessage:I,isInvalid:o,isDisabled:i,isReadOnly:b,...q}){const h=A.clsx(e,"combobox-container"),[P,R]=f.useState(x??[]),l=s??P,[F,w]=f.useState(""),[M,N]=f.useState(!1),L=W.useOverlayPortalContainer();function S(t){_(t,l)||(s===void 0&&R(t),a==null||a(t))}function T(t){w(t),N(!1)}function O(t){t.length>l.length&&T(""),S(t)}function E(t){return m===!0&&((p==null?void 0:p(t))??!0)}function $(t,v){if(v===void 0&&!E(t)){N(m===!0);return}const D=v??t;T(""),l.includes(D)||S([...l,D])}return r.jsx(d.ComboBox,{...q,className:h,selectionMode:"multiple",menuTrigger:"focus",value:l,onChange:O,inputValue:F,onInputChange:T,isInvalid:o||M,isDisabled:i,isReadOnly:b,children:r.jsxs(j.Field,{children:[n&&r.jsx(j.Label,{children:n}),r.jsx(Q,{keys:l,inputValue:F,placeholder:y,canRemove:!i&&!b,removeValueLabel:C,onRemoveKey:t=>S(l.filter(v=>v!==t)),onSubmitText:$}),r.jsx(d.Popover,{className:"combobox-popover",UNSTABLE_portalContainer:L,children:r.jsx(G.ListBox,{items:B,children:g})}),c&&r.jsx(j.Description,{children:c}),r.jsx(j.FieldError,{children:M?I:u})]})})}exports.MultiComboBoxField=X;
|
|
2
|
+
//# sourceMappingURL=MultiComboBox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiComboBox.cjs","sources":["../../../../../src/ui/primitives/ComboBox/MultiComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n Label,\n ListBox,\n SharedFieldProps,\n Tag,\n} from \"primitives\";\nimport React, { useContext, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n ButtonContext as RACButtonContext,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n type Key as RACKey,\n} from \"react-aria-components\";\nimport {\n keepFocusOnInput,\n openMenuWhenFocusedInputIsPressed,\n useKeepFocusOnInput,\n} from \"./comboBoxFocus\";\nimport \"./combobox.css\";\n\ntype MultiComboBoxState = NonNullable<\n React.ContextType<typeof RACComboBoxStateContext>\n>;\n\ntype PropsManagedByMultiComboBox =\n | \"children\"\n | \"selectionMode\"\n | \"value\"\n | \"defaultValue\"\n | \"onChange\"\n | \"selectedKey\"\n | \"defaultSelectedKey\"\n | \"onSelectionChange\"\n | \"allowsCustomValue\"\n | \"inputValue\"\n | \"defaultInputValue\"\n | \"onInputChange\"\n | \"menuTrigger\";\n\ninterface CustomValueValidationProps {\n validateCustomValue: (text: string) => boolean;\n invalidCustomValueMessage: string;\n}\n\ninterface WithoutCustomValueValidation {\n validateCustomValue?: never;\n invalidCustomValueMessage?: never;\n}\n\ntype CustomValueProps =\n | ({ allowsCustomValue: true } & (\n | CustomValueValidationProps\n | WithoutCustomValueValidation\n ))\n | ({ allowsCustomValue?: false } & WithoutCustomValueValidation);\n\nexport type MultiComboBoxFieldProps<T extends object> = Omit<\n RACComboBoxProps<T, \"multiple\">,\n PropsManagedByMultiComboBox\n> &\n SharedFieldProps &\n CustomValueProps & {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n value?: RACKey[];\n defaultValue?: RACKey[];\n onChange?: (keys: RACKey[]) => void;\n removeValueLabel: (valueText: string) => string;\n };\n\nfunction hasSameKeys(a: readonly RACKey[], b: readonly RACKey[]): boolean {\n return a.length === b.length && a.every((key, index) => key === b[index]);\n}\n\nfunction isSameText(a: string, b: string): boolean {\n return a.localeCompare(b, undefined, { sensitivity: \"base\" }) === 0;\n}\n\nfunction itemKeyWithText(\n state: MultiComboBoxState | null,\n text: string,\n): RACKey | undefined {\n if (!state) return undefined;\n for (const node of state.collection) {\n if (node.type === \"item\" && isSameText(node.textValue, text))\n return node.key;\n }\n return undefined;\n}\n\nfunction selectedTextByKey(\n state: MultiComboBoxState | null,\n): Map<RACKey, string> {\n const texts = new Map<RACKey, string>();\n state?.selectedItems.forEach((item) => texts.set(item.key, item.textValue));\n return texts;\n}\n\ninterface MultiComboBoxControlProps {\n keys: RACKey[];\n inputValue: string;\n placeholder?: string;\n canRemove: boolean;\n removeValueLabel: (valueText: string) => string;\n onRemoveKey: (key: RACKey) => void;\n onSubmitText: (text: string, matchingItemKey: RACKey | undefined) => void;\n}\n\nfunction MultiComboBoxControl({\n keys,\n inputValue,\n placeholder,\n canRemove,\n removeValueLabel,\n onRemoveKey,\n onSubmitText,\n}: MultiComboBoxControlProps) {\n const state = useContext(RACComboBoxStateContext);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n useKeepFocusOnInput(triggerRef);\n const textByKey = selectedTextByKey(state);\n const textOf = (key: RACKey) => textByKey.get(key) || String(key);\n\n function removeKey(key: RACKey) {\n onRemoveKey(key);\n inputRef.current?.focus();\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n const lastKey: RACKey | undefined = keys[keys.length - 1];\n const canRemoveLastKey =\n canRemove && inputValue === \"\" && lastKey !== undefined;\n if (event.key === \"Backspace\" && canRemoveLastKey) {\n onRemoveKey(lastKey);\n return;\n }\n const isChoosingHighlightedItem =\n state?.selectionManager.focusedKey != null;\n if (event.key !== \"Enter\" || isChoosingHighlightedItem) return;\n const text = inputValue.trim();\n if (text === \"\") return;\n event.preventDefault();\n onSubmitText(text, itemKeyWithText(state, text));\n }\n\n return (\n <RACGroup className=\"combobox combobox-multiple\">\n {keys.length > 0 && (\n <span\n className=\"combobox-tags\"\n role=\"list\"\n onMouseDown={keepFocusOnInput}\n >\n <RACButtonContext.Provider value={null}>\n {keys.map((key) => (\n <Tag\n key={`${typeof key}:${key}`}\n role=\"listitem\"\n scheme=\"neutral\"\n variant=\"secondary\"\n removeLabel={\n canRemove ? removeValueLabel(textOf(key)) : undefined\n }\n onRemove={canRemove ? () => removeKey(key) : undefined}\n >\n {textOf(key)}\n </Tag>\n ))}\n </RACButtonContext.Provider>\n </span>\n )}\n <Input\n ref={inputRef}\n className=\"combobox-input\"\n placeholder={keys.length === 0 ? placeholder : undefined}\n onKeyDown={handleKeyDown}\n onPointerDown={openMenuWhenFocusedInputIsPressed(triggerRef)}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n );\n}\n\nexport function MultiComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n value,\n defaultValue,\n onChange,\n removeValueLabel,\n allowsCustomValue,\n validateCustomValue,\n invalidCustomValueMessage,\n isInvalid,\n isDisabled,\n isReadOnly,\n ...props\n}: MultiComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const [uncontrolledKeys, setUncontrolledKeys] = useState<RACKey[]>(\n defaultValue ?? [],\n );\n const keys = value ?? uncontrolledKeys;\n const [inputValue, setInputValue] = useState(\"\");\n const [isCustomValueRejected, setCustomValueRejected] = useState(false);\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n\n function changeKeys(nextKeys: RACKey[]) {\n if (hasSameKeys(nextKeys, keys)) return;\n if (value === undefined) setUncontrolledKeys(nextKeys);\n onChange?.(nextKeys);\n }\n\n function changeInput(text: string) {\n setInputValue(text);\n setCustomValueRejected(false);\n }\n\n function changeSelection(nextKeys: RACKey[]) {\n if (nextKeys.length > keys.length) changeInput(\"\");\n changeKeys(nextKeys);\n }\n\n function isAcceptedCustomValue(text: string): boolean {\n return allowsCustomValue === true && (validateCustomValue?.(text) ?? true);\n }\n\n function addTypedValue(text: string, matchingItemKey: RACKey | undefined) {\n if (matchingItemKey === undefined && !isAcceptedCustomValue(text)) {\n setCustomValueRejected(allowsCustomValue === true);\n return;\n }\n const key = matchingItemKey ?? text;\n changeInput(\"\");\n if (!keys.includes(key)) changeKeys([...keys, key]);\n }\n\n return (\n <RACComboBox<T, \"multiple\">\n {...props}\n className={classNames}\n selectionMode=\"multiple\"\n menuTrigger=\"focus\"\n value={keys}\n onChange={changeSelection}\n inputValue={inputValue}\n onInputChange={changeInput}\n isInvalid={isInvalid || isCustomValueRejected}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n >\n <Field>\n {label && <Label>{label}</Label>}\n <MultiComboBoxControl\n keys={keys}\n inputValue={inputValue}\n placeholder={placeholder}\n canRemove={!isDisabled && !isReadOnly}\n removeValueLabel={removeValueLabel}\n onRemoveKey={(key) => changeKeys(keys.filter((k) => k !== key))}\n onSubmitText={addTypedValue}\n />\n <RACPopover\n className=\"combobox-popover\"\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>\n {isCustomValueRejected ? invalidCustomValueMessage : errorMessage}\n </FieldError>\n </Field>\n </RACComboBox>\n );\n}\n"],"names":["hasSameKeys","a","b","key","index","isSameText","itemKeyWithText","state","text","node","selectedTextByKey","texts","item","MultiComboBoxControl","keys","inputValue","placeholder","canRemove","removeValueLabel","onRemoveKey","onSubmitText","useContext","RACComboBoxStateContext","triggerRef","useRef","inputRef","useKeepFocusOnInput","textByKey","textOf","removeKey","_a","handleKeyDown","event","lastKey","canRemoveLastKey","isChoosingHighlightedItem","jsxs","RACGroup","jsx","keepFocusOnInput","RACButtonContext","Tag","Input","openMenuWhenFocusedInputIsPressed","RACButton","IconChevronDown","MultiComboBoxField","className","label","description","errorMessage","children","items","value","defaultValue","onChange","allowsCustomValue","validateCustomValue","invalidCustomValueMessage","isInvalid","isDisabled","isReadOnly","props","classNames","clsx","uncontrolledKeys","setUncontrolledKeys","useState","setInputValue","isCustomValueRejected","setCustomValueRejected","portalContainer","useOverlayPortalContainer","changeKeys","nextKeys","changeInput","changeSelection","isAcceptedCustomValue","addTypedValue","matchingItemKey","RACComboBox","Field","Label","k","RACPopover","ListBox","Description","FieldError"],"mappings":"igBAiFA,SAASA,EAAYC,EAAsBC,EAA+B,CACxE,OAAOD,EAAE,SAAWC,EAAE,QAAUD,EAAE,MAAM,CAACE,EAAKC,IAAUD,IAAQD,EAAEE,CAAK,CAAC,CAC1E,CAEA,SAASC,EAAWJ,EAAWC,EAAoB,CACjD,OAAOD,EAAE,cAAcC,EAAG,OAAW,CAAE,YAAa,MAAA,CAAQ,IAAM,CACpE,CAEA,SAASI,EACPC,EACAC,EACoB,CACpB,GAAKD,GACL,UAAWE,KAAQF,EAAM,WACvB,GAAIE,EAAK,OAAS,QAAUJ,EAAWI,EAAK,UAAWD,CAAI,EACzD,OAAOC,EAAK,IAGlB,CAEA,SAASC,EACPH,EACqB,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A,IAACgD,EAAAA,YAAA,CAAa,SAAArC,CAAA,CAAY,EAC1CX,EAAAA,IAACiD,EAAAA,WAAA,CACE,SAAAlB,EAAwBX,EAA4BR,CAAA,CACvD,CAAA,CAAA,CACF,CAAA,CAAA,CAGN"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsx as i, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as U } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
|
+
import { useState as N, useContext as V, useRef as F } from "react";
|
|
4
|
+
import { ComboBox as W, Popover as $, ComboBoxStateContext as G, Group as H, ButtonContext as _, Button as q } from "react-aria-components";
|
|
5
|
+
import { useKeepFocusOnInput as z, keepFocusOnInput as J, openMenuWhenFocusedInputIsPressed as Q } from "./comboBoxFocus.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Tag as X } from "../Tag/Tag.js";
|
|
8
|
+
import { IconChevronDown as Y } from "../../icons/IconChevronDown.js";
|
|
9
|
+
import { useOverlayPortalContainer as Z } from "../../hooks/useOverlayPortal.js";
|
|
10
|
+
import { Field as k, Label as ee, Description as oe, FieldError as ne } from "../Fieldset/Fieldset.js";
|
|
11
|
+
import { ListBox as te } from "../ListBox/ListBox.js";
|
|
12
|
+
import { Input as re } from "../Input/Input.js";
|
|
13
|
+
function ie(e, n) {
|
|
14
|
+
return e.length === n.length && e.every((r, u) => r === n[u]);
|
|
15
|
+
}
|
|
16
|
+
function ce(e, n) {
|
|
17
|
+
return e.localeCompare(n, void 0, { sensitivity: "base" }) === 0;
|
|
18
|
+
}
|
|
19
|
+
function le(e, n) {
|
|
20
|
+
if (e) {
|
|
21
|
+
for (const r of e.collection)
|
|
22
|
+
if (r.type === "item" && ce(r.textValue, n))
|
|
23
|
+
return r.key;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function ue(e) {
|
|
27
|
+
const n = /* @__PURE__ */ new Map();
|
|
28
|
+
return e == null || e.selectedItems.forEach((r) => n.set(r.key, r.textValue)), n;
|
|
29
|
+
}
|
|
30
|
+
function se({
|
|
31
|
+
keys: e,
|
|
32
|
+
inputValue: n,
|
|
33
|
+
placeholder: r,
|
|
34
|
+
canRemove: u,
|
|
35
|
+
removeValueLabel: b,
|
|
36
|
+
onRemoveKey: h,
|
|
37
|
+
onSubmitText: v
|
|
38
|
+
}) {
|
|
39
|
+
const c = V(G), f = F(null), m = F(null);
|
|
40
|
+
z(f);
|
|
41
|
+
const y = ue(c), p = (o) => y.get(o) || String(o);
|
|
42
|
+
function a(o) {
|
|
43
|
+
var l;
|
|
44
|
+
h(o), (l = m.current) == null || l.focus();
|
|
45
|
+
}
|
|
46
|
+
function B(o) {
|
|
47
|
+
const l = e[e.length - 1], x = u && n === "" && l !== void 0;
|
|
48
|
+
if (o.key === "Backspace" && x) {
|
|
49
|
+
h(l);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const I = (c == null ? void 0 : c.selectionManager.focusedKey) != null;
|
|
53
|
+
if (o.key !== "Enter" || I) return;
|
|
54
|
+
const d = n.trim();
|
|
55
|
+
d !== "" && (o.preventDefault(), v(d, le(c, d)));
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ w(H, { className: "combobox combobox-multiple", children: [
|
|
58
|
+
e.length > 0 && /* @__PURE__ */ i(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
className: "combobox-tags",
|
|
62
|
+
role: "list",
|
|
63
|
+
onMouseDown: J,
|
|
64
|
+
children: /* @__PURE__ */ i(_.Provider, { value: null, children: e.map((o) => /* @__PURE__ */ i(
|
|
65
|
+
X,
|
|
66
|
+
{
|
|
67
|
+
role: "listitem",
|
|
68
|
+
scheme: "neutral",
|
|
69
|
+
variant: "secondary",
|
|
70
|
+
removeLabel: u ? b(p(o)) : void 0,
|
|
71
|
+
onRemove: u ? () => a(o) : void 0,
|
|
72
|
+
children: p(o)
|
|
73
|
+
},
|
|
74
|
+
`${typeof o}:${o}`
|
|
75
|
+
)) })
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ i(
|
|
79
|
+
re,
|
|
80
|
+
{
|
|
81
|
+
ref: m,
|
|
82
|
+
className: "combobox-input",
|
|
83
|
+
placeholder: e.length === 0 ? r : void 0,
|
|
84
|
+
onKeyDown: B,
|
|
85
|
+
onPointerDown: Q(f)
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ i(q, { ref: f, className: "combobox-trigger", children: /* @__PURE__ */ i(Y, { "aria-hidden": "true" }) })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function Ie({
|
|
92
|
+
className: e,
|
|
93
|
+
label: n,
|
|
94
|
+
description: r,
|
|
95
|
+
errorMessage: u,
|
|
96
|
+
placeholder: b,
|
|
97
|
+
children: h,
|
|
98
|
+
items: v,
|
|
99
|
+
value: c,
|
|
100
|
+
defaultValue: f,
|
|
101
|
+
onChange: m,
|
|
102
|
+
removeValueLabel: y,
|
|
103
|
+
allowsCustomValue: p,
|
|
104
|
+
validateCustomValue: a,
|
|
105
|
+
invalidCustomValueMessage: B,
|
|
106
|
+
isInvalid: o,
|
|
107
|
+
isDisabled: l,
|
|
108
|
+
isReadOnly: x,
|
|
109
|
+
...I
|
|
110
|
+
}) {
|
|
111
|
+
const d = U(e, "combobox-container"), [L, P] = N(
|
|
112
|
+
f ?? []
|
|
113
|
+
), s = c ?? L, [S, R] = N(""), [T, M] = N(!1), j = Z();
|
|
114
|
+
function C(t) {
|
|
115
|
+
ie(t, s) || (c === void 0 && P(t), m == null || m(t));
|
|
116
|
+
}
|
|
117
|
+
function K(t) {
|
|
118
|
+
R(t), M(!1);
|
|
119
|
+
}
|
|
120
|
+
function E(t) {
|
|
121
|
+
t.length > s.length && K(""), C(t);
|
|
122
|
+
}
|
|
123
|
+
function O(t) {
|
|
124
|
+
return p === !0 && ((a == null ? void 0 : a(t)) ?? !0);
|
|
125
|
+
}
|
|
126
|
+
function A(t, g) {
|
|
127
|
+
if (g === void 0 && !O(t)) {
|
|
128
|
+
M(p === !0);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const D = g ?? t;
|
|
132
|
+
K(""), s.includes(D) || C([...s, D]);
|
|
133
|
+
}
|
|
134
|
+
return /* @__PURE__ */ i(
|
|
135
|
+
W,
|
|
136
|
+
{
|
|
137
|
+
...I,
|
|
138
|
+
className: d,
|
|
139
|
+
selectionMode: "multiple",
|
|
140
|
+
menuTrigger: "focus",
|
|
141
|
+
value: s,
|
|
142
|
+
onChange: E,
|
|
143
|
+
inputValue: S,
|
|
144
|
+
onInputChange: K,
|
|
145
|
+
isInvalid: o || T,
|
|
146
|
+
isDisabled: l,
|
|
147
|
+
isReadOnly: x,
|
|
148
|
+
children: /* @__PURE__ */ w(k, { children: [
|
|
149
|
+
n && /* @__PURE__ */ i(ee, { children: n }),
|
|
150
|
+
/* @__PURE__ */ i(
|
|
151
|
+
se,
|
|
152
|
+
{
|
|
153
|
+
keys: s,
|
|
154
|
+
inputValue: S,
|
|
155
|
+
placeholder: b,
|
|
156
|
+
canRemove: !l && !x,
|
|
157
|
+
removeValueLabel: y,
|
|
158
|
+
onRemoveKey: (t) => C(s.filter((g) => g !== t)),
|
|
159
|
+
onSubmitText: A
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ i(
|
|
163
|
+
$,
|
|
164
|
+
{
|
|
165
|
+
className: "combobox-popover",
|
|
166
|
+
UNSTABLE_portalContainer: j,
|
|
167
|
+
children: /* @__PURE__ */ i(te, { items: v, children: h })
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
r && /* @__PURE__ */ i(oe, { children: r }),
|
|
171
|
+
/* @__PURE__ */ i(ne, { children: T ? B : u })
|
|
172
|
+
] })
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
Ie as MultiComboBoxField
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=MultiComboBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiComboBox.js","sources":["../../../../../src/ui/primitives/ComboBox/MultiComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n Label,\n ListBox,\n SharedFieldProps,\n Tag,\n} from \"primitives\";\nimport React, { useContext, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n ButtonContext as RACButtonContext,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n type Key as RACKey,\n} from \"react-aria-components\";\nimport {\n keepFocusOnInput,\n openMenuWhenFocusedInputIsPressed,\n useKeepFocusOnInput,\n} from \"./comboBoxFocus\";\nimport \"./combobox.css\";\n\ntype MultiComboBoxState = NonNullable<\n React.ContextType<typeof RACComboBoxStateContext>\n>;\n\ntype PropsManagedByMultiComboBox =\n | \"children\"\n | \"selectionMode\"\n | \"value\"\n | \"defaultValue\"\n | \"onChange\"\n | \"selectedKey\"\n | \"defaultSelectedKey\"\n | \"onSelectionChange\"\n | \"allowsCustomValue\"\n | \"inputValue\"\n | \"defaultInputValue\"\n | \"onInputChange\"\n | \"menuTrigger\";\n\ninterface CustomValueValidationProps {\n validateCustomValue: (text: string) => boolean;\n invalidCustomValueMessage: string;\n}\n\ninterface WithoutCustomValueValidation {\n validateCustomValue?: never;\n invalidCustomValueMessage?: never;\n}\n\ntype CustomValueProps =\n | ({ allowsCustomValue: true } & (\n | CustomValueValidationProps\n | WithoutCustomValueValidation\n ))\n | ({ allowsCustomValue?: false } & WithoutCustomValueValidation);\n\nexport type MultiComboBoxFieldProps<T extends object> = Omit<\n RACComboBoxProps<T, \"multiple\">,\n PropsManagedByMultiComboBox\n> &\n SharedFieldProps &\n CustomValueProps & {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n value?: RACKey[];\n defaultValue?: RACKey[];\n onChange?: (keys: RACKey[]) => void;\n removeValueLabel: (valueText: string) => string;\n };\n\nfunction hasSameKeys(a: readonly RACKey[], b: readonly RACKey[]): boolean {\n return a.length === b.length && a.every((key, index) => key === b[index]);\n}\n\nfunction isSameText(a: string, b: string): boolean {\n return a.localeCompare(b, undefined, { sensitivity: \"base\" }) === 0;\n}\n\nfunction itemKeyWithText(\n state: MultiComboBoxState | null,\n text: string,\n): RACKey | undefined {\n if (!state) return undefined;\n for (const node of state.collection) {\n if (node.type === \"item\" && isSameText(node.textValue, text))\n return node.key;\n }\n return undefined;\n}\n\nfunction selectedTextByKey(\n state: MultiComboBoxState | null,\n): Map<RACKey, string> {\n const texts = new Map<RACKey, string>();\n state?.selectedItems.forEach((item) => texts.set(item.key, item.textValue));\n return texts;\n}\n\ninterface MultiComboBoxControlProps {\n keys: RACKey[];\n inputValue: string;\n placeholder?: string;\n canRemove: boolean;\n removeValueLabel: (valueText: string) => string;\n onRemoveKey: (key: RACKey) => void;\n onSubmitText: (text: string, matchingItemKey: RACKey | undefined) => void;\n}\n\nfunction MultiComboBoxControl({\n keys,\n inputValue,\n placeholder,\n canRemove,\n removeValueLabel,\n onRemoveKey,\n onSubmitText,\n}: MultiComboBoxControlProps) {\n const state = useContext(RACComboBoxStateContext);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n useKeepFocusOnInput(triggerRef);\n const textByKey = selectedTextByKey(state);\n const textOf = (key: RACKey) => textByKey.get(key) || String(key);\n\n function removeKey(key: RACKey) {\n onRemoveKey(key);\n inputRef.current?.focus();\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n const lastKey: RACKey | undefined = keys[keys.length - 1];\n const canRemoveLastKey =\n canRemove && inputValue === \"\" && lastKey !== undefined;\n if (event.key === \"Backspace\" && canRemoveLastKey) {\n onRemoveKey(lastKey);\n return;\n }\n const isChoosingHighlightedItem =\n state?.selectionManager.focusedKey != null;\n if (event.key !== \"Enter\" || isChoosingHighlightedItem) return;\n const text = inputValue.trim();\n if (text === \"\") return;\n event.preventDefault();\n onSubmitText(text, itemKeyWithText(state, text));\n }\n\n return (\n <RACGroup className=\"combobox combobox-multiple\">\n {keys.length > 0 && (\n <span\n className=\"combobox-tags\"\n role=\"list\"\n onMouseDown={keepFocusOnInput}\n >\n <RACButtonContext.Provider value={null}>\n {keys.map((key) => (\n <Tag\n key={`${typeof key}:${key}`}\n role=\"listitem\"\n scheme=\"neutral\"\n variant=\"secondary\"\n removeLabel={\n canRemove ? removeValueLabel(textOf(key)) : undefined\n }\n onRemove={canRemove ? () => removeKey(key) : undefined}\n >\n {textOf(key)}\n </Tag>\n ))}\n </RACButtonContext.Provider>\n </span>\n )}\n <Input\n ref={inputRef}\n className=\"combobox-input\"\n placeholder={keys.length === 0 ? placeholder : undefined}\n onKeyDown={handleKeyDown}\n onPointerDown={openMenuWhenFocusedInputIsPressed(triggerRef)}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n );\n}\n\nexport function MultiComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n value,\n defaultValue,\n onChange,\n removeValueLabel,\n allowsCustomValue,\n validateCustomValue,\n invalidCustomValueMessage,\n isInvalid,\n isDisabled,\n isReadOnly,\n ...props\n}: MultiComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const [uncontrolledKeys, setUncontrolledKeys] = useState<RACKey[]>(\n defaultValue ?? [],\n );\n const keys = value ?? uncontrolledKeys;\n const [inputValue, setInputValue] = useState(\"\");\n const [isCustomValueRejected, setCustomValueRejected] = useState(false);\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n\n function changeKeys(nextKeys: RACKey[]) {\n if (hasSameKeys(nextKeys, keys)) return;\n if (value === undefined) setUncontrolledKeys(nextKeys);\n onChange?.(nextKeys);\n }\n\n function changeInput(text: string) {\n setInputValue(text);\n setCustomValueRejected(false);\n }\n\n function changeSelection(nextKeys: RACKey[]) {\n if (nextKeys.length > keys.length) changeInput(\"\");\n changeKeys(nextKeys);\n }\n\n function isAcceptedCustomValue(text: string): boolean {\n return allowsCustomValue === true && (validateCustomValue?.(text) ?? true);\n }\n\n function addTypedValue(text: string, matchingItemKey: RACKey | undefined) {\n if (matchingItemKey === undefined && !isAcceptedCustomValue(text)) {\n setCustomValueRejected(allowsCustomValue === true);\n return;\n }\n const key = matchingItemKey ?? text;\n changeInput(\"\");\n if (!keys.includes(key)) changeKeys([...keys, key]);\n }\n\n return (\n <RACComboBox<T, \"multiple\">\n {...props}\n className={classNames}\n selectionMode=\"multiple\"\n menuTrigger=\"focus\"\n value={keys}\n onChange={changeSelection}\n inputValue={inputValue}\n onInputChange={changeInput}\n isInvalid={isInvalid || isCustomValueRejected}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n >\n <Field>\n {label && <Label>{label}</Label>}\n <MultiComboBoxControl\n keys={keys}\n inputValue={inputValue}\n placeholder={placeholder}\n canRemove={!isDisabled && !isReadOnly}\n removeValueLabel={removeValueLabel}\n onRemoveKey={(key) => changeKeys(keys.filter((k) => k !== key))}\n onSubmitText={addTypedValue}\n />\n <RACPopover\n className=\"combobox-popover\"\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>\n {isCustomValueRejected ? invalidCustomValueMessage : errorMessage}\n </FieldError>\n </Field>\n </RACComboBox>\n );\n}\n"],"names":["hasSameKeys","a","b","key","index","isSameText","itemKeyWithText","state","text","node","selectedTextByKey","texts","item","MultiComboBoxControl","keys","inputValue","placeholder","canRemove","removeValueLabel","onRemoveKey","onSubmitText","useContext","RACComboBoxStateContext","triggerRef","useRef","inputRef","useKeepFocusOnInput","textByKey","textOf","removeKey","_a","handleKeyDown","event","lastKey","canRemoveLastKey","isChoosingHighlightedItem","jsxs","RACGroup","jsx","keepFocusOnInput","RACButtonContext","Tag","Input","openMenuWhenFocusedInputIsPressed","RACButton","IconChevronDown","MultiComboBoxField","className","label","description","errorMessage","children","items","value","defaultValue","onChange","allowsCustomValue","validateCustomValue","invalidCustomValueMessage","isInvalid","isDisabled","isReadOnly","props","classNames","clsx","uncontrolledKeys","setUncontrolledKeys","useState","setInputValue","isCustomValueRejected","setCustomValueRejected","portalContainer","useOverlayPortalContainer","changeKeys","nextKeys","changeInput","changeSelection","isAcceptedCustomValue","addTypedValue","matchingItemKey","RACComboBox","Field","Label","k","RACPopover","ListBox","Description","FieldError"],"mappings":";;;;;;;;;;;;AAiFA,SAASA,GAAYC,GAAsBC,GAA+B;AACxE,SAAOD,EAAE,WAAWC,EAAE,UAAUD,EAAE,MAAM,CAACE,GAAKC,MAAUD,MAAQD,EAAEE,CAAK,CAAC;AAC1E;AAEA,SAASC,GAAWJ,GAAWC,GAAoB;AACjD,SAAOD,EAAE,cAAcC,GAAG,QAAW,EAAE,aAAa,OAAA,CAAQ,MAAM;AACpE;AAEA,SAASI,GACPC,GACAC,GACoB;AACpB,MAAKD;AACL,eAAWE,KAAQF,EAAM;AACvB,UAAIE,EAAK,SAAS,UAAUJ,GAAWI,EAAK,WAAWD,CAAI;AACzD,eAAOC,EAAK;AAAA;AAGlB;AAEA,SAASC,GACPH,GACqB;AACrB,QAAMI,wBAAY,IAAA;AAClB,SAAAJ,KAAA,QAAAA,EAAO,cAAc,QAAQ,CAACK,MAASD,EAAM,IAAIC,EAAK,KAAKA,EAAK,SAAS,IAClED;AACT;AAYA,SAASE,GAAqB;AAAA,EAC5B,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC;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AACqE,MAAMA,MAAMhF,CAAG,CAAC;AAAA,YAC9D,cAAc2E;AAAA,UAAA;AAAA,QAAA;AAAA,QAEhB,gBAAAxC;AAAA,UAAC8C;AAAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,0BAA0Bb;AAAA,YAE1B,UAAA,gBAAAjC,EAAC+C,IAAA,EAAQ,OAAAjC,GAAe,UAAAD,EAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAElCF,KAAe,gBAAAX,EAACgD,IAAA,EAAa,UAAArC,EAAA,CAAY;AAAA,QAC1C,gBAAAX,EAACiD,IAAA,EACE,UAAAlB,IAAwBX,IAA4BR,EAAA,CACvD;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react");function r(n){const e=n.getRootNode();return e instanceof ShadowRoot||e instanceof Document?e.activeElement:null}function c(n){return e=>{var t;r(e.currentTarget)===e.currentTarget&&((t=n.current)==null||t.click())}}function s(n){n.preventDefault()}function i(n){o.useEffect(()=>{const e=n.current;if(!e)return;function t(u){u.preventDefault()}return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[n])}exports.keepFocusOnInput=s;exports.openMenuWhenFocusedInputIsPressed=c;exports.useKeepFocusOnInput=i;
|
|
2
|
+
//# sourceMappingURL=comboBoxFocus.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comboBoxFocus.cjs","sources":["../../../../../src/ui/primitives/ComboBox/comboBoxFocus.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\n// `document.activeElement` para no host da shadow root: quem sabe o que está focado\n// dentro dela é a própria raiz. Ver ui/hooks/useOverlayPortal.\nfunction activeElementOf(element: Element): Element | null {\n const root = element.getRootNode();\n return root instanceof ShadowRoot || root instanceof Document\n ? root.activeElement\n : null;\n}\n\nexport function openMenuWhenFocusedInputIsPressed(\n triggerRef: React.RefObject<HTMLButtonElement | null>,\n) {\n return (event: React.PointerEvent<HTMLInputElement>) => {\n if (activeElementOf(event.currentTarget) === event.currentTarget) {\n triggerRef.current?.click();\n }\n };\n}\n\nexport function keepFocusOnInput(event: React.MouseEvent): void {\n event.preventDefault();\n}\n\n// O react-aria pede `preventFocusOnPress` para o botão do dropdown, mas a implementação\n// dele guarda `document.activeElement` — que dentro de uma shadow root devolve o host, e\n// não o input. O botão fica com o foco de verdade, o input nunca mais recebe blur, e a\n// partir daí só escolher um item fecha o dropdown: clicar fora não fecha nada. Impedir o\n// padrão do mousedown é o que mantém o foco no input, dentro e fora da shadow root.\n//\n// Via listener nativo, e não por prop: o `useButton` do react-aria só repassa ao <button>\n// os handlers que ele mesmo declara, e descarta um `onMouseDown` vindo de fora.\nexport function useKeepFocusOnInput(\n triggerRef: React.RefObject<HTMLButtonElement | null>,\n): void {\n useEffect(() => {\n const trigger: HTMLButtonElement | null = triggerRef.current;\n if (!trigger) return undefined;\n\n function preventFocus(event: MouseEvent): void {\n event.preventDefault();\n }\n\n trigger.addEventListener(\"mousedown\", preventFocus);\n return () => trigger.removeEventListener(\"mousedown\", preventFocus);\n }, [triggerRef]);\n}\n"],"names":["activeElementOf","element","root","openMenuWhenFocusedInputIsPressed","triggerRef","event","_a","keepFocusOnInput","useKeepFocusOnInput","useEffect","trigger","preventFocus"],"mappings":"yGAIA,SAASA,EAAgBC,EAAkC,CACzD,MAAMC,EAAOD,EAAQ,YAAA,EACrB,OAAOC,aAAgB,YAAcA,aAAgB,SACjDA,EAAK,cACL,IACN,CAEO,SAASC,EACdC,EACA,CACA,OAAQC,GAAgD,OAClDL,EAAgBK,EAAM,aAAa,IAAMA,EAAM,iBACjDC,EAAAF,EAAW,UAAX,MAAAE,EAAoB,QAExB,CACF,CAEO,SAASC,EAAiBF,EAA+B,CAC9DA,EAAM,eAAA,CACR,CAUO,SAASG,EACdJ,EACM,CACNK,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAoCN,EAAW,QACrD,GAAI,CAACM,EAAS,OAEd,SAASC,EAAaN,EAAyB,CAC7CA,EAAM,eAAA,CACR,CAEA,OAAAK,EAAQ,iBAAiB,YAAaC,CAAY,EAC3C,IAAMD,EAAQ,oBAAoB,YAAaC,CAAY,CACpE,EAAG,CAACP,CAAU,CAAC,CACjB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect as r } from "react";
|
|
2
|
+
function u(n) {
|
|
3
|
+
const e = n.getRootNode();
|
|
4
|
+
return e instanceof ShadowRoot || e instanceof Document ? e.activeElement : null;
|
|
5
|
+
}
|
|
6
|
+
function s(n) {
|
|
7
|
+
return (e) => {
|
|
8
|
+
var t;
|
|
9
|
+
u(e.currentTarget) === e.currentTarget && ((t = n.current) == null || t.click());
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function i(n) {
|
|
13
|
+
n.preventDefault();
|
|
14
|
+
}
|
|
15
|
+
function f(n) {
|
|
16
|
+
r(() => {
|
|
17
|
+
const e = n.current;
|
|
18
|
+
if (!e) return;
|
|
19
|
+
function t(o) {
|
|
20
|
+
o.preventDefault();
|
|
21
|
+
}
|
|
22
|
+
return e.addEventListener("mousedown", t), () => e.removeEventListener("mousedown", t);
|
|
23
|
+
}, [n]);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
i as keepFocusOnInput,
|
|
27
|
+
s as openMenuWhenFocusedInputIsPressed,
|
|
28
|
+
f as useKeepFocusOnInput
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=comboBoxFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comboBoxFocus.js","sources":["../../../../../src/ui/primitives/ComboBox/comboBoxFocus.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\n// `document.activeElement` para no host da shadow root: quem sabe o que está focado\n// dentro dela é a própria raiz. Ver ui/hooks/useOverlayPortal.\nfunction activeElementOf(element: Element): Element | null {\n const root = element.getRootNode();\n return root instanceof ShadowRoot || root instanceof Document\n ? root.activeElement\n : null;\n}\n\nexport function openMenuWhenFocusedInputIsPressed(\n triggerRef: React.RefObject<HTMLButtonElement | null>,\n) {\n return (event: React.PointerEvent<HTMLInputElement>) => {\n if (activeElementOf(event.currentTarget) === event.currentTarget) {\n triggerRef.current?.click();\n }\n };\n}\n\nexport function keepFocusOnInput(event: React.MouseEvent): void {\n event.preventDefault();\n}\n\n// O react-aria pede `preventFocusOnPress` para o botão do dropdown, mas a implementação\n// dele guarda `document.activeElement` — que dentro de uma shadow root devolve o host, e\n// não o input. O botão fica com o foco de verdade, o input nunca mais recebe blur, e a\n// partir daí só escolher um item fecha o dropdown: clicar fora não fecha nada. Impedir o\n// padrão do mousedown é o que mantém o foco no input, dentro e fora da shadow root.\n//\n// Via listener nativo, e não por prop: o `useButton` do react-aria só repassa ao <button>\n// os handlers que ele mesmo declara, e descarta um `onMouseDown` vindo de fora.\nexport function useKeepFocusOnInput(\n triggerRef: React.RefObject<HTMLButtonElement | null>,\n): void {\n useEffect(() => {\n const trigger: HTMLButtonElement | null = triggerRef.current;\n if (!trigger) return undefined;\n\n function preventFocus(event: MouseEvent): void {\n event.preventDefault();\n }\n\n trigger.addEventListener(\"mousedown\", preventFocus);\n return () => trigger.removeEventListener(\"mousedown\", preventFocus);\n }, [triggerRef]);\n}\n"],"names":["activeElementOf","element","root","openMenuWhenFocusedInputIsPressed","triggerRef","event","_a","keepFocusOnInput","useKeepFocusOnInput","useEffect","trigger","preventFocus"],"mappings":";AAIA,SAASA,EAAgBC,GAAkC;AACzD,QAAMC,IAAOD,EAAQ,YAAA;AACrB,SAAOC,aAAgB,cAAcA,aAAgB,WACjDA,EAAK,gBACL;AACN;AAEO,SAASC,EACdC,GACA;AACA,SAAO,CAACC,MAAgD;;AACtD,IAAIL,EAAgBK,EAAM,aAAa,MAAMA,EAAM,mBACjDC,IAAAF,EAAW,YAAX,QAAAE,EAAoB;AAAA,EAExB;AACF;AAEO,SAASC,EAAiBF,GAA+B;AAC9D,EAAAA,EAAM,eAAA;AACR;AAUO,SAASG,EACdJ,GACM;AACN,EAAAK,EAAU,MAAM;AACd,UAAMC,IAAoCN,EAAW;AACrD,QAAI,CAACM,EAAS;AAEd,aAASC,EAAaN,GAAyB;AAC7C,MAAAA,EAAM,eAAA;AAAA,IACR;AAEA,WAAAK,EAAQ,iBAAiB,aAAaC,CAAY,GAC3C,MAAMD,EAAQ,oBAAoB,aAAaC,CAAY;AAAA,EACpE,GAAG,CAACP,CAAU,CAAC;AACjB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@internationalized/date"),Ie=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react"),r=require("react-aria-components"),Be=require("./dateRangePresets.cjs");;/* empty css */const Z=require("../../icons/IconCalendar.cjs"),Re=require("../../icons/IconChevronDown.cjs"),z=require("../Text/Text.cjs"),we=require("../../icons/IconCheck.cjs"),Fe=require("../../icons/IconChevronLeft.cjs"),Pe=require("../../icons/IconChevronRight.cjs"),Ee=require("../../hooks/useOverlayPortal.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@internationalized/date"),Ie=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react"),r=require("react-aria-components"),Be=require("./dateRangePresets.cjs");;/* empty css */const Z=require("../../icons/IconCalendar.cjs"),Re=require("../../icons/IconChevronDown.cjs"),z=require("../Text/Text.cjs"),we=require("../../icons/IconCheck.cjs"),Fe=require("../../icons/IconChevronLeft.cjs"),Pe=require("../../icons/IconChevronRight.cjs"),Ee=require("../../hooks/useOverlayPortal.cjs"),U=require("../Fieldset/Fieldset.cjs"),re=require("../ListBox/ListBox.cjs"),se=require("../Button/Button.cjs"),H=()=>new d.Time(0,0,0),ie=()=>new d.Time(23,59,59);function Ae({onAnchorChange:a}){const i=h.useContext(r.RangeCalendarStateContext),c=(i==null?void 0:i.anchorDate)??null,o=c==null?void 0:c.toString();return h.useEffect(()=>{a(c)},[o]),null}const k=a=>a&&"hour"in a?new d.Time(a.hour,a.minute,a.second):null,y=(a,i)=>"timeZone"in a?d.toTimeZone(a,i):a,ce=(a,i)=>{if(!a||!a.start&&!a.end)return{range:null,startTime:null,endTime:null,preset:a==null?void 0:a.preset};const c=a.start&&y(a.start,i),o=a.end&&y(a.end,i);return{range:c&&o?{start:d.toCalendarDate(c),end:d.toCalendarDate(o)}:null,startTime:k(c),endTime:k(o),preset:a.preset}},m=(a,i,c)=>{if(!a)return null;const o=d.toCalendarDate(a);return c||!i?o:d.toCalendarDateTime(o,i)},Oe=(a,i)=>{var c,o;return{preset:a.preset,start:m((c=a.range)==null?void 0:c.start,a.startTime,i),end:m((o=a.range)==null?void 0:o.end,a.endTime,i)}};function Ge({className:a,locale:i,label:c,"aria-label":o,description:L,errorMessage:I,labels:le,intervals:B,presetKeys:R,presetLabels:w,hideTime:l=!1,minValue:F,maxValue:P,timezone:E,firstDayOfWeek:K,isDisabled:oe=!1,isRequired:de=!1,value:v,defaultValue:ge,onChange:A}){var te,ae;const ue=Ee.useOverlayPortalContainer(),{locale:me}=r.useLocale(),pe=i??me??"pt-BR",x=E??d.getLocalTimeZone(),{placeholder:M,relativeLabel:_,absoluteLabel:J,startDateLabel:he,endDateLabel:xe,cancelLabel:O,applyLabel:G}=le,j=h.useMemo(()=>{if(B)return B;if(R){if(!w)throw new Error("DateRangePicker: `presetLabels` is required when `presetKeys` is provided.");return Be.createDateRangePresets({timezone:E,firstDayOfWeek:K,include:R,labels:w})}},[B,R,w,K,E]),[u,Q]=h.useState(()=>ce(v??ge,x)),[p,f]=h.useState(u),[je,T]=h.useState(null),[fe,V]=h.useState(!1);h.useEffect(()=>{v!==void 0&&Q(ce(v,x))},[v,x]);const q=t=>({...t,preset:void 0}),Ce=t=>l?t:{...t,startTime:t.startTime??H(),endTime:t.endTime??ie()},ke=t=>{t&&(f(u),T(null)),V(t)},Te=t=>{T(null);const s=t.getValue(),g=y(s.start,x),n=y(s.end,x);f({range:{start:d.toCalendarDate(g),end:d.toCalendarDate(n)},startTime:k(g),endTime:k(n),preset:t})},De=t=>{T(t),t&&!l&&f(s=>q({...s,startTime:s.startTime??H()}))},Ne=t=>{T(null),f(s=>Ce(q({...s,range:t})))},be=t=>{if(!t)return;T(null);const s=d.toCalendarDate(t),g=k(t);f(n=>{var S,ne;const C=l?n.startTime:g??n.startTime??H(),D=m(s,C,l),N=m((S=n.range)==null?void 0:S.end,n.endTime,l),b=!!(D&&N&&N.compare(D)<0);return q({...n,range:{start:s,end:b||!((ne=n.range)!=null&&ne.end)?s:n.range.end},startTime:C,endTime:b?C:n.endTime})})},Se=t=>{if(!t)return;const s=d.toCalendarDate(t),g=k(t);f(n=>{var b,S;const C=l?n.endTime:g??n.endTime??ie(),D=m(s,C,l),N=m((b=n.range)==null?void 0:b.start,n.startTime,l);return N&&D&&D.compare(N)<0?n:q({...n,range:{start:((S=n.range)==null?void 0:S.start)??s,end:s},endTime:C})})},ve=()=>{Q(p),A==null||A(Oe(p,l)),V(!1)},qe=()=>V(!1),ye=!!(O||G),X=(()=>{if(u.preset)return u.preset.label;if(u.range){const t=n=>n.toDate(x).toLocaleString(pe,{day:"2-digit",month:"2-digit",year:"numeric",...l?{}:{hour:"2-digit",minute:"2-digit",second:"2-digit"}}),s=m(u.range.start,u.startTime,l),g=m(u.range.end,u.endTime,l);if(s&&g)return`${t(s)} — ${t(g)}`}return null})(),Le=!!(j&&j.length>0),Y=l?"day":"second",W=m(((te=p.range)==null?void 0:te.start)??je??void 0,p.startTime,l),$=m(((ae=p.range)==null?void 0:ae.end)??void 0,p.endTime,l),ee=e.jsxs(U.Field,{className:Ie.clsx(a,"date-range-picker"),children:[c&&e.jsx(U.Label,{children:c}),e.jsxs(r.DialogTrigger,{isOpen:fe,onOpenChange:ke,children:[e.jsxs(r.Button,{className:"date-range-picker-trigger",isDisabled:oe,"aria-label":c?void 0:o??M,"aria-required":de||void 0,"data-invalid":I?!0:void 0,children:[u.preset?e.jsxs("span",{className:"date-range-picker-preset-badge",children:[e.jsx(Z.IconCalendar,{"aria-hidden":"true"}),u.preset.label]}):e.jsx("span",{className:"date-range-picker-value","data-placeholder":X?void 0:!0,children:X??M}),e.jsx(Re.IconChevronDown,{"aria-hidden":"true"})]}),e.jsx(r.Popover,{className:"date-range-picker-popover",placement:"bottom start",UNSTABLE_portalContainer:ue,children:e.jsxs(r.Dialog,{className:"date-range-picker-dialog",children:[e.jsxs("div",{className:"date-range-picker-body",children:[Le&&e.jsxs("div",{className:"date-range-picker-presets",children:[e.jsx(z.TextSmallStrong,{className:"date-range-picker-section-title",children:_}),e.jsx(re.ListBox,{"aria-label":_,className:"date-range-picker-presets-list",selectionMode:"single",selectedKeys:p.preset?[p.preset.id]:[],items:j,onSelectionChange:t=>{const[s]=[...t],g=j==null?void 0:j.find(n=>n.id===s);g&&Te(g)},children:t=>e.jsxs(re.ListBoxItem,{id:t.id,textValue:t.label,className:"date-range-picker-preset-item",children:[e.jsx("span",{children:t.label}),e.jsx(we.IconCheck,{"aria-hidden":"true",className:"date-range-picker-preset-check"})]})})]}),e.jsxs("div",{className:"date-range-picker-absolute",children:[e.jsx(z.TextSmallStrong,{className:"date-range-picker-section-title",children:J}),e.jsxs("div",{className:"date-range-picker-fields",children:[e.jsxs(r.DateField,{className:"date-range-picker-datefield",granularity:Y,value:W,minValue:F,maxValue:$??P,onChange:be,children:[e.jsx(r.Label,{className:"date-range-picker-field-label",children:he}),e.jsxs(r.Group,{className:"date-range-picker-input",children:[e.jsx(r.DateInput,{children:t=>e.jsx(r.DateSegment,{segment:t})}),e.jsx(Z.IconCalendar,{"aria-hidden":"true"})]})]}),e.jsxs(r.DateField,{className:"date-range-picker-datefield",granularity:Y,value:$,minValue:W??F,maxValue:P,onChange:Se,children:[e.jsx(r.Label,{className:"date-range-picker-field-label",children:xe}),e.jsxs(r.Group,{className:"date-range-picker-input",children:[e.jsx(r.DateInput,{children:t=>e.jsx(r.DateSegment,{segment:t})}),e.jsx(Z.IconCalendar,{"aria-hidden":"true"})]})]})]}),e.jsxs(r.RangeCalendar,{className:"date-range-picker-calendar","aria-label":J,value:p.range,minValue:F,maxValue:P,onChange:Ne,children:[e.jsx(Ae,{onAnchorChange:De}),e.jsxs("header",{className:"date-range-picker-calendar-header",children:[e.jsx(r.Button,{slot:"previous",className:"date-range-picker-calendar-nav",children:e.jsx(Fe.IconChevronLeft,{"aria-hidden":"true"})}),e.jsx(r.Heading,{className:"date-range-picker-calendar-heading"}),e.jsx(r.Button,{slot:"next",className:"date-range-picker-calendar-nav",children:e.jsx(Pe.IconChevronRight,{"aria-hidden":"true"})})]}),e.jsx(r.CalendarGrid,{className:"date-range-picker-calendar-grid",children:t=>e.jsx(r.CalendarCell,{date:t,className:"date-range-picker-calendar-cell"})})]})]})]}),ye&&e.jsxs("div",{className:"date-range-picker-actions",children:[O&&e.jsx(se.Button,{variant:"neutral",size:"small",onPress:qe,children:O}),G&&e.jsx(se.Button,{variant:"primary",size:"small",onPress:ve,children:G})]})]})})]}),L&&e.jsx(U.Description,{children:L}),I&&e.jsx(z.Text,{className:"date-range-picker-error",elementType:"span",children:I})]});return i?e.jsx(r.I18nProvider,{locale:i,children:ee}):ee}exports.DateRangePicker=Ge;
|
|
2
2
|
//# sourceMappingURL=DateRangePicker.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),p=require("react");;/* empty css */const y=require("../../icons/IconUploadCloud.cjs"),I=require("../Tag/Tag.cjs"),m=require("../Fieldset/Fieldset.cjs"),j=p.forwardRef(function({className:d,accept:o,multiple:a=!1,isDisabled:r=!1,isInvalid:t=!1,name:c,value:n=[],onChange:s,children:v,...g},F){const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../../../vendor/clsx/dist/clsx.cjs"),p=require("react");;/* empty css */const y=require("../../icons/IconUploadCloud.cjs"),I=require("../Tag/Tag.cjs"),m=require("../Fieldset/Fieldset.cjs"),j=p.forwardRef(function({className:d,accept:o,multiple:a=!1,isDisabled:r=!1,isInvalid:t=!1,name:c,value:n=[],onChange:s,children:v,...g},F){const[U,u]=p.useState(!1);function q(i){const l=i.target.files;l&&l.length>0&&(s==null||s(a?[...n,...Array.from(l)]:Array.from(l))),i.target.value=""}function N(i){s==null||s(n.filter((l,h)=>h!==i))}return e.jsxs("div",{...g,className:x.clsx(d,"file-upload"),"data-disabled":r||void 0,"data-invalid":t||void 0,children:[e.jsxs("label",{className:"file-upload-dropzone","data-dragging":U||void 0,children:[e.jsx("input",{ref:F,type:"file",className:"file-upload-input",accept:o,multiple:a,disabled:r,name:c,onChange:q,onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),onDrop:()=>u(!1)}),e.jsx(y.IconUploadCloud,{size:"24"}),e.jsx("span",{className:"file-upload-prompt",children:v})]}),n.length>0&&e.jsx("ul",{className:"file-upload-list",children:n.map((i,l)=>e.jsx("li",{children:e.jsx(I.Tag,{variant:"secondary",onRemove:r?void 0:()=>N(l),children:i.name})},`${i.name}-${l}`))})]})});function D({className:f,label:d,description:o,errorMessage:a,isInvalid:r,...t}){const c=r??!!a;return e.jsxs("div",{className:x.clsx(f,"field"),children:[d&&e.jsx(m.Label,{children:d}),e.jsx(j,{isInvalid:c,...t}),o&&e.jsx(m.Description,{children:o}),a&&e.jsx("span",{className:"error-message",children:a})]})}exports.FileUpload=j;exports.FileUploadField=D;
|
|
2
2
|
//# sourceMappingURL=FileUpload.cjs.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as u } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
|
-
import
|
|
3
|
+
import F, { useState as I } from "react";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { IconUploadCloud as
|
|
5
|
+
import { IconUploadCloud as $ } from "../../icons/IconUploadCloud.js";
|
|
6
6
|
import { Tag as x } from "../Tag/Tag.js";
|
|
7
|
-
import { Label as
|
|
8
|
-
const
|
|
7
|
+
import { Label as R, Description as j } from "../Fieldset/Fieldset.js";
|
|
8
|
+
const z = F.forwardRef(function({
|
|
9
9
|
className: d,
|
|
10
10
|
accept: t,
|
|
11
|
-
multiple:
|
|
11
|
+
multiple: r = !1,
|
|
12
12
|
isDisabled: o = !1,
|
|
13
13
|
isInvalid: s = !1,
|
|
14
14
|
name: c,
|
|
15
15
|
value: n = [],
|
|
16
|
-
onChange:
|
|
16
|
+
onChange: e,
|
|
17
17
|
children: v,
|
|
18
18
|
...g
|
|
19
19
|
}, N) {
|
|
20
|
-
const [h, f] =
|
|
21
|
-
function
|
|
20
|
+
const [h, f] = I(!1);
|
|
21
|
+
function U(l) {
|
|
22
22
|
const i = l.target.files;
|
|
23
|
-
i && i.length > 0 && (
|
|
23
|
+
i && i.length > 0 && (e == null || e(r ? [...n, ...Array.from(i)] : Array.from(i))), l.target.value = "";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
25
|
+
function y(l) {
|
|
26
|
+
e == null || e(n.filter((i, D) => D !== l));
|
|
27
27
|
}
|
|
28
28
|
return /* @__PURE__ */ m(
|
|
29
29
|
"div",
|
|
@@ -46,16 +46,16 @@ const A = I.forwardRef(function({
|
|
|
46
46
|
type: "file",
|
|
47
47
|
className: "file-upload-input",
|
|
48
48
|
accept: t,
|
|
49
|
-
multiple:
|
|
49
|
+
multiple: r,
|
|
50
50
|
disabled: o,
|
|
51
51
|
name: c,
|
|
52
|
-
onChange:
|
|
52
|
+
onChange: U,
|
|
53
53
|
onDragEnter: () => f(!0),
|
|
54
54
|
onDragLeave: () => f(!1),
|
|
55
55
|
onDrop: () => f(!1)
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
/* @__PURE__ */ a(
|
|
58
|
+
/* @__PURE__ */ a($, { size: "24" }),
|
|
59
59
|
/* @__PURE__ */ a("span", { className: "file-upload-prompt", children: v })
|
|
60
60
|
]
|
|
61
61
|
}
|
|
@@ -64,7 +64,7 @@ const A = I.forwardRef(function({
|
|
|
64
64
|
x,
|
|
65
65
|
{
|
|
66
66
|
variant: "secondary",
|
|
67
|
-
onRemove: o ? void 0 : () =>
|
|
67
|
+
onRemove: o ? void 0 : () => y(i),
|
|
68
68
|
children: l.name
|
|
69
69
|
}
|
|
70
70
|
) }, `${l.name}-${i}`)) })
|
|
@@ -72,24 +72,24 @@ const A = I.forwardRef(function({
|
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
74
|
});
|
|
75
|
-
function
|
|
75
|
+
function B({
|
|
76
76
|
className: p,
|
|
77
77
|
label: d,
|
|
78
78
|
description: t,
|
|
79
|
-
errorMessage:
|
|
79
|
+
errorMessage: r,
|
|
80
80
|
isInvalid: o,
|
|
81
81
|
...s
|
|
82
82
|
}) {
|
|
83
|
-
const c = o ?? !!
|
|
83
|
+
const c = o ?? !!r;
|
|
84
84
|
return /* @__PURE__ */ m("div", { className: u(p, "field"), children: [
|
|
85
|
-
d && /* @__PURE__ */ a(
|
|
86
|
-
/* @__PURE__ */ a(
|
|
87
|
-
t && /* @__PURE__ */ a(
|
|
88
|
-
|
|
85
|
+
d && /* @__PURE__ */ a(R, { children: d }),
|
|
86
|
+
/* @__PURE__ */ a(z, { isInvalid: c, ...s }),
|
|
87
|
+
t && /* @__PURE__ */ a(j, { children: t }),
|
|
88
|
+
r && /* @__PURE__ */ a("span", { className: "error-message", children: r })
|
|
89
89
|
] });
|
|
90
90
|
}
|
|
91
91
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
z as FileUpload,
|
|
93
|
+
B as FileUploadField
|
|
94
94
|
};
|
|
95
95
|
//# sourceMappingURL=FileUpload.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react");;/* empty css */function m({aspectRatio:a="natural",className:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react");;/* empty css */function m({aspectRatio:a="natural",className:r,size:s="natural",variant:n="rounded",...c}){const[i,o]=l.useState(!1),u=t.clsx(r,"image",`image-aspect-ratio-${a}`,`image-size-${s}`,`image-variant-${n}`,!i&&"image-loading");return e.jsxs(e.Fragment,{children:[!i&&e.jsx("span",{className:t.clsx("image-placeholder",u)}),c.src&&e.jsx("img",{className:u,...c,onLoad:()=>o(!0)})]})}function g({className:a,...r}){const s=t.clsx(a,"picture");return e.jsx("picture",{className:s,...r})}function d({...a}){return e.jsx("source",{...a})}exports.Image=m;exports.Picture=g;exports.PictureSource=d;
|
|
2
2
|
//# sourceMappingURL=Image.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../../vendor/clsx/dist/clsx.cjs"),x=require("react"),l=require("react-aria-components");;/* empty css */const c=require("../Fieldset/Fieldset.cjs");function p({className:i,placeholder:t,label:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../../vendor/clsx/dist/clsx.cjs"),x=require("react"),l=require("react-aria-components");;/* empty css */const c=require("../Fieldset/Fieldset.cjs");function p({className:i,placeholder:t,label:r,description:s,errorMessage:n,...a}){const d=u.clsx(i,"field");return e.jsxs(l.TextField,{className:d,...a,children:[r&&e.jsx(c.Label,{children:r}),e.jsx(o,{placeholder:t}),s&&e.jsx(c.Description,{children:s}),e.jsx(c.FieldError,{children:n})]})}const o=x.forwardRef(function({className:t,...r},s){const n=u.clsx(t,"input");return e.jsx(l.Input,{className:n,ref:s,...r})});exports.Input=o;exports.InputField=p;
|
|
2
2
|
//# sourceMappingURL=Input.cjs.map
|
|
@@ -4,7 +4,7 @@ import l from "react";
|
|
|
4
4
|
import { TextField as a, Input as f } from "react-aria-components";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { Label as u, Description as d, FieldError as x } from "../Fieldset/Fieldset.js";
|
|
7
|
-
function
|
|
7
|
+
function k({
|
|
8
8
|
className: s,
|
|
9
9
|
placeholder: o,
|
|
10
10
|
label: t,
|
|
@@ -26,6 +26,6 @@ const I = l.forwardRef(function({ className: o, ...t }, n) {
|
|
|
26
26
|
});
|
|
27
27
|
export {
|
|
28
28
|
I as Input,
|
|
29
|
-
|
|
29
|
+
k as InputField
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),r=require("react"),L=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("@codemirror/state"),d=require("@codemirror/view"),R=require("@codemirror/language"),a=require("./json-code-mirror.cjs");;/* empty css */const V=require("../../icons/IconChevronDown.cjs"),$=require("../../icons/IconChevronRight.cjs"),N=require("../Button/Button.cjs");function v(t,o){o.length>0&&t.dispatch({effects:o.map(f=>R.foldEffect.of(f))})}function O({value:t,onChange:o,expandAllLabel:f,className:S,height:b,minHeight:q,maxHeight:y,isDisabled:m=!1,isReadOnly:C=!1,"aria-label":z}){const E=r.useRef(null),s=r.useRef(null),p=r.useRef(new l.Compartment),u=r.useRef(o),x=r.useRef(t),[w,F]=r.useState(!1),I=a.toEditorSizeStyle({height:b,minHeight:q,maxHeight:y}),i=!m&&!C;u.current=o,r.useEffect(()=>{if(!E.current)return;const e=d.EditorView.updateListener.of(g=>{var j;if(!g.docChanged)return;const h=g.state.doc.toString();x.current=h,(j=u.current)==null||j.call(u,h)}),n=new d.EditorView({parent:E.current,state:l.EditorState.create({doc:t,extensions:[p.current.of([d.EditorView.editable.of(i),l.EditorState.readOnly.of(!i)]),a.jsonEditorTheme,...a.jsonEditorExtensions,e]})});return s.current=n,v(n,a.computeFirstLevelFoldRanges(t)),()=>{n.destroy(),s.current=null}},[]),r.useEffect(()=>{const e=s.current;if(!e)return;const n=e.state.doc.toString();t!==n&&t!==x.current&&(e.dispatch({changes:{from:0,to:n.length,insert:t}}),x.current=t)},[t]),r.useEffect(()=>{const e=s.current;e&&e.dispatch({effects:p.current.reconfigure([d.EditorView.editable.of(i),l.EditorState.readOnly.of(!i)])})},[i]);const T=()=>{const e=s.current;e&&(w?v(e,a.computeFirstLevelFoldRanges(e.state.doc.toString())):R.unfoldAll(e),F(!w))};return c.jsxs("div",{className:L.clsx("json-viewer","json-viewer-editable",S),"data-disabled":m||void 0,children:[c.jsx(N.Button,{"aria-label":f,variant:"subtle",size:"small",className:"json-viewer-expand-all",onPress:T,children:w?c.jsx(V.IconChevronDown,{size:"14"}):c.jsx($.IconChevronRight,{size:"14"})}),c.jsx("div",{ref:E,className:"json-viewer-content",style:I,"aria-label":z,role:"textbox","aria-multiline":"true"})]})}exports.JsonEditor=O;
|
|
2
2
|
//# sourceMappingURL=JsonEditor.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),t=require("../../../vendor/clsx/dist/clsx.cjs"),c=require("react");;/* empty css */const i=c.forwardRef(function(e,r){const s=t.clsx("link",e.className);return n.jsx("a",{...e,ref:r,className:s})});exports.Link=i;
|
|
2
2
|
//# sourceMappingURL=Link.cjs.map
|
|
@@ -2,9 +2,9 @@ import { jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx as t } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
3
|
import a from "react";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const l = a.forwardRef(function(
|
|
6
|
-
const m = t("link",
|
|
7
|
-
return /* @__PURE__ */ s("a", { ...
|
|
5
|
+
const l = a.forwardRef(function(r, o) {
|
|
6
|
+
const m = t("link", r.className);
|
|
7
|
+
return /* @__PURE__ */ s("a", { ...r, ref: o, className: m });
|
|
8
8
|
});
|
|
9
9
|
export {
|
|
10
10
|
l as Link
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../../vendor/clsx/dist/clsx.cjs"),c=require("react"),j=require("../PermissionGate/PermissionGate.cjs"),u=require("react-aria-components");;/* empty css */const h=require("../../icons/IconChevronDown.cjs"),i=require("../Fieldset/Fieldset.cjs"),g=require("../IconButton/IconButton.cjs"),N=require("../Button/Button.cjs"),v=require("../../hooks/useOverlayPortal.cjs"),q=require("../Text/Text.cjs");let l=!1;function m(n){l||c.Children.forEach(n,e=>{if(c.isValidElement(e)){if(e.type===c.Fragment){m(e.props.children);return}e.type===j.PermissionGate&&(l=!0,console.error("[design-system] Menu: PermissionGate não pode envolver um MenuItem — o react-aria descarta esse item e os seguintes, e o menu abre vazio quando ele é o primeiro. Mova o gate para dentro do MenuItem, em volta do conteúdo do item."))}})}function d({className:n,...e}){return m(typeof e.children=="function"?null:e.children),r.jsx(u.Menu,{className:s.clsx(n,"menu"),...e})}function x({...n}){return r.jsx(u.MenuTrigger,{...n})}function p({label:n,children:e,icon:t,placement:o,variant:a,...f}){return r.jsxs(x,{children:[t?r.jsx(g.IconButton,{variant:a,"aria-label":n,children:t}):r.jsx(N.Button,{variant:a,children:n}),r.jsx(M,{placement:o,children:r.jsx(d,{...f,children:e})})]})}function M({UNSTABLE_portalContainer:n,...e}){const t=v.useOverlayPortalContainer();return r.jsx(u.Popover,{...e,UNSTABLE_portalContainer:n??t})}function I({className:n,...e}){const t=s.clsx(n,"menu-item"),o=e.textValue||(typeof e.children=="string"?e.children:void 0);return r.jsx(u.MenuItem,{...e,className:t,textValue:o,children:({hasSubmenu:a})=>r.jsxs(r.Fragment,{children:[e.children,a&&r.jsx(h.IconChevronDown,{})]})})}function y({className:n,...e}){const t=s.clsx(n,"menu-header");return r.jsx("div",{...e,className:t})}function S({className:n,...e}){const t=s.clsx(n,"menu-section");return r.jsx("div",{...e,className:t})}function b({className:n,...e}){const t=s.clsx(n,"menu-heading");return r.jsx(q.TextHeading,{...e,className:t})}function P({className:n,...e}){const t=s.clsx(n,"menu-separator");return r.jsx(u.Separator,{...e,className:t})}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../../vendor/clsx/dist/clsx.cjs"),c=require("react"),j=require("../PermissionGate/PermissionGate.cjs"),u=require("react-aria-components");;/* empty css */const h=require("../../icons/IconChevronDown.cjs"),i=require("../Fieldset/Fieldset.cjs"),g=require("../IconButton/IconButton.cjs"),N=require("../Button/Button.cjs"),v=require("../../hooks/useOverlayPortal.cjs"),q=require("../Text/Text.cjs");let l=!1;function m(n){l||c.Children.forEach(n,e=>{if(c.isValidElement(e)){if(e.type===c.Fragment){m(e.props.children);return}e.type===j.PermissionGate&&(l=!0,console.error("[design-system] Menu: PermissionGate não pode envolver um MenuItem — o react-aria descarta esse item e os seguintes, e o menu abre vazio quando ele é o primeiro. Mova o gate para dentro do MenuItem, em volta do conteúdo do item."))}})}function d({className:n,...e}){return m(typeof e.children=="function"?null:e.children),r.jsx(u.Menu,{className:s.clsx(n,"menu"),...e})}function x({...n}){return r.jsx(u.MenuTrigger,{...n})}function p({label:n,children:e,icon:t,placement:o,variant:a,...f}){return r.jsxs(x,{children:[t?r.jsx(g.IconButton,{variant:a,"aria-label":n,children:t}):r.jsx(N.Button,{variant:a,children:n}),r.jsx(M,{placement:o,children:r.jsx(d,{...f,children:e})})]})}function M({UNSTABLE_portalContainer:n,...e}){const t=v.useOverlayPortalContainer();return r.jsx(u.Popover,{...e,UNSTABLE_portalContainer:n??t})}function I({className:n,...e}){const t=s.clsx(n,"menu-item"),o=e.textValue||(typeof e.children=="string"?e.children:void 0);return r.jsx(u.MenuItem,{...e,className:t,textValue:o,children:({hasSubmenu:a})=>r.jsxs(r.Fragment,{children:[e.children,a&&r.jsx(h.IconChevronDown,{})]})})}function y({className:n,...e}){const t=s.clsx(n,"menu-header");return r.jsx("div",{...e,className:t})}function S({className:n,...e}){const t=s.clsx(n,"menu-section");return r.jsx("div",{...e,className:t})}function b({className:n,...e}){const t=s.clsx(n,"menu-heading");return r.jsx(q.TextHeading,{...e,className:t})}function P({className:n,...e}){const t=s.clsx(n,"menu-separator");return r.jsx(u.Separator,{...e,className:t})}function T({className:n,...e}){const t=s.clsx(n,"menu-label");return r.jsx(i.Label,{...e,className:t})}function B({className:n,...e}){const t=s.clsx(n,"menu-description");return r.jsx(i.Description,{...e,className:t})}function C({children:n,className:e,...t}){const o=s.clsx(e,"menu-shortcut");return r.jsx(i.Keyboard,{...t,className:o,children:n})}exports.Menu=d;exports.MenuButton=p;exports.MenuDescription=B;exports.MenuHeader=y;exports.MenuHeading=b;exports.MenuItem=I;exports.MenuLabel=T;exports.MenuPopover=M;exports.MenuSection=S;exports.MenuSeparator=P;exports.MenuShortcut=C;exports.MenuTrigger=x;
|
|
2
2
|
//# sourceMappingURL=Menu.cjs.map
|