@webiny/admin-ui 6.5.0-beta.11 → 6.5.0-beta.12

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.
@@ -74,6 +74,12 @@ interface AutoCompletePrimitiveProps {
74
74
  * Refer to `InputPrimitiveProps["size"]` for possible values.
75
75
  */
76
76
  size?: InputPrimitiveProps["size"];
77
+ /**
78
+ * Filter the options by the typed text on the client. Defaults to `true`.
79
+ * Set to `false` when `onValueSearch` already returns the matching options,
80
+ * so options matched on data other than their label are not dropped.
81
+ */
82
+ shouldFilter?: boolean;
77
83
  /**
78
84
  * Icon to be displayed at the start of the input field.
79
85
  */
@@ -31,6 +31,7 @@ const DecoratableAutoCompletePrimitive = (props)=>{
31
31
  onOpenChange: ()=>setListOpenState(true)
32
32
  }, /*#__PURE__*/ react.createElement(Command, {
33
33
  label: String(props.label),
34
+ shouldFilter: props.shouldFilter,
34
35
  onKeyDown: handleKeyDown
35
36
  }, /*#__PURE__*/ react.createElement(PopoverPrimitive.Trigger, {
36
37
  asChild: true
@@ -1 +1 @@
1
- {"version":3,"file":"AutoComplete/primitives/AutoCompletePrimitive.js","sources":["../../../src/AutoComplete/primitives/AutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { useAutoComplete } from \"./useAutoComplete.js\";\nimport { AutoCompleteInputIcons, AutoCompleteList } from \"./components/index.js\";\nimport type { AutoCompleteOption } from \"../domains/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { Icon } from \"~/Icon/index.js\";\n\ninterface AutoCompletePrimitiveProps {\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: string;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered to reset the value.\n */\n onValueReset?: () => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the value changes.\n */\n onValueChange: (value: string) => void;\n /**\n * List of options for the autocomplete.\n */\n options?: AutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\nconst DecoratableAutoCompletePrimitive = (props: AutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n resetSelectedOption,\n showSelectedOption\n } = useAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n } else {\n setListOpenState(true);\n }\n },\n [props.disabled, setListOpenState]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleOnBlur = React.useCallback(() => {\n setListOpenState(false);\n showSelectedOption();\n }, [setListOpenState]);\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command label={String(props.label)} onKeyDown={handleKeyDown}>\n <PopoverPrimitive.Trigger asChild>\n <span>\n <Command.Input\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n onValueChange={searchOption}\n placeholder={vm.inputVm.placeholder}\n size={props.size}\n variant={props.variant}\n disabled={props.disabled}\n invalid={props.invalid}\n startIcon={props.startIcon}\n endIcon={\n <AutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={vm.inputVm.displayResetAction}\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOption}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n onBlur={handleOnBlur}\n onFocus={() => setListOpenState(true)}\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ minWidth: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <AutoCompleteList\n options={vm.optionsListVm.options}\n onOptionSelect={handleSelectOption}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n emptyMessage={vm.optionsListVm.emptyMessage}\n optionRenderer={props.optionRenderer}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst AutoCompletePrimitive = makeDecoratable(\n \"AutoCompletePrimitive\",\n DecoratableAutoCompletePrimitive\n);\n\nexport { AutoCompletePrimitive, type AutoCompletePrimitiveProps };\n"],"names":["DecoratableAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","resetSelectedOption","showSelectedOption","useAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleOnBlur","PopoverPrimitive","Command","String","AutoCompleteInputIcons","e","AutoCompleteList","AutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAkGA,MAAMA,mCAAmC,CAACC;IACtC,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,mBAAmB,EACnBC,kBAAkB,EACrB,GAAGC,gBAAgBP;IAEpB,MAAMQ,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIV,MAAM,QAAQ,EACd;QAG4B,aAA5BU,MAAM,GAAG,CAAC,WAAW,KACrBR,iBAAiB,SAEjBA,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;KAAiB;IAGtC,MAAMS,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGT,kBAAkBS;QAClBV,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMW,eAAeJ,MAAAA,WAAiB,CAAC;QACnCP,iBAAiB;QACjBI;IACJ,GAAG;QAACJ;KAAiB;IAErB,OAAO,WAAP,GACI,oBAACY,kBAAgBA;QAAC,MAAMb,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACa,SAAOA;QAAC,OAAOC,OAAOhB,MAAM,KAAK;QAAG,WAAWQ;qBAC5C,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACC,QAAQ,KAAK;QACV,UAAUf,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,eAAeG;QACf,aAAaH,GAAG,OAAO,CAAC,WAAW;QACnC,MAAMD,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACiB,wBAAsBA;YACnB,WAAWjB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBAAoBC,GAAG,OAAO,CAAC,kBAAkB;YACjD,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcK;YACd,cAAc,IAAMH,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;QAGnE,QAAQY;QACR,SAAS,IAAMX,iBAAiB;wBAI5C,oBAACY,iBAAiB,OAAO;QACrB,OAAO;YAAE,UAAU;QAAqC;QACxD,iBAAiBI,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,kBAAgBA;QACb,SAASlB,GAAG,aAAa,CAAC,OAAO;QACjC,gBAAgBU;QAChB,OAAOV,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,cAAcA,GAAG,aAAa,CAAC,YAAY;QAC3C,gBAAgBD,MAAM,cAAc;;AAM5D;AAEA,MAAMoB,wBAAwBC,gBAC1B,yBACAtB"}
1
+ {"version":3,"file":"AutoComplete/primitives/AutoCompletePrimitive.js","sources":["../../../src/AutoComplete/primitives/AutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { useAutoComplete } from \"./useAutoComplete.js\";\nimport { AutoCompleteInputIcons, AutoCompleteList } from \"./components/index.js\";\nimport type { AutoCompleteOption } from \"../domains/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { Icon } from \"~/Icon/index.js\";\n\ninterface AutoCompletePrimitiveProps {\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: string;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered to reset the value.\n */\n onValueReset?: () => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the value changes.\n */\n onValueChange: (value: string) => void;\n /**\n * List of options for the autocomplete.\n */\n options?: AutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Filter the options by the typed text on the client. Defaults to `true`.\n * Set to `false` when `onValueSearch` already returns the matching options,\n * so options matched on data other than their label are not dropped.\n */\n shouldFilter?: boolean;\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\nconst DecoratableAutoCompletePrimitive = (props: AutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n resetSelectedOption,\n showSelectedOption\n } = useAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n } else {\n setListOpenState(true);\n }\n },\n [props.disabled, setListOpenState]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleOnBlur = React.useCallback(() => {\n setListOpenState(false);\n showSelectedOption();\n }, [setListOpenState]);\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command\n label={String(props.label)}\n shouldFilter={props.shouldFilter}\n onKeyDown={handleKeyDown}\n >\n <PopoverPrimitive.Trigger asChild>\n <span>\n <Command.Input\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n onValueChange={searchOption}\n placeholder={vm.inputVm.placeholder}\n size={props.size}\n variant={props.variant}\n disabled={props.disabled}\n invalid={props.invalid}\n startIcon={props.startIcon}\n endIcon={\n <AutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={vm.inputVm.displayResetAction}\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOption}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n onBlur={handleOnBlur}\n onFocus={() => setListOpenState(true)}\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ minWidth: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <AutoCompleteList\n options={vm.optionsListVm.options}\n onOptionSelect={handleSelectOption}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n emptyMessage={vm.optionsListVm.emptyMessage}\n optionRenderer={props.optionRenderer}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst AutoCompletePrimitive = makeDecoratable(\n \"AutoCompletePrimitive\",\n DecoratableAutoCompletePrimitive\n);\n\nexport { AutoCompletePrimitive, type AutoCompletePrimitiveProps };\n"],"names":["DecoratableAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","resetSelectedOption","showSelectedOption","useAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleOnBlur","PopoverPrimitive","Command","String","AutoCompleteInputIcons","e","AutoCompleteList","AutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAwGA,MAAMA,mCAAmC,CAACC;IACtC,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,mBAAmB,EACnBC,kBAAkB,EACrB,GAAGC,gBAAgBP;IAEpB,MAAMQ,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIV,MAAM,QAAQ,EACd;QAG4B,aAA5BU,MAAM,GAAG,CAAC,WAAW,KACrBR,iBAAiB,SAEjBA,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;KAAiB;IAGtC,MAAMS,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGT,kBAAkBS;QAClBV,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMW,eAAeJ,MAAAA,WAAiB,CAAC;QACnCP,iBAAiB;QACjBI;IACJ,GAAG;QAACJ;KAAiB;IAErB,OAAO,WAAP,GACI,oBAACY,kBAAgBA;QAAC,MAAMb,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACa,SAAOA;QACJ,OAAOC,OAAOhB,MAAM,KAAK;QACzB,cAAcA,MAAM,YAAY;QAChC,WAAWQ;qBAEX,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACC,QAAQ,KAAK;QACV,UAAUf,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,eAAeG;QACf,aAAaH,GAAG,OAAO,CAAC,WAAW;QACnC,MAAMD,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACiB,wBAAsBA;YACnB,WAAWjB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBAAoBC,GAAG,OAAO,CAAC,kBAAkB;YACjD,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcK;YACd,cAAc,IAAMH,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;QAGnE,QAAQY;QACR,SAAS,IAAMX,iBAAiB;wBAI5C,oBAACY,iBAAiB,OAAO;QACrB,OAAO;YAAE,UAAU;QAAqC;QACxD,iBAAiBI,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,kBAAgBA;QACb,SAASlB,GAAG,aAAa,CAAC,OAAO;QACjC,gBAAgBU;QAChB,OAAOV,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,cAAcA,GAAG,aAAa,CAAC,YAAY;QAC3C,gBAAgBD,MAAM,cAAc;;AAM5D;AAEA,MAAMoB,wBAAwBC,gBAC1B,yBACAtB"}
@@ -82,6 +82,12 @@ interface MultiAutoCompletePrimitiveProps {
82
82
  * Custom renderer for the selected options.
83
83
  */
84
84
  selectedOptionRenderer?: (item: any, index: number) => React.ReactNode;
85
+ /**
86
+ * Filter the options by the typed text on the client. Defaults to `true`.
87
+ * Set to `false` when `onValueSearch` already returns the matching options,
88
+ * so options matched on data other than their label are not dropped.
89
+ */
90
+ shouldFilter?: boolean;
85
91
  /**
86
92
  * Icon to be displayed at the start of the input field.
87
93
  */
@@ -35,6 +35,7 @@ const DecoratableMultiAutoCompletePrimitive = (props)=>{
35
35
  onOpenChange: ()=>setListOpenState(true)
36
36
  }, /*#__PURE__*/ react.createElement(Command, {
37
37
  label: String(props.label),
38
+ shouldFilter: props.shouldFilter,
38
39
  onKeyDown: handleKeyDown
39
40
  }, /*#__PURE__*/ react.createElement(PopoverPrimitive.Trigger, {
40
41
  asChild: true
@@ -1 +1 @@
1
- {"version":3,"file":"MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js","sources":["../../../src/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport { useMultiAutoComplete } from \"./useMultiAutoComplete.js\";\nimport {\n MultiAutoCompleteInput,\n MultiAutoCompleteInputIcons,\n MultiAutoCompleteList\n} from \"./components/index.js\";\nimport type { MultiAutoCompleteOption } from \"../domains/index.js\";\nimport type { Icon } from \"~/Icon/index.js\";\n\ninterface MultiAutoCompletePrimitiveProps {\n /**\n * Allows free input of values not present in the options.\n */\n allowFreeInput?: boolean;\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: React.ReactNode;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the values change.\n */\n onValuesChange: (values: string[]) => void;\n /**\n * Callback triggered to reset the values.\n */\n onValuesReset?: () => void;\n /**\n * List of options for the autocomplete.\n */\n options?: MultiAutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Custom renderer for the selected options.\n */\n selectedOptionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Ensures that each value is unique.\n */\n uniqueValues?: boolean;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected items.\n */\n values?: string[];\n}\n\nconst DecoratableMultiAutoCompletePrimitive = (props: MultiAutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n removeSelectedOption,\n resetSelectedOptions,\n createOption\n } = useMultiAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (!vm.optionsListVm.open) {\n setListOpenState(true);\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n }\n },\n [props.disabled, setListOpenState, setSelectedOption, vm.optionsListVm.open]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleCreateOption = React.useCallback(\n (value: string) => {\n createOption(value);\n setListOpenState(false);\n },\n [createOption, setListOpenState]\n );\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command label={String(props.label)} onKeyDown={handleKeyDown}>\n <PopoverPrimitive.Trigger asChild>\n <span>\n <MultiAutoCompleteInput\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n placeholder={vm.inputVm.placeholder}\n changeValue={searchOption}\n closeList={() => setListOpenState(false)}\n openList={() => setListOpenState(true)}\n variant={props.variant}\n size={props.size}\n invalid={props.invalid}\n removeSelectedOption={removeSelectedOption}\n selectedOptionRenderer={props.selectedOptionRenderer}\n selectedOptions={vm.selectedOptionsVm.options}\n disabled={props.disabled}\n startIcon={props.startIcon}\n endIcon={\n <MultiAutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={\n !vm.selectedOptionsVm.empty && vm.inputVm.displayResetAction\n }\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOptions}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <MultiAutoCompleteList\n emptyMessage={vm.optionsListVm.emptyMessage}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n onOptionCreate={handleCreateOption}\n onOptionSelect={handleSelectOption}\n optionRenderer={props.optionRenderer}\n options={vm.optionsListVm.options}\n temporaryOption={vm.temporaryOptionVm.option}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst MultiAutoCompletePrimitive = makeDecoratable(\n \"MultiAutoCompletePrimitive\",\n DecoratableMultiAutoCompletePrimitive\n);\n\nexport { MultiAutoCompletePrimitive, type MultiAutoCompletePrimitiveProps };\n"],"names":["DecoratableMultiAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","removeSelectedOption","resetSelectedOptions","createOption","useMultiAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleCreateOption","PopoverPrimitive","Command","String","MultiAutoCompleteInput","MultiAutoCompleteInputIcons","e","MultiAutoCompleteList","MultiAutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAkHA,MAAMA,wCAAwC,CAACC;IAC3C,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,oBAAoB,EACpBC,oBAAoB,EACpBC,YAAY,EACf,GAAGC,qBAAqBR;IAEzB,MAAMS,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIX,MAAM,QAAQ,EACd;QAGJ,IAAI,CAACC,GAAG,aAAa,CAAC,IAAI,EACtBC,iBAAiB;QAGrB,IAAIS,AAA4B,aAA5BA,MAAM,GAAG,CAAC,WAAW,IACrBT,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;QAAkBC;QAAmBF,GAAG,aAAa,CAAC,IAAI;KAAC;IAGhF,MAAMW,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGV,kBAAkBU;QAClBX,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMY,qBAAqBJ,MAAAA,WAAiB,CACxC,CAACG;QACGN,aAAaM;QACbX,iBAAiB;IACrB,GACA;QAACK;QAAcL;KAAiB;IAGpC,OAAO,WAAP,GACI,oBAACa,kBAAgBA;QAAC,MAAMd,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACc,SAAOA;QAAC,OAAOC,OAAOjB,MAAM,KAAK;QAAG,WAAWS;qBAC5C,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACG,wBAAsBA;QACnB,UAAUlB,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,aAAaA,GAAG,OAAO,CAAC,WAAW;QACnC,aAAaG;QACb,WAAW,IAAMF,iBAAiB;QAClC,UAAU,IAAMA,iBAAiB;QACjC,SAASF,MAAM,OAAO;QACtB,MAAMA,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,sBAAsBK;QACtB,wBAAwBL,MAAM,sBAAsB;QACpD,iBAAiBC,GAAG,iBAAiB,CAAC,OAAO;QAC7C,UAAUD,MAAM,QAAQ;QACxB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACmB,6BAA2BA;YACxB,WAAWnB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBACI,CAACC,GAAG,iBAAiB,CAAC,KAAK,IAAIA,GAAG,OAAO,CAAC,kBAAkB;YAEhE,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcM;YACd,cAAc,IAAMJ,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;wBAM/E,oBAACc,iBAAiB,OAAO;QACrB,OAAO;YAAE,OAAO;QAAqC;QACrD,iBAAiBK,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,uBAAqBA;QAClB,cAAcpB,GAAG,aAAa,CAAC,YAAY;QAC3C,OAAOA,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,gBAAgBa;QAChB,gBAAgBF;QAChB,gBAAgBZ,MAAM,cAAc;QACpC,SAASC,GAAG,aAAa,CAAC,OAAO;QACjC,iBAAiBA,GAAG,iBAAiB,CAAC,MAAM;;AAMpE;AAEA,MAAMqB,6BAA6BC,gBAC/B,8BACAxB"}
1
+ {"version":3,"file":"MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js","sources":["../../../src/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport { useMultiAutoComplete } from \"./useMultiAutoComplete.js\";\nimport {\n MultiAutoCompleteInput,\n MultiAutoCompleteInputIcons,\n MultiAutoCompleteList\n} from \"./components/index.js\";\nimport type { MultiAutoCompleteOption } from \"../domains/index.js\";\nimport type { Icon } from \"~/Icon/index.js\";\n\ninterface MultiAutoCompletePrimitiveProps {\n /**\n * Allows free input of values not present in the options.\n */\n allowFreeInput?: boolean;\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: React.ReactNode;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the values change.\n */\n onValuesChange: (values: string[]) => void;\n /**\n * Callback triggered to reset the values.\n */\n onValuesReset?: () => void;\n /**\n * List of options for the autocomplete.\n */\n options?: MultiAutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Custom renderer for the selected options.\n */\n selectedOptionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Filter the options by the typed text on the client. Defaults to `true`.\n * Set to `false` when `onValueSearch` already returns the matching options,\n * so options matched on data other than their label are not dropped.\n */\n shouldFilter?: boolean;\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Ensures that each value is unique.\n */\n uniqueValues?: boolean;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected items.\n */\n values?: string[];\n}\n\nconst DecoratableMultiAutoCompletePrimitive = (props: MultiAutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n removeSelectedOption,\n resetSelectedOptions,\n createOption\n } = useMultiAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (!vm.optionsListVm.open) {\n setListOpenState(true);\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n }\n },\n [props.disabled, setListOpenState, setSelectedOption, vm.optionsListVm.open]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleCreateOption = React.useCallback(\n (value: string) => {\n createOption(value);\n setListOpenState(false);\n },\n [createOption, setListOpenState]\n );\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command\n label={String(props.label)}\n shouldFilter={props.shouldFilter}\n onKeyDown={handleKeyDown}\n >\n <PopoverPrimitive.Trigger asChild>\n <span>\n <MultiAutoCompleteInput\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n placeholder={vm.inputVm.placeholder}\n changeValue={searchOption}\n closeList={() => setListOpenState(false)}\n openList={() => setListOpenState(true)}\n variant={props.variant}\n size={props.size}\n invalid={props.invalid}\n removeSelectedOption={removeSelectedOption}\n selectedOptionRenderer={props.selectedOptionRenderer}\n selectedOptions={vm.selectedOptionsVm.options}\n disabled={props.disabled}\n startIcon={props.startIcon}\n endIcon={\n <MultiAutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={\n !vm.selectedOptionsVm.empty && vm.inputVm.displayResetAction\n }\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOptions}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <MultiAutoCompleteList\n emptyMessage={vm.optionsListVm.emptyMessage}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n onOptionCreate={handleCreateOption}\n onOptionSelect={handleSelectOption}\n optionRenderer={props.optionRenderer}\n options={vm.optionsListVm.options}\n temporaryOption={vm.temporaryOptionVm.option}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst MultiAutoCompletePrimitive = makeDecoratable(\n \"MultiAutoCompletePrimitive\",\n DecoratableMultiAutoCompletePrimitive\n);\n\nexport { MultiAutoCompletePrimitive, type MultiAutoCompletePrimitiveProps };\n"],"names":["DecoratableMultiAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","removeSelectedOption","resetSelectedOptions","createOption","useMultiAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleCreateOption","PopoverPrimitive","Command","String","MultiAutoCompleteInput","MultiAutoCompleteInputIcons","e","MultiAutoCompleteList","MultiAutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAwHA,MAAMA,wCAAwC,CAACC;IAC3C,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,oBAAoB,EACpBC,oBAAoB,EACpBC,YAAY,EACf,GAAGC,qBAAqBR;IAEzB,MAAMS,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIX,MAAM,QAAQ,EACd;QAGJ,IAAI,CAACC,GAAG,aAAa,CAAC,IAAI,EACtBC,iBAAiB;QAGrB,IAAIS,AAA4B,aAA5BA,MAAM,GAAG,CAAC,WAAW,IACrBT,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;QAAkBC;QAAmBF,GAAG,aAAa,CAAC,IAAI;KAAC;IAGhF,MAAMW,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGV,kBAAkBU;QAClBX,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMY,qBAAqBJ,MAAAA,WAAiB,CACxC,CAACG;QACGN,aAAaM;QACbX,iBAAiB;IACrB,GACA;QAACK;QAAcL;KAAiB;IAGpC,OAAO,WAAP,GACI,oBAACa,kBAAgBA;QAAC,MAAMd,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACc,SAAOA;QACJ,OAAOC,OAAOjB,MAAM,KAAK;QACzB,cAAcA,MAAM,YAAY;QAChC,WAAWS;qBAEX,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACG,wBAAsBA;QACnB,UAAUlB,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,aAAaA,GAAG,OAAO,CAAC,WAAW;QACnC,aAAaG;QACb,WAAW,IAAMF,iBAAiB;QAClC,UAAU,IAAMA,iBAAiB;QACjC,SAASF,MAAM,OAAO;QACtB,MAAMA,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,sBAAsBK;QACtB,wBAAwBL,MAAM,sBAAsB;QACpD,iBAAiBC,GAAG,iBAAiB,CAAC,OAAO;QAC7C,UAAUD,MAAM,QAAQ;QACxB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACmB,6BAA2BA;YACxB,WAAWnB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBACI,CAACC,GAAG,iBAAiB,CAAC,KAAK,IAAIA,GAAG,OAAO,CAAC,kBAAkB;YAEhE,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcM;YACd,cAAc,IAAMJ,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;wBAM/E,oBAACc,iBAAiB,OAAO;QACrB,OAAO;YAAE,OAAO;QAAqC;QACrD,iBAAiBK,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,uBAAqBA;QAClB,cAAcpB,GAAG,aAAa,CAAC,YAAY;QAC3C,OAAOA,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,gBAAgBa;QAChB,gBAAgBF;QAChB,gBAAgBZ,MAAM,cAAc;QACpC,SAASC,GAAG,aAAa,CAAC,OAAO;QACjC,iBAAiBA,GAAG,iBAAiB,CAAC,MAAM;;AAMpE;AAEA,MAAMqB,6BAA6BC,gBAC/B,8BACAxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/admin-ui",
3
- "version": "6.5.0-beta.11",
3
+ "version": "6.5.0-beta.12",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -19,9 +19,9 @@
19
19
  "@monaco-editor/react": "4.7.0",
20
20
  "@radix-ui/react-scroll-area": "1.2.18",
21
21
  "@tanstack/react-table": "9.2.5",
22
- "@webiny/icons": "6.5.0-beta.11",
23
- "@webiny/react-composition": "6.5.0-beta.11",
24
- "@webiny/utils": "6.5.0-beta.11",
22
+ "@webiny/icons": "6.5.0-beta.12",
23
+ "@webiny/react-composition": "6.5.0-beta.12",
24
+ "@webiny/utils": "6.5.0-beta.12",
25
25
  "bytes": "3.1.2",
26
26
  "class-variance-authority": "0.7.1",
27
27
  "clsx": "2.1.1",
@@ -56,8 +56,8 @@
56
56
  "@types/react-color": "3.0.13",
57
57
  "@types/react-custom-scrollbars": "4.0.13",
58
58
  "@types/react-virtualized": "9.22.4",
59
- "@webiny/build-tools": "6.5.0-beta.11",
60
- "@webiny/project": "6.5.0-beta.11",
59
+ "@webiny/build-tools": "6.5.0-beta.12",
60
+ "@webiny/project": "6.5.0-beta.12",
61
61
  "chalk": "6.0.1",
62
62
  "oxfmt": "0.71.0",
63
63
  "rimraf": "6.1.3",