@commercetools/nimbus 0.0.0-canary-20251031185705 → 0.0.0-canary-20251105152021
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/chunks/{data-table-WpSHciHZ.es.js → data-table-DOtu1sY_.es.js} +6 -6
- package/dist/chunks/{data-table-WpSHciHZ.es.js.map → data-table-DOtu1sY_.es.js.map} +1 -1
- package/dist/chunks/{data-table-BjFkMw2E.cjs.js → data-table-DU27AnZ8.cjs.js} +2 -2
- package/dist/chunks/{data-table-BjFkMw2E.cjs.js.map → data-table-DU27AnZ8.cjs.js.map} +1 -1
- package/dist/chunks/date-range-picker-field-0y5CNFyh.cjs.js.map +1 -1
- package/dist/chunks/date-range-picker-field-BjK520E2.es.js.map +1 -1
- package/dist/chunks/draggable-list-COLeAeV4.es.js.map +1 -1
- package/dist/chunks/draggable-list-D0ov_oEo.cjs.js.map +1 -1
- package/dist/chunks/icon-toggle-button-DZjAAxUN.cjs.js.map +1 -1
- package/dist/chunks/icon-toggle-button-JNBy2M8q.es.js.map +1 -1
- package/dist/chunks/{localized-field-CLNEUHDE.cjs.js → localized-field-Caslgcr8.cjs.js} +2 -2
- package/dist/chunks/{localized-field-CLNEUHDE.cjs.js.map → localized-field-Caslgcr8.cjs.js.map} +1 -1
- package/dist/chunks/{localized-field-D3NXlDB4.es.js → localized-field-DsNOtBui.es.js} +4 -4
- package/dist/chunks/{localized-field-D3NXlDB4.es.js.map → localized-field-DsNOtBui.es.js.map} +1 -1
- package/dist/chunks/menu-BN2WBtU1.cjs.js.map +1 -1
- package/dist/chunks/menu-CV4u_xTQ.es.js.map +1 -1
- package/dist/chunks/{money-input-CHGisosY.es.js → money-input-BWV3r-yy.es.js} +2 -2
- package/dist/chunks/{money-input-CHGisosY.es.js.map → money-input-BWV3r-yy.es.js.map} +1 -1
- package/dist/chunks/{money-input-BcVl1GSJ.cjs.js → money-input-DQpIRVRF.cjs.js} +2 -2
- package/dist/chunks/{money-input-BcVl1GSJ.cjs.js.map → money-input-DQpIRVRF.cjs.js.map} +1 -1
- package/dist/chunks/password-input-BCoucE5i.cjs.js.map +1 -1
- package/dist/chunks/password-input-CizSENHi.es.js.map +1 -1
- package/dist/chunks/{rich-text-input-BJk01U_c.cjs.js → rich-text-input-BdQt1zJu.cjs.js} +2 -2
- package/dist/chunks/{rich-text-input-BJk01U_c.cjs.js.map → rich-text-input-BdQt1zJu.cjs.js.map} +1 -1
- package/dist/chunks/{rich-text-input-CdYQJX6c.es.js → rich-text-input-Dt24WZJB.es.js} +2 -2
- package/dist/chunks/{rich-text-input-CdYQJX6c.es.js.map → rich-text-input-Dt24WZJB.es.js.map} +1 -1
- package/dist/chunks/scoped-search-input-D6qpyJYv.cjs.js.map +1 -1
- package/dist/chunks/scoped-search-input-gMsh3VM9.es.js.map +1 -1
- package/dist/chunks/split-button-4gxONpNC.es.js.map +1 -1
- package/dist/chunks/split-button-Ci3LSgyf.cjs.js.map +1 -1
- package/dist/chunks/text-input-field-KEntobaR.cjs.js.map +1 -1
- package/dist/chunks/text-input-field-rt2r9i_0.es.js.map +1 -1
- package/dist/components/alert/alert.recipe.d.ts +1 -1
- package/dist/components/alert/alert.types.d.ts +2 -2
- package/dist/components/data-table/data-table.slots.d.ts +1 -1
- package/dist/components/data-table.cjs +1 -1
- package/dist/components/data-table.es.js +1 -1
- package/dist/components/date-input/date-input.slots.d.ts +1 -1
- package/dist/components/date-picker/date-picker.types.d.ts +1 -1
- package/dist/components/date-range-picker/date-range-picker.slots.d.ts +1 -1
- package/dist/components/dialog/dialog.types.d.ts +1 -1
- package/dist/components/drawer/drawer.types.d.ts +1 -1
- package/dist/components/icon-button/icon-button.types.d.ts +1 -1
- package/dist/components/icon-toggle-button/icon-toggle-button.types.d.ts +1 -1
- package/dist/components/link/link.slots.d.ts +1 -1
- package/dist/components/localized-field/localized-field.types.d.ts +1 -1
- package/dist/components/localized-field.cjs +1 -1
- package/dist/components/localized-field.es.js +1 -1
- package/dist/components/money-input/money-input.recipe.d.ts +1 -1
- package/dist/components/money-input.cjs +1 -1
- package/dist/components/money-input.es.js +1 -1
- package/dist/components/multiline-text-input/multiline-text-input.slots.d.ts +3 -3
- package/dist/components/number-input/number-input.slots.d.ts +6 -6
- package/dist/components/rich-text-input.cjs +1 -1
- package/dist/components/rich-text-input.es.js +1 -1
- package/dist/components/split-button/split-button.types.d.ts +1 -1
- package/dist/components/time-input/time-input.slots.d.ts +3 -3
- package/dist/constants/color-palettes.d.ts +24 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +5 -5
- package/dist/patterns/fields/date-range-picker-field/date-range-picker-field.types.d.ts +1 -1
- package/dist/patterns/fields/text-input-field/text-input-field.types.d.ts +3 -3
- package/dist/theme/slot-recipes/index.d.ts +2 -2
- package/dist/type-utils/shared-types.d.ts +14 -1
- package/dist/utils/display-color-palettes.d.ts +39 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-search-input-D6qpyJYv.cjs.js","sources":["../../src/components/scoped-search-input/scoped-search-input.slots.tsx","../../src/components/scoped-search-input/utils/helpers.ts","../../src/components/scoped-search-input/scoped-search-input.i18n.ts","../../src/components/scoped-search-input/scoped-search-input.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n ScopedSearchInputRootSlotProps,\n ScopedSearchInputContainerSlotProps,\n ScopedSearchInputSelectWrapperSlotProps,\n ScopedSearchInputSearchWrapperSlotProps,\n} from \"./scoped-search-input.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"scopedSearchInput\",\n});\n\nexport const ScopedSearchInputRootSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputRootSlotProps\n> = withProvider<HTMLDivElement, ScopedSearchInputRootSlotProps>(\"div\", \"root\");\n\nexport const ScopedSearchInputContainerSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputContainerSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputContainerSlotProps>(\n \"div\",\n \"container\"\n);\n\nexport const ScopedSearchInputSelectWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSelectWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSelectWrapperSlotProps>(\n \"div\",\n \"selectWrapper\"\n);\n\nexport const ScopedSearchInputSearchWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSearchWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSearchWrapperSlotProps>(\n \"div\",\n \"searchWrapper\"\n);\n","import type { ScopedSearchInputValue } from \"../scoped-search-input.types\";\n\n/**\n * Check if the search text is empty or only whitespace\n */\nexport const isEmpty = (value: ScopedSearchInputValue): boolean => {\n return !value.text || value.text.trim().length === 0;\n};\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n selectLabel: {\n id: \"Nimbus.ScopedSearchInput.selectLabel\",\n description: \"Default aria-label for select dropdown\",\n defaultMessage: \"Filter by\",\n },\n searchLabel: {\n id: \"Nimbus.ScopedSearchInput.searchLabel\",\n description: \"Default aria-label for search input\",\n defaultMessage: \"Search\",\n },\n});\n","import { useCallback, useId, useRef } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react/styled-system\";\nimport { useIntl } from \"react-intl\";\nimport { Select } from \"@/components/select\";\nimport { SearchInput } from \"@/components/search-input\";\nimport { extractStyleProps } from \"@/utils\";\nimport { scopedSearchInputSlotRecipe } from \"./scoped-search-input.recipe\";\nimport {\n ScopedSearchInputRootSlot,\n ScopedSearchInputContainerSlot,\n ScopedSearchInputSelectWrapperSlot,\n ScopedSearchInputSearchWrapperSlot,\n} from \"./scoped-search-input.slots\";\nimport type {\n ScopedSearchInputProps,\n ScopedSearchInputOption,\n ScopedSearchInputOptionGroup,\n} from \"./scoped-search-input.types\";\nimport { isEmpty } from \"./utils/helpers\";\nimport { messages } from \"./scoped-search-input.i18n\";\n\n/**\n * ScopedSearchInput\n * ============================================================\n * A combined input component that integrates a select dropdown with a search input field,\n * enabling users to filter search by category or field type.\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/scoped-search-input}\n *\n * @supportsStyleProps\n */\nexport const ScopedSearchInput = (props: ScopedSearchInputProps) => {\n const {\n value,\n onValueChange,\n onTextChange,\n onOptionChange,\n onSubmit,\n onReset,\n options,\n selectPlaceholder,\n searchPlaceholder,\n selectAriaLabel,\n searchAriaLabel,\n isClearable = true,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired,\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n size,\n } = props;\n\n const intl = useIntl();\n\n // Split recipe props\n const recipe = useSlotRecipe({ recipe: scopedSearchInputSlotRecipe });\n const [recipeProps, restRecipeProps] = recipe.splitVariantProps(props);\n\n // Extract style props\n const [styleProps, remainingProps] = extractStyleProps(restRecipeProps);\n\n // Generate unique IDs for ARIA relationships\n const generatedId = useId();\n const componentId = id || generatedId;\n const selectId = `${componentId}-select`;\n const searchId = `${componentId}-search`;\n\n // Ref for search input to enable auto-focus on option selection\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n // Event handlers that coordinate state\n const handleTextChange = useCallback(\n (newText: string) => {\n onTextChange?.(newText);\n onValueChange?.({ ...value, text: newText });\n },\n [value, onTextChange, onValueChange]\n );\n\n const handleOptionChange = useCallback(\n (newOption: React.Key | null) => {\n if (newOption === null) return;\n const optionString = String(newOption);\n onOptionChange?.(optionString);\n onValueChange?.({ ...value, option: optionString });\n\n // Auto-focus search input after option selection (unless disabled/readonly)\n if (searchInputRef.current && !isDisabled && !isReadOnly) {\n // Use setTimeout to ensure focus happens after React Aria's state updates\n setTimeout(() => {\n searchInputRef.current?.focus();\n }, 0);\n }\n },\n [value, onOptionChange, onValueChange, isDisabled, isReadOnly]\n );\n\n const handleSubmit = useCallback(() => {\n onSubmit(value);\n }, [value, onSubmit]);\n\n const handleReset = useCallback(() => {\n onReset?.();\n // Clear text but keep selected option\n handleTextChange(\"\");\n }, [onReset, handleTextChange]);\n\n return (\n <ScopedSearchInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...remainingProps}\n >\n <ScopedSearchInputContainerSlot>\n {/* Select Dropdown (Left) */}\n <ScopedSearchInputSelectWrapperSlot asChild>\n <Select.Root\n id={selectId}\n selectedKey={value.option}\n onSelectionChange={isReadOnly ? undefined : handleOptionChange}\n placeholder={selectPlaceholder}\n aria-label={\n selectAriaLabel || intl.formatMessage(messages.selectLabel)\n }\n aria-controls={searchId}\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isClearable={false}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n <Select.Options>\n {options.map(\n (\n item: ScopedSearchInputOption | ScopedSearchInputOptionGroup\n ) => {\n // Check if it's an option group\n if (\"options\" in item) {\n const group = item as ScopedSearchInputOptionGroup;\n return (\n <Select.OptionGroup key={group.label} label={group.label}>\n {group.options.map((opt: ScopedSearchInputOption) => (\n <Select.Option\n key={opt.value}\n id={opt.value}\n isDisabled={opt.isDisabled}\n >\n {opt.label}\n </Select.Option>\n ))}\n </Select.OptionGroup>\n );\n }\n // Regular option\n const option = item as ScopedSearchInputOption;\n return (\n <Select.Option\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n >\n {option.label}\n </Select.Option>\n );\n }\n )}\n </Select.Options>\n </Select.Root>\n </ScopedSearchInputSelectWrapperSlot>\n\n {/* Search Input (Right) */}\n <ScopedSearchInputSearchWrapperSlot asChild>\n <SearchInput\n ref={searchInputRef}\n id={searchId}\n value={value.text}\n onChange={handleTextChange}\n onSubmit={handleSubmit}\n onClear={isClearable ? handleReset : undefined}\n placeholder={searchPlaceholder}\n aria-label={\n searchAriaLabel || intl.formatMessage(messages.searchLabel)\n }\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n isRequired={isRequired}\n />\n </ScopedSearchInputSearchWrapperSlot>\n </ScopedSearchInputContainerSlot>\n </ScopedSearchInputRootSlot>\n );\n};\n\n// Static methods\nScopedSearchInput.isEmpty = isEmpty;\n\n// Display name\nScopedSearchInput.displayName = \"ScopedSearchInput\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","ScopedSearchInputRootSlot","ScopedSearchInputContainerSlot","ScopedSearchInputSelectWrapperSlot","ScopedSearchInputSearchWrapperSlot","isEmpty","value","messages","defineMessages","ScopedSearchInput","props","onValueChange","onTextChange","onOptionChange","onSubmit","onReset","options","selectPlaceholder","searchPlaceholder","selectAriaLabel","searchAriaLabel","isClearable","isDisabled","isReadOnly","isInvalid","isRequired","id","ariaDescribedby","ariaLabelledby","size","intl","useIntl","recipe","useSlotRecipe","scopedSearchInputSlotRecipe","recipeProps","restRecipeProps","styleProps","remainingProps","extractStyleProps","generatedId","useId","componentId","selectId","searchId","searchInputRef","useRef","handleTextChange","useCallback","newText","handleOptionChange","newOption","optionString","handleSubmit","handleReset","jsx","Select","item","group","opt","option","SearchInput"],"mappings":"iVASM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,mBACP,CAAC,EAEYC,EAGTH,EAA6D,MAAO,MAAM,EAEjEI,GAGTH,EACF,MACA,WACF,EAEaI,GAGTJ,EACF,MACA,eACF,EAEaK,GAGTL,EACF,MACA,eACF,ECnCaM,GAAWC,GACf,CAACA,EAAM,MAAQA,EAAM,KAAK,KAAA,EAAO,SAAW,ECJxCC,EAAWC,EAAAA,eAAe,CACrC,YAAa,CACX,GAAI,uCACJ,YAAa,yCACb,eAAgB,WAAA,EAElB,YAAa,CACX,GAAI,uCACJ,YAAa,sCACb,eAAgB,QAAA,CAEpB,CAAC,ECkBYC,EAAqBC,GAAkC,CAClE,KAAM,CACJ,MAAAJ,EACA,cAAAK,EACA,aA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E,GAAmBU,EAAK,cAAcvB,EAAS,WAAW,EAE5D,mBAAkBoB,EAClB,kBAAiBC,EACjB,KAAAC,EACA,WAAAP,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,CAAA,CAAA,CACF,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,EAGAhB,EAAkB,QAAUJ,GAG5BI,EAAkB,YAAc"}
|
|
1
|
+
{"version":3,"file":"scoped-search-input-D6qpyJYv.cjs.js","sources":["../../src/components/scoped-search-input/scoped-search-input.slots.tsx","../../src/components/scoped-search-input/utils/helpers.ts","../../src/components/scoped-search-input/scoped-search-input.i18n.ts","../../src/components/scoped-search-input/scoped-search-input.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n ScopedSearchInputRootSlotProps,\n ScopedSearchInputContainerSlotProps,\n ScopedSearchInputSelectWrapperSlotProps,\n ScopedSearchInputSearchWrapperSlotProps,\n} from \"./scoped-search-input.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"scopedSearchInput\",\n});\n\nexport const ScopedSearchInputRootSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputRootSlotProps\n> = withProvider<HTMLDivElement, ScopedSearchInputRootSlotProps>(\"div\", \"root\");\n\nexport const ScopedSearchInputContainerSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputContainerSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputContainerSlotProps>(\n \"div\",\n \"container\"\n);\n\nexport const ScopedSearchInputSelectWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSelectWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSelectWrapperSlotProps>(\n \"div\",\n \"selectWrapper\"\n);\n\nexport const ScopedSearchInputSearchWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSearchWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSearchWrapperSlotProps>(\n \"div\",\n \"searchWrapper\"\n);\n","import type { ScopedSearchInputValue } from \"../scoped-search-input.types\";\n\n/**\n * Check if the search text is empty or only whitespace\n */\nexport const isEmpty = (value: ScopedSearchInputValue): boolean => {\n return !value.text || value.text.trim().length === 0;\n};\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n selectLabel: {\n id: \"Nimbus.ScopedSearchInput.selectLabel\",\n description: \"Default aria-label for select dropdown\",\n defaultMessage: \"Filter by\",\n },\n searchLabel: {\n id: \"Nimbus.ScopedSearchInput.searchLabel\",\n description: \"Default aria-label for search input\",\n defaultMessage: \"Search\",\n },\n});\n","import { useCallback, useId, useRef } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react/styled-system\";\nimport { useIntl } from \"react-intl\";\nimport { Select } from \"@/components/select/select\";\nimport { SearchInput } from \"@/components/search-input/search-input\";\nimport { extractStyleProps } from \"@/utils\";\nimport { scopedSearchInputSlotRecipe } from \"./scoped-search-input.recipe\";\nimport {\n ScopedSearchInputRootSlot,\n ScopedSearchInputContainerSlot,\n ScopedSearchInputSelectWrapperSlot,\n ScopedSearchInputSearchWrapperSlot,\n} from \"./scoped-search-input.slots\";\nimport type {\n ScopedSearchInputProps,\n ScopedSearchInputOption,\n ScopedSearchInputOptionGroup,\n} from \"./scoped-search-input.types\";\nimport { isEmpty } from \"./utils/helpers\";\nimport { messages } from \"./scoped-search-input.i18n\";\n\n/**\n * ScopedSearchInput\n * ============================================================\n * A combined input component that integrates a select dropdown with a search input field,\n * enabling users to filter search by category or field type.\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/scoped-search-input}\n *\n * @supportsStyleProps\n */\nexport const ScopedSearchInput = (props: ScopedSearchInputProps) => {\n const {\n value,\n onValueChange,\n onTextChange,\n onOptionChange,\n onSubmit,\n onReset,\n options,\n selectPlaceholder,\n searchPlaceholder,\n selectAriaLabel,\n searchAriaLabel,\n isClearable = true,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired,\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n size,\n } = props;\n\n const intl = useIntl();\n\n // Split recipe props\n const recipe = useSlotRecipe({ recipe: scopedSearchInputSlotRecipe });\n const [recipeProps, restRecipeProps] = recipe.splitVariantProps(props);\n\n // Extract style props\n const [styleProps, remainingProps] = extractStyleProps(restRecipeProps);\n\n // Generate unique IDs for ARIA relationships\n const generatedId = useId();\n const componentId = id || generatedId;\n const selectId = `${componentId}-select`;\n const searchId = `${componentId}-search`;\n\n // Ref for search input to enable auto-focus on option selection\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n // Event handlers that coordinate state\n const handleTextChange = useCallback(\n (newText: string) => {\n onTextChange?.(newText);\n onValueChange?.({ ...value, text: newText });\n },\n [value, onTextChange, onValueChange]\n );\n\n const handleOptionChange = useCallback(\n (newOption: React.Key | null) => {\n if (newOption === null) return;\n const optionString = String(newOption);\n onOptionChange?.(optionString);\n onValueChange?.({ ...value, option: optionString });\n\n // Auto-focus search input after option selection (unless disabled/readonly)\n if (searchInputRef.current && !isDisabled && !isReadOnly) {\n // Use setTimeout to ensure focus happens after React Aria's state updates\n setTimeout(() => {\n searchInputRef.current?.focus();\n }, 0);\n }\n },\n [value, onOptionChange, onValueChange, isDisabled, isReadOnly]\n );\n\n const handleSubmit = useCallback(() => {\n onSubmit(value);\n }, [value, onSubmit]);\n\n const handleReset = useCallback(() => {\n onReset?.();\n // Clear text but keep selected option\n handleTextChange(\"\");\n }, [onReset, handleTextChange]);\n\n return (\n <ScopedSearchInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...remainingProps}\n >\n <ScopedSearchInputContainerSlot>\n {/* Select Dropdown (Left) */}\n <ScopedSearchInputSelectWrapperSlot asChild>\n <Select.Root\n id={selectId}\n selectedKey={value.option}\n onSelectionChange={isReadOnly ? undefined : handleOptionChange}\n placeholder={selectPlaceholder}\n aria-label={\n selectAriaLabel || intl.formatMessage(messages.selectLabel)\n }\n aria-controls={searchId}\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isClearable={false}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n <Select.Options>\n {options.map(\n (\n item: ScopedSearchInputOption | ScopedSearchInputOptionGroup\n ) => {\n // Check if it's an option group\n if (\"options\" in item) {\n const group = item as ScopedSearchInputOptionGroup;\n return (\n <Select.OptionGroup key={group.label} label={group.label}>\n {group.options.map((opt: ScopedSearchInputOption) => (\n <Select.Option\n key={opt.value}\n id={opt.value}\n isDisabled={opt.isDisabled}\n >\n {opt.label}\n </Select.Option>\n ))}\n </Select.OptionGroup>\n );\n }\n // Regular option\n const option = item as ScopedSearchInputOption;\n return (\n <Select.Option\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n >\n {option.label}\n </Select.Option>\n );\n }\n )}\n </Select.Options>\n </Select.Root>\n </ScopedSearchInputSelectWrapperSlot>\n\n {/* Search Input (Right) */}\n <ScopedSearchInputSearchWrapperSlot asChild>\n <SearchInput\n ref={searchInputRef}\n id={searchId}\n value={value.text}\n onChange={handleTextChange}\n onSubmit={handleSubmit}\n onClear={isClearable ? handleReset : undefined}\n placeholder={searchPlaceholder}\n aria-label={\n searchAriaLabel || intl.formatMessage(messages.searchLabel)\n }\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n isRequired={isRequired}\n />\n </ScopedSearchInputSearchWrapperSlot>\n </ScopedSearchInputContainerSlot>\n </ScopedSearchInputRootSlot>\n );\n};\n\n// Static methods\nScopedSearchInput.isEmpty = isEmpty;\n\n// Display name\nScopedSearchInput.displayName = \"ScopedSearchInput\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","ScopedSearchInputRootSlot","ScopedSearchInputContainerSlot","ScopedSearchInputSelectWrapperSlot","ScopedSearchInputSearchWrapperSlot","isEmpty","value","messages","defineMessages","ScopedSearchInput","props","onValueChange","onTextChange","onOptionChange","onSubmit","onReset","options","selectPlaceholder","searchPlaceholder","selectAriaLabel","searchAriaLabel","isClearable","isDisabled","isReadOnly","isInvalid","isRequired","id","ariaDescribedby","ariaLabelledby","size","intl","useIntl","recipe","useSlotRecipe","scopedSearchInputSlotRecipe","recipeProps","restRecipeProps","styleProps","remainingProps","extractStyleProps","generatedId","useId","componentId","selectId","searchId","searchInputRef","useRef","handleTextChange","useCallback","newText","handleOptionChange","newOption","optionString","handleSubmit","handleReset","jsx","Select","item","group","opt","option","SearchInput"],"mappings":"iVASM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,mBACP,CAAC,EAEYC,EAGTH,EAA6D,MAAO,MAAM,EAEjEI,GAGTH,EACF,MACA,WACF,EAEaI,GAGTJ,EACF,MACA,eACF,EAEaK,GAGTL,EACF,MACA,eACF,ECnCaM,GAAWC,GACf,CAACA,EAAM,MAAQA,EAAM,KAAK,KAAA,EAAO,SAAW,ECJxCC,EAAWC,EAAAA,eAAe,CACrC,YAAa,CACX,GAAI,uCACJ,YAAa,yCACb,eAAgB,WAAA,EAElB,YAAa,CACX,GAAI,uCACJ,YAAa,sCACb,eAAgB,QAAA,CAEpB,CAAC,ECkBYC,EAAqBC,GAAkC,CAClE,KAAM,CACJ,MAAAJ,EACA,cAAAK,EACA,aAAAC,EACA,eAAAC,EACA,SAAAC,EACA,QAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,YAAAC,EAAc,GACd,WAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,GAAAC,EACA,mBAAoBC,EACpB,kBAAmBC,EACnB,KAAAC,CAAA,EACEnB,EAEEoB,EAAOC,EAAAA,QAAA,EAGPC,EAASC,EAAAA,cAAc,CAAE,OAAQC,EAAAA,4BAA6B,EAC9D,CAACC,EAAaC,CAAe,EAAIJ,EAAO,kBAAkBtB,CAAK,EAG/D,CAA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kBjB,EAClB,kBAAiBC,EACjB,KAAAC,EACA,YAAa,GACb,WAAAP,EACA,WAAAG,EAEA,SAAA8B,EAAAA,IAACC,EAAAA,OAAO,QAAP,CACE,SAAAxC,EAAQ,IAELyC,GACG,CAEH,GAAI,YAAaA,EAAM,CACrB,MAAMC,EAAQD,EACd,OACEF,EAAAA,IAACC,EAAAA,OAAO,YAAP,CAAqC,MAAOE,EAAM,MAChD,SAAAA,EAAM,QAAQ,IAAKC,GAClBJ,EAAAA,IAACC,EAAAA,OAAO,OAAP,CAEC,GAAIG,EAAI,MACR,WAAYA,EAAI,WAEf,SAAAA,EAAI,KAAA,EAJAA,EAAI,KAAA,CAMZ,CAAA,EATsBD,EAAM,KAU/B,CAEJ,CAEA,MAAME,EAASH,EACf,OACEF,EAAAA,IAACC,EAAAA,OAAO,OAAP,CAEC,GAAII,EAAO,MACX,WAAYA,EAAO,WAElB,SAAAA,EAAO,KAAA,EAJHA,EAAO,KAAA,CAOlB,CAAA,CACF,CACF,CAAA,CAAA,EAEJ,EAGAL,EAAAA,IAACnD,GAAA,CAAmC,QAAO,GACzC,SAAAmD,EAAAA,IAACM,EAAAA,YAAA,CACC,IAAKhB,EACL,GAAID,EACJ,MAAOtC,EAAM,KACb,SAAUyC,EACV,SAAUM,EACV,QAAShC,EAAciC,EAAc,OACrC,YAAapC,EACb,aACEE,GAAmBU,EAAK,cAAcvB,EAAS,WAAW,EAE5D,mBAAkBoB,EAClB,kBAAiBC,EACjB,KAAAC,EACA,WAAAP,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,CAAA,CAAA,CACF,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,EAGAhB,EAAkB,QAAUJ,GAG5BI,EAAkB,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-search-input-gMsh3VM9.es.js","sources":["../../src/components/scoped-search-input/scoped-search-input.slots.tsx","../../src/components/scoped-search-input/utils/helpers.ts","../../src/components/scoped-search-input/scoped-search-input.i18n.ts","../../src/components/scoped-search-input/scoped-search-input.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n ScopedSearchInputRootSlotProps,\n ScopedSearchInputContainerSlotProps,\n ScopedSearchInputSelectWrapperSlotProps,\n ScopedSearchInputSearchWrapperSlotProps,\n} from \"./scoped-search-input.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"scopedSearchInput\",\n});\n\nexport const ScopedSearchInputRootSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputRootSlotProps\n> = withProvider<HTMLDivElement, ScopedSearchInputRootSlotProps>(\"div\", \"root\");\n\nexport const ScopedSearchInputContainerSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputContainerSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputContainerSlotProps>(\n \"div\",\n \"container\"\n);\n\nexport const ScopedSearchInputSelectWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSelectWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSelectWrapperSlotProps>(\n \"div\",\n \"selectWrapper\"\n);\n\nexport const ScopedSearchInputSearchWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSearchWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSearchWrapperSlotProps>(\n \"div\",\n \"searchWrapper\"\n);\n","import type { ScopedSearchInputValue } from \"../scoped-search-input.types\";\n\n/**\n * Check if the search text is empty or only whitespace\n */\nexport const isEmpty = (value: ScopedSearchInputValue): boolean => {\n return !value.text || value.text.trim().length === 0;\n};\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n selectLabel: {\n id: \"Nimbus.ScopedSearchInput.selectLabel\",\n description: \"Default aria-label for select dropdown\",\n defaultMessage: \"Filter by\",\n },\n searchLabel: {\n id: \"Nimbus.ScopedSearchInput.searchLabel\",\n description: \"Default aria-label for search input\",\n defaultMessage: \"Search\",\n },\n});\n","import { useCallback, useId, useRef } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react/styled-system\";\nimport { useIntl } from \"react-intl\";\nimport { Select } from \"@/components/select\";\nimport { SearchInput } from \"@/components/search-input\";\nimport { extractStyleProps } from \"@/utils\";\nimport { scopedSearchInputSlotRecipe } from \"./scoped-search-input.recipe\";\nimport {\n ScopedSearchInputRootSlot,\n ScopedSearchInputContainerSlot,\n ScopedSearchInputSelectWrapperSlot,\n ScopedSearchInputSearchWrapperSlot,\n} from \"./scoped-search-input.slots\";\nimport type {\n ScopedSearchInputProps,\n ScopedSearchInputOption,\n ScopedSearchInputOptionGroup,\n} from \"./scoped-search-input.types\";\nimport { isEmpty } from \"./utils/helpers\";\nimport { messages } from \"./scoped-search-input.i18n\";\n\n/**\n * ScopedSearchInput\n * ============================================================\n * A combined input component that integrates a select dropdown with a search input field,\n * enabling users to filter search by category or field type.\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/scoped-search-input}\n *\n * @supportsStyleProps\n */\nexport const ScopedSearchInput = (props: ScopedSearchInputProps) => {\n const {\n value,\n onValueChange,\n onTextChange,\n onOptionChange,\n onSubmit,\n onReset,\n options,\n selectPlaceholder,\n searchPlaceholder,\n selectAriaLabel,\n searchAriaLabel,\n isClearable = true,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired,\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n size,\n } = props;\n\n const intl = useIntl();\n\n // Split recipe props\n const recipe = useSlotRecipe({ recipe: scopedSearchInputSlotRecipe });\n const [recipeProps, restRecipeProps] = recipe.splitVariantProps(props);\n\n // Extract style props\n const [styleProps, remainingProps] = extractStyleProps(restRecipeProps);\n\n // Generate unique IDs for ARIA relationships\n const generatedId = useId();\n const componentId = id || generatedId;\n const selectId = `${componentId}-select`;\n const searchId = `${componentId}-search`;\n\n // Ref for search input to enable auto-focus on option selection\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n // Event handlers that coordinate state\n const handleTextChange = useCallback(\n (newText: string) => {\n onTextChange?.(newText);\n onValueChange?.({ ...value, text: newText });\n },\n [value, onTextChange, onValueChange]\n );\n\n const handleOptionChange = useCallback(\n (newOption: React.Key | null) => {\n if (newOption === null) return;\n const optionString = String(newOption);\n onOptionChange?.(optionString);\n onValueChange?.({ ...value, option: optionString });\n\n // Auto-focus search input after option selection (unless disabled/readonly)\n if (searchInputRef.current && !isDisabled && !isReadOnly) {\n // Use setTimeout to ensure focus happens after React Aria's state updates\n setTimeout(() => {\n searchInputRef.current?.focus();\n }, 0);\n }\n },\n [value, onOptionChange, onValueChange, isDisabled, isReadOnly]\n );\n\n const handleSubmit = useCallback(() => {\n onSubmit(value);\n }, [value, onSubmit]);\n\n const handleReset = useCallback(() => {\n onReset?.();\n // Clear text but keep selected option\n handleTextChange(\"\");\n }, [onReset, handleTextChange]);\n\n return (\n <ScopedSearchInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...remainingProps}\n >\n <ScopedSearchInputContainerSlot>\n {/* Select Dropdown (Left) */}\n <ScopedSearchInputSelectWrapperSlot asChild>\n <Select.Root\n id={selectId}\n selectedKey={value.option}\n onSelectionChange={isReadOnly ? undefined : handleOptionChange}\n placeholder={selectPlaceholder}\n aria-label={\n selectAriaLabel || intl.formatMessage(messages.selectLabel)\n }\n aria-controls={searchId}\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isClearable={false}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n <Select.Options>\n {options.map(\n (\n item: ScopedSearchInputOption | ScopedSearchInputOptionGroup\n ) => {\n // Check if it's an option group\n if (\"options\" in item) {\n const group = item as ScopedSearchInputOptionGroup;\n return (\n <Select.OptionGroup key={group.label} label={group.label}>\n {group.options.map((opt: ScopedSearchInputOption) => (\n <Select.Option\n key={opt.value}\n id={opt.value}\n isDisabled={opt.isDisabled}\n >\n {opt.label}\n </Select.Option>\n ))}\n </Select.OptionGroup>\n );\n }\n // Regular option\n const option = item as ScopedSearchInputOption;\n return (\n <Select.Option\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n >\n {option.label}\n </Select.Option>\n );\n }\n )}\n </Select.Options>\n </Select.Root>\n </ScopedSearchInputSelectWrapperSlot>\n\n {/* Search Input (Right) */}\n <ScopedSearchInputSearchWrapperSlot asChild>\n <SearchInput\n ref={searchInputRef}\n id={searchId}\n value={value.text}\n onChange={handleTextChange}\n onSubmit={handleSubmit}\n onClear={isClearable ? handleReset : undefined}\n placeholder={searchPlaceholder}\n aria-label={\n searchAriaLabel || intl.formatMessage(messages.searchLabel)\n }\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n isRequired={isRequired}\n />\n </ScopedSearchInputSearchWrapperSlot>\n </ScopedSearchInputContainerSlot>\n </ScopedSearchInputRootSlot>\n );\n};\n\n// Static methods\nScopedSearchInput.isEmpty = isEmpty;\n\n// Display name\nScopedSearchInput.displayName = \"ScopedSearchInput\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","ScopedSearchInputRootSlot","ScopedSearchInputContainerSlot","ScopedSearchInputSelectWrapperSlot","ScopedSearchInputSearchWrapperSlot","isEmpty","value","messages","defineMessages","ScopedSearchInput","props","onValueChange","onTextChange","onOptionChange","onSubmit","onReset","options","selectPlaceholder","searchPlaceholder","selectAriaLabel","searchAriaLabel","isClearable","isDisabled","isReadOnly","isInvalid","isRequired","id","ariaDescribedby","ariaLabelledby","size","intl","useIntl","recipe","useSlotRecipe","scopedSearchInputSlotRecipe","recipeProps","restRecipeProps","styleProps","remainingProps","extractStyleProps","generatedId","useId","componentId","selectId","searchId","searchInputRef","useRef","handleTextChange","useCallback","newText","handleOptionChange","newOption","optionString","handleSubmit","handleReset","jsx","Select","item","group","opt","option","SearchInput"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,cAAAA,IAAc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AC;AAAA,YACA,WAAAC;AAAA,YACA,YAAAC;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAGAhB,EAAkB,UAAUJ;AAG5BI,EAAkB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"scoped-search-input-gMsh3VM9.es.js","sources":["../../src/components/scoped-search-input/scoped-search-input.slots.tsx","../../src/components/scoped-search-input/utils/helpers.ts","../../src/components/scoped-search-input/scoped-search-input.i18n.ts","../../src/components/scoped-search-input/scoped-search-input.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n ScopedSearchInputRootSlotProps,\n ScopedSearchInputContainerSlotProps,\n ScopedSearchInputSelectWrapperSlotProps,\n ScopedSearchInputSearchWrapperSlotProps,\n} from \"./scoped-search-input.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"scopedSearchInput\",\n});\n\nexport const ScopedSearchInputRootSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputRootSlotProps\n> = withProvider<HTMLDivElement, ScopedSearchInputRootSlotProps>(\"div\", \"root\");\n\nexport const ScopedSearchInputContainerSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputContainerSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputContainerSlotProps>(\n \"div\",\n \"container\"\n);\n\nexport const ScopedSearchInputSelectWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSelectWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSelectWrapperSlotProps>(\n \"div\",\n \"selectWrapper\"\n);\n\nexport const ScopedSearchInputSearchWrapperSlot: SlotComponent<\n HTMLDivElement,\n ScopedSearchInputSearchWrapperSlotProps\n> = withContext<HTMLDivElement, ScopedSearchInputSearchWrapperSlotProps>(\n \"div\",\n \"searchWrapper\"\n);\n","import type { ScopedSearchInputValue } from \"../scoped-search-input.types\";\n\n/**\n * Check if the search text is empty or only whitespace\n */\nexport const isEmpty = (value: ScopedSearchInputValue): boolean => {\n return !value.text || value.text.trim().length === 0;\n};\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n selectLabel: {\n id: \"Nimbus.ScopedSearchInput.selectLabel\",\n description: \"Default aria-label for select dropdown\",\n defaultMessage: \"Filter by\",\n },\n searchLabel: {\n id: \"Nimbus.ScopedSearchInput.searchLabel\",\n description: \"Default aria-label for search input\",\n defaultMessage: \"Search\",\n },\n});\n","import { useCallback, useId, useRef } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react/styled-system\";\nimport { useIntl } from \"react-intl\";\nimport { Select } from \"@/components/select/select\";\nimport { SearchInput } from \"@/components/search-input/search-input\";\nimport { extractStyleProps } from \"@/utils\";\nimport { scopedSearchInputSlotRecipe } from \"./scoped-search-input.recipe\";\nimport {\n ScopedSearchInputRootSlot,\n ScopedSearchInputContainerSlot,\n ScopedSearchInputSelectWrapperSlot,\n ScopedSearchInputSearchWrapperSlot,\n} from \"./scoped-search-input.slots\";\nimport type {\n ScopedSearchInputProps,\n ScopedSearchInputOption,\n ScopedSearchInputOptionGroup,\n} from \"./scoped-search-input.types\";\nimport { isEmpty } from \"./utils/helpers\";\nimport { messages } from \"./scoped-search-input.i18n\";\n\n/**\n * ScopedSearchInput\n * ============================================================\n * A combined input component that integrates a select dropdown with a search input field,\n * enabling users to filter search by category or field type.\n *\n * @see {@link https://nimbus-documentation.vercel.app/components/inputs/scoped-search-input}\n *\n * @supportsStyleProps\n */\nexport const ScopedSearchInput = (props: ScopedSearchInputProps) => {\n const {\n value,\n onValueChange,\n onTextChange,\n onOptionChange,\n onSubmit,\n onReset,\n options,\n selectPlaceholder,\n searchPlaceholder,\n selectAriaLabel,\n searchAriaLabel,\n isClearable = true,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired,\n id,\n \"aria-describedby\": ariaDescribedby,\n \"aria-labelledby\": ariaLabelledby,\n size,\n } = props;\n\n const intl = useIntl();\n\n // Split recipe props\n const recipe = useSlotRecipe({ recipe: scopedSearchInputSlotRecipe });\n const [recipeProps, restRecipeProps] = recipe.splitVariantProps(props);\n\n // Extract style props\n const [styleProps, remainingProps] = extractStyleProps(restRecipeProps);\n\n // Generate unique IDs for ARIA relationships\n const generatedId = useId();\n const componentId = id || generatedId;\n const selectId = `${componentId}-select`;\n const searchId = `${componentId}-search`;\n\n // Ref for search input to enable auto-focus on option selection\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n // Event handlers that coordinate state\n const handleTextChange = useCallback(\n (newText: string) => {\n onTextChange?.(newText);\n onValueChange?.({ ...value, text: newText });\n },\n [value, onTextChange, onValueChange]\n );\n\n const handleOptionChange = useCallback(\n (newOption: React.Key | null) => {\n if (newOption === null) return;\n const optionString = String(newOption);\n onOptionChange?.(optionString);\n onValueChange?.({ ...value, option: optionString });\n\n // Auto-focus search input after option selection (unless disabled/readonly)\n if (searchInputRef.current && !isDisabled && !isReadOnly) {\n // Use setTimeout to ensure focus happens after React Aria's state updates\n setTimeout(() => {\n searchInputRef.current?.focus();\n }, 0);\n }\n },\n [value, onOptionChange, onValueChange, isDisabled, isReadOnly]\n );\n\n const handleSubmit = useCallback(() => {\n onSubmit(value);\n }, [value, onSubmit]);\n\n const handleReset = useCallback(() => {\n onReset?.();\n // Clear text but keep selected option\n handleTextChange(\"\");\n }, [onReset, handleTextChange]);\n\n return (\n <ScopedSearchInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...remainingProps}\n >\n <ScopedSearchInputContainerSlot>\n {/* Select Dropdown (Left) */}\n <ScopedSearchInputSelectWrapperSlot asChild>\n <Select.Root\n id={selectId}\n selectedKey={value.option}\n onSelectionChange={isReadOnly ? undefined : handleOptionChange}\n placeholder={selectPlaceholder}\n aria-label={\n selectAriaLabel || intl.formatMessage(messages.selectLabel)\n }\n aria-controls={searchId}\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isClearable={false}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n <Select.Options>\n {options.map(\n (\n item: ScopedSearchInputOption | ScopedSearchInputOptionGroup\n ) => {\n // Check if it's an option group\n if (\"options\" in item) {\n const group = item as ScopedSearchInputOptionGroup;\n return (\n <Select.OptionGroup key={group.label} label={group.label}>\n {group.options.map((opt: ScopedSearchInputOption) => (\n <Select.Option\n key={opt.value}\n id={opt.value}\n isDisabled={opt.isDisabled}\n >\n {opt.label}\n </Select.Option>\n ))}\n </Select.OptionGroup>\n );\n }\n // Regular option\n const option = item as ScopedSearchInputOption;\n return (\n <Select.Option\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n >\n {option.label}\n </Select.Option>\n );\n }\n )}\n </Select.Options>\n </Select.Root>\n </ScopedSearchInputSelectWrapperSlot>\n\n {/* Search Input (Right) */}\n <ScopedSearchInputSearchWrapperSlot asChild>\n <SearchInput\n ref={searchInputRef}\n id={searchId}\n value={value.text}\n onChange={handleTextChange}\n onSubmit={handleSubmit}\n onClear={isClearable ? handleReset : undefined}\n placeholder={searchPlaceholder}\n aria-label={\n searchAriaLabel || intl.formatMessage(messages.searchLabel)\n }\n aria-describedby={ariaDescribedby}\n aria-labelledby={ariaLabelledby}\n size={size}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n isRequired={isRequired}\n />\n </ScopedSearchInputSearchWrapperSlot>\n </ScopedSearchInputContainerSlot>\n </ScopedSearchInputRootSlot>\n );\n};\n\n// Static methods\nScopedSearchInput.isEmpty = isEmpty;\n\n// Display name\nScopedSearchInput.displayName = \"ScopedSearchInput\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","ScopedSearchInputRootSlot","ScopedSearchInputContainerSlot","ScopedSearchInputSelectWrapperSlot","ScopedSearchInputSearchWrapperSlot","isEmpty","value","messages","defineMessages","ScopedSearchInput","props","onValueChange","onTextChange","onOptionChange","onSubmit","onReset","options","selectPlaceholder","searchPlaceholder","selectAriaLabel","searchAriaLabel","isClearable","isDisabled","isReadOnly","isInvalid","isRequired","id","ariaDescribedby","ariaLabelledby","size","intl","useIntl","recipe","useSlotRecipe","scopedSearchInputSlotRecipe","recipeProps","restRecipeProps","styleProps","remainingProps","extractStyleProps","generatedId","useId","componentId","selectId","searchId","searchInputRef","useRef","handleTextChange","useCallback","newText","handleOptionChange","newOption","optionString","handleSubmit","handleReset","jsx","Select","item","group","opt","option","SearchInput"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,cAAAA,IAAc,aAAAC,EAAA,IAAgB,gBAAAC,GAAwB;AAAA,EAC5D,KAAK;AACP,CAAC,GAEYC,KAGT,gBAAAH,GAA6D,OAAO,MAAM,GAEjEI,KAGT,gBAAAH;AAAA,EACF;AAAA,EACA;AACF,GAEaI,KAGT,gBAAAJ;AAAA,EACF;AAAA,EACA;AACF,GAEaK,KAGT,gBAAAL;AAAA,EACF;AAAA,EACA;AACF,GCnCaM,KAAU,CAACC,MACf,CAACA,EAAM,QAAQA,EAAM,KAAK,KAAA,EAAO,WAAW,GCJxCC,IAAW,gBAAAC,EAAe;AAAA,EACrC,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,gBAAgB;AAAA,EAAA;AAAA,EAElB,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,gBAAgB;AAAA,EAAA;AAEpB,CAAC,GCkBYC,IAAoB,CAACC,MAAkC;AAClE,QAAM;AAAA,IACJ,OAAAJ;AAAA,IACA,eAAAK;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,IAAAC;AAAA,IACA,o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UAACM;AAAA,UAAA;AAAA,YACC,KAAKhB;AAAA,YACL,IAAID;AAAA,YACJ,OAAOtC,EAAM;AAAA,YACb,UAAUyC;AAAA,YACV,UAAUM;AAAA,YACV,SAAShC,IAAciC,IAAc;AAAA,YACrC,aAAapC;AAAA,YACb,cACEE,KAAmBU,EAAK,cAAcvB,EAAS,WAAW;AAAA,YAE5D,oBAAkBoB;AAAA,YAClB,mBAAiBC;AAAA,YACjB,MAAAC;AAAA,YACA,YAAAP;AAAA,YACA,YAAAC;AAAA,YACA,WAAAC;AAAA,YACA,YAAAC;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAGAhB,EAAkB,UAAUJ;AAG5BI,EAAkB,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button-4gxONpNC.es.js","sources":["../../src/components/split-button/split-button.slots.tsx","../../src/components/split-button/split-button.i18n.ts","../../src/components/split-button/split-button.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n SplitButtonRootSlotProps,\n SplitButtonButtonGroupSlotProps,\n SplitButtonPrimaryButtonSlotProps,\n SplitButtonTriggerSlotProps,\n} from \"./split-button.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"splitButton\",\n});\n\n// Root Container\nexport const SplitButtonRootSlot: SlotComponent<\n HTMLDivElement,\n SplitButtonRootSlotProps\n> = withProvider<HTMLDivElement, SplitButtonRootSlotProps>(\"div\", \"root\");\n\n// Button Group Container\nexport const SplitButtonButtonGroupSlot = withContext<\n HTMLDivElement,\n SplitButtonButtonGroupSlotProps\n>(\"div\", \"buttonGroup\");\n\n// Primary Action Button\nexport const SplitButtonPrimaryButtonSlot = withContext<\n HTMLButtonElement,\n SplitButtonPrimaryButtonSlotProps\n>(\"button\", \"primaryButton\");\n\n// Dropdown Trigger Button\nexport const SplitButtonTriggerSlot = withContext<\n HTMLButtonElement,\n SplitButtonTriggerSlotProps\n>(\"button\", \"dropdownTrigger\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n noActionsAvailable: {\n id: \"Nimbus.SplitButton.noActionsAvailable\",\n description: \"fallback message when split button has no menu items\",\n defaultMessage: \"No actions available\",\n },\n});\n","import React from \"react\";\nimport { useIntl } from \"react-intl\";\nimport { Button } from \"@/components/button\";\nimport { IconButton } from \"@/components/icon-button\";\nimport { Menu } from \"@/components/menu\";\nimport { Icon } from \"@/components/icon\";\nimport type { SplitButtonProps } from \"./split-button.types\";\nimport {\n SplitButtonRootSlot,\n SplitButtonButtonGroupSlot,\n SplitButtonPrimaryButtonSlot,\n SplitButtonTriggerSlot,\n} from \"./split-button.slots\";\nimport { messages } from \"./split-button.i18n\";\nimport { KeyboardArrowDown } from \"@commercetools/nimbus-icons\";\n\n// Re-export types\nexport type * from \"./split-button.types\";\n\n/**\n * # SplitButton\n *\n * A split-button component that combines a primary action button with a dropdown menu.\n *\n * Shows a primary action button + dropdown trigger. The primary button automatically\n * executes the first enabled Menu.Item action, while the dropdown trigger opens a menu\n * with all available options.\n *\n * Use with Menu.Item, Menu.Section, and Separator components for content.\n */\nexport const SplitButton = (props: SplitButtonProps) => {\n const intl = useIntl();\n const {\n size = \"md\",\n variant = \"solid\",\n colorPalette,\n isDisabled = false,\n \"aria-label\": ariaLabel,\n onAction,\n isOpen,\n defaultOpen,\n onOpenChange,\n icon,\n } = props;\n\n const buttonProps = { size, variant, colorPalette };\n\n /**\n * CORE CONCEPT: In split button mode, we need to populate the primary button\n * with content from a Menu.Item (specified by defaultAction prop).\n *\n * Why this complexity exists:\n * - Users define actions as <Menu.Item id=\"save\">Save Document</Menu.Item>\n * - We need to extract \"Save Document\" text to show on the primary button\n * - Menu.Items can be nested inside Menu.Section components\n * - We need to handle disabled states and fallbacks\n */\n\n // Type guards for safe prop access\n type MenuItemProps = {\n id: string;\n children: React.ReactNode;\n isDisabled?: boolean;\n isCritical?: boolean;\n };\n\n type ComponentWithChildren = {\n children: React.ReactNode;\n };\n\n // Check if element is a Menu.Item with required props\n const isMenuItemWithId = (\n element: React.ReactNode\n ): element is React.ReactElement<MenuItemProps> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"id\" in props && typeof props.id === \"string\";\n };\n\n // Check if element has children prop\n const hasChildren = (\n element: React.ReactNode\n ): element is React.ReactElement<ComponentWithChildren> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"children\" in props;\n };\n\n // All children are menu items\n const menuItems = props.children;\n\n /**\n * Check if there are any actionable (enabled) Menu.Items in the children.\n * This is used to determine if the dropdown trigger should be disabled.\n */\n const hasActionableMenuItems = (children: React.ReactNode): boolean => {\n let hasActionable = false;\n\n React.Children.forEach(children, (child) => {\n if (hasActionable) return;\n\n // Check if this is an enabled Menu.Item\n if (isMenuItemWithId(child) && !child.props.isDisabled) {\n hasActionable = true;\n return;\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n hasActionable = hasActionableMenuItems(child.props.children);\n }\n });\n\n return hasActionable;\n };\n\n /**\n * Find the primary Menu.Item using the same logic as the original PrimaryActionDropdown.\n * Selects the first enabled Menu.Item, or falls back to the first Menu.Item if all are disabled.\n */\n const findPrimaryMenuItem = () => {\n const allMenuItems: Array<{\n content: React.ReactNode;\n isDisabled: boolean;\n actionId: string | null;\n }> = [];\n\n // Recursively collect all Menu.Items from children (including nested ones)\n const collectMenuItems = (children: React.ReactNode): void => {\n React.Children.forEach(children, (child) => {\n if (isMenuItemWithId(child)) {\n allMenuItems.push({\n content: child.props.children,\n isDisabled: child.props.isDisabled || false,\n actionId: child.props.id,\n });\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n collectMenuItems(child.props.children);\n }\n });\n };\n\n collectMenuItems(menuItems);\n\n // Find first enabled Menu.Item, or fallback to first Menu.Item\n const primaryMenuItem =\n allMenuItems.find((item) => !item.isDisabled) || allMenuItems[0];\n\n return (\n primaryMenuItem || {\n content: intl.formatMessage(messages.noActionsAvailable),\n isDisabled: true,\n actionId: null,\n }\n );\n };\n\n // Check if there are any actionable menu items for dropdown functionality\n const hasActionableItems = hasActionableMenuItems(menuItems);\n\n // Get the primary button content using smart selection\n const buttonContent = findPrimaryMenuItem();\n\n const executePrimaryAction = () => {\n if (!buttonContent.isDisabled && buttonContent.actionId && onAction) {\n onAction(buttonContent.actionId);\n }\n };\n\n const isPrimaryDisabled = isDisabled || buttonContent.isDisabled;\n const isDropdownTriggerDisabled = isDisabled || !hasActionableItems;\n\n return (\n <SplitButtonRootSlot variant={variant} data-mode=\"split\">\n <SplitButtonButtonGroupSlot>\n {/* Primary Action Button */}\n <SplitButtonPrimaryButtonSlot asChild>\n <Button\n {...buttonProps}\n isDisabled={isPrimaryDisabled}\n onPress={executePrimaryAction}\n >\n {icon && <Icon>{icon}</Icon>}\n {buttonContent.content}\n </Button>\n </SplitButtonPrimaryButtonSlot>\n\n {/* Menu Trigger and Dropdown */}\n <Menu.Root\n trigger=\"press\"\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n placement=\"bottom end\"\n selectionMode=\"none\"\n onAction={onAction ? (key) => onAction(String(key)) : undefined}\n >\n <Menu.Trigger asChild>\n <SplitButtonTriggerSlot asChild>\n <IconButton\n {...buttonProps}\n aria-label={ariaLabel}\n isDisabled={isDropdownTriggerDisabled}\n >\n <KeyboardArrowDown />\n </IconButton>\n </SplitButtonTriggerSlot>\n </Menu.Trigger>\n\n <Menu.Content>{menuItems}</Menu.Content>\n </Menu.Root>\n </SplitButtonButtonGroupSlot>\n </SplitButtonRootSlot>\n );\n};\n\nSplitButton.displayName = \"SplitButton\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","SplitButtonRootSlot","SplitButtonButtonGroupSlot","SplitButtonPrimaryButtonSlot","SplitButtonTriggerSlot","messages","defineMessages","SplitButton","props","intl","useIntl","size","variant","colorPalette","isDisabled","ariaLabel","onAction","isOpen","defaultOpen","onOpenChange","icon","buttonProps","isMenuItemWithId","element","React","hasChildren","menuItems","hasActionableMenuItems","children","hasActionable","child","findPrimaryMenuItem","allMenuItems","collectMenuItems","item","hasActionableItems","buttonContent","executePrimaryAction","isPrimaryDisabled","isDropdownTriggerDisabled","jsx","jsxs","Button","Icon","Menu","key","IconButton","KeyboardArrowDown"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,cAAAA,GAAc,aAAAC,EAAA,IAAgB,gBAAAC,EAAwB;AAAA,EAC5D,KAAK;AACP,CAAC,GAGYC,IAGT,gBAAAH,EAAuD,OAAO,MAAM,GAG3DI,IAA6B,gBAAAH,EAGxC,OAAO,aAAa,GAGTI,IAA+B,gBAAAJ,EAG1C,UAAU,eAAe,GAGdK,IAAyB,gBAAAL,EAGpC,UAAU,iBAAiB,GCjChBM,IAAW,gBAAAC,EAAe;AAAA,EACrC,oBAAoB;AAAA,IAClB,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,gBAAgB;AAAA,EAAA;AAEpB,CAAC,GCsBYC,IAAc,CAACC,MAA4B;AACtD,QAAMC,IAAOC,EAAA,GACP;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,SAAAC,IAAU;AAAA,IACV,cAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,cAAcC;AAAA,IACd,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,MAAAC;AAAA,EAAA,IACEZ,GAEEa,IAAc,EAAE,MAAAV,GAAM,SAAAC,GAAS,cAAAC,EAAA,GA0B/BS,IAAmB,CACvBC,MACiD;AACjD,QAAI,CAACC,EAAM,eAAeD,CAAO,KAAK,CAACA,EAAQ,MAAO,QAAO;AAC7D,UAAMf,IAAQe,EAAQ;AACtB,WAAO,QAAQf,KAAS,OAAOA,EAAM,MAAO;AAAA,EAC9C,GAG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sB,EAAc,YAChDG,IAA4BzB,KAAc,CAACqB;AAEjD,2BACGlC,GAAA,EAAoB,SAAAW,GAAkB,aAAU,SAC/C,4BAACV,GAAA,EAEC,UAAA;AAAA,IAAA,gBAAAsC,EAACrC,GAAA,EAA6B,SAAO,IACnC,UAAA,gBAAAsC;AAAA,MAACC;AAAA,MAAA;AAAA,QACE,GAAGrB;AAAA,QACJ,YAAYiB;AAAA,QACZ,SAASD;AAAA,QAER,UAAA;AAAA,UAAAjB,KAAQ,gBAAAoB,EAACG,KAAM,UAAAvB,EAAA,CAAK;AAAA,UACpBgB,EAAc;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEnB;AAAA,IAGA,gBAAAK;AAAA,MAACG,EAAK;AAAA,MAAL;AAAA,QACC,SAAQ;AAAA,QACR,QAAA3B;AAAA,QACA,aAAAC;AAAA,QACA,cAAAC;AAAA,QACA,WAAU;AAAA,QACV,eAAc;AAAA,QACd,UAAUH,IAAW,CAAC6B,MAAQ7B,EAAS,OAAO6B,CAAG,CAAC,IAAI;AAAA,QAEtD,UAAA;AAAA,UAAA,gBAAAL,EAACI,EAAK,SAAL,EAAa,SAAO,IACnB,UAAA,gBAAAJ,EAACpC,GAAA,EAAuB,SAAO,IAC7B,UAAA,gBAAAoC;AAAA,YAACM;AAAA,YAAA;AAAA,cACE,GAAGzB;AAAA,cACJ,cAAYN;AAAA,cACZ,YAAYwB;AAAA,cAEZ,4BAACQ,GAAA,CAAA,CAAkB;AAAA,YAAA;AAAA,UAAA,GAEvB,EAAA,CACF;AAAA,UAEA,gBAAAP,EAACI,EAAK,SAAL,EAAc,UAAAlB,EAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC3B,EAAA,CACF,EAAA,CACF;AAEJ;AAEAnB,EAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"split-button-4gxONpNC.es.js","sources":["../../src/components/split-button/split-button.slots.tsx","../../src/components/split-button/split-button.i18n.ts","../../src/components/split-button/split-button.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n SplitButtonRootSlotProps,\n SplitButtonButtonGroupSlotProps,\n SplitButtonPrimaryButtonSlotProps,\n SplitButtonTriggerSlotProps,\n} from \"./split-button.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"splitButton\",\n});\n\n// Root Container\nexport const SplitButtonRootSlot: SlotComponent<\n HTMLDivElement,\n SplitButtonRootSlotProps\n> = withProvider<HTMLDivElement, SplitButtonRootSlotProps>(\"div\", \"root\");\n\n// Button Group Container\nexport const SplitButtonButtonGroupSlot = withContext<\n HTMLDivElement,\n SplitButtonButtonGroupSlotProps\n>(\"div\", \"buttonGroup\");\n\n// Primary Action Button\nexport const SplitButtonPrimaryButtonSlot = withContext<\n HTMLButtonElement,\n SplitButtonPrimaryButtonSlotProps\n>(\"button\", \"primaryButton\");\n\n// Dropdown Trigger Button\nexport const SplitButtonTriggerSlot = withContext<\n HTMLButtonElement,\n SplitButtonTriggerSlotProps\n>(\"button\", \"dropdownTrigger\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n noActionsAvailable: {\n id: \"Nimbus.SplitButton.noActionsAvailable\",\n description: \"fallback message when split button has no menu items\",\n defaultMessage: \"No actions available\",\n },\n});\n","import React from \"react\";\nimport { useIntl } from \"react-intl\";\nimport { Button } from \"@/components/button/button\";\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport { Menu } from \"@/components/menu/menu\";\nimport { Icon } from \"@/components/icon/icon\";\nimport type { SplitButtonProps } from \"./split-button.types\";\nimport {\n SplitButtonRootSlot,\n SplitButtonButtonGroupSlot,\n SplitButtonPrimaryButtonSlot,\n SplitButtonTriggerSlot,\n} from \"./split-button.slots\";\nimport { messages } from \"./split-button.i18n\";\nimport { KeyboardArrowDown } from \"@commercetools/nimbus-icons\";\n\n// Re-export types\nexport type * from \"./split-button.types\";\n\n/**\n * # SplitButton\n *\n * A split-button component that combines a primary action button with a dropdown menu.\n *\n * Shows a primary action button + dropdown trigger. The primary button automatically\n * executes the first enabled Menu.Item action, while the dropdown trigger opens a menu\n * with all available options.\n *\n * Use with Menu.Item, Menu.Section, and Separator components for content.\n */\nexport const SplitButton = (props: SplitButtonProps) => {\n const intl = useIntl();\n const {\n size = \"md\",\n variant = \"solid\",\n colorPalette,\n isDisabled = false,\n \"aria-label\": ariaLabel,\n onAction,\n isOpen,\n defaultOpen,\n onOpenChange,\n icon,\n } = props;\n\n const buttonProps = { size, variant, colorPalette };\n\n /**\n * CORE CONCEPT: In split button mode, we need to populate the primary button\n * with content from a Menu.Item (specified by defaultAction prop).\n *\n * Why this complexity exists:\n * - Users define actions as <Menu.Item id=\"save\">Save Document</Menu.Item>\n * - We need to extract \"Save Document\" text to show on the primary button\n * - Menu.Items can be nested inside Menu.Section components\n * - We need to handle disabled states and fallbacks\n */\n\n // Type guards for safe prop access\n type MenuItemProps = {\n id: string;\n children: React.ReactNode;\n isDisabled?: boolean;\n isCritical?: boolean;\n };\n\n type ComponentWithChildren = {\n children: React.ReactNode;\n };\n\n // Check if element is a Menu.Item with required props\n const isMenuItemWithId = (\n element: React.ReactNode\n ): element is React.ReactElement<MenuItemProps> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"id\" in props && typeof props.id === \"string\";\n };\n\n // Check if element has children prop\n const hasChildren = (\n element: React.ReactNode\n ): element is React.ReactElement<ComponentWithChildren> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"children\" in props;\n };\n\n // All children are menu items\n const menuItems = props.children;\n\n /**\n * Check if there are any actionable (enabled) Menu.Items in the children.\n * This is used to determine if the dropdown trigger should be disabled.\n */\n const hasActionableMenuItems = (children: React.ReactNode): boolean => {\n let hasActionable = false;\n\n React.Children.forEach(children, (child) => {\n if (hasActionable) return;\n\n // Check if this is an enabled Menu.Item\n if (isMenuItemWithId(child) && !child.props.isDisabled) {\n hasActionable = true;\n return;\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n hasActionable = hasActionableMenuItems(child.props.children);\n }\n });\n\n return hasActionable;\n };\n\n /**\n * Find the primary Menu.Item using the same logic as the original PrimaryActionDropdown.\n * Selects the first enabled Menu.Item, or falls back to the first Menu.Item if all are disabled.\n */\n const findPrimaryMenuItem = () => {\n const allMenuItems: Array<{\n content: React.ReactNode;\n isDisabled: boolean;\n actionId: string | null;\n }> = [];\n\n // Recursively collect all Menu.Items from children (including nested ones)\n const collectMenuItems = (children: React.ReactNode): void => {\n React.Children.forEach(children, (child) => {\n if (isMenuItemWithId(child)) {\n allMenuItems.push({\n content: child.props.children,\n isDisabled: child.props.isDisabled || false,\n actionId: child.props.id,\n });\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n collectMenuItems(child.props.children);\n }\n });\n };\n\n collectMenuItems(menuItems);\n\n // Find first enabled Menu.Item, or fallback to first Menu.Item\n const primaryMenuItem =\n allMenuItems.find((item) => !item.isDisabled) || allMenuItems[0];\n\n return (\n primaryMenuItem || {\n content: intl.formatMessage(messages.noActionsAvailable),\n isDisabled: true,\n actionId: null,\n }\n );\n };\n\n // Check if there are any actionable menu items for dropdown functionality\n const hasActionableItems = hasActionableMenuItems(menuItems);\n\n // Get the primary button content using smart selection\n const buttonContent = findPrimaryMenuItem();\n\n const executePrimaryAction = () => {\n if (!buttonContent.isDisabled && buttonContent.actionId && onAction) {\n onAction(buttonContent.actionId);\n }\n };\n\n const isPrimaryDisabled = isDisabled || buttonContent.isDisabled;\n const isDropdownTriggerDisabled = isDisabled || !hasActionableItems;\n\n return (\n <SplitButtonRootSlot variant={variant} data-mode=\"split\">\n <SplitButtonButtonGroupSlot>\n {/* Primary Action Button */}\n <SplitButtonPrimaryButtonSlot asChild>\n <Button\n {...buttonProps}\n isDisabled={isPrimaryDisabled}\n onPress={executePrimaryAction}\n >\n {icon && <Icon>{icon}</Icon>}\n {buttonContent.content}\n </Button>\n </SplitButtonPrimaryButtonSlot>\n\n {/* Menu Trigger and Dropdown */}\n <Menu.Root\n trigger=\"press\"\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n placement=\"bottom end\"\n selectionMode=\"none\"\n onAction={onAction ? (key) => onAction(String(key)) : undefined}\n >\n <Menu.Trigger asChild>\n <SplitButtonTriggerSlot asChild>\n <IconButton\n {...buttonProps}\n aria-label={ariaLabel}\n isDisabled={isDropdownTriggerDisabled}\n >\n <KeyboardArrowDown />\n </IconButton>\n </SplitButtonTriggerSlot>\n </Menu.Trigger>\n\n <Menu.Content>{menuItems}</Menu.Content>\n </Menu.Root>\n </SplitButtonButtonGroupSlot>\n </SplitButtonRootSlot>\n );\n};\n\nSplitButton.displayName = \"SplitButton\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","SplitButtonRootSlot","SplitButtonButtonGroupSlot","SplitButtonPrimaryButtonSlot","SplitButtonTriggerSlot","messages","defineMessages","SplitButton","props","intl","useIntl","size","variant","colorPalette","isDisabled","ariaLabel","onAction","isOpen","defaultOpen","onOpenChange","icon","buttonProps","isMenuItemWithId","element","React","hasChildren","menuItems","hasActionableMenuItems","children","hasActionable","child","findPrimaryMenuItem","allMenuItems","collectMenuItems","item","hasActionableItems","buttonContent","executePrimaryAction","isPrimaryDisabled","isDropdownTriggerDisabled","jsx","jsxs","Button","Icon","Menu","key","IconButton","KeyboardArrowDown"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,cAAAA,GAAc,aAAAC,EAAA,IAAgB,gBAAAC,EAAwB;AAAA,EAC5D,KAAK;AACP,CAAC,GAGYC,IAGT,gBAAAH,EAAuD,OAAO,MAAM,GAG3DI,IAA6B,gBAAAH,EAGxC,OAAO,aAAa,GAGTI,IAA+B,gBAAAJ,EAG1C,UAAU,eAAe,GAGdK,IAAyB,gBAAAL,EAGpC,UAAU,iBAAiB,GCjChBM,IAAW,gBAAAC,EAAe;AA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MAAQ7B,EAAS,OAAO6B,CAAG,CAAC,IAAI;AAAA,QAEtD,UAAA;AAAA,UAAA,gBAAAL,EAACI,EAAK,SAAL,EAAa,SAAO,IACnB,UAAA,gBAAAJ,EAACpC,GAAA,EAAuB,SAAO,IAC7B,UAAA,gBAAAoC;AAAA,YAACM;AAAA,YAAA;AAAA,cACE,GAAGzB;AAAA,cACJ,cAAYN;AAAA,cACZ,YAAYwB;AAAA,cAEZ,4BAACQ,GAAA,CAAA,CAAkB;AAAA,YAAA;AAAA,UAAA,GAEvB,EAAA,CACF;AAAA,UAEA,gBAAAP,EAACI,EAAK,SAAL,EAAc,UAAAlB,EAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC3B,EAAA,CACF,EAAA,CACF;AAEJ;AAEAnB,EAAY,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button-Ci3LSgyf.cjs.js","sources":["../../src/components/split-button/split-button.slots.tsx","../../src/components/split-button/split-button.i18n.ts","../../src/components/split-button/split-button.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n SplitButtonRootSlotProps,\n SplitButtonButtonGroupSlotProps,\n SplitButtonPrimaryButtonSlotProps,\n SplitButtonTriggerSlotProps,\n} from \"./split-button.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"splitButton\",\n});\n\n// Root Container\nexport const SplitButtonRootSlot: SlotComponent<\n HTMLDivElement,\n SplitButtonRootSlotProps\n> = withProvider<HTMLDivElement, SplitButtonRootSlotProps>(\"div\", \"root\");\n\n// Button Group Container\nexport const SplitButtonButtonGroupSlot = withContext<\n HTMLDivElement,\n SplitButtonButtonGroupSlotProps\n>(\"div\", \"buttonGroup\");\n\n// Primary Action Button\nexport const SplitButtonPrimaryButtonSlot = withContext<\n HTMLButtonElement,\n SplitButtonPrimaryButtonSlotProps\n>(\"button\", \"primaryButton\");\n\n// Dropdown Trigger Button\nexport const SplitButtonTriggerSlot = withContext<\n HTMLButtonElement,\n SplitButtonTriggerSlotProps\n>(\"button\", \"dropdownTrigger\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n noActionsAvailable: {\n id: \"Nimbus.SplitButton.noActionsAvailable\",\n description: \"fallback message when split button has no menu items\",\n defaultMessage: \"No actions available\",\n },\n});\n","import React from \"react\";\nimport { useIntl } from \"react-intl\";\nimport { Button } from \"@/components/button\";\nimport { IconButton } from \"@/components/icon-button\";\nimport { Menu } from \"@/components/menu\";\nimport { Icon } from \"@/components/icon\";\nimport type { SplitButtonProps } from \"./split-button.types\";\nimport {\n SplitButtonRootSlot,\n SplitButtonButtonGroupSlot,\n SplitButtonPrimaryButtonSlot,\n SplitButtonTriggerSlot,\n} from \"./split-button.slots\";\nimport { messages } from \"./split-button.i18n\";\nimport { KeyboardArrowDown } from \"@commercetools/nimbus-icons\";\n\n// Re-export types\nexport type * from \"./split-button.types\";\n\n/**\n * # SplitButton\n *\n * A split-button component that combines a primary action button with a dropdown menu.\n *\n * Shows a primary action button + dropdown trigger. The primary button automatically\n * executes the first enabled Menu.Item action, while the dropdown trigger opens a menu\n * with all available options.\n *\n * Use with Menu.Item, Menu.Section, and Separator components for content.\n */\nexport const SplitButton = (props: SplitButtonProps) => {\n const intl = useIntl();\n const {\n size = \"md\",\n variant = \"solid\",\n colorPalette,\n isDisabled = false,\n \"aria-label\": ariaLabel,\n onAction,\n isOpen,\n defaultOpen,\n onOpenChange,\n icon,\n } = props;\n\n const buttonProps = { size, variant, colorPalette };\n\n /**\n * CORE CONCEPT: In split button mode, we need to populate the primary button\n * with content from a Menu.Item (specified by defaultAction prop).\n *\n * Why this complexity exists:\n * - Users define actions as <Menu.Item id=\"save\">Save Document</Menu.Item>\n * - We need to extract \"Save Document\" text to show on the primary button\n * - Menu.Items can be nested inside Menu.Section components\n * - We need to handle disabled states and fallbacks\n */\n\n // Type guards for safe prop access\n type MenuItemProps = {\n id: string;\n children: React.ReactNode;\n isDisabled?: boolean;\n isCritical?: boolean;\n };\n\n type ComponentWithChildren = {\n children: React.ReactNode;\n };\n\n // Check if element is a Menu.Item with required props\n const isMenuItemWithId = (\n element: React.ReactNode\n ): element is React.ReactElement<MenuItemProps> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"id\" in props && typeof props.id === \"string\";\n };\n\n // Check if element has children prop\n const hasChildren = (\n element: React.ReactNode\n ): element is React.ReactElement<ComponentWithChildren> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"children\" in props;\n };\n\n // All children are menu items\n const menuItems = props.children;\n\n /**\n * Check if there are any actionable (enabled) Menu.Items in the children.\n * This is used to determine if the dropdown trigger should be disabled.\n */\n const hasActionableMenuItems = (children: React.ReactNode): boolean => {\n let hasActionable = false;\n\n React.Children.forEach(children, (child) => {\n if (hasActionable) return;\n\n // Check if this is an enabled Menu.Item\n if (isMenuItemWithId(child) && !child.props.isDisabled) {\n hasActionable = true;\n return;\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n hasActionable = hasActionableMenuItems(child.props.children);\n }\n });\n\n return hasActionable;\n };\n\n /**\n * Find the primary Menu.Item using the same logic as the original PrimaryActionDropdown.\n * Selects the first enabled Menu.Item, or falls back to the first Menu.Item if all are disabled.\n */\n const findPrimaryMenuItem = () => {\n const allMenuItems: Array<{\n content: React.ReactNode;\n isDisabled: boolean;\n actionId: string | null;\n }> = [];\n\n // Recursively collect all Menu.Items from children (including nested ones)\n const collectMenuItems = (children: React.ReactNode): void => {\n React.Children.forEach(children, (child) => {\n if (isMenuItemWithId(child)) {\n allMenuItems.push({\n content: child.props.children,\n isDisabled: child.props.isDisabled || false,\n actionId: child.props.id,\n });\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n collectMenuItems(child.props.children);\n }\n });\n };\n\n collectMenuItems(menuItems);\n\n // Find first enabled Menu.Item, or fallback to first Menu.Item\n const primaryMenuItem =\n allMenuItems.find((item) => !item.isDisabled) || allMenuItems[0];\n\n return (\n primaryMenuItem || {\n content: intl.formatMessage(messages.noActionsAvailable),\n isDisabled: true,\n actionId: null,\n }\n );\n };\n\n // Check if there are any actionable menu items for dropdown functionality\n const hasActionableItems = hasActionableMenuItems(menuItems);\n\n // Get the primary button content using smart selection\n const buttonContent = findPrimaryMenuItem();\n\n const executePrimaryAction = () => {\n if (!buttonContent.isDisabled && buttonContent.actionId && onAction) {\n onAction(buttonContent.actionId);\n }\n };\n\n const isPrimaryDisabled = isDisabled || buttonContent.isDisabled;\n const isDropdownTriggerDisabled = isDisabled || !hasActionableItems;\n\n return (\n <SplitButtonRootSlot variant={variant} data-mode=\"split\">\n <SplitButtonButtonGroupSlot>\n {/* Primary Action Button */}\n <SplitButtonPrimaryButtonSlot asChild>\n <Button\n {...buttonProps}\n isDisabled={isPrimaryDisabled}\n onPress={executePrimaryAction}\n >\n {icon && <Icon>{icon}</Icon>}\n {buttonContent.content}\n </Button>\n </SplitButtonPrimaryButtonSlot>\n\n {/* Menu Trigger and Dropdown */}\n <Menu.Root\n trigger=\"press\"\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n placement=\"bottom end\"\n selectionMode=\"none\"\n onAction={onAction ? (key) => onAction(String(key)) : undefined}\n >\n <Menu.Trigger asChild>\n <SplitButtonTriggerSlot asChild>\n <IconButton\n {...buttonProps}\n aria-label={ariaLabel}\n isDisabled={isDropdownTriggerDisabled}\n >\n <KeyboardArrowDown />\n </IconButton>\n </SplitButtonTriggerSlot>\n </Menu.Trigger>\n\n <Menu.Content>{menuItems}</Menu.Content>\n </Menu.Root>\n </SplitButtonButtonGroupSlot>\n </SplitButtonRootSlot>\n );\n};\n\nSplitButton.displayName = \"SplitButton\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","SplitButtonRootSlot","SplitButtonButtonGroupSlot","SplitButtonPrimaryButtonSlot","SplitButtonTriggerSlot","messages","defineMessages","SplitButton","props","intl","useIntl","size","variant","colorPalette","isDisabled","ariaLabel","onAction","isOpen","defaultOpen","onOpenChange","icon","buttonProps","isMenuItemWithId","element","React","hasChildren","menuItems","hasActionableMenuItems","children","hasActionable","child","findPrimaryMenuItem","allMenuItems","collectMenuItems","item","hasActionableItems","buttonContent","executePrimaryAction","isPrimaryDisabled","isDropdownTriggerDisabled","jsx","jsxs","Button","Icon","Menu","key","IconButton","KeyboardArrowDown"],"mappings":"6TASM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,aACP,CAAC,EAGYC,EAGTH,EAAuD,MAAO,MAAM,EAG3DI,EAA6BH,EAGxC,MAAO,aAAa,EAGTI,EAA+BJ,EAG1C,SAAU,eAAe,EAGdK,EAAyBL,EAGpC,SAAU,iBAAiB,ECjChBM,EAAWC,EAAAA,eAAe,CACrC,mBAAoB,CAClB,GAAI,wCACJ,YAAa,uDACb,eAAgB,sBAAA,CAEpB,CAAC,ECsBYC,EAAeC,GAA4B,CACtD,MAAMC,EAAOC,EAAAA,QAAA,EACP,CACJ,KAAAC,EAAO,KACP,QAAAC,EAAU,QACV,aAAAC,EACA,WAAAC,EAAa,GACb,aAAcC,EACd,SAAAC,EACA,OAAAC,EACA,YAAAC,EACA,aAAAC,EAAA,KACAC,CAAA,EACEZ,EAEEa,EAAc,CAAE,KAAAV,EAAM,QAAAC,EAAS,aAAAC,CAAA,EA0B/BS,EACJC,GACiD,CACjD,GAAI,CAACC,EAAM,eAAeD,CAAO,GAAK,CAACA,EAAQ,MAAO,MAAO,GAC7D,MAAMf,EAAQe,EAAQ,MACtB,MAAO,OAAQf,GAAS,OAAOA,EAAM,IAAO,QAC9C,EAGMiB,EACJF,GAEI,CAACC,EAAM,eAAeD,CAAO,GAAK,CAACA,EAAQ,MAAc,GAEtD,aADOA,EAAQ,MAKlBG,EAAYlB,EAAM,SAMlBmB,EAA0BC,GAAu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AAvB,CAAA,CAAK,EACpBgB,EAAc,OAAA,CAAA,CAAA,EAEnB,EAGAK,EAAAA,KAACG,EAAAA,KAAK,KAAL,CACC,QAAQ,QACR,OAAA3B,EACA,YAAAC,EACA,aAAAC,EACA,UAAU,aACV,cAAc,OACd,SAAUH,EAAY6B,GAAQ7B,EAAS,OAAO6B,CAAG,CAAC,EAAI,OAEtD,SAAA,CAAAL,EAAAA,IAACI,EAAAA,KAAK,QAAL,CAAa,QAAO,GACnB,SAAAJ,EAAAA,IAACpC,EAAA,CAAuB,QAAO,GAC7B,SAAAoC,EAAAA,IAACM,EAAAA,WAAA,CACE,GAAGzB,EACJ,aAAYN,EACZ,WAAYwB,EAEZ,eAACQ,EAAAA,kBAAA,CAAA,CAAkB,CAAA,CAAA,EAEvB,CAAA,CACF,EAEAP,EAAAA,IAACI,EAAAA,KAAK,QAAL,CAAc,SAAAlB,CAAA,CAAU,CAAA,CAAA,CAAA,CAC3B,CAAA,CACF,CAAA,CACF,CAEJ,EAEAnB,EAAY,YAAc"}
|
|
1
|
+
{"version":3,"file":"split-button-Ci3LSgyf.cjs.js","sources":["../../src/components/split-button/split-button.slots.tsx","../../src/components/split-button/split-button.i18n.ts","../../src/components/split-button/split-button.tsx"],"sourcesContent":["import { createSlotRecipeContext } from \"@chakra-ui/react\";\nimport type { SlotComponent } from \"@/type-utils\";\nimport type {\n SplitButtonRootSlotProps,\n SplitButtonButtonGroupSlotProps,\n SplitButtonPrimaryButtonSlotProps,\n SplitButtonTriggerSlotProps,\n} from \"./split-button.types\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"splitButton\",\n});\n\n// Root Container\nexport const SplitButtonRootSlot: SlotComponent<\n HTMLDivElement,\n SplitButtonRootSlotProps\n> = withProvider<HTMLDivElement, SplitButtonRootSlotProps>(\"div\", \"root\");\n\n// Button Group Container\nexport const SplitButtonButtonGroupSlot = withContext<\n HTMLDivElement,\n SplitButtonButtonGroupSlotProps\n>(\"div\", \"buttonGroup\");\n\n// Primary Action Button\nexport const SplitButtonPrimaryButtonSlot = withContext<\n HTMLButtonElement,\n SplitButtonPrimaryButtonSlotProps\n>(\"button\", \"primaryButton\");\n\n// Dropdown Trigger Button\nexport const SplitButtonTriggerSlot = withContext<\n HTMLButtonElement,\n SplitButtonTriggerSlotProps\n>(\"button\", \"dropdownTrigger\");\n","import { defineMessages } from \"react-intl\";\n\nexport const messages = defineMessages({\n noActionsAvailable: {\n id: \"Nimbus.SplitButton.noActionsAvailable\",\n description: \"fallback message when split button has no menu items\",\n defaultMessage: \"No actions available\",\n },\n});\n","import React from \"react\";\nimport { useIntl } from \"react-intl\";\nimport { Button } from \"@/components/button/button\";\nimport { IconButton } from \"@/components/icon-button/icon-button\";\nimport { Menu } from \"@/components/menu/menu\";\nimport { Icon } from \"@/components/icon/icon\";\nimport type { SplitButtonProps } from \"./split-button.types\";\nimport {\n SplitButtonRootSlot,\n SplitButtonButtonGroupSlot,\n SplitButtonPrimaryButtonSlot,\n SplitButtonTriggerSlot,\n} from \"./split-button.slots\";\nimport { messages } from \"./split-button.i18n\";\nimport { KeyboardArrowDown } from \"@commercetools/nimbus-icons\";\n\n// Re-export types\nexport type * from \"./split-button.types\";\n\n/**\n * # SplitButton\n *\n * A split-button component that combines a primary action button with a dropdown menu.\n *\n * Shows a primary action button + dropdown trigger. The primary button automatically\n * executes the first enabled Menu.Item action, while the dropdown trigger opens a menu\n * with all available options.\n *\n * Use with Menu.Item, Menu.Section, and Separator components for content.\n */\nexport const SplitButton = (props: SplitButtonProps) => {\n const intl = useIntl();\n const {\n size = \"md\",\n variant = \"solid\",\n colorPalette,\n isDisabled = false,\n \"aria-label\": ariaLabel,\n onAction,\n isOpen,\n defaultOpen,\n onOpenChange,\n icon,\n } = props;\n\n const buttonProps = { size, variant, colorPalette };\n\n /**\n * CORE CONCEPT: In split button mode, we need to populate the primary button\n * with content from a Menu.Item (specified by defaultAction prop).\n *\n * Why this complexity exists:\n * - Users define actions as <Menu.Item id=\"save\">Save Document</Menu.Item>\n * - We need to extract \"Save Document\" text to show on the primary button\n * - Menu.Items can be nested inside Menu.Section components\n * - We need to handle disabled states and fallbacks\n */\n\n // Type guards for safe prop access\n type MenuItemProps = {\n id: string;\n children: React.ReactNode;\n isDisabled?: boolean;\n isCritical?: boolean;\n };\n\n type ComponentWithChildren = {\n children: React.ReactNode;\n };\n\n // Check if element is a Menu.Item with required props\n const isMenuItemWithId = (\n element: React.ReactNode\n ): element is React.ReactElement<MenuItemProps> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"id\" in props && typeof props.id === \"string\";\n };\n\n // Check if element has children prop\n const hasChildren = (\n element: React.ReactNode\n ): element is React.ReactElement<ComponentWithChildren> => {\n if (!React.isValidElement(element) || !element.props) return false;\n const props = element.props as Record<string, unknown>;\n return \"children\" in props;\n };\n\n // All children are menu items\n const menuItems = props.children;\n\n /**\n * Check if there are any actionable (enabled) Menu.Items in the children.\n * This is used to determine if the dropdown trigger should be disabled.\n */\n const hasActionableMenuItems = (children: React.ReactNode): boolean => {\n let hasActionable = false;\n\n React.Children.forEach(children, (child) => {\n if (hasActionable) return;\n\n // Check if this is an enabled Menu.Item\n if (isMenuItemWithId(child) && !child.props.isDisabled) {\n hasActionable = true;\n return;\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n hasActionable = hasActionableMenuItems(child.props.children);\n }\n });\n\n return hasActionable;\n };\n\n /**\n * Find the primary Menu.Item using the same logic as the original PrimaryActionDropdown.\n * Selects the first enabled Menu.Item, or falls back to the first Menu.Item if all are disabled.\n */\n const findPrimaryMenuItem = () => {\n const allMenuItems: Array<{\n content: React.ReactNode;\n isDisabled: boolean;\n actionId: string | null;\n }> = [];\n\n // Recursively collect all Menu.Items from children (including nested ones)\n const collectMenuItems = (children: React.ReactNode): void => {\n React.Children.forEach(children, (child) => {\n if (isMenuItemWithId(child)) {\n allMenuItems.push({\n content: child.props.children,\n isDisabled: child.props.isDisabled || false,\n actionId: child.props.id,\n });\n }\n\n // Recurse into Menu.Section or any component with children\n if (hasChildren(child)) {\n collectMenuItems(child.props.children);\n }\n });\n };\n\n collectMenuItems(menuItems);\n\n // Find first enabled Menu.Item, or fallback to first Menu.Item\n const primaryMenuItem =\n allMenuItems.find((item) => !item.isDisabled) || allMenuItems[0];\n\n return (\n primaryMenuItem || {\n content: intl.formatMessage(messages.noActionsAvailable),\n isDisabled: true,\n actionId: null,\n }\n );\n };\n\n // Check if there are any actionable menu items for dropdown functionality\n const hasActionableItems = hasActionableMenuItems(menuItems);\n\n // Get the primary button content using smart selection\n const buttonContent = findPrimaryMenuItem();\n\n const executePrimaryAction = () => {\n if (!buttonContent.isDisabled && buttonContent.actionId && onAction) {\n onAction(buttonContent.actionId);\n }\n };\n\n const isPrimaryDisabled = isDisabled || buttonContent.isDisabled;\n const isDropdownTriggerDisabled = isDisabled || !hasActionableItems;\n\n return (\n <SplitButtonRootSlot variant={variant} data-mode=\"split\">\n <SplitButtonButtonGroupSlot>\n {/* Primary Action Button */}\n <SplitButtonPrimaryButtonSlot asChild>\n <Button\n {...buttonProps}\n isDisabled={isPrimaryDisabled}\n onPress={executePrimaryAction}\n >\n {icon && <Icon>{icon}</Icon>}\n {buttonContent.content}\n </Button>\n </SplitButtonPrimaryButtonSlot>\n\n {/* Menu Trigger and Dropdown */}\n <Menu.Root\n trigger=\"press\"\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n placement=\"bottom end\"\n selectionMode=\"none\"\n onAction={onAction ? (key) => onAction(String(key)) : undefined}\n >\n <Menu.Trigger asChild>\n <SplitButtonTriggerSlot asChild>\n <IconButton\n {...buttonProps}\n aria-label={ariaLabel}\n isDisabled={isDropdownTriggerDisabled}\n >\n <KeyboardArrowDown />\n </IconButton>\n </SplitButtonTriggerSlot>\n </Menu.Trigger>\n\n <Menu.Content>{menuItems}</Menu.Content>\n </Menu.Root>\n </SplitButtonButtonGroupSlot>\n </SplitButtonRootSlot>\n );\n};\n\nSplitButton.displayName = \"SplitButton\";\n"],"names":["withProvider","withContext","createSlotRecipeContext","SplitButtonRootSlot","SplitButtonButtonGroupSlot","SplitButtonPrimaryButtonSlot","SplitButtonTriggerSlot","messages","defineMessages","SplitButton","props","intl","useIntl","size","variant","colorPalette","isDisabled","ariaLabel","onAction","isOpen","defaultOpen","onOpenChange","icon","buttonProps","isMenuItemWithId","element","React","hasChildren","menuItems","hasActionableMenuItems","children","hasActionable","child","findPrimaryMenuItem","allMenuItems","collectMenuItems","item","hasActionableItems","buttonContent","executePrimaryAction","isPrimaryDisabled","isDropdownTriggerDisabled","jsx","jsxs","Button","Icon","Menu","key","IconButton","KeyboardArrowDown"],"mappings":"6TASM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,aACP,CAAC,EAGYC,EAGTH,EAAuD,MAAO,MAAM,EAG3DI,EAA6BH,EAGxC,MAAO,aAAa,EAGTI,EAA+BJ,EAG1C,SAAU,eAAe,EAGdK,EAAyBL,EAGpC,SAAU,iBAAiB,ECjChBM,EAAWC,EAAAA,eAAe,CACrC,mBAAoB,CAClB,GAAI,wCACJ,YAAa,uDACb,eAAgB,sBAAA,CAEpB,CAAC,ECsBYC,EAAeC,GAA4B,CACtD,MAAMC,EAAOC,EAAAA,QAAA,EACP,CACJ,KAAAC,EAAO,KACP,QAAAC,EAAU,QACV,aAAAC,EACA,WAAAC,EAAa,GACb,aAAcC,EACd,SAAAC,EACA,OAAAC,EACA,YAAAC,EACA,aAAAC,EAAA,KACAC,CAAA,EACEZ,EAEEa,EAAc,CAAE,KAAAV,EAAM,QAAAC,EAAS,aAAAC,CAAA,EA0B/BS,EACJC,GACiD,CACjD,GAAI,CAACC,EAAM,eAAeD,CAAO,GAAK,CAACA,EAAQ,MAAO,MAAO,GAC7D,MAAMf,EAAQe,EAAQ,MACtB,MAAO,OAAQf,GAAS,OAAOA,EAAM,IAAO,QAC9C,EAGMiB,EACJF,GA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AAA,KAACC,EAAAA,OAAA,CACE,GAAGrB,EACJ,WAAYiB,EACZ,QAASD,EAER,SAAA,CAAAjB,GAAQoB,EAAAA,IAACG,EAAAA,MAAM,SAAAvB,CAAA,CAAK,EACpBgB,EAAc,OAAA,CAAA,CAAA,EAEnB,EAGAK,EAAAA,KAACG,EAAAA,KAAK,KAAL,CACC,QAAQ,QACR,OAAA3B,EACA,YAAAC,EACA,aAAAC,EACA,UAAU,aACV,cAAc,OACd,SAAUH,EAAY6B,GAAQ7B,EAAS,OAAO6B,CAAG,CAAC,EAAI,OAEtD,SAAA,CAAAL,EAAAA,IAACI,EAAAA,KAAK,QAAL,CAAa,QAAO,GACnB,SAAAJ,EAAAA,IAACpC,EAAA,CAAuB,QAAO,GAC7B,SAAAoC,EAAAA,IAACM,EAAAA,WAAA,CACE,GAAGzB,EACJ,aAAYN,EACZ,WAAYwB,EAEZ,eAACQ,EAAAA,kBAAA,CAAA,CAAkB,CAAA,CAAA,EAEvB,CAAA,CACF,EAEAP,EAAAA,IAACI,EAAAA,KAAK,QAAL,CAAc,SAAAlB,CAAA,CAAU,CAAA,CAAA,CAAA,CAC3B,CAAA,CACF,CAAA,CACF,CAEJ,EAEAnB,EAAY,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-field-KEntobaR.cjs.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":"kLA4BaA,EAAiB,CAAC,CAC7B,GAAAC,EACA,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAAC,EACA,SAAAC,EACA,YAAAC,EACA,QAAAC,EAAU,GACV,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,UAAAC,EAAY,GACZ,MAAAC,EACA,YAAAC,EACA,KAAAC,EAAO,OACP,GAAGC,CACL,IAA2B,CAEzB,MAAMC,EAAYT,GAAWH,GAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO,EAEzE,OACEa,EAAAA,KAACC,EAAAA,UAAU,KAAV,CACC,GAAAlB,EACA,WAAAQ,EACA,WAAAC,EACA,WAAAC,EACA,UAAWM,GAAaL,EAExB,SAAA,CAAAQ,EAAAA,IAACD,EAAAA,UAAU,MAAV,CAAiB,SAAAjB,CAAA,CAAM,EACxBkB,EAAAA,IAACD,EAAAA,UAAU,MAAV,CACC,SAAAC,EAAAA,IAACC,EAAAA,UAAA,CACE,GAAGL,EACJ,KAAAD,EACA,YAAAD,EACA,SAAAR,EACA,MAAAO,CAAA,CAAA,EAEJ,EACCV,GACCiB,EAAAA,IAACD,EAAAA,UAAU,YAAV,CAAuB,SAAAhB,EAAY,EAErCc,SACEE,YAAU,MAAV,CACC,SAAAC,MAACE,EAAAA,YAAA,CAAY,OAAAjB,EAAgB,YAAAE,CAAA,CAA0B,CAAA,CACzD,EAEDH,GAAQgB,EAAAA,IAACD,EAAAA,UAAU,QAAV,CAAmB,SAAAf,CAAA,CAAK,CAAA,CAAA,CAAA,CAGxC,EAEAJ,EAAe,YAAc"}
|
|
1
|
+
{"version":3,"file":"text-input-field-KEntobaR.cjs.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":"kLA4BaA,EAAiB,CAAC,CAC7B,GAAAC,EACA,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAAC,EACA,SAAAC,EACA,YAAAC,EACA,QAAAC,EAAU,GACV,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,UAAAC,EAAY,GACZ,MAAAC,EACA,YAAAC,EACA,KAAAC,EAAO,OACP,GAAGC,CACL,IAA2B,CAEzB,MAAMC,EAAYT,GAAWH,GAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO,EAEzE,OACEa,EAAAA,KAACC,EAAAA,UAAU,KAAV,CACC,GAAAlB,EACA,WAAAQ,EACA,WAAAC,EACA,WAAAC,EACA,UAAWM,GAAaL,EAExB,SAAA,CAAAQ,EAAAA,IAACD,EAAAA,UAAU,MAAV,CAAiB,SAAAjB,CAAA,CAAM,EACxBkB,EAAAA,IAACD,EAAAA,UAAU,MAAV,CACC,SAAAC,EAAAA,IAACC,EAAAA,UAAA,CACE,GAAGL,EACJ,KAAAD,EACA,YAAAD,EACA,SAAAR,EACA,MAAAO,CAAA,CAAA,EAEJ,EACCV,GACCiB,EAAAA,IAACD,EAAAA,UAAU,YAAV,CAAuB,SAAAhB,EAAY,EAErCc,SACEE,YAAU,MAAV,CACC,SAAAC,MAACE,EAAAA,YAAA,CAAY,OAAAjB,EAAgB,YAAAE,CAAA,CAA0B,CAAA,CACzD,EAEDH,GAAQgB,EAAAA,IAACD,EAAAA,UAAU,QAAV,CAAmB,SAAAf,CAAA,CAAK,CAAA,CAAA,CAAA,CAGxC,EAEAJ,EAAe,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-field-rt2r9i_0.es.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":";;;;AA4BO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,MAA2B;AAEzB,QAAMC,IAAYT,KAAWH,KAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO;AAEzE,SACE,gBAAAa;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACC,IAAAlB;AAAA,MACA,YAAAQ;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,WAAWM,KAAaL;AAAA,MAExB,UAAA;AAAA,QAAA,gBAAAQ,EAACD,EAAU,OAAV,EAAiB,UAAAjB,EAAA,CAAM;AAAA,QACxB,gBAAAkB,EAACD,EAAU,OAAV,EACC,UAAA,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YACE,GAAGL;AAAA,YACJ,MAAAD;AAAA,YACA,aAAAD;AAAA,YACA,UAAAR;AAAA,YACA,OAAAO;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACCV,KACC,gBAAAiB,EAACD,EAAU,aAAV,EAAuB,UAAAhB,GAAY;AAAA,QAErCc,uBACEE,EAAU,OAAV,EACC,UAAA,gBAAAC,EAACE,GAAA,EAAY,QAAAjB,GAAgB,aAAAE,EAAA,CAA0B,EAAA,CACzD;AAAA,QAEDH,KAAQ,gBAAAgB,EAACD,EAAU,SAAV,EAAmB,UAAAf,EAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxC;AAEAJ,EAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"text-input-field-rt2r9i_0.es.js","sources":["../../src/patterns/fields/text-input-field/text-input-field.tsx"],"sourcesContent":["import { TextInput } from \"@/components/text-input/text-input\";\nimport type { TextInputFieldProps } from \"./text-input-field.types\";\nimport { FormField, FieldErrors } from \"@/components\";\n\n/**\n * # TextInputField\n *\n * A pre-composed form field component that combines TextInput with FormField features\n * like labels, descriptions, error handling, and validation feedback.\n *\n * This component provides a simple, flat API for common text input use cases and serves\n * as a drop-in replacement for UI-Kit's TextField, maintaining compatibility with the\n * same error format and localized error messages.\n *\n * @example\n * ```tsx\n * <TextInputField\n * label=\"Project name\"\n * description=\"Enter a descriptive name for your project\"\n * placeholder=\"My Awesome Project\"\n * value={value}\n * onChange={setValue}\n * errors={{ missing: true }}\n * isRequired\n * />\n * ```\n */\n\nexport const TextInputField = ({\n id,\n label,\n description,\n info,\n errors,\n onChange,\n renderError,\n touched = false,\n isRequired = false,\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n value,\n placeholder,\n type = \"text\",\n ...rest\n}: TextInputFieldProps) => {\n // Determine if we should show errors\n const hasErrors = touched && errors && Object.values(errors).some(Boolean);\n\n return (\n <FormField.Root\n id={id}\n isRequired={isRequired}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={hasErrors || isInvalid}\n >\n <FormField.Label>{label}</FormField.Label>\n <FormField.Input>\n <TextInput\n {...rest}\n type={type}\n placeholder={placeholder}\n onChange={onChange}\n value={value}\n />\n </FormField.Input>\n {description && (\n <FormField.Description>{description}</FormField.Description>\n )}\n {hasErrors && (\n <FormField.Error>\n <FieldErrors errors={errors} renderError={renderError} />\n </FormField.Error>\n )}\n {info && <FormField.InfoBox>{info}</FormField.InfoBox>}\n </FormField.Root>\n );\n};\n\nTextInputField.displayName = \"TextInputField\";\n"],"names":["TextInputField","id","label","description","info","errors","onChange","renderError","touched","isRequired","isDisabled","isReadOnly","isInvalid","value","placeholder","type","rest","hasErrors","jsxs","FormField","jsx","TextInput","FieldErrors"],"mappings":";;;;AA4BO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,MAA2B;AAEzB,QAAMC,IAAYT,KAAWH,KAAU,OAAO,OAAOA,CAAM,EAAE,KAAK,OAAO;AAEzE,SACE,gBAAAa;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACC,IAAAlB;AAAA,MACA,YAAAQ;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,WAAWM,KAAaL;AAAA,MAExB,UAAA;AAAA,QAAA,gBAAAQ,EAACD,EAAU,OAAV,EAAiB,UAAAjB,EAAA,CAAM;AAAA,QACxB,gBAAAkB,EAACD,EAAU,OAAV,EACC,UAAA,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YACE,GAAGL;AAAA,YACJ,MAAAD;AAAA,YACA,aAAAD;AAAA,YACA,UAAAR;AAAA,YACA,OAAAO;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACCV,KACC,gBAAAiB,EAACD,EAAU,aAAV,EAAuB,UAAAhB,GAAY;AAAA,QAErCc,uBACEE,EAAU,OAAV,EACC,UAAA,gBAAAC,EAACE,GAAA,EAAY,QAAAjB,GAAgB,aAAAE,EAAA,CAA0B,EAAA,CACzD;AAAA,QAEDH,KAAQ,gBAAAgB,EAACD,EAAU,SAAV,EAAmB,UAAAf,EAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxC;AAEAJ,EAAe,cAAc;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Recipe configuration for the Alert component.
|
|
3
3
|
* Defines the styling variants and base styles using Chakra UI's recipe system.
|
|
4
4
|
*/
|
|
5
|
-
export declare const alertRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"root" | "title" | "
|
|
5
|
+
export declare const alertRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"root" | "title" | "icon" | "description" | "actions" | "dismissButton", {
|
|
6
6
|
variant: {
|
|
7
7
|
flat: {};
|
|
8
8
|
outlined: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLChakraProps, SlotRecipeProps } from '@chakra-ui/react';
|
|
2
|
-
import { TextProps } from '../text';
|
|
3
|
-
import { ButtonProps } from '../button';
|
|
2
|
+
import { TextProps } from '../text/text';
|
|
3
|
+
import { ButtonProps } from '../button/button.types';
|
|
4
4
|
import { SemanticPalettesOnly } from '../../type-utils/shared-types';
|
|
5
5
|
import { OmitInternalProps } from '../../type-utils/omit-props';
|
|
6
6
|
type AlertRecipeProps = {
|
|
@@ -3,7 +3,7 @@ import { DataTableTableSlotProps } from './data-table.types';
|
|
|
3
3
|
* Root component that provides the styling context for the DataTable component.
|
|
4
4
|
* Uses Chakra UI's recipe context system for consistent styling across instances.
|
|
5
5
|
*/
|
|
6
|
-
export declare const DataTableRoot: import('react').ForwardRefExoticComponent<Omit<import('@chakra-ui/react').PatchHtmlProps<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">>, "css" | "_hover" | "_active" | "_focus" | "_focusWithin" | "_focusVisible" | "_disabled" | "_visited" | "_target" | "_readOnly" | "_readWrite" | "_empty" | "_checked" | "_enabled" | "_expanded" | "_highlighted" | "_complete" | "_incomplete" | "_dragging" | "_before" | "_after" | "_firstLetter" | "_firstLine" | "_marker" | "_selection" | "_file" | "_backdrop" | "_first" | "_last" | "_notFirst" | "_notLast" | "_only" | "_even" | "_odd" | "_peerFocus" | "_peerHover" | "_peerActive" | "_peerFocusWithin" | "_peerFocusVisible" | "_peerDisabled" | "_peerChecked" | "_peerInvalid" | "_peerExpanded" | "_peerPlaceholderShown" | "_groupFocus" | "_groupHover" | "_groupActive" | "_groupFocusWithin" | "_groupFocusVisible" | "_groupDisabled" | "_groupChecked" | "_groupExpanded" | "_groupInvalid" | "_indeterminate" | "_required" | "_valid" | "_invalid" | "_autofill" | "_inRange" | "_outOfRange" | "_placeholder" | "_placeholderShown" | "_pressed" | "_selected" | "_grabbed" | "_underValue" | "_overValue" | "_atValue" | "_default" | "_optional" | "_open" | "_closed" | "_fullscreen" | "_loading" | "_hidden" | "_current" | "_currentPage" | "_currentStep" | "_today" | "_unavailable" | "_rangeStart" | "_rangeEnd" | "_now" | "_topmost" | "_motionReduce" | "_motionSafe" | "_print" | "_landscape" | "_portrait" | "_dark" | "_light" | "_osDark" | "_osLight" | "_highContrast" | "_lessContrast" | "_moreContrast" | "_ltr" | "_rtl" | "_scrollbar" | "_scrollbarThumb" | "_scrollbarTrack" | "_horizontal" | "_vertical" | "_icon" | "_starting" | "sm" | "smOnly" | "smDown" | "md" | "mdOnly" | "mdDown" | "lg" | "lgOnly" | "lgDown" | "xl" | "xlOnly" | "xlDown" | "2xl" | "2xlOnly" | "2xlDown" | "smToMd" | "smToLg" | "smToXl" | "smTo2xl" | "mdToLg" | "mdToXl" | "mdTo2xl" | "lgToXl" | "lgTo2xl" | "xlTo2xl" | "base" | "color" | "translate" | "transition" | "width" | "height" | "content" | "page" | "container" | "WebkitAppearance" | "WebkitBorderBefore" | "WebkitBorderBeforeColor" | "WebkitBorderBeforeStyle" | "WebkitBorderBeforeWidth" | "WebkitBoxReflect" | "WebkitLineClamp" | "WebkitMask" | "WebkitMaskAttachment" | "WebkitMaskClip" | "WebkitMaskComposite" | "WebkitMaskImage" | "WebkitMaskOrigin" | "WebkitMaskPosition" | "WebkitMaskPositionX" | "WebkitMaskPositionY" | "WebkitMaskRepeat" | "WebkitMaskRepeatX" | "WebkitMaskRepeatY" | "WebkitMaskSize" | "WebkitOverflowScrolling" | "WebkitTapHighlightColor" | "WebkitTextFillColor" | "WebkitTextStroke" | "WebkitTextStrokeColor" | "WebkitTextStrokeWidth" | "WebkitTouchCallout" | "WebkitUserModify" | "WebkitUserSelect" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "all" | "anchorName" | "anchorScope" | "animation" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationRange" | "animationRangeEnd" | "animationRangeStart" | "animationTimeline" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockSize" | "border" | "borderBlock" | "borderBlockColor" | "borderBlockEnd" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStart" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInline" | "borderInlineColor" | "borderInlineEnd" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStart" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRadius" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "borderWidth" | "bottom" | "boxAlign" | "boxDecorationBreak" | "boxDirection" | "boxFlex" | "boxFlexGroup" | "boxLines" | "boxOrdinalGroup" | "boxOrient" | "boxPack" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caret" | "caretColor" | "caretShape" | "clear" | "clip" | "clipPath" | "clipRule" | "colorInterpolationFilters" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "columns" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicSize" | "containIntrinsicWidth" | "containerName" | "containerType" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "cx" | "cy" | "d" | "direction" | "display" | "dominantBaseline" | "emptyCells" | "fieldSizing" | "fill" | "fillOpacity" | "fillRule" | "filter" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "floodColor" | "floodOpacity" | "font" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontPalette" | "fontSize" | "fontSizeAdjust" | "fontSmooth" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontSynthesisPosition" | "fontSynthesisSmallCaps" | "fontSynthesisStyle" | "fontSynthesisWeight" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantEmoji" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "forcedColorAdjust" | "gap" | "grid" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphenateLimitChars" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "imeMode" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "interpolateSize" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lightingColor" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "maskBorder" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offset" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipBox" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overlay" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "pointerEvents" | "position" | "positionAnchor" | "positionArea" | "positionTry" | "positionTryFallbacks" | "positionTryOrder" | "positionVisibility" | "printColorAdjust" | "quotes" | "r" | "resize" | "right" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "rx" | "ry" | "scale" | "scrollBehavior" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInline" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInline" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapCoordinate" | "scrollSnapDestination" | "scrollSnapPointsX" | "scrollSnapPointsY" | "scrollSnapStop" | "scrollSnapType" | "scrollSnapTypeX" | "scrollSnapTypeY" | "scrollTimeline" | "scrollTimelineAxis" | "scrollTimelineName" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textAnchor" | "textBox" | "textBoxEdge" | "textBoxTrim" | "textCombineUpright" | "textDecoration" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textSpacingTrim" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "textWrap" | "textWrapMode" | "textWrapStyle" | "timelineScope" | "top" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionBehavior" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "unicodeBidi" | "userSelect" | "vectorEffect" | "verticalAlign" | "viewTimeline" | "viewTimelineAxis" | "viewTimelineInset" | "viewTimelineName" | "viewTransitionName" | "visibility" | "whiteSpace" | "whiteSpaceCollapse" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "x" | "y" | "zIndex" | "zoom" | "alignmentBaseline" | "baselineShift" | "colorInterpolation" | "colorRendering" | "glyphOrientationVertical" | "bg" | "bgColor" | "bgSize" | "bgPos" | "bgRepeat" | "bgAttachment" | "bgClip" | "bgGradient" | "bgImg" | "bgImage" | "borderStart" | "borderEnd" | "borderX" | "borderY" | "borderStartColor" | "borderEndColor" | "borderStartStyle" | "borderEndStyle" | "rounded" | "roundedTopLeft" | "roundedStartStart" | "borderTopStartRadius" | "roundedEndStart" | "borderBottomStartRadius" | "roundedTopRight" | "roundedStartEnd" | "borderTopEndRadius" | "roundedEndEnd" | "borderBottomEndRadius" | "roundedBottomLeft" | "roundedBottomRight" | "roundedStart" | "borderStartRadius" | "roundedEnd" | "borderEndRadius" | "roundedTop" | "roundedBottom" | "roundedLeft" | "roundedRight" | "borderXWidth" | "borderStartWidth" | "borderEndWidth" | "borderYWidth" | "shadow" | "shadowColor" | "blendMode" | "bgBlendMode" | "gapY" | "gapX" | "flexDir" | "w" | "h" | "minW" | "minH" | "maxW" | "maxH" | "overscroll" | "overscrollX" | "overscrollY" | "scrollPaddingX" | "scrollPaddingY" | "listStylePos" | "listStyleImg" | "pos" | "insetX" | "insetY" | "insetStart" | "insetEnd" | "m" | "mt" | "mr" | "mb" | "ml" | "ms" | "marginStart" | "me" | "marginEnd" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "ps" | "paddingStart" | "pe" | "paddingEnd" | "px" | "paddingX" | "py" | "paddingY" | "textDecor" | "backgroundGradient" | "gradientFrom" | "gradientTo" | "gradientVia" | "borderInlineStartRadius" | "borderInlineEndRadius" | "borderTopRadius" | "borderBottomRadius" | "borderLeftRadius" | "borderRightRadius" | "divideX" | "divideY" | "divideColor" | "divideStyle" | "boxShadowColor" | "blur" | "brightness" | "contrast" | "grayscale" | "hueRotate" | "invert" | "saturate" | "sepia" | "dropShadow" | "backdropBlur" | "backdropBrightness" | "backdropContrast" | "backdropGrayscale" | "backdropHueRotate" | "backdropInvert" | "backdropOpacity" | "backdropSaturate" | "backdropSepia" | "focusRing" | "focusVisibleRing" | "focusRingColor" | "focusRingOffset" | "focusRingWidth" | "focusRingStyle" | "boxSize" | "hideFrom" | "hideBelow" | "scrollbar" | "scrollMarginX" | "scrollMarginY" | "scrollSnapStrictness" | "scrollSnapMargin" | "scrollSnapMarginTop" | "scrollSnapMarginBottom" | "scrollSnapMarginLeft" | "scrollSnapMarginRight" | "ring" | "ringColor" | "ringOffset" | "ringOffsetColor" | "ringInset" | "skewX" | "skewY" | "scaleX" | "scaleY" | "spaceXReverse" | "spaceX" | "spaceYReverse" | "spaceY" | "rotateX" | "rotateY" | "translateX" | "translateY" | "truncate" | "borderSpacingX" | "borderSpacingY" | "srOnly" | "debug" | "colorPalette" | "textStyle" | "layerStyle" | "animationStyle" | keyof import('@chakra-ui/react').PolymorphicProps | "truncated" | "density" | "unstyled"> & Omit<import('@chakra-ui/react').JsxStyleProps, "truncated" | "density" | "unstyled"> & {
|
|
6
|
+
export declare const DataTableRoot: import('react').ForwardRefExoticComponent<Omit<import('@chakra-ui/react').PatchHtmlProps<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">>, "css" | "_hover" | "_active" | "_focus" | "_focusWithin" | "_focusVisible" | "_disabled" | "_visited" | "_target" | "_readOnly" | "_readWrite" | "_empty" | "_checked" | "_enabled" | "_expanded" | "_highlighted" | "_complete" | "_incomplete" | "_dragging" | "_before" | "_after" | "_firstLetter" | "_firstLine" | "_marker" | "_selection" | "_file" | "_backdrop" | "_first" | "_last" | "_notFirst" | "_notLast" | "_only" | "_even" | "_odd" | "_peerFocus" | "_peerHover" | "_peerActive" | "_peerFocusWithin" | "_peerFocusVisible" | "_peerDisabled" | "_peerChecked" | "_peerInvalid" | "_peerExpanded" | "_peerPlaceholderShown" | "_groupFocus" | "_groupHover" | "_groupActive" | "_groupFocusWithin" | "_groupFocusVisible" | "_groupDisabled" | "_groupChecked" | "_groupExpanded" | "_groupInvalid" | "_indeterminate" | "_required" | "_valid" | "_invalid" | "_autofill" | "_inRange" | "_outOfRange" | "_placeholder" | "_placeholderShown" | "_pressed" | "_selected" | "_grabbed" | "_underValue" | "_overValue" | "_atValue" | "_default" | "_optional" | "_open" | "_closed" | "_fullscreen" | "_loading" | "_hidden" | "_current" | "_currentPage" | "_currentStep" | "_today" | "_unavailable" | "_rangeStart" | "_rangeEnd" | "_now" | "_topmost" | "_motionReduce" | "_motionSafe" | "_print" | "_landscape" | "_portrait" | "_dark" | "_light" | "_osDark" | "_osLight" | "_highContrast" | "_lessContrast" | "_moreContrast" | "_ltr" | "_rtl" | "_scrollbar" | "_scrollbarThumb" | "_scrollbarTrack" | "_horizontal" | "_vertical" | "_icon" | "_starting" | "sm" | "smOnly" | "smDown" | "md" | "mdOnly" | "mdDown" | "lg" | "lgOnly" | "lgDown" | "xl" | "xlOnly" | "xlDown" | "2xl" | "2xlOnly" | "2xlDown" | "smToMd" | "smToLg" | "smToXl" | "smTo2xl" | "mdToLg" | "mdToXl" | "mdTo2xl" | "lgToXl" | "lgTo2xl" | "xlTo2xl" | "base" | "color" | "translate" | "transition" | "width" | "height" | "content" | "page" | "container" | "WebkitAppearance" | "WebkitBorderBefore" | "WebkitBorderBeforeColor" | "WebkitBorderBeforeStyle" | "WebkitBorderBeforeWidth" | "WebkitBoxReflect" | "WebkitLineClamp" | "WebkitMask" | "WebkitMaskAttachment" | "WebkitMaskClip" | "WebkitMaskComposite" | "WebkitMaskImage" | "WebkitMaskOrigin" | "WebkitMaskPosition" | "WebkitMaskPositionX" | "WebkitMaskPositionY" | "WebkitMaskRepeat" | "WebkitMaskRepeatX" | "WebkitMaskRepeatY" | "WebkitMaskSize" | "WebkitOverflowScrolling" | "WebkitTapHighlightColor" | "WebkitTextFillColor" | "WebkitTextStroke" | "WebkitTextStrokeColor" | "WebkitTextStrokeWidth" | "WebkitTouchCallout" | "WebkitUserModify" | "WebkitUserSelect" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "all" | "anchorName" | "anchorScope" | "animation" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationRange" | "animationRangeEnd" | "animationRangeStart" | "animationTimeline" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockSize" | "border" | "borderBlock" | "borderBlockColor" | "borderBlockEnd" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStart" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInline" | "borderInlineColor" | "borderInlineEnd" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStart" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRadius" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "borderWidth" | "bottom" | "boxAlign" | "boxDecorationBreak" | "boxDirection" | "boxFlex" | "boxFlexGroup" | "boxLines" | "boxOrdinalGroup" | "boxOrient" | "boxPack" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caret" | "caretColor" | "caretShape" | "clear" | "clip" | "clipPath" | "clipRule" | "colorInterpolationFilters" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "columns" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicSize" | "containIntrinsicWidth" | "containerName" | "containerType" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "cx" | "cy" | "d" | "direction" | "display" | "dominantBaseline" | "emptyCells" | "fieldSizing" | "fill" | "fillOpacity" | "fillRule" | "filter" | "flex" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "floodColor" | "floodOpacity" | "font" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontPalette" | "fontSize" | "fontSizeAdjust" | "fontSmooth" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontSynthesisPosition" | "fontSynthesisSmallCaps" | "fontSynthesisStyle" | "fontSynthesisWeight" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantEmoji" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "forcedColorAdjust" | "gap" | "grid" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphenateLimitChars" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "imeMode" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "interpolateSize" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lightingColor" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "maskBorder" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offset" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipBox" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overlay" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "pointerEvents" | "position" | "positionAnchor" | "positionArea" | "positionTry" | "positionTryFallbacks" | "positionTryOrder" | "positionVisibility" | "printColorAdjust" | "quotes" | "r" | "resize" | "right" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "rx" | "ry" | "scale" | "scrollBehavior" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInline" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInline" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapCoordinate" | "scrollSnapDestination" | "scrollSnapPointsX" | "scrollSnapPointsY" | "scrollSnapStop" | "scrollSnapType" | "scrollSnapTypeX" | "scrollSnapTypeY" | "scrollTimeline" | "scrollTimelineAxis" | "scrollTimelineName" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textAnchor" | "textBox" | "textBoxEdge" | "textBoxTrim" | "textCombineUpright" | "textDecoration" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textSpacingTrim" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "textWrap" | "textWrapMode" | "textWrapStyle" | "timelineScope" | "top" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionBehavior" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "unicodeBidi" | "userSelect" | "vectorEffect" | "verticalAlign" | "viewTimeline" | "viewTimelineAxis" | "viewTimelineInset" | "viewTimelineName" | "viewTransitionName" | "visibility" | "whiteSpace" | "whiteSpaceCollapse" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "x" | "y" | "zIndex" | "zoom" | "alignmentBaseline" | "baselineShift" | "colorInterpolation" | "colorRendering" | "glyphOrientationVertical" | "bg" | "bgColor" | "bgSize" | "bgPos" | "bgRepeat" | "bgAttachment" | "bgClip" | "bgGradient" | "bgImg" | "bgImage" | "borderStart" | "borderEnd" | "borderX" | "borderY" | "borderStartColor" | "borderEndColor" | "borderStartStyle" | "borderEndStyle" | "rounded" | "roundedTopLeft" | "roundedStartStart" | "borderTopStartRadius" | "roundedEndStart" | "borderBottomStartRadius" | "roundedTopRight" | "roundedStartEnd" | "borderTopEndRadius" | "roundedEndEnd" | "borderBottomEndRadius" | "roundedBottomLeft" | "roundedBottomRight" | "roundedStart" | "borderStartRadius" | "roundedEnd" | "borderEndRadius" | "roundedTop" | "roundedBottom" | "roundedLeft" | "roundedRight" | "borderXWidth" | "borderStartWidth" | "borderEndWidth" | "borderYWidth" | "shadow" | "shadowColor" | "blendMode" | "bgBlendMode" | "gapY" | "gapX" | "flexDir" | "w" | "h" | "minW" | "minH" | "maxW" | "maxH" | "overscroll" | "overscrollX" | "overscrollY" | "scrollPaddingX" | "scrollPaddingY" | "listStylePos" | "listStyleImg" | "pos" | "insetX" | "insetY" | "insetStart" | "insetEnd" | "m" | "mt" | "mr" | "mb" | "ml" | "ms" | "marginStart" | "me" | "marginEnd" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "ps" | "paddingStart" | "pe" | "paddingEnd" | "px" | "paddingX" | "py" | "paddingY" | "textDecor" | "backgroundGradient" | "gradientFrom" | "gradientTo" | "gradientVia" | "borderInlineStartRadius" | "borderInlineEndRadius" | "borderTopRadius" | "borderBottomRadius" | "borderLeftRadius" | "borderRightRadius" | "divideX" | "divideY" | "divideColor" | "divideStyle" | "boxShadowColor" | "blur" | "brightness" | "contrast" | "grayscale" | "hueRotate" | "invert" | "saturate" | "sepia" | "dropShadow" | "backdropBlur" | "backdropBrightness" | "backdropContrast" | "backdropGrayscale" | "backdropHueRotate" | "backdropInvert" | "backdropOpacity" | "backdropSaturate" | "backdropSepia" | "focusRing" | "focusVisibleRing" | "focusRingColor" | "focusRingOffset" | "focusRingWidth" | "focusRingStyle" | "boxSize" | "hideFrom" | "hideBelow" | "scrollbar" | "scrollMarginX" | "scrollMarginY" | "scrollSnapStrictness" | "scrollSnapMargin" | "scrollSnapMarginTop" | "scrollSnapMarginBottom" | "scrollSnapMarginLeft" | "scrollSnapMarginRight" | "ring" | "ringColor" | "ringOffset" | "ringOffsetColor" | "ringInset" | "skewX" | "skewY" | "scaleX" | "scaleY" | "spaceXReverse" | "spaceX" | "spaceYReverse" | "spaceY" | "rotateX" | "rotateY" | "translateX" | "translateY" | "truncate" | "borderSpacingX" | "borderSpacingY" | "srOnly" | "debug" | "colorPalette" | "textStyle" | "layerStyle" | "animationStyle" | keyof import('@chakra-ui/react').PolymorphicProps | "unstyled" | "truncated" | "density"> & Omit<import('@chakra-ui/react').JsxStyleProps, "unstyled" | "truncated" | "density"> & {
|
|
7
7
|
truncated?: boolean;
|
|
8
8
|
density?: "default" | "condensed";
|
|
9
9
|
} & import('@chakra-ui/react').UnstyledProp & import('@chakra-ui/react').PolymorphicProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const a=require("../chunks/data-table-
|
|
1
|
+
"use strict";const a=require("../chunks/data-table-DU27AnZ8.cjs.js");exports.DataTable=a.DataTable;exports.UPDATE_ACTIONS=a.UPDATE_ACTIONS;exports._DataTableBody=a.DataTableBody;exports._DataTableCell=a.DataTableCell;exports._DataTableColumn=a.DataTableColumn;exports._DataTableExpandButton=a.DataTableExpandButton;exports._DataTableFooter=a.DataTableFooter;exports._DataTableHeader=a.DataTableHeader;exports._DataTableManager=a.DataTableManager;exports._DataTableNestedIcon=a.DataTableNestedIcon;exports._DataTableRoot=a.DataTableRoot;exports._DataTableRow=a.DataTableRow;exports._DataTableSelectionCell=a.DataTableSelectionCell;exports._DataTableTable=a.DataTableTable;
|
|
2
2
|
//# sourceMappingURL=data-table.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as l, U as t, e as T, g as b, d as s, j as D, h as _, c as o, i as n, k as d, a as r, f as C, l as c, b as f } from "../chunks/data-table-
|
|
1
|
+
import { D as l, U as t, e as T, g as b, d as s, j as D, h as _, c as o, i as n, k as d, a as r, f as C, l as c, b as f } from "../chunks/data-table-DOtu1sY_.es.js";
|
|
2
2
|
export {
|
|
3
3
|
l as DataTable,
|
|
4
4
|
t as UPDATE_ACTIONS,
|