@raystack/apsara 0.48.1 → 0.48.3
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/components/avatar/avatar.cjs +2 -3
- package/dist/components/avatar/avatar.cjs.map +1 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +3 -4
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb-item.cjs +26 -0
- package/dist/components/breadcrumb/breadcrumb-item.cjs.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +14 -0
- package/dist/components/breadcrumb/breadcrumb-item.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-item.js +24 -0
- package/dist/components/breadcrumb/breadcrumb-item.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-misc.cjs +20 -0
- package/dist/components/breadcrumb/breadcrumb-misc.cjs.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-misc.d.ts +8 -0
- package/dist/components/breadcrumb/breadcrumb-misc.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-misc.js +17 -0
- package/dist/components/breadcrumb/breadcrumb-misc.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-root.cjs +25 -0
- package/dist/components/breadcrumb/breadcrumb-root.cjs.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-root.d.ts +10 -0
- package/dist/components/breadcrumb/breadcrumb-root.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-root.js +23 -0
- package/dist/components/breadcrumb/breadcrumb-root.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.cjs +7 -53
- package/dist/components/breadcrumb/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +5 -27
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +7 -53
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.module.css.cjs +1 -1
- package/dist/components/breadcrumb/breadcrumb.module.css.js +1 -1
- package/dist/components/breadcrumb/index.d.ts +1 -1
- package/dist/components/calendar/calendar.cjs +12 -13
- package/dist/components/calendar/calendar.cjs.map +1 -1
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/calendar.js +13 -14
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/checkbox/checkbox.cjs +1 -2
- package/dist/components/checkbox/checkbox.cjs.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -3
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/data-table/components/content.cjs +8 -8
- package/dist/components/data-table/components/content.cjs.map +1 -1
- package/dist/components/data-table/components/content.js +3 -3
- package/dist/components/data-table/components/content.js.map +1 -1
- package/dist/components/data-table/components/toolbar.cjs +2 -2
- package/dist/components/data-table/components/toolbar.cjs.map +1 -1
- package/dist/components/data-table/components/toolbar.d.ts.map +1 -1
- package/dist/components/data-table/components/toolbar.js +2 -2
- package/dist/components/data-table/components/toolbar.js.map +1 -1
- package/dist/components/dialog/dialog.cjs +7 -8
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +8 -9
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-misc.cjs +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-misc.cjs.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-misc.js +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-misc.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-root.cjs +10 -10
- package/dist/components/dropdown-menu/dropdown-menu-root.cjs.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +8 -5
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-root.js +11 -11
- package/dist/components/dropdown-menu/dropdown-menu-root.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-trigger.cjs +6 -2
- package/dist/components/dropdown-menu/dropdown-menu-trigger.cjs.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +1 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-trigger.js +6 -2
- package/dist/components/dropdown-menu/dropdown-menu-trigger.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/empty-state/empty-state.cjs +5 -5
- package/dist/components/empty-state/empty-state.cjs.map +1 -1
- package/dist/components/empty-state/empty-state.d.ts +3 -3
- package/dist/components/empty-state/empty-state.d.ts.map +1 -1
- package/dist/components/empty-state/empty-state.js +5 -5
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/filter-chip/filter-chip-operation.cjs +24 -0
- package/dist/components/filter-chip/filter-chip-operation.cjs.map +1 -0
- package/dist/components/filter-chip/filter-chip-operation.d.ts +10 -0
- package/dist/components/filter-chip/filter-chip-operation.d.ts.map +1 -0
- package/dist/components/filter-chip/filter-chip-operation.js +22 -0
- package/dist/components/filter-chip/filter-chip-operation.js.map +1 -0
- package/dist/components/filter-chip/filter-chip.cjs +31 -43
- package/dist/components/filter-chip/filter-chip.cjs.map +1 -1
- package/dist/components/filter-chip/filter-chip.d.ts +6 -5
- package/dist/components/filter-chip/filter-chip.d.ts.map +1 -1
- package/dist/components/filter-chip/filter-chip.js +31 -43
- package/dist/components/filter-chip/filter-chip.js.map +1 -1
- package/dist/components/filter-chip/filter-chip.module.css.cjs +1 -1
- package/dist/components/filter-chip/filter-chip.module.css.js +1 -1
- package/dist/components/input-field/input-field.cjs +12 -13
- package/dist/components/input-field/input-field.cjs.map +1 -1
- package/dist/components/input-field/input-field.d.ts +4 -4
- package/dist/components/input-field/input-field.d.ts.map +1 -1
- package/dist/components/input-field/input-field.js +13 -14
- package/dist/components/input-field/input-field.js.map +1 -1
- package/dist/components/select/select-item.cjs +2 -1
- package/dist/components/select/select-item.cjs.map +1 -1
- package/dist/components/select/select-item.d.ts.map +1 -1
- package/dist/components/select/select-item.js +2 -1
- package/dist/components/select/select-item.js.map +1 -1
- package/dist/components/select/select-root.cjs +2 -2
- package/dist/components/select/select-root.cjs.map +1 -1
- package/dist/components/select/select-root.d.ts.map +1 -1
- package/dist/components/select/select-root.js +2 -2
- package/dist/components/select/select-root.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs +2 -3
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar.js +3 -4
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/skeleton/skeleton.cjs +3 -3
- package/dist/components/skeleton/skeleton.cjs.map +1 -1
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +3 -3
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/text-area/text-area.cjs +4 -5
- package/dist/components/text-area/text-area.cjs.map +1 -1
- package/dist/components/text-area/text-area.d.ts +2 -2
- package/dist/components/text-area/text-area.d.ts.map +1 -1
- package/dist/components/text-area/text-area.js +4 -5
- package/dist/components/text-area/text-area.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
|
|
2
2
|
import { MenuProvider } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/menu/menu-provider.js';
|
|
3
3
|
import { ComboboxProvider } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js';
|
|
4
|
-
import { createContext, useContext, useState } from 'react';
|
|
4
|
+
import { createContext, useContext, useState, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
Root context to manage the Dropdown control
|
|
@@ -13,35 +13,35 @@ const useDropdownContext = () => {
|
|
|
13
13
|
if (!context)
|
|
14
14
|
return {};
|
|
15
15
|
const shouldFilter = !!(context?.autocomplete &&
|
|
16
|
-
context?.autocompleteMode ===
|
|
16
|
+
context?.autocompleteMode === 'auto' &&
|
|
17
17
|
context?.searchValue?.length);
|
|
18
18
|
const shouldFilterParent = !!(context?.parent?.autocomplete &&
|
|
19
|
-
context?.parent?.autocompleteMode ===
|
|
19
|
+
context?.parent?.autocompleteMode === 'auto' &&
|
|
20
20
|
context?.parent?.searchValue?.length);
|
|
21
21
|
return {
|
|
22
22
|
...context,
|
|
23
23
|
shouldFilter,
|
|
24
24
|
parent: context?.parent && {
|
|
25
25
|
...context.parent,
|
|
26
|
-
shouldFilter: shouldFilterParent
|
|
27
|
-
}
|
|
26
|
+
shouldFilter: shouldFilterParent
|
|
27
|
+
}
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
const DropdownMenuRoot = ({ autocomplete, autocompleteMode =
|
|
30
|
+
const DropdownMenuRoot = ({ autocomplete, autocompleteMode = 'auto', searchValue: providedSearchValue, onSearch, focusLoop = true, defaultSearchValue = '', onOpenChange, ...props }) => {
|
|
31
31
|
const [internalSearchValue, setInternalSearchValue] = useState(defaultSearchValue);
|
|
32
32
|
const dropdownContext = useDropdownContext();
|
|
33
33
|
const searchValue = providedSearchValue ?? internalSearchValue;
|
|
34
|
-
const setValue = (value) => {
|
|
34
|
+
const setValue = useCallback((value) => {
|
|
35
35
|
setInternalSearchValue(value);
|
|
36
36
|
onSearch?.(value);
|
|
37
|
-
};
|
|
38
|
-
const element = jsxRuntimeExports.jsx(MenuProvider, { focusLoop: focusLoop, ...props });
|
|
37
|
+
}, [onSearch]);
|
|
38
|
+
const element = (jsxRuntimeExports.jsx(MenuProvider, { focusLoop: focusLoop, setOpen: onOpenChange, ...props }));
|
|
39
39
|
return (jsxRuntimeExports.jsx(DropdownContext.Provider, { value: {
|
|
40
40
|
autocomplete,
|
|
41
41
|
parent: dropdownContext,
|
|
42
42
|
autocompleteMode,
|
|
43
|
-
searchValue
|
|
44
|
-
}, children: autocomplete ? (jsxRuntimeExports.jsx(ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setValue: setValue, children: element })) : (element) }));
|
|
43
|
+
searchValue
|
|
44
|
+
}, children: autocomplete ? (jsxRuntimeExports.jsx(ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setOpen: onOpenChange, setValue: setValue, children: element })) : (element) }));
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export { DropdownContext, DropdownMenuRoot, useDropdownContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-root.js","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps
|
|
1
|
+
{"version":3,"file":"dropdown-menu-root.js","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps\n} from '@ariakit/react';\nimport { createContext, useCallback, useContext, useState } from 'react';\n\ninterface CommonProps {\n autocomplete?: boolean;\n autocompleteMode?: 'auto' | 'manual';\n searchValue?: string;\n}\n\ninterface DropdownContextValue extends CommonProps {\n parent?: CommonProps;\n}\n\ninterface UseDropdownContext extends DropdownContextValue {\n shouldFilter?: boolean;\n parent?: CommonProps & {\n shouldFilter?: boolean;\n };\n}\n\n/**\n Root context to manage the Dropdown control\n @remarks Only for internal usage.\n */\n\nexport const DropdownContext = createContext<DropdownContextValue | undefined>(\n undefined\n);\n\nexport const useDropdownContext = (): UseDropdownContext => {\n const context = useContext(DropdownContext);\n if (!context) return {};\n\n const shouldFilter = !!(\n context?.autocomplete &&\n context?.autocompleteMode === 'auto' &&\n context?.searchValue?.length\n );\n\n const shouldFilterParent = !!(\n context?.parent?.autocomplete &&\n context?.parent?.autocompleteMode === 'auto' &&\n context?.parent?.searchValue?.length\n );\n\n return {\n ...context,\n shouldFilter,\n parent: context?.parent && {\n ...context.parent,\n shouldFilter: shouldFilterParent\n }\n };\n};\n\nexport interface BaseMenuProviderProps\n extends Omit<MenuProviderProps, 'setOpen'> {\n onOpenChange?: MenuProviderProps['setOpen'];\n}\n\nexport interface NormalDropdownMenuRootProps extends BaseMenuProviderProps {\n autocomplete?: false;\n autocompleteMode?: never;\n searchValue?: never;\n onSearch?: never;\n defaultSearchValue?: never;\n}\n\nexport interface AutocompleteDropdownMenuRootProps\n extends BaseMenuProviderProps,\n CommonProps {\n autocomplete: true;\n onSearch?: (value: string) => void;\n defaultSearchValue?: string;\n}\n\nexport type DropdownMenuRootProps =\n | NormalDropdownMenuRootProps\n | AutocompleteDropdownMenuRootProps;\n\nexport const DropdownMenuRoot = ({\n autocomplete,\n autocompleteMode = 'auto',\n searchValue: providedSearchValue,\n onSearch,\n focusLoop = true,\n defaultSearchValue = '',\n onOpenChange,\n ...props\n}: DropdownMenuRootProps) => {\n const [internalSearchValue, setInternalSearchValue] =\n useState(defaultSearchValue);\n const dropdownContext = useDropdownContext();\n\n const searchValue = providedSearchValue ?? internalSearchValue;\n\n const setValue = useCallback(\n (value: string) => {\n setInternalSearchValue(value);\n onSearch?.(value);\n },\n [onSearch]\n );\n\n const element = (\n <MenuProvider focusLoop={focusLoop} setOpen={onOpenChange} {...props} />\n );\n\n return (\n <DropdownContext.Provider\n value={{\n autocomplete,\n parent: dropdownContext,\n autocompleteMode,\n searchValue\n }}\n >\n {autocomplete ? (\n <ComboboxProvider\n resetValueOnHide\n focusLoop={focusLoop}\n includesBaseElement={false}\n value={searchValue}\n setOpen={onO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GAAG,mBAAmB,IAAI,mBAAmB,CAAC;AAE/D,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAa,KAAI;QAChB,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC9B,QAAA,QAAQ,GAAG,KAAK,CAAC,CAAC;AACpB,KAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;AAEF,IAAA,MAAM,OAAO,IACXA,qBAAC,CAAA,YAAY,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,KAAM,KAAK,EAAA,CAAI,CACzE,CAAC;AAEF,IAAA,QACEA,qBAAC,CAAA,eAAe,CAAC,QAAQ,EAAA,EACvB,KAAK,EAAE;YACL,YAAY;AACZ,YAAA,MAAM,EAAE,eAAe;YACvB,gBAAgB;YAChB,WAAW;AACZ,SAAA,EAAA,QAAA,EAEA,YAAY,IACXA,qBAAA,CAAC,gBAAgB,EACf,EAAA,gBAAgB,EAChB,IAAA,EAAA,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,EAEjB,QAAA,EAAA,OAAO,GACS,KAEnB,OAAO,CACR,EAAA,CACwB,EAC3B;AACJ;;;;"}
|
|
@@ -9,8 +9,12 @@ var dropdownMenuRoot = require('./dropdown-menu-root.cjs');
|
|
|
9
9
|
var utils = require('./utils.cjs');
|
|
10
10
|
var index = require('../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs');
|
|
11
11
|
|
|
12
|
-
const DropdownMenuTrigger = React.forwardRef(({ children, asChild, ...props }, ref) => {
|
|
13
|
-
return (jsxRuntime.jsxRuntimeExports.jsx(menuButton.MenuButton, { ref: ref, render: asChild ? jsxRuntime.jsxRuntimeExports.jsx(index.Root, {}) : undefined,
|
|
12
|
+
const DropdownMenuTrigger = React.forwardRef(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {
|
|
13
|
+
return (jsxRuntime.jsxRuntimeExports.jsx(menuButton.MenuButton, { ref: ref, render: asChild ? jsxRuntime.jsxRuntimeExports.jsx(index.Root, {}) : undefined, onClick: (e) => {
|
|
14
|
+
if (stopPropagation)
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
onClick?.(e);
|
|
17
|
+
}, ...props, children: children }));
|
|
14
18
|
});
|
|
15
19
|
/**
|
|
16
20
|
* `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-trigger.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps
|
|
1
|
+
{"version":3,"file":"dropdown-menu-trigger.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { PointerEvent, forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {\n stopPropagation?: boolean;\n}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n onClick={(\n e: PointerEvent<HTMLButtonElement> & PointerEvent<HTMLDivElement>\n ) => {\n if (stopPropagation) e.stopPropagation();\n onClick?.(e);\n }}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["forwardRef","_jsx","MenuButton","Slot.Root","TriangleRightIcon","useDropdownContext","getMatch","DropdownMenuItem"],"mappings":";;;;;;;;;;;AAaa,MAAA,mBAAmB,GAAGA,gBAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1E,IAAA,QACEC,gCAAA,CAACC,qBAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGD,gCAAC,CAAAE,UAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAC3C,OAAO,EAAE,CACP,CAAiE,KAC/D;AACF,YAAA,IAAI,eAAe;gBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACzC,YAAA,OAAO,GAAG,CAAC,CAAC,CAAC;AACf,SAAC,KACG,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAGH,gBAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGC,gCAAA,CAACG,4BAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAGC,mCAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAACC,cAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEL,gCAAC,CAAAC,qBAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJD,gCAAA,CAACM,iCAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;;"}
|
|
@@ -2,6 +2,7 @@ import { MenuButtonProps } from '@ariakit/react';
|
|
|
2
2
|
import { DropdownMenuItemProps } from './dropdown-menu-item';
|
|
3
3
|
import { WithAsChild } from './types';
|
|
4
4
|
export interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {
|
|
5
|
+
stopPropagation?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const DropdownMenuTrigger: import("react").ForwardRefExoticComponent<Omit<DropdownMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
8
|
export interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-trigger.d.ts","sourceRoot":"","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"dropdown-menu-trigger.d.ts","sourceRoot":"","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,MAAM,WAAW,wBAAyB,SAAQ,WAAW,CAAC,eAAe,CAAC;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,qIAmB9B,CAAC;AAEH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;CAAG;AAE9E;;GAEG;AACH,eAAO,MAAM,uBAAuB,yIAiCnC,CAAC"}
|
|
@@ -7,8 +7,12 @@ import { useDropdownContext } from './dropdown-menu-root.js';
|
|
|
7
7
|
import { getMatch } from './utils.js';
|
|
8
8
|
import { Root as Slot } from '../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.js';
|
|
9
9
|
|
|
10
|
-
const DropdownMenuTrigger = forwardRef(({ children, asChild, ...props }, ref) => {
|
|
11
|
-
return (jsxRuntimeExports.jsx(MenuButton, { ref: ref, render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined,
|
|
10
|
+
const DropdownMenuTrigger = forwardRef(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {
|
|
11
|
+
return (jsxRuntimeExports.jsx(MenuButton, { ref: ref, render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, onClick: (e) => {
|
|
12
|
+
if (stopPropagation)
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
onClick?.(e);
|
|
15
|
+
}, ...props, children: children }));
|
|
12
16
|
});
|
|
13
17
|
/**
|
|
14
18
|
* `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu-trigger.js","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps
|
|
1
|
+
{"version":3,"file":"dropdown-menu-trigger.js","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { PointerEvent, forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {\n stopPropagation?: boolean;\n}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n onClick={(\n e: PointerEvent<HTMLButtonElement> & PointerEvent<HTMLDivElement>\n ) => {\n if (stopPropagation) e.stopPropagation();\n onClick?.(e);\n }}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["_jsx","Slot.Root","TriangleRightIcon"],"mappings":";;;;;;;;;AAaa,MAAA,mBAAmB,GAAG,UAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1E,IAAA,QACEA,qBAAA,CAAC,UAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGA,qBAAC,CAAAC,IAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAC3C,OAAO,EAAE,CACP,CAAiE,KAC/D;AACF,YAAA,IAAI,eAAe;gBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACzC,YAAA,OAAO,GAAG,CAAC,CAAC,CAAC;AACf,SAAC,KACG,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAG,UAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGD,qBAAA,CAACE,gBAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEF,qBAAC,CAAA,UAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJA,qBAAA,CAAC,gBAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DropdownMenu: (({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, ...props }: import("./dropdown-menu-root").DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
1
|
+
export declare const DropdownMenu: (({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, onOpenChange, ...props }: import("./dropdown-menu-root").DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
2
2
|
Trigger: import("react").ForwardRefExoticComponent<Omit<import("./dropdown-menu-trigger").DropdownMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
3
3
|
/**
|
|
4
4
|
* `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
|
|
4
|
-
var
|
|
4
|
+
var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
|
|
5
5
|
var flex = require('../flex/flex.cjs');
|
|
6
6
|
var text = require('../text/text.cjs');
|
|
7
7
|
var emptyState_module = require('./empty-state.module.css.cjs');
|
|
8
8
|
|
|
9
|
-
const EmptyState = ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant =
|
|
10
|
-
if (variant ===
|
|
11
|
-
return (jsxRuntime.jsxRuntimeExports.jsx(flex.Flex, { align:
|
|
9
|
+
const EmptyState = ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant = 'empty1' }) => {
|
|
10
|
+
if (variant === 'empty2') {
|
|
11
|
+
return (jsxRuntime.jsxRuntimeExports.jsx(flex.Flex, { align: 'center', justify: 'center', className: emptyState_module.default.emptyStatePage, children: jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction: 'column', align: 'start', gap: 'medium', className: index.cx(emptyState_module.default.emptyStateContent, classNames?.container), children: [jsxRuntime.jsxRuntimeExports.jsx("div", { className: index.cx(emptyState_module.default.iconContainer, classNames?.iconContainer), children: jsxRuntime.jsxRuntimeExports.jsx("div", { className: index.cx(emptyState_module.default.icon, emptyState_module.default.iconLarge, classNames?.icon), children: icon }) }), heading && (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 5, weight: 500, className: index.cx(emptyState_module.default.headerText, classNames?.heading), children: heading })), subHeading && (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 4, weight: 400, className: index.cx(emptyState_module.default.subHeaderText, classNames?.subHeading), children: subHeading })), jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { gap: 'medium', children: [primaryAction, secondaryAction] })] }) }));
|
|
12
12
|
}
|
|
13
|
-
return (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction:
|
|
13
|
+
return (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction: 'column', align: 'center', gap: 'medium', className: index.cx(emptyState_module.default.emptyState, classNames?.container), children: [jsxRuntime.jsxRuntimeExports.jsx("div", { className: index.cx(emptyState_module.default.iconContainer, classNames?.iconContainer), children: jsxRuntime.jsxRuntimeExports.jsx("div", { className: index.cx(emptyState_module.default.icon, classNames?.icon), children: icon }) }), jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction: 'column', gap: 'small', align: 'center', children: [heading && (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 5, weight: 500, className: index.cx(emptyState_module.default.headerText, classNames?.heading), children: heading })), subHeading && (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 4, weight: 400, className: index.cx(emptyState_module.default.subHeaderText, classNames?.subHeading), children: subHeading }))] }), primaryAction, secondaryAction] }));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
exports.EmptyState = EmptyState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.cjs","sources":["../../../components/empty-state/empty-state.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"empty-state.cjs","sources":["../../../components/empty-state/empty-state.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { Flex } from '../flex';\nimport { Text } from '../text';\nimport styles from './empty-state.module.css';\n\ntype classNameKeys =\n | 'container'\n | 'iconContainer'\n | 'icon'\n | 'heading'\n | 'subHeading';\n\ninterface EmptyStateProps {\n icon: React.ReactNode;\n heading?: React.ReactNode;\n subHeading?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n classNames?: Partial<Record<classNameKeys, string>>;\n variant?: 'empty1' | 'empty2';\n}\n\nexport const EmptyState = ({\n icon,\n heading,\n subHeading,\n primaryAction,\n secondaryAction,\n classNames,\n variant = 'empty1'\n}: EmptyStateProps) => {\n if (variant === 'empty2') {\n return (\n <Flex align='center' justify='center' className={styles.emptyStatePage}>\n <Flex\n direction='column'\n align='start'\n gap='medium'\n className={cx(styles.emptyStateContent, classNames?.container)}\n >\n <div className={cx(styles.iconContainer, classNames?.iconContainer)}>\n <div\n className={cx(styles.icon, styles.iconLarge, classNames?.icon)}\n >\n {icon}\n </div>\n </div>\n\n {heading && (\n <Text\n size={5}\n weight={500}\n className={cx(styles.headerText, classNames?.heading)}\n >\n {heading}\n </Text>\n )}\n\n {subHeading && (\n <Text\n size={4}\n weight={400}\n className={cx(styles.subHeaderText, classNames?.subHeading)}\n >\n {subHeading}\n </Text>\n )}\n\n <Flex gap='medium'>\n {primaryAction}\n {secondaryAction}\n </Flex>\n </Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n direction='column'\n align='center'\n gap='medium'\n className={cx(styles.emptyState, classNames?.container)}\n >\n <div className={cx(styles.iconContainer, classNames?.iconContainer)}>\n <div className={cx(styles.icon, classNames?.icon)}>{icon}</div>\n </div>\n\n <Flex direction='column' gap='small' align='center'>\n {heading && (\n <Text\n size={5}\n weight={500}\n className={cx(styles.headerText, classNames?.heading)}\n >\n {heading}\n </Text>\n )}\n\n {subHeading && (\n <Text\n size={4}\n weight={400}\n className={cx(styles.subHeaderText, classNames?.subHeading)}\n >\n {subHeading}\n </Text>\n )}\n </Flex>\n\n {primaryAction}\n\n {secondaryAction}\n </Flex>\n );\n};\n"],"names":["_jsx","Flex","styles","_jsxs","cx","Text"],"mappings":";;;;;;;;MAsBa,UAAU,GAAG,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,aAAa,EACb,eAAe,EACf,UAAU,EACV,OAAO,GAAG,QAAQ,EACF,KAAI;AACpB,IAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;AACxB,QAAA,QACEA,gCAAC,CAAAC,SAAI,EAAC,EAAA,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAC,QAAQ,EAAC,SAAS,EAAEC,yBAAM,CAAC,cAAc,EAAA,QAAA,EACpEC,iCAAC,CAAAF,SAAI,IACH,SAAS,EAAC,QAAQ,EAClB,KAAK,EAAC,OAAO,EACb,GAAG,EAAC,QAAQ,EACZ,SAAS,EAAEG,QAAE,CAACF,yBAAM,CAAC,iBAAiB,EAAE,UAAU,EAAE,SAAS,CAAC,aAE9DF,gCAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAEI,QAAE,CAACF,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,IAAI,EAAA,CAAO,GAC3D,EAENC,iCAAA,CAACF,SAAI,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,OAAO,EAAC,KAAK,EAAC,QAAQ,EAAA,QAAA,EAAA,CAChD,OAAO,KACND,gCAAC,CAAAK,SAAI,EACH,EAAA,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,GAAG,EACX,SAAS,EAAED,QAAE,CAACF,yBAAM,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAEpD,QAAA,EAAA,OAAO,EACH,CAAA,CACR,EAEA,UAAU,KACTF,gCAAA,CAACK,SAAI,EAAA,EACH,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,GAAG,EACX,SAAS,EAAED,QAAE,CAACF,yBAAM,CAAC,aAAa,EAAE,UAAU,EAAE,UAAU,CAAC,YAE1D,UAAU,EAAA,CACN,CACR,CAAA,EAAA,CACI,EAEN,aAAa,EAEb,eAAe,CAAA,EAAA,CACX,EACP;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type classNameKeys =
|
|
1
|
+
type classNameKeys = 'container' | 'iconContainer' | 'icon' | 'heading' | 'subHeading';
|
|
2
2
|
interface EmptyStateProps {
|
|
3
3
|
icon: React.ReactNode;
|
|
4
4
|
heading?: React.ReactNode;
|
|
@@ -6,8 +6,8 @@ interface EmptyStateProps {
|
|
|
6
6
|
primaryAction?: React.ReactNode;
|
|
7
7
|
secondaryAction?: React.ReactNode;
|
|
8
8
|
classNames?: Partial<Record<classNameKeys, string>>;
|
|
9
|
-
variant?:
|
|
9
|
+
variant?: 'empty1' | 'empty2';
|
|
10
10
|
}
|
|
11
|
-
export declare const EmptyState: ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant
|
|
11
|
+
export declare const EmptyState: ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant }: EmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../components/empty-state/empty-state.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../components/empty-state/empty-state.tsx"],"names":[],"mappings":"AAKA,KAAK,aAAa,GACd,WAAW,GACX,eAAe,GACf,MAAM,GACN,SAAS,GACT,YAAY,CAAC;AAEjB,UAAU,eAAe;IACvB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,uFAQpB,eAAe,4CAqFjB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
|
|
2
|
-
import {
|
|
2
|
+
import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
|
|
3
3
|
import { Flex } from '../flex/flex.js';
|
|
4
4
|
import { Text } from '../text/text.js';
|
|
5
5
|
import styles from './empty-state.module.css.js';
|
|
6
6
|
|
|
7
|
-
const EmptyState = ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant =
|
|
8
|
-
if (variant ===
|
|
9
|
-
return (jsxRuntimeExports.jsx(Flex, { align:
|
|
7
|
+
const EmptyState = ({ icon, heading, subHeading, primaryAction, secondaryAction, classNames, variant = 'empty1' }) => {
|
|
8
|
+
if (variant === 'empty2') {
|
|
9
|
+
return (jsxRuntimeExports.jsx(Flex, { align: 'center', justify: 'center', className: styles.emptyStatePage, children: jsxRuntimeExports.jsxs(Flex, { direction: 'column', align: 'start', gap: 'medium', className: cx(styles.emptyStateContent, classNames?.container), children: [jsxRuntimeExports.jsx("div", { className: cx(styles.iconContainer, classNames?.iconContainer), children: jsxRuntimeExports.jsx("div", { className: cx(styles.icon, styles.iconLarge, classNames?.icon), children: icon }) }), heading && (jsxRuntimeExports.jsx(Text, { size: 5, weight: 500, className: cx(styles.headerText, classNames?.heading), children: heading })), subHeading && (jsxRuntimeExports.jsx(Text, { size: 4, weight: 400, className: cx(styles.subHeaderText, classNames?.subHeading), children: subHeading })), jsxRuntimeExports.jsxs(Flex, { gap: 'medium', children: [primaryAction, secondaryAction] })] }) }));
|
|
10
10
|
}
|
|
11
|
-
return (jsxRuntimeExports.jsxs(Flex, { direction:
|
|
11
|
+
return (jsxRuntimeExports.jsxs(Flex, { direction: 'column', align: 'center', gap: 'medium', className: cx(styles.emptyState, classNames?.container), children: [jsxRuntimeExports.jsx("div", { className: cx(styles.iconContainer, classNames?.iconContainer), children: jsxRuntimeExports.jsx("div", { className: cx(styles.icon, classNames?.icon), children: icon }) }), jsxRuntimeExports.jsxs(Flex, { direction: 'column', gap: 'small', align: 'center', children: [heading && (jsxRuntimeExports.jsx(Text, { size: 5, weight: 500, className: cx(styles.headerText, classNames?.heading), children: heading })), subHeading && (jsxRuntimeExports.jsx(Text, { size: 4, weight: 400, className: cx(styles.subHeaderText, classNames?.subHeading), children: subHeading }))] }), primaryAction, secondaryAction] }));
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { EmptyState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","sources":["../../../components/empty-state/empty-state.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"empty-state.js","sources":["../../../components/empty-state/empty-state.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { Flex } from '../flex';\nimport { Text } from '../text';\nimport styles from './empty-state.module.css';\n\ntype classNameKeys =\n | 'container'\n | 'iconContainer'\n | 'icon'\n | 'heading'\n | 'subHeading';\n\ninterface EmptyStateProps {\n icon: React.ReactNode;\n heading?: React.ReactNode;\n subHeading?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n classNames?: Partial<Record<classNameKeys, string>>;\n variant?: 'empty1' | 'empty2';\n}\n\nexport const EmptyState = ({\n icon,\n heading,\n subHeading,\n primaryAction,\n secondaryAction,\n classNames,\n variant = 'empty1'\n}: EmptyStateProps) => {\n if (variant === 'empty2') {\n return (\n <Flex align='center' justify='center' className={styles.emptyStatePage}>\n <Flex\n direction='column'\n align='start'\n gap='medium'\n className={cx(styles.emptyStateContent, classNames?.container)}\n >\n <div className={cx(styles.iconContainer, classNames?.iconContainer)}>\n <div\n className={cx(styles.icon, styles.iconLarge, classNames?.icon)}\n >\n {icon}\n </div>\n </div>\n\n {heading && (\n <Text\n size={5}\n weight={500}\n className={cx(styles.headerText, classNames?.heading)}\n >\n {heading}\n </Text>\n )}\n\n {subHeading && (\n <Text\n size={4}\n weight={400}\n className={cx(styles.subHeaderText, classNames?.subHeading)}\n >\n {subHeading}\n </Text>\n )}\n\n <Flex gap='medium'>\n {primaryAction}\n {secondaryAction}\n </Flex>\n </Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n direction='column'\n align='center'\n gap='medium'\n className={cx(styles.emptyState, classNames?.container)}\n >\n <div className={cx(styles.iconContainer, classNames?.iconContainer)}>\n <div className={cx(styles.icon, classNames?.icon)}>{icon}</div>\n </div>\n\n <Flex direction='column' gap='small' align='center'>\n {heading && (\n <Text\n size={5}\n weight={500}\n className={cx(styles.headerText, classNames?.heading)}\n >\n {heading}\n </Text>\n )}\n\n {subHeading && (\n <Text\n size={4}\n weight={400}\n className={cx(styles.subHeaderText,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I,EAEN,aAAa,EAEb,eAAe,CAAA,EAAA,CACX,EACP;AACJ;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var select = require('../select/select.cjs');
|
|
6
|
+
var text = require('../text/text.cjs');
|
|
7
|
+
var filterChip_module = require('./filter-chip.module.css.cjs');
|
|
8
|
+
|
|
9
|
+
const Operation = ({ label, value, onChange, operations }) => {
|
|
10
|
+
const operationValue = value?.value ?? '';
|
|
11
|
+
const handleValueChange = React.useCallback((newValue) => {
|
|
12
|
+
const operation = operations.find(o => o.value === newValue);
|
|
13
|
+
if (operation)
|
|
14
|
+
onChange(operation);
|
|
15
|
+
}, [operations, onChange]);
|
|
16
|
+
if (operations.length === 1)
|
|
17
|
+
return (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { variant: 'secondary', className: filterChip_module.default.selectValue, children: operations[0].label }));
|
|
18
|
+
return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: operationValue, onValueChange: handleValueChange, "aria-labelledby": `${label}-label`, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { variant: 'text', className: filterChip_module.default.selectValue, "aria-label": `${label} filter operation`, children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: 'Select operation', className: filterChip_module.default.operationText }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": 'filter', children: operations.map(operation => {
|
|
19
|
+
return (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: operation.value, "aria-label": `Filter ${label} ${operation.label}`, children: operation.label }, operation.value));
|
|
20
|
+
}) })] }));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.Operation = Operation;
|
|
24
|
+
//# sourceMappingURL=filter-chip-operation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-chip-operation.cjs","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { FilterOperation, FilterOperator } from '~/types/filters';\nimport { Select } from '../select';\nimport { Text } from '../text';\nimport styles from './filter-chip.module.css';\n\ninterface OperationProps {\n label: string;\n value?: FilterOperation;\n onChange: (operation: FilterOperation) => void;\n operations: FilterOperator<string>[];\n}\n\nexport const Operation = ({\n label,\n value,\n onChange,\n operations\n}: OperationProps) => {\n const operationValue = value?.value ?? '';\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n const operation = operations.find(o => o.value === newValue);\n if (operation) onChange(operation);\n },\n [operations, onChange]\n );\n\n if (operations.length === 1)\n return (\n <Text variant='secondary' className={styles.selectValue}>\n {operations[0].label}\n </Text>\n );\n\n return (\n <Select\n value={operationValue}\n onValueChange={handleValueChange}\n aria-labelledby={`${label}-label`}\n >\n <Select.Trigger\n variant='text'\n className={styles.selectValue}\n aria-label={`${label} filter operation`}\n >\n <Select.Value\n placeholder='Select operation'\n className={styles.operationText}\n />\n </Select.Trigger>\n <Select.Content data-variant='filter'>\n {operations.map(operation => {\n return (\n <Select.Item\n key={operation.value}\n value={operation.value}\n aria-label={`Filter ${label} ${operation.label}`}\n >\n {operation.label}\n </Select.Item>\n );\n })}\n </Select.Content>\n </Select>\n );\n};\n"],"names":["useCallback","_jsx","Text","styles","_jsxs","Select"],"mappings":";;;;;;;;AAaO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACK,KAAI;AACnB,IAAA,MAAM,cAAc,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AAE1C,IAAA,MAAM,iBAAiB,GAAGA,iBAAW,CACnC,CAAC,QAAgB,KAAI;AACnB,QAAA,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,CAA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ACV,EAAA,CAAA,EACT;AACJ;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterOperation, FilterOperator } from '~/types/filters';
|
|
2
|
+
interface OperationProps {
|
|
3
|
+
label: string;
|
|
4
|
+
value?: FilterOperation;
|
|
5
|
+
onChange: (operation: FilterOperation) => void;
|
|
6
|
+
operations: FilterOperator<string>[];
|
|
7
|
+
}
|
|
8
|
+
export declare const Operation: ({ label, value, onChange, operations }: OperationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=filter-chip-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-chip-operation.d.ts","sourceRoot":"","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKlE,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,SAAS,2CAKnB,cAAc,4CAiDhB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { Select } from '../select/select.js';
|
|
4
|
+
import { Text } from '../text/text.js';
|
|
5
|
+
import styles from './filter-chip.module.css.js';
|
|
6
|
+
|
|
7
|
+
const Operation = ({ label, value, onChange, operations }) => {
|
|
8
|
+
const operationValue = value?.value ?? '';
|
|
9
|
+
const handleValueChange = useCallback((newValue) => {
|
|
10
|
+
const operation = operations.find(o => o.value === newValue);
|
|
11
|
+
if (operation)
|
|
12
|
+
onChange(operation);
|
|
13
|
+
}, [operations, onChange]);
|
|
14
|
+
if (operations.length === 1)
|
|
15
|
+
return (jsxRuntimeExports.jsx(Text, { variant: 'secondary', className: styles.selectValue, children: operations[0].label }));
|
|
16
|
+
return (jsxRuntimeExports.jsxs(Select, { value: operationValue, onValueChange: handleValueChange, "aria-labelledby": `${label}-label`, children: [jsxRuntimeExports.jsx(Select.Trigger, { variant: 'text', className: styles.selectValue, "aria-label": `${label} filter operation`, children: jsxRuntimeExports.jsx(Select.Value, { placeholder: 'Select operation', className: styles.operationText }) }), jsxRuntimeExports.jsx(Select.Content, { "data-variant": 'filter', children: operations.map(operation => {
|
|
17
|
+
return (jsxRuntimeExports.jsx(Select.Item, { value: operation.value, "aria-label": `Filter ${label} ${operation.label}`, children: operation.label }, operation.value));
|
|
18
|
+
}) })] }));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { Operation };
|
|
22
|
+
//# sourceMappingURL=filter-chip-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-chip-operation.js","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { FilterOperation, FilterOperator } from '~/types/filters';\nimport { Select } from '../select';\nimport { Text } from '../text';\nimport styles from './filter-chip.module.css';\n\ninterface OperationProps {\n label: string;\n value?: FilterOperation;\n onChange: (operation: FilterOperation) => void;\n operations: FilterOperator<string>[];\n}\n\nexport const Operation = ({\n label,\n value,\n onChange,\n operations\n}: OperationProps) => {\n const operationValue = value?.value ?? '';\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n const operation = operations.find(o => o.value === newValue);\n if (operation) onChange(operation);\n },\n [operations, onChange]\n );\n\n if (operations.length === 1)\n return (\n <Text variant='secondary' className={styles.selectValue}>\n {operations[0].label}\n </Text>\n );\n\n return (\n <Select\n value={operationValue}\n onValueChange={handleValueChange}\n aria-labelledby={`${label}-label`}\n >\n <Select.Trigger\n variant='text'\n className={styles.selectValue}\n aria-label={`${label} filter operation`}\n >\n <Select.Value\n placeholder='Select operation'\n className={styles.operationText}\n />\n </Select.Trigger>\n <Select.Content data-variant='filter'>\n {operations.map(operation => {\n return (\n <Select.Item\n key={operation.value}\n value={operation.value}\n aria-label={`Filter ${label} ${operation.label}`}\n >\n {operation.label}\n </Select.Item>\n );\n })}\n </Select.Content>\n </Select>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAaO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACK,KAAI;AACnB,IAAA,MAAM,cAAc,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AAE1C,IAAA,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,QAAgB,KAAI;AACnB,QAAA,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;AAC7D,QAAA,IAAI,SAAS;YAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AACrC,KAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAC;AAEF,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QACzB,QACEA,sBAAC,IAAI,EAAA,EAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAA,QAAA,EACpD,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,EACf,CAAA,EACP;AAEJ,IAAA,QACEC,sBAAA,CAAC,MAAM,EAAA,EACL,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,iBAAiB,EAAA,iBAAA,EACf,GAAG,KAAK,CAAA,MAAA,CAAQ,EAEjC,QAAA,EAAA,CAAAD,qBAAA,CAAC,MAAM,CAAC,OAAO,EAAA,EACb,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,WAAW,EACjB,YAAA,EAAA,CAAA,EAAG,KAAK,CAAA,iBAAA,CAAmB,EAEvC,QAAA,EAAAA,qBAAA,CAAC,MAAM,CAAC,KAAK,EAAA,EACX,WAAW,EAAC,kBAAkB,EAC9B,SAAS,EAAE,MAAM,CAAC,aAAa,EAC/B,CAAA,EAAA,CACa,EACjBA,qBAAA,CAAC,MAAM,CAAC,OAAO,EAAc,EAAA,cAAA,EAAA,QAAQ,EAClC,QAAA,EAAA,UAAU,CAAC,GAAG,CAAC,SAAS,IAAG;AAC1B,oBAAA,QACEA,qBAAA,CAAC,MAAM,CAAC,IAAI,EAAA,EAEV,KAAK,EAAE,SAAS,CAAC,KAAK,EAAA,YAAA,EACV,CAAU,OAAA,EAAA,KAAK,CAAI,CAAA,EAAA,SAAS,CAAC,KAAK,CAAE,CAAA,EAAA,QAAA,EAE/C,SAAS,CAAC,KAAK,EAAA,EAJX,SAAS,CAAC,KAAK,CAKR,EACd;AACJ,iBAAC,CAAC,EAAA,CACa,CACV,EAAA,CAAA,EACT;AACJ;;;;"}
|
|
@@ -2,75 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
|
|
4
4
|
var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var box = require('../box/box.cjs');
|
|
7
5
|
var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var filters = require('../../types/filters.cjs');
|
|
8
8
|
var flex = require('../flex/flex.cjs');
|
|
9
|
+
require('../icon-button/icon-button.cjs');
|
|
9
10
|
var select = require('../select/select.cjs');
|
|
10
|
-
require('../tooltip/tooltip.cjs');
|
|
11
11
|
require('../skeleton/skeleton.cjs');
|
|
12
|
-
require('../
|
|
12
|
+
require('../tooltip/tooltip.cjs');
|
|
13
13
|
var datePicker = require('../calendar/date-picker.cjs');
|
|
14
14
|
require('../../node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.cjs');
|
|
15
15
|
require('../popover/popover.cjs');
|
|
16
16
|
require('../input-field/input-field.cjs');
|
|
17
17
|
var text = require('../text/text.cjs');
|
|
18
18
|
var textfield = require('../textfield/textfield.cjs');
|
|
19
|
+
var filterChipOperation = require('./filter-chip-operation.cjs');
|
|
19
20
|
var filterChip_module = require('./filter-chip.module.css.cjs');
|
|
20
|
-
var filters = require('../../types/filters.cjs');
|
|
21
21
|
|
|
22
22
|
const chip = index.cva(filterChip_module.default.chip, {
|
|
23
23
|
variants: {
|
|
24
24
|
variant: {
|
|
25
|
-
default: filterChip_module.default[
|
|
26
|
-
text: null
|
|
27
|
-
}
|
|
25
|
+
default: filterChip_module.default['chip-default'],
|
|
26
|
+
text: null
|
|
27
|
+
}
|
|
28
28
|
},
|
|
29
29
|
defaultVariants: {
|
|
30
|
-
variant:
|
|
31
|
-
}
|
|
30
|
+
variant: 'default'
|
|
31
|
+
}
|
|
32
32
|
});
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
React.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const [filterValue, setFilterValue] = React.useState(value || "");
|
|
50
|
-
const showOnRemove = typeof onRemove === "function";
|
|
51
|
-
React.useEffect(() => {
|
|
52
|
-
if (onOperationChange && operation?.value) {
|
|
53
|
-
onOperationChange(operation?.value);
|
|
54
|
-
}
|
|
55
|
-
}, [operation?.value]);
|
|
56
|
-
React.useEffect(() => {
|
|
57
|
-
if (onValueChange) {
|
|
58
|
-
onValueChange(filterValue);
|
|
59
|
-
}
|
|
60
|
-
}, [filterValue]);
|
|
33
|
+
const FilterChip = ({ label, value, onRemove, className, ref, columnType = filters.FilterType.string, options = [], onValueChange, onOperationChange, leadingIcon, variant, operations, ...props }) => {
|
|
34
|
+
const computedOperations = operations?.length
|
|
35
|
+
? operations
|
|
36
|
+
: filters.filterOperators[columnType];
|
|
37
|
+
const [operation, setOperation] = React.useState(computedOperations?.[0]);
|
|
38
|
+
const [filterValue, setFilterValue] = React.useState(value || '');
|
|
39
|
+
const showOnRemove = typeof onRemove === 'function';
|
|
40
|
+
const handleOperationChange = React.useCallback((operation) => {
|
|
41
|
+
setOperation(operation);
|
|
42
|
+
if (operation?.value)
|
|
43
|
+
onOperationChange?.(operation.value);
|
|
44
|
+
}, [onOperationChange]);
|
|
45
|
+
const handleFilterValueChange = React.useCallback((value) => {
|
|
46
|
+
setFilterValue(value);
|
|
47
|
+
onValueChange?.(value, operation?.value ?? '');
|
|
48
|
+
}, [operation, onValueChange]);
|
|
61
49
|
const renderValueInput = () => {
|
|
62
50
|
switch (columnType) {
|
|
63
51
|
case filters.FilterType.select:
|
|
64
|
-
return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: filterValue.toString(), onValueChange:
|
|
52
|
+
return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: filterValue.toString(), onValueChange: handleFilterValueChange, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { variant: 'text', className: index.cx(filterChip_module.default.selectValue, filterChip_module.default.selectColumn), children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: 'Select value' }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": 'filter', children: options.map(opt => (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: opt.value.toString(), children: opt.label }, opt.value.toString()))) })] }));
|
|
65
53
|
case filters.FilterType.date:
|
|
66
|
-
return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.dateFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(datePicker.DatePicker, { value: filterValue, onSelect: date =>
|
|
54
|
+
return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.dateFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(datePicker.DatePicker, { value: filterValue, onSelect: date => handleFilterValueChange(date), showCalendarIcon: false, inputFieldProps: { className: filterChip_module.default.dateField } }) }));
|
|
67
55
|
default:
|
|
68
|
-
return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.textFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { className: filterChip_module.default.textField, value: filterValue, onChange: e =>
|
|
56
|
+
return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.textFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { className: filterChip_module.default.textField, value: filterValue, onChange: e => handleFilterValueChange(e.target.value) }) }));
|
|
69
57
|
}
|
|
70
58
|
};
|
|
71
|
-
return (jsxRuntime.jsxRuntimeExports.
|
|
59
|
+
return (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: 'center', ref: ref, className: chip({ variant, className }), role: 'group', "aria-label": `Filter by ${label}`, ...props, children: [jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: 'center', gap: 2, className: filterChip_module.default['chip-label'], children: [leadingIcon && (jsxRuntime.jsxRuntimeExports.jsx("span", { className: filterChip_module.default.leadingIcon, "aria-hidden": 'true', children: leadingIcon })), jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 2, weight: 'normal', children: label })] }), jsxRuntime.jsxRuntimeExports.jsx(filterChipOperation.Operation, { operations: computedOperations, label: label, value: operation, onChange: handleOperationChange }), renderValueInput(), showOnRemove && (jsxRuntime.jsxRuntimeExports.jsx("button", { className: filterChip_module.default.removeIconContainer, "aria-label": `Remove ${label} filter`, onClick: onRemove, children: jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.Cross1Icon, { className: filterChip_module.default.removeIcon }) }))] }));
|
|
72
60
|
};
|
|
73
|
-
FilterChip.displayName =
|
|
61
|
+
FilterChip.displayName = 'FilterChip';
|
|
74
62
|
|
|
75
63
|
exports.FilterChip = FilterChip;
|
|
76
64
|
//# sourceMappingURL=filter-chip.cjs.map
|