@frontify/fondue-components 13.0.2 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fondue-components.js +56 -54
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +124 -34
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +36 -84
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +89 -36
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +30 -40
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +47 -24
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +28 -39
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +34 -16
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +21 -68
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +68 -36
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +34 -45
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +53 -130
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +133 -53
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +54 -28
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +28 -153
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +151 -116
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +117 -31
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +32 -65
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +66 -7
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +10 -55
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +56 -32
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +89 -36
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +18 -4
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +32 -12
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +5 -155
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +10 -116
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +59 -22
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +112 -15
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +116 -30
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +21 -37
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +31 -129
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +37 -21
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +32 -38
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +130 -45
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +20 -7
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +45 -13
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +7 -14
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +13 -60
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +15 -18
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +60 -19
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +18 -5
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +18 -14
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +1 -1
- package/dist/fondue-components5.js +42 -45
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components50.js +12 -16
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +5 -35
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +18 -6
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +35 -13
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +6 -4
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +12 -24
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +4 -16
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +23 -140
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +17 -16
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +142 -70
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +46 -48
- package/dist/fondue-components6.js.map +1 -1
- package/dist/fondue-components60.js +16 -8
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +72 -32
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +8 -49
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +32 -10
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +48 -12
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +10 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +11 -19
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +13 -15
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +20 -52
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +15 -15
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +43 -144
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components70.js +52 -25
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +14 -17
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +24 -5
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +16 -5
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +7 -2
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +4 -12
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +2 -39
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +18 -0
- package/dist/fondue-components77.js.map +1 -0
- package/dist/fondue-components78.js +42 -0
- package/dist/fondue-components78.js.map +1 -0
- package/dist/fondue-components8.js +146 -27
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components9.js +28 -125
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +183 -57
- package/dist/style.css +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components59.js","sources":["../src/components/Select/SelectMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { type UseComboboxPropGetters, type UseSelectPropGetters } from 'downshift';\nimport { isValidElement, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuProps = {\n /**\n * @internal\n * The index of the highlighted item in the menu.\n */\n highlightedIndex: number;\n /**\n * @internal\n * Callback function to retrieve the props for a menu element.\n */\n getMenuProps: UseSelectPropGetters<unknown>['getMenuProps'] | UseComboboxPropGetters<unknown>['getMenuProps'];\n /**\n * @internal\n * Callback function to retrieve the props for a item element.\n */\n getItemProps: UseSelectPropGetters<unknown>['getItemProps'] | UseComboboxPropGetters<unknown>['getItemProps'];\n /**\n * @internal\n * The children of the menu component. This can contain multiple `Select.Item` or `Select.Group` components.\n */\n children: ReactNode;\n /**\n * @internal\n * The filter text shown in the combobox input element.\n */\n filterText?: string;\n /**\n * @internal\n * The alignment of the menu.\n */\n align: 'start' | 'center' | 'end';\n /**\n * @internal\n * Defines the preferred side of the select. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side: 'left' | 'right' | 'bottom' | 'top';\n /**\n * @internal\n * The type of the menu.\n */\n selectedItem?: {\n value: string;\n } | null;\n /**\n * @internal\n * A boolean to indicate if highlighted item was changed since opening the menu.\n * This is used to determine the style of the selected/highlighted item.\n */\n hasInteractedSinceOpening?: boolean;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n align,\n side,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n };\n\n const theme = useFondueTheme();\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme}>\n <RadixPopover.Content\n align={align}\n side={side}\n collisionPadding={16}\n onOpenAutoFocus={handleOnOpenAutoFocus}\n className={styles.portal}\n >\n <ul\n className={styles.menu}\n {...getMenuProps()}\n data-has-interacted={hasInteractedSinceOpening ? 'true' : 'false'}\n data-test-id=\"fondue-select-menu\"\n >\n {\n recursiveMap(\n children,\n (child, index) => {\n const isValid = <TProps,>(\n child: ReactNode,\n ): child is ReactElement<TProps> & { ref: ForwardedRef<HTMLElement> } =>\n // @ts-expect-error - We are explicitly checking for ref\n isValidElement<TProps>(child) && child.ref !== undefined;\n\n if (isValid<SelectItemProps>(child)) {\n const optionData = getSelectOptionValue(child.props);\n const itemProps = getItemProps({\n item: optionData,\n index,\n ...(child.ref ? { ref: child.ref } : {}),\n });\n\n return (\n <RadixSlot\n className={styles.item}\n data-highlighted={highlightedIndex === index}\n data-selected={selectedItem?.value === optionData.value}\n key={child.props.value}\n // Workaround for the issue where the onClick event is not fired on touch devices because of portal usage\n onTouchStart={(event) => {\n if (itemProps.onClick) {\n itemProps.onClick(event as unknown as MouseEvent<HTMLElement>);\n }\n }}\n {...itemProps}\n >\n {child}\n </RadixSlot>\n );\n }\n },\n filterText,\n ).parsedChildren\n }\n </ul>\n </RadixPopover.Content>\n </ThemeProvider>\n </RadixPopover.Portal>\n );\n};\nSelectMenu.displayName = 'Select.Menu';\n"],"names":["SelectMenu","highlightedIndex","getMenuProps","getItemProps","children","filterText","align","side","selectedItem","hasInteractedSinceOpening","handleOnOpenAutoFocus","event","theme","useFondueTheme","RadixPopover","jsx","ThemeProvider","styles","recursiveMap","child","index","isValidElement","optionData","getSelectOptionValue","itemProps","RadixSlot"],"mappings":";;;;;;;AAiEO,MAAMA,IAAa,CAAC;AAAA,EACvB,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,2BAAAC;AACJ,MAAuB;AACb,QAAAC,IAAwB,CAACC,MAAiB;AAC5C,IAAAA,EAAM,eAAe;AAAA,EACzB,GAEMC,IAAQC,EAAe;AAC7B,2BACKC,EAAa,QAAb,EACG,UAAA,gBAAAC,EAACC,KAAc,OAAAJ,GACX,UAAA,gBAAAG;AAAA,IAACD,EAAa;AAAA,IAAb;AAAA,MACG,OAAAR;AAAA,MACA,MAAAC;AAAA,MACA,kBAAkB;AAAA,MAClB,iBAAiBG;AAAA,MACjB,WAAWO,EAAO;AAAA,MAElB,UAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAWE,EAAO;AAAA,UACjB,GAAGf,EAAa;AAAA,UACjB,uBAAqBO,IAA4B,SAAS;AAAA,UAC1D,gBAAa;AAAA,UAGT,UAAAS;AAAA,YACId;AAAA,YACA,CAACe,GAAOC,MAAU;AAOV,mBANY,CACZD;AAAAA;AAAAA,gBAGAE,EAAuBF,CAAK,KAAKA,EAAM,QAAQ;AAAA,iBAEtBA,CAAK,GAAG;AAC3B,sBAAAG,IAAaC,EAAqBJ,EAAM,KAAK,GAC7CK,IAAYrB,EAAa;AAAA,kBAC3B,MAAMmB;AAAA,kBACN,OAAAF;AAAA,kBACA,GAAID,EAAM,MAAM,EAAE,KAAKA,EAAM,IAAA,IAAQ,CAAA;AAAA,gBAAC,CACzC;AAGG,uBAAA,gBAAAJ;AAAA,kBAACU;AAAAA,kBAAA;AAAA,oBACG,WAAWR,EAAO;AAAA,oBAClB,oBAAkBhB,MAAqBmB;AAAA,oBACvC,kBAAeZ,KAAA,gBAAAA,EAAc,WAAUc,EAAW;AAAA,oBAGlD,cAAc,CAACX,MAAU;AACrB,sBAAIa,EAAU,WACVA,EAAU,QAAQb,CAA2C;AAAA,oBAErE;AAAA,oBACC,GAAGa;AAAA,oBAEH,UAAAL;AAAA,kBAAA;AAAA,kBATIA,EAAM,MAAM;AAAA,gBAUrB;AAAA,cAAA;AAAA,YAGZ;AAAA,YACAd;AAAA,UAAA,EACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAEV;AAAA,KAER,EACJ,CAAA;AAER;AACAL,EAAW,cAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components59.js","sources":["../src/components/Select/Combobox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useCombobox } from 'downshift';\nimport { forwardRef, useMemo, useRef, useState, type FocusEvent, type ForwardedRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport { SelectMenu } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type ComboboxProps = {\n /**\n * Children of the Combobox component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string | null) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the combobox component.\n */\n placeholder?: string;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error';\n /**\n * Disables the combobox component.\n */\n disabled?: boolean;\n /**\n * The alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end' /**\n * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n ...props\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText } =\n useSelectData(children);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\n }\n\n if (getInputProps().onBlur) {\n getInputProps().onBlur?.(blurEvent);\n }\n };\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div ref={forwardedRef} className={styles.root} data-status={valueInvalid ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={onBlurHandler}\n />\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n )}\n <div className={styles.icons}>\n <button\n aria-label=\"toggle menu\"\n {...getToggleButtonProps()}\n type=\"button\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {valueInvalid || status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n align={alignMenu}\n side={side}\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","dataTestId","alignMenu","side","id","props","forwardedRef","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","useSelectData","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;AA+DO,MAAMA,IAAiB,CAC1B;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,IAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,EAAA,IAC3EC,EAAcpB,CAAQ,GAEpB,CAACqB,GAA2BC,CAA4B,IAAIC,EAAS,EAAK,GAE1E;AAAA,IACF,eAAAC;AAAA,IACA,sBAAAC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-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
e.Input.displayName = "ColorPicker.Input";
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { IconMinus as m, IconCheckMark as h } from "@frontify/fondue-icons";
|
|
3
|
+
import * as o from "@radix-ui/react-checkbox";
|
|
4
|
+
import { forwardRef as k } from "react";
|
|
5
|
+
import { cn as p } from "./fondue-components33.js";
|
|
6
|
+
import { checkboxStyles as l, checkboxIndicatorStyles as w } from "./fondue-components37.js";
|
|
7
|
+
const f = ({
|
|
8
|
+
className: a,
|
|
9
|
+
value: c,
|
|
10
|
+
onChange: i,
|
|
11
|
+
defaultValue: d,
|
|
12
|
+
"data-test-id": r = "fondue-checkbox",
|
|
13
|
+
...e
|
|
14
|
+
}, n) => /* @__PURE__ */ t(
|
|
15
|
+
o.Root,
|
|
16
|
+
{
|
|
17
|
+
ref: n,
|
|
18
|
+
checked: c,
|
|
19
|
+
defaultChecked: d,
|
|
20
|
+
className: p(l(e), a),
|
|
21
|
+
onClick: i,
|
|
22
|
+
"data-test-id": r,
|
|
23
|
+
...e,
|
|
24
|
+
children: /* @__PURE__ */ s(o.Indicator, { className: w, children: [
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
m,
|
|
27
|
+
{
|
|
28
|
+
size: 16,
|
|
29
|
+
className: 'tw-hidden tw-opacity-0 group-data-[state="indeterminate"]:tw-block group-data-[state="indeterminate"]:tw-opacity-100 tw-transition-opacity',
|
|
30
|
+
"data-test-id": "icon-indeterminate"
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
h,
|
|
35
|
+
{
|
|
36
|
+
size: 16,
|
|
37
|
+
className: 'tw-hidden tw-opacity-0 group-data-[state="checked"]:tw-block group-data-[state="checked"]:tw-opacity-100 tw-transition-opacity',
|
|
38
|
+
"data-test-id": "icon-checked"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] })
|
|
42
|
+
}
|
|
43
|
+
), x = k(f);
|
|
44
|
+
x.displayName = "Checkbox";
|
|
46
45
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
V as ForwardedRefColorPicker
|
|
46
|
+
x as Checkbox,
|
|
47
|
+
f as CheckboxComponent
|
|
50
48
|
};
|
|
51
49
|
//# sourceMappingURL=fondue-components6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components6.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components6.js","sources":["../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconMinus } from '@frontify/fondue-icons';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { forwardRef, type FormEvent, type ForwardedRef } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { checkboxIndicatorStyles, checkboxStyles } from './styles/checkboxStyles';\n\nexport type CheckboxProps = {\n id?: string;\n name?: string;\n /**\n * The default value of the checkbox\n * Used for uncontrolled components\n * @default false\n */\n defaultValue?: boolean | 'indeterminate';\n /**\n * The controlled value of the checkbox\n * @default false\n */\n value?: boolean | 'indeterminate';\n /**\n * The size of the checkbox\n * @default \"default\"\n */\n size?: 'default' | 'large';\n /**\n * The emphasis of the checkbox\n * @default \"default\"\n */\n emphasis?: 'default' | 'weak';\n /**\n * Disable the checkbox\n * @default false\n */\n disabled?: boolean;\n /**\n * Make the checkbox required in form\n * @default false\n */\n required?: boolean;\n /**\n * Make the checkbox read-only\n * @default false\n */\n readOnly?: boolean;\n className?: string;\n /**\n * Event handler called when the checkbox value changes\n */\n onChange?: (event: FormEvent<HTMLButtonElement>) => void;\n /**\n * Event handler called when the checkbox is blurred\n */\n onBlur?: (event: FormEvent<HTMLButtonElement>) => void;\n /**\n * Event handler called when the checkbox is focused\n */\n onFocus?: (event: FormEvent<HTMLButtonElement>) => void;\n 'data-test-id'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\n\nexport const CheckboxComponent = (\n {\n className,\n value,\n onChange,\n defaultValue,\n 'data-test-id': dataTestId = 'fondue-checkbox',\n ...props\n }: CheckboxProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n checked={value}\n defaultChecked={defaultValue}\n className={cn(checkboxStyles(props), className)}\n onClick={onChange}\n data-test-id={dataTestId}\n {...props}\n >\n <CheckboxPrimitive.Indicator className={checkboxIndicatorStyles}>\n <IconMinus\n size={16}\n className='tw-hidden tw-opacity-0 group-data-[state=\"indeterminate\"]:tw-block group-data-[state=\"indeterminate\"]:tw-opacity-100 tw-transition-opacity'\n data-test-id=\"icon-indeterminate\"\n />\n\n <IconCheckMark\n size={16}\n className='tw-hidden tw-opacity-0 group-data-[state=\"checked\"]:tw-block group-data-[state=\"checked\"]:tw-opacity-100 tw-transition-opacity'\n data-test-id=\"icon-checked\"\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n};\n\nexport const Checkbox = forwardRef<HTMLButtonElement, CheckboxProps>(CheckboxComponent);\nCheckbox.displayName = 'Checkbox';\n"],"names":["CheckboxComponent","className","value","onChange","defaultValue","dataTestId","props","ref","jsx","CheckboxPrimitive","cn","checkboxStyles","jsxs","checkboxIndicatorStyles","IconMinus","IconCheckMark","Checkbox","forwardRef"],"mappings":";;;;;;AAoEO,MAAMA,IAAoB,CAC7B;AAAA,EACI,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MAGI,gBAAAC;AAAA,EAACC,EAAkB;AAAA,EAAlB;AAAA,IACG,KAAAF;AAAA,IACA,SAASL;AAAA,IACT,gBAAgBE;AAAA,IAChB,WAAWM,EAAGC,EAAeL,CAAK,GAAGL,CAAS;AAAA,IAC9C,SAASE;AAAA,IACT,gBAAcE;AAAA,IACb,GAAGC;AAAA,IAEJ,UAAC,gBAAAM,EAAAH,EAAkB,WAAlB,EAA4B,WAAWI,GACpC,UAAA;AAAA,MAAA,gBAAAL;AAAA,QAACM;AAAA,QAAA;AAAA,UACG,MAAM;AAAA,UACN,WAAU;AAAA,UACV,gBAAa;AAAA,QAAA;AAAA,MACjB;AAAA,MAEA,gBAAAN;AAAA,QAACO;AAAA,QAAA;AAAA,UACG,MAAM;AAAA,UACN,WAAU;AAAA,UACV,gBAAa;AAAA,QAAA;AAAA,MAAA;AAAA,IACjB,EACJ,CAAA;AAAA,EAAA;AACJ,GAIKC,IAAWC,EAA6CjB,CAAiB;AACtFgB,EAAS,cAAc;"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
t
|
|
6
|
-
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheckMark as l } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as c } from "react";
|
|
4
|
+
import o from "./fondue-components63.js";
|
|
5
|
+
const d = ({ "data-test-id": t = "fondue-select-item", ...e }, r) => /* @__PURE__ */ i("li", { "data-test-id": t, ref: r, ...e, children: [
|
|
6
|
+
/* @__PURE__ */ a("div", { className: o.itemValue, children: e.children }),
|
|
7
|
+
/* @__PURE__ */ a(l, { className: o.checkmarkIcon })
|
|
8
|
+
] });
|
|
9
|
+
d.displayName = "Select.Item";
|
|
10
|
+
const I = c(d), m = ({ children: t, groupId: e, "data-test-id": r = "fondue-select-item-group" }, s) => /* @__PURE__ */ a("div", { "data-test-id": r, className: o.group, ref: s, children: t }, e);
|
|
11
|
+
m.displayName = "Select.Group";
|
|
12
|
+
const S = c(m);
|
|
7
13
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
I as ForwardedRefSelectItem,
|
|
15
|
+
S as ForwardedRefSelectItemGroup,
|
|
16
|
+
d as SelectItem,
|
|
17
|
+
m as SelectItemGroup
|
|
10
18
|
};
|
|
11
19
|
//# sourceMappingURL=fondue-components60.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components60.js","sources":["../src/components/Select/
|
|
1
|
+
{"version":3,"file":"fondue-components60.js","sources":["../src/components/Select/SelectItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark } from '@frontify/fondue-icons';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectItemProps = {\n /**\n * The value of the select item.\n */\n value: string;\n /**\n * The data test id of the select item.\n */\n 'data-test-id'?: string;\n} & (\n | {\n /**\n * The label of the select item. Required when the child is not a string.\n */\n label: string;\n /**\n * The children of the select item. This can be a custom component or a string.\n */\n children?: ReactNode;\n }\n | {\n label?: string;\n children: string;\n }\n);\n\nexport const SelectItem = (\n { 'data-test-id': dataTestId = 'fondue-select-item', ...props }: SelectItemProps,\n forwardedRef?: ForwardedRef<HTMLLIElement>,\n) => {\n return (\n <li data-test-id={dataTestId} ref={forwardedRef} {...props}>\n <div className={styles.itemValue}>{props.children}</div>\n <IconCheckMark className={styles.checkmarkIcon} />\n </li>\n );\n};\nSelectItem.displayName = 'Select.Item';\n\nexport const ForwardedRefSelectItem = forwardRef<HTMLLIElement, SelectItemProps>(SelectItem);\n\nexport type SelectItemGroupProps = {\n /**\n * The children of the select item group. This can contain multiple `Select.Item` components.\n */\n children: ReactNode;\n /**\n * The internal group ID of the select item group.\n */\n groupId: string;\n /**\n * The data test id of the select item group.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectItemGroup = (\n { children, groupId, 'data-test-id': dataTestId = 'fondue-select-item-group' }: SelectItemGroupProps,\n forwardedRef?: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} className={styles.group} ref={forwardedRef} key={groupId}>\n {children}\n </div>\n );\n};\nSelectItemGroup.displayName = 'Select.Group';\n\nexport const ForwardedRefSelectItemGroup = forwardRef<HTMLDivElement, SelectItemGroupProps>(SelectItemGroup);\n"],"names":["SelectItem","dataTestId","props","forwardedRef","jsx","styles","IconCheckMark","ForwardedRefSelectItem","forwardRef","SelectItemGroup","children","groupId","ForwardedRefSelectItemGroup"],"mappings":";;;;AAiCa,MAAAA,IAAa,CACtB,EAAE,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9DC,wBAGK,MAAG,EAAA,gBAAcF,GAAY,KAAKE,GAAe,GAAGD,GACjD,UAAA;AAAA,EAAA,gBAAAE,EAAC,OAAI,EAAA,WAAWC,EAAO,WAAY,YAAM,UAAS;AAAA,EACjD,gBAAAD,EAAAE,GAAA,EAAc,WAAWD,EAAO,cAAe,CAAA;AAAA,GACpD;AAGRL,EAAW,cAAc;AAEZ,MAAAO,IAAyBC,EAA2CR,CAAU,GAiB9ES,IAAkB,CAC3B,EAAE,UAAAC,GAAU,SAAAC,GAAS,gBAAgBV,IAAa,2BAA2B,GAC7EE,MAGI,gBAAAC,EAAC,OAAI,EAAA,gBAAcH,GAAY,WAAWI,EAAO,OAAO,KAAKF,GACxD,UAAAO,EAAA,GAD2EC,CAEhF;AAGRF,EAAgB,cAAc;AAEjB,MAAAG,IAA8BJ,EAAiDC,CAAe;"}
|
|
@@ -1,36 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "@radix-ui/react-popover";
|
|
3
|
+
import { Slot as g } from "@radix-ui/react-slot";
|
|
4
|
+
import { isValidElement as C } from "react";
|
|
5
|
+
import { useFondueTheme as N, ThemeProvider as O } from "./fondue-components28.js";
|
|
6
|
+
import n from "./fondue-components63.js";
|
|
7
|
+
import { recursiveMap as V, getSelectOptionValue as F } from "./fondue-components78.js";
|
|
8
|
+
const M = ({
|
|
9
|
+
highlightedIndex: l,
|
|
10
|
+
getMenuProps: p,
|
|
11
|
+
getItemProps: u,
|
|
12
|
+
children: m,
|
|
13
|
+
filterText: f,
|
|
14
|
+
align: c,
|
|
15
|
+
side: d,
|
|
16
|
+
selectedItem: t,
|
|
17
|
+
hasInteractedSinceOpening: h
|
|
18
|
+
}) => {
|
|
19
|
+
const v = (e) => {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
}, P = N();
|
|
22
|
+
return /* @__PURE__ */ o(s.Portal, { children: /* @__PURE__ */ o(O, { theme: P, children: /* @__PURE__ */ o(
|
|
23
|
+
s.Content,
|
|
24
|
+
{
|
|
25
|
+
align: c,
|
|
26
|
+
side: d,
|
|
27
|
+
collisionPadding: 16,
|
|
28
|
+
onOpenAutoFocus: v,
|
|
29
|
+
className: n.portal,
|
|
30
|
+
children: /* @__PURE__ */ o(
|
|
31
|
+
"ul",
|
|
32
|
+
{
|
|
33
|
+
className: n.menu,
|
|
34
|
+
...p({}, { suppressRefError: !0 }),
|
|
35
|
+
"data-has-interacted": h ? "true" : "false",
|
|
36
|
+
"data-test-id": "fondue-select-menu",
|
|
37
|
+
children: V(
|
|
38
|
+
m,
|
|
39
|
+
(e, i) => {
|
|
40
|
+
if (((r) => (
|
|
41
|
+
// @ts-expect-error - We are explicitly checking for ref
|
|
42
|
+
C(r) && r.ref !== void 0
|
|
43
|
+
))(e)) {
|
|
44
|
+
const r = F(e.props), a = u({
|
|
45
|
+
item: r,
|
|
46
|
+
index: i,
|
|
47
|
+
...e.ref ? { ref: e.ref } : {}
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ o(
|
|
50
|
+
g,
|
|
51
|
+
{
|
|
52
|
+
className: n.item,
|
|
53
|
+
"data-highlighted": l === i,
|
|
54
|
+
"data-selected": (t == null ? void 0 : t.value) === r.value,
|
|
55
|
+
onTouchStart: (S) => {
|
|
56
|
+
a.onClick && a.onClick(S);
|
|
57
|
+
},
|
|
58
|
+
...a,
|
|
59
|
+
children: e
|
|
60
|
+
},
|
|
61
|
+
e.props.value
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
f
|
|
66
|
+
).parsedChildren
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
) }) });
|
|
17
71
|
};
|
|
72
|
+
M.displayName = "Select.Menu";
|
|
18
73
|
export {
|
|
19
|
-
|
|
20
|
-
y as checkmarkIcon,
|
|
21
|
-
e as clear,
|
|
22
|
-
p as default,
|
|
23
|
-
m as group,
|
|
24
|
-
r as iconError,
|
|
25
|
-
s as iconSuccess,
|
|
26
|
-
a as icons,
|
|
27
|
-
_ as input,
|
|
28
|
-
i as item,
|
|
29
|
-
j as itemValue,
|
|
30
|
-
l as menu,
|
|
31
|
-
u as portal,
|
|
32
|
-
c as root,
|
|
33
|
-
o as selectedValue,
|
|
34
|
-
t as slot
|
|
74
|
+
M as SelectMenu
|
|
35
75
|
};
|
|
36
76
|
//# sourceMappingURL=fondue-components61.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components61.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components61.js","sources":["../src/components/Select/SelectMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { type UseComboboxPropGetters, type UseSelectPropGetters } from 'downshift';\nimport { isValidElement, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuProps = {\n /**\n * @internal\n * The index of the highlighted item in the menu.\n */\n highlightedIndex: number;\n /**\n * @internal\n * Callback function to retrieve the props for a menu element.\n */\n getMenuProps: UseSelectPropGetters<unknown>['getMenuProps'] | UseComboboxPropGetters<unknown>['getMenuProps'];\n /**\n * @internal\n * Callback function to retrieve the props for a item element.\n */\n getItemProps: UseSelectPropGetters<unknown>['getItemProps'] | UseComboboxPropGetters<unknown>['getItemProps'];\n /**\n * @internal\n * The children of the menu component. This can contain multiple `Select.Item` or `Select.Group` components.\n */\n children: ReactNode;\n /**\n * @internal\n * The filter text shown in the combobox input element.\n */\n filterText?: string;\n /**\n * @internal\n * The alignment of the menu.\n */\n align: 'start' | 'center' | 'end';\n /**\n * @internal\n * Defines the preferred side of the select. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side: 'left' | 'right' | 'bottom' | 'top';\n /**\n * @internal\n * The type of the menu.\n */\n selectedItem?: {\n value: string;\n } | null;\n /**\n * @internal\n * A boolean to indicate if highlighted item was changed since opening the menu.\n * This is used to determine the style of the selected/highlighted item.\n */\n hasInteractedSinceOpening?: boolean;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n align,\n side,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n };\n\n const theme = useFondueTheme();\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme}>\n <RadixPopover.Content\n align={align}\n side={side}\n collisionPadding={16}\n onOpenAutoFocus={handleOnOpenAutoFocus}\n className={styles.portal}\n >\n <ul\n className={styles.menu}\n // TODO: fix this accessibility issue\n // We are mounting/unmounting the menu on open/close\n // We should instead toggle its visibility for accessibility reasons\n // https://github.com/downshift-js/downshift?tab=readme-ov-file#getmenuprops\n {...getMenuProps({}, { suppressRefError: true })}\n data-has-interacted={hasInteractedSinceOpening ? 'true' : 'false'}\n data-test-id=\"fondue-select-menu\"\n >\n {\n recursiveMap(\n children,\n (child, index) => {\n const isValid = <TProps,>(\n child: ReactNode,\n ): child is ReactElement<TProps> & { ref: ForwardedRef<HTMLElement> } =>\n // @ts-expect-error - We are explicitly checking for ref\n isValidElement<TProps>(child) && child.ref !== undefined;\n\n if (isValid<SelectItemProps>(child)) {\n const optionData = getSelectOptionValue(child.props);\n const itemProps = getItemProps({\n item: optionData,\n index,\n ...(child.ref ? { ref: child.ref } : {}),\n });\n\n return (\n <RadixSlot\n className={styles.item}\n data-highlighted={highlightedIndex === index}\n data-selected={selectedItem?.value === optionData.value}\n key={child.props.value}\n // Workaround for the issue where the onClick event is not fired on touch devices because of portal usage\n onTouchStart={(event) => {\n if (itemProps.onClick) {\n itemProps.onClick(event as unknown as MouseEvent<HTMLElement>);\n }\n }}\n {...itemProps}\n >\n {child}\n </RadixSlot>\n );\n }\n },\n filterText,\n ).parsedChildren\n }\n </ul>\n </RadixPopover.Content>\n </ThemeProvider>\n </RadixPopover.Portal>\n );\n};\nSelectMenu.displayName = 'Select.Menu';\n"],"names":["SelectMenu","highlightedIndex","getMenuProps","getItemProps","children","filterText","align","side","selectedItem","hasInteractedSinceOpening","handleOnOpenAutoFocus","event","theme","useFondueTheme","RadixPopover","jsx","ThemeProvider","styles","recursiveMap","child","index","isValidElement","optionData","getSelectOptionValue","itemProps","RadixSlot"],"mappings":";;;;;;;AAiEO,MAAMA,IAAa,CAAC;AAAA,EACvB,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,2BAAAC;AACJ,MAAuB;AACb,QAAAC,IAAwB,CAACC,MAAiB;AAC5C,IAAAA,EAAM,eAAe;AAAA,EAC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A,KAER,EACJ,CAAA;AAER;AACAL,EAAW,cAAc;"}
|
|
@@ -1,52 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const S = (r) => {
|
|
8
|
-
const t = [];
|
|
9
|
-
return f.forEach(r, (o) => {
|
|
10
|
-
if (u(o) && o.type === I)
|
|
11
|
-
t.push(R(o.props));
|
|
12
|
-
else if (u(o) && o.props.children) {
|
|
13
|
-
const a = S(o.props.children);
|
|
14
|
-
for (const l of a)
|
|
15
|
-
t.push(l);
|
|
16
|
-
}
|
|
17
|
-
}), t;
|
|
18
|
-
}, z = (r) => {
|
|
19
|
-
const [t, o] = B(""), { inputSlots: a, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
|
-
const s = [], n = [];
|
|
21
|
-
let m;
|
|
22
|
-
f.toArray(r).some(
|
|
23
|
-
(e) => u(e) && e.type === c
|
|
24
|
-
) ? f.forEach(r, (e) => {
|
|
25
|
-
u(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
|
-
}) : n.push(r);
|
|
27
|
-
const g = S(n);
|
|
28
|
-
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
29
|
-
}, [r]), y = i(
|
|
30
|
-
() => p.filter(
|
|
31
|
-
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
|
-
),
|
|
33
|
-
[p, t]
|
|
34
|
-
), C = F(
|
|
35
|
-
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
|
-
[p]
|
|
37
|
-
);
|
|
38
|
-
return {
|
|
39
|
-
items: y,
|
|
40
|
-
menuSlots: l,
|
|
41
|
-
filterText: t,
|
|
42
|
-
inputSlots: a,
|
|
43
|
-
clearButton: V,
|
|
44
|
-
setFilterText: o,
|
|
45
|
-
getItemByValue: C
|
|
46
|
-
};
|
|
47
|
-
};
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import m from "./fondue-components63.js";
|
|
4
|
+
const t = ({ children: e, name: o, "data-test-id": r = "fondue-select-slot", ...a }, s) => /* @__PURE__ */ l("div", { "data-test-id": r, ref: s, className: m.slot, "data-name": o, ...a, children: e });
|
|
5
|
+
t.displayName = "Select.Slot";
|
|
6
|
+
const S = d(t);
|
|
48
7
|
export {
|
|
49
|
-
S as
|
|
50
|
-
|
|
8
|
+
S as ForwardedRefSelectSlot,
|
|
9
|
+
t as SelectSlot
|
|
51
10
|
};
|
|
52
11
|
//# sourceMappingURL=fondue-components62.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components62.js","sources":["../src/components/Select/
|
|
1
|
+
{"version":3,"file":"fondue-components62.js","sources":["../src/components/Select/SelectSlot.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectSlotProps = {\n /**\n * The children of the select slot. This can be a custom component.\n */\n children?: ReactNode;\n /**\n * The slot name that is used to determine the placement.\n */\n name: 'menu' | 'left' | 'right' | 'clear';\n /**\n * The data test id of the select slot.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-select-slot', ...props }: SelectSlotProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={forwardedRef} className={styles.slot} data-name={name} {...props}>\n {children}\n </div>\n );\n};\nSelectSlot.displayName = 'Select.Slot';\n\nexport const ForwardedRefSelectSlot = forwardRef<HTMLDivElement, SelectSlotProps>(SelectSlot);\n"],"names":["SelectSlot","children","name","dataTestId","props","forwardedRef","jsx","styles","ForwardedRefSelectSlot","forwardRef"],"mappings":";;;AAqBa,MAAAA,IAAa,CACtB,EAAE,UAAAC,GAAU,MAAAC,GAAM,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9EC,MAGK,gBAAAC,EAAA,OAAA,EAAI,gBAAcH,GAAY,KAAKE,GAAc,WAAWE,EAAO,MAAM,aAAWL,GAAO,GAAGE,GAC1F,UAAAH,GACL;AAGRD,EAAW,cAAc;AAEZ,MAAAQ,IAAyBC,EAA4CT,CAAU;"}
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const c = "_root_1m2qz_7", o = "_selectedValue_1m2qz_69", _ = "_input_1m2qz_82", t = "_slot_1m2qz_108", e = "_clear_1m2qz_160", n = "_icons_1m2qz_173", s = "_caret_1m2qz_179", r = "_iconSuccess_1m2qz_207", m = "_iconError_1m2qz_213", a = "_menu_1m2qz_219", l = "_portal_1m2qz_242", u = "_item_1m2qz_258", i = "_checkmarkIcon_1m2qz_299", q = "_itemValue_1m2qz_306", z = "_group_1m2qz_320", p = {
|
|
2
|
+
root: c,
|
|
3
|
+
selectedValue: o,
|
|
4
|
+
input: _,
|
|
5
|
+
slot: t,
|
|
6
|
+
clear: e,
|
|
7
|
+
icons: n,
|
|
8
|
+
caret: s,
|
|
9
|
+
iconSuccess: r,
|
|
10
|
+
iconError: m,
|
|
11
|
+
menu: a,
|
|
12
|
+
portal: l,
|
|
13
|
+
item: u,
|
|
14
|
+
checkmarkIcon: i,
|
|
15
|
+
itemValue: q,
|
|
16
|
+
group: z
|
|
6
17
|
};
|
|
7
18
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
s as caret,
|
|
20
|
+
i as checkmarkIcon,
|
|
21
|
+
e as clear,
|
|
22
|
+
p as default,
|
|
23
|
+
z as group,
|
|
24
|
+
m as iconError,
|
|
25
|
+
r as iconSuccess,
|
|
26
|
+
n as icons,
|
|
27
|
+
_ as input,
|
|
28
|
+
u as item,
|
|
29
|
+
q as itemValue,
|
|
30
|
+
a as menu,
|
|
31
|
+
l as portal,
|
|
32
|
+
c as root,
|
|
33
|
+
o as selectedValue,
|
|
34
|
+
t as slot
|
|
13
35
|
};
|
|
14
36
|
//# sourceMappingURL=fondue-components63.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as x } from "@frontify/fondue-icons";
|
|
3
|
+
import { useState as B, useMemo as i, Children as f, isValidElement as u, cloneElement as E, useCallback as F } from "react";
|
|
4
|
+
import { ForwardedRefSelectItem as I } from "./fondue-components60.js";
|
|
5
|
+
import { ForwardedRefSelectSlot as c } from "./fondue-components62.js";
|
|
6
|
+
import { getSelectOptionValue as R } from "./fondue-components78.js";
|
|
7
|
+
const S = (r) => {
|
|
8
|
+
const t = [];
|
|
9
|
+
return f.forEach(r, (o) => {
|
|
10
|
+
if (u(o) && o.type === I)
|
|
11
|
+
t.push(R(o.props));
|
|
12
|
+
else if (u(o) && o.props.children) {
|
|
13
|
+
const a = S(o.props.children);
|
|
14
|
+
for (const l of a)
|
|
15
|
+
t.push(l);
|
|
16
|
+
}
|
|
17
|
+
}), t;
|
|
18
|
+
}, z = (r) => {
|
|
19
|
+
const [t, o] = B(""), { inputSlots: a, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
|
+
const s = [], n = [];
|
|
21
|
+
let m;
|
|
22
|
+
f.toArray(r).some(
|
|
23
|
+
(e) => u(e) && e.type === c
|
|
24
|
+
) ? f.forEach(r, (e) => {
|
|
25
|
+
u(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
|
+
}) : n.push(r);
|
|
27
|
+
const g = S(n);
|
|
28
|
+
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
29
|
+
}, [r]), y = i(
|
|
30
|
+
() => p.filter(
|
|
31
|
+
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
|
+
),
|
|
33
|
+
[p, t]
|
|
34
|
+
), C = F(
|
|
35
|
+
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
|
+
[p]
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
items: y,
|
|
40
|
+
menuSlots: l,
|
|
41
|
+
filterText: t,
|
|
42
|
+
inputSlots: a,
|
|
43
|
+
clearButton: V,
|
|
44
|
+
setFilterText: o,
|
|
45
|
+
getItemByValue: C
|
|
46
|
+
};
|
|
7
47
|
};
|
|
8
48
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_ as medium,
|
|
12
|
-
m as root,
|
|
13
|
-
t as small,
|
|
14
|
-
r as thumb
|
|
49
|
+
S as getRecursiveOptionValues,
|
|
50
|
+
z as useSelectData
|
|
15
51
|
};
|
|
16
52
|
//# sourceMappingURL=fondue-components64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components64.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components64.js","sources":["../src/components/Select/useSelectData.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport { Children, cloneElement, isValidElement, useCallback, useMemo, useState, type ReactNode } from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\nimport { ForwardedRefSelectSlot, type SelectSlotProps } from './SelectSlot';\nimport { getSelectOptionValue } from './utils';\n\nexport type SelectItemType = {\n value: string;\n label: string;\n};\n\n/**\n * Recursively extracts option values from children.\n * This function traverses through the React component tree and collects all SelectItem values.\n *\n * @param {ReactNode} children - The React children to extract values from.\n * @returns {SelectItemType[]} An array of SelectItemType objects.\n *\n * @example\n * const options = (\n * <SelectItem value=\"1\">Option 1</SelectItem>\n * <SelectItem value=\"2\">Option 2</SelectItem>\n * );\n * const values = getRecursiveOptionValues(options);\n * // Returns: [{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]\n */\nexport const getRecursiveOptionValues = (children: ReactNode): { value: string; label: string }[] => {\n const values: { value: string; label: string }[] = [];\n Children.forEach(children, (child) => {\n if (isValidElement<SelectItemProps>(child) && child.type === ForwardedRefSelectItem) {\n values.push(getSelectOptionValue(child.props));\n } else if (isValidElement<{ children: ReactNode }>(child) && child.props.children) {\n const optionValues = getRecursiveOptionValues(child.props.children);\n for (const optionValue of optionValues) {\n values.push(optionValue);\n }\n }\n });\n return values;\n};\n\n/**\n * Custom hook for managing select data and filtering.\n *\n * @param {ReactNode} children - The React children to process, typically SelectItem components.\n * @returns {Object} An object containing the processed data.\n */\nexport const useSelectData = (children: ReactNode) => {\n const [filterText, setFilterText] = useState('');\n const { inputSlots, menuSlots, itemValues, clearButton } = useMemo(() => {\n const inputSlots: ReactNode[] = [];\n const menuSlots: ReactNode[] = [];\n let clearButton: ReactNode;\n\n const hasSlots = Children.toArray(children).some(\n (child) => isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot,\n );\n\n if (hasSlots) {\n Children.forEach(children, (child) => {\n if (isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot) {\n if (child.props.name === 'menu') {\n menuSlots.push(child.props.children);\n } else if (child.props.name === 'left' || child.props.name === 'right') {\n inputSlots.push(child);\n } else if (child.props.name === 'clear') {\n if (child.props.children) {\n clearButton = child;\n } else {\n clearButton = cloneElement(child, { children: <IconCross size={16} /> });\n }\n }\n }\n });\n } else {\n menuSlots.push(children);\n }\n\n const itemValues = getRecursiveOptionValues(menuSlots);\n\n return { inputSlots, menuSlots, itemValues, clearButton };\n }, [children]);\n\n const items = useMemo(\n () =>\n itemValues.filter(\n (item) => filterText === '' || item.label.toLowerCase().includes(filterText.toLowerCase()),\n ),\n [itemValues, filterText],\n );\n\n const getItemByValue = useCallback(\n (value?: string | null) => (value ? itemValues.find((item) => item.value === value) : undefined),\n [itemValues],\n );\n\n return {\n items,\n menuSlots,\n filterText,\n inputSlots,\n clearButton,\n setFilterText,\n getItemByValue,\n };\n};\n"],"names":["getRecursiveOptionValues","children","values","Children","child","isValidElement","ForwardedRefSelectItem","getSelectOptionValue","optionValues","optionValue","useSelectData","filterText","setFilterText","useState","inputSlots","menuSlots","itemValues","clearButton","useMemo","ForwardedRefSelectSlot","cloneElement","IconCross","items","item","getItemByValue","useCallback","value"],"mappings":";;;;;;AA6Ba,MAAAA,IAA2B,CAACC,MAA4D;AACjG,QAAMC,IAA6C,CAAC;AAC3C,SAAAC,EAAA,QAAQF,GAAU,CAACG,MAAU;AAClC,QAAIC,EAAgCD,CAAK,KAAKA,EAAM,SAASE;AACzD,MAAAJ,EAAO,KAAKK,EAAqBH,EAAM,KAAK,CAAC;AAAA,aACtCC,EAAwCD,CAAK,KAAKA,EAAM,MAAM,UAAU;AAC/E,YAAMI,IAAeR,EAAyBI,EAAM,MAAM,QAAQ;AAClE,iBAAWK,KAAeD;AACtB,QAAAN,EAAO,KAAKO,CAAW;AAAA,IAC3B;AAAA,EACJ,CACH,GACMP;AACX,GAQaQ,IAAgB,CAACT,MAAwB;AAClD,QAAM,CAACU,GAAYC,CAAa,IAAIC,EAAS,EAAE,GACzC,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,GAAY,aAAA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