@mage-ui/components 0.0.91 → 0.0.93

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.
@@ -1,5 +1,5 @@
1
1
  import { ButtonProps } from "../button/Button.js";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/buttons/button-icon/ButtonIcon.d.ts
5
5
  type ButtonIconProps = ButtonProps & {
@@ -15,7 +15,7 @@ declare const ButtonIcon: ({
15
15
  icon,
16
16
  classNames,
17
17
  ...props
18
- }: ButtonIconProps) => react_jsx_runtime4.JSX.Element;
18
+ }: ButtonIconProps) => react_jsx_runtime5.JSX.Element;
19
19
  //#endregion
20
20
  export { ButtonIcon, ButtonIconProps };
21
21
  //# sourceMappingURL=ButtonIcon.d.ts.map
@@ -20,7 +20,7 @@ type ComboboxProps = Omit<DropdownBaseProps, 'children' | 'onClick' | 'setQuery'
20
20
  create?: string;
21
21
  };
22
22
  create?: string;
23
- empty?: string;
23
+ empty?: string | null;
24
24
  endSlot?: React.ReactNode;
25
25
  isClearable?: boolean;
26
26
  clearableIcon?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.d.ts","names":[],"sources":["../../../../src/components/controls/dropdown/Combobox.tsx"],"sourcesContent":[],"mappings":";;;;;;KAiBY,aAAA,GAAgB,KAC1B,qEAGA,KAAK;;;IAJK,KAAA,EAAA,MAAa;EAAA,CAAA,GAAA,SAAA,EAAA,GAAA,IAAA;SACvB,EAAA;IAD0B,EAAA,EAAA,MAAA,GAAA,MAAA;IAIrB,KAAA,EAAA,MAAA;KAAL;WAakB,CAAA,EAAA,OAAA;EAAS,UAAA,CAAA,EAAA;IAKhB,MAAA,CA8FZ,EAAA,MAAA;IAAA,KAAA,CAAA,EAAA,MAAA;IA9FwB,MAAA,CAAA,EAAA,MAAA;;QAAA,CAAA,EAAA,MAAA;OAAA,CAAA,EAAA,MAAA;SAAA,CAAA,EALX,KAAA,CAAM,SAKK;aAAA,CAAA,EAAA,OAAA;eAAA,CAAA,EAAA,MAAA;;AAAA,cAAZ,QAAY,EAAA,CAAA;EAAA,aAAA;EAAA,SAAA;EAAA,iBAAA;EAAA,cAAA;EAAA,OAAA;EAAA,OAAA;EAAA,UAAA;EAAA,MAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,GAAA;AAAA,CAAA,EAatB,aAbsB,EAAA,GAaT,kBAAA,CAAA,GAAA,CAAA,OAbS"}
1
+ {"version":3,"file":"Combobox.d.ts","names":[],"sources":["../../../../src/components/controls/dropdown/Combobox.tsx"],"sourcesContent":[],"mappings":";;;;;;KAkBY,aAAA,GAAgB,KAC1B,qEAGA,KAAK;;;IAJK,KAAA,EAAA,MAAa;EAAA,CAAA,GAAA,SAAA,EAAA,GAAA,IAAA;SACvB,EAAA;IAD0B,EAAA,EAAA,MAAA,GAAA,MAAA;IAIrB,KAAA,EAAA,MAAA;KAAL;WAakB,CAAA,EAAA,OAAA;EAAS,UAAA,CAAA,EAAA;IAKhB,MAAA,CAiGZ,EAAA,MAAA;IAAA,KAAA,CAAA,EAAA,MAAA;IAjGwB,MAAA,CAAA,EAAA,MAAA;;QAAA,CAAA,EAAA,MAAA;OAAA,CAAA,EAAA,MAAA,GAAA,IAAA;SAAA,CAAA,EALX,KAAA,CAAM,SAKK;aAAA,CAAA,EAAA,OAAA;eAAA,CAAA,EAAA,MAAA;;AAAA,cAAZ,QAAY,EAAA,CAAA;EAAA,aAAA;EAAA,SAAA;EAAA,iBAAA;EAAA,cAAA;EAAA,OAAA;EAAA,OAAA;EAAA,UAAA;EAAA,MAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,GAAA;AAAA,CAAA,EAatB,aAbsB,EAAA,GAaT,kBAAA,CAAA,GAAA,CAAA,OAbS"}
@@ -1,2 +1,2 @@
1
- import{Icon as e}from"../../data-display/icons/icon/Icon.js";import{DropdownBase as t}from"./DropdownBase.js";import{InputText as n}from"../input-text/InputText.js";import{clearSection as r,comboboxEmpty as i,comboboxOption as a,icon as o,inputSection as s,selectSection as c}from"@mage-ui/styled-system/recipes";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useState as d}from"react";import{cx as f}from"@mage-ui/styled-system/css";const p=({defaultOpened:p=!1,creatable:m,setSelectedOption:h,selectedOption:g,endSlot:_,options:v,classNames:y,create:b,empty:x,isClearable:S,clearableIcon:C,...w})=>{let[T,E]=d(g?.value??``),D=(v.every(e=>e.value!==T)?v.filter(e=>e.value.toLowerCase().includes(T.toLowerCase().trim())):v).map(e=>l(t.Option,{value:e.value,active:g?.id===e.id,classNames:{option:y?.option??a()},children:e.value},e.id)),O=()=>m&&T?u(t.Option,{value:T,classNames:{option:y?.create??a({type:`create`})},children:[l(e,{name:`plus`,classNames:o({size:`m`})}),`${b??`Create`} '${T}'`]},T):l(t.Empty,{classNames:{empty:y?.empty??i()},children:x??`Nothing found`}),k=e=>{let t=v.find(t=>t.value===e);!t&&m&&e&&(t={id:`new`,value:e}),h(t)};return l(t,{readOnly:!1,target:l(n,{value:T,classNames:{section:y?.section??f(s(),S&&T?r():c())},...w}),selectedOption:g,setQuery:E,setSelectedOption:e=>k(e),endSlot:_,width:`target`,isClearable:S,clearableIcon:C,children:D.length>0?D:l(O,{})})};export{p as Combobox};
1
+ import{Icon as e}from"../../data-display/icons/icon/Icon.js";import{DropdownBase as t}from"./DropdownBase.js";import{InputText as n}from"../input-text/InputText.js";import{clearSection as r,comboboxEmpty as i,comboboxOption as a,dropdown as o,icon as s,inputSection as c,selectSection as l}from"@mage-ui/styled-system/recipes";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useState as f}from"react";import{cx as p}from"@mage-ui/styled-system/css";const m=({defaultOpened:m=!1,creatable:h,setSelectedOption:g,selectedOption:_,endSlot:v,options:y,classNames:b,create:x,empty:S,isClearable:C,clearableIcon:w,...T})=>{let[E,D]=f(_?.value??``),O=(y.every(e=>e.value!==E)?y.filter(e=>e.value.toLowerCase().includes(E.toLowerCase().trim())):y).map(e=>u(t.Option,{value:e.value,active:_?.id===e.id,classNames:{option:b?.option??a()},children:e.value},e.id)),k=()=>h&&E?d(t.Option,{value:E,classNames:{option:b?.create??a({type:`create`})},children:[u(e,{name:`plus`,classNames:s({size:`m`})}),`${x??`Create`} '${E}'`]},E):S!==null&&u(t.Empty,{classNames:{empty:b?.empty??i()},children:S??`Nothing found`}),A=e=>{let t=y.find(t=>t.value===e);!t&&h&&e&&(t={id:`new`,value:e}),g(t)};return u(t,{classNames:{dropdown:S===null?``:o()},readOnly:!1,target:u(n,{value:E,classNames:{section:b?.section??p(c(),C&&E?r():l())},...T}),selectedOption:_,setQuery:D,setSelectedOption:e=>A(e),endSlot:v,width:`target`,isClearable:C,clearableIcon:w,children:O.length>0?O:u(k,{})})};export{m as Combobox};
2
2
  //# sourceMappingURL=Combobox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","names":[],"sources":["../../../../src/components/controls/dropdown/Combobox.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n clearSection,\n comboboxEmpty,\n comboboxOption,\n icon,\n inputSection,\n selectSection,\n} from '@mage-ui/styled-system/recipes';\nimport { InputText, type InputTextProps } from '@/components/controls';\nimport { Icon } from '@/components/data-display';\n\nimport { DropdownBase, type DropdownBaseProps } from './DropdownBase';\n\nexport type ComboboxProps = Omit<\n DropdownBaseProps,\n 'children' | 'onClick' | 'setQuery' | 'target'\n> &\n Omit<InputTextProps, 'isClearable' | 'clearableIcon'> & {\n setSelectedOption: (\n option: { id: string | number; value: string } | undefined,\n ) => void;\n options: { id: string | number; value: string }[];\n creatable?: boolean;\n classNames?: {\n option?: string;\n empty?: string;\n create?: string;\n };\n create?: string;\n empty?: string;\n endSlot?: React.ReactNode;\n isClearable?: boolean;\n clearableIcon?: string;\n };\n\nexport const Combobox = ({\n defaultOpened = false,\n creatable,\n setSelectedOption,\n selectedOption,\n endSlot,\n options,\n classNames,\n create,\n empty,\n isClearable,\n clearableIcon,\n ...props\n}: ComboboxProps) => {\n const [query, setQuery] = useState(selectedOption?.value ?? '');\n\n const shouldFilterOptions = options.every((item) => item.value !== query);\n const filteredOptions = shouldFilterOptions\n ? options.filter((item) =>\n item.value.toLowerCase().includes(query.toLowerCase().trim()),\n )\n : options;\n\n const dropdownOptions = filteredOptions.map((option) => (\n <DropdownBase.Option\n value={option.value}\n key={option.id}\n active={selectedOption?.id === option.id}\n classNames={{ option: classNames?.option ?? comboboxOption() }}\n >\n {option.value}\n </DropdownBase.Option>\n ));\n\n const MissingOption = () => {\n if (creatable && query) {\n return (\n <DropdownBase.Option\n value={query}\n key={query}\n classNames={{\n option: classNames?.create ?? comboboxOption({ type: 'create' }),\n }}\n >\n <Icon name='plus' classNames={icon({ size: 'm' })} />\n {`${create ?? 'Create'} '${query}'`}\n </DropdownBase.Option>\n );\n }\n return (\n <DropdownBase.Empty\n classNames={{ empty: classNames?.empty ?? comboboxEmpty() }}\n >\n {empty ?? 'Nothing found'}\n </DropdownBase.Empty>\n );\n };\n\n const onChange = (value: string | undefined) => {\n let selected = options.find((item) => item.value === value);\n if (!selected && creatable && value) {\n selected = { id: 'new', value };\n }\n setSelectedOption(selected);\n };\n\n return (\n <DropdownBase\n readOnly={false}\n target={\n <InputText\n value={query}\n classNames={{\n section:\n classNames?.section ??\n cx(\n inputSection(),\n isClearable && query ? clearSection() : selectSection(),\n ),\n }}\n {...props}\n />\n }\n selectedOption={selectedOption}\n setQuery={setQuery}\n setSelectedOption={(option) => onChange(option)}\n endSlot={endSlot}\n width='target'\n isClearable={isClearable}\n clearableIcon={clearableIcon}\n >\n {dropdownOptions.length > 0 ? dropdownOptions : <MissingOption />}\n </DropdownBase>\n );\n};\n"],"mappings":"4bAuCA,MAAa,GAAY,CACvB,gBAAgB,GAChB,YACA,oBACA,iBACA,UACA,UACA,aACA,SACA,QACA,cACA,gBACA,G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obox.js","names":[],"sources":["../../../../src/components/controls/dropdown/Combobox.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n clearSection,\n comboboxEmpty,\n comboboxOption,\n dropdown,\n icon,\n inputSection,\n selectSection,\n} from '@mage-ui/styled-system/recipes';\nimport { InputText, type InputTextProps } from '@/components/controls';\nimport { Icon } from '@/components/data-display';\n\nimport { DropdownBase, type DropdownBaseProps } from './DropdownBase';\n\nexport type ComboboxProps = Omit<\n DropdownBaseProps,\n 'children' | 'onClick' | 'setQuery' | 'target'\n> &\n Omit<InputTextProps, 'isClearable' | 'clearableIcon'> & {\n setSelectedOption: (\n option: { id: string | number; value: string } | undefined,\n ) => void;\n options: { id: string | number; value: string }[];\n creatable?: boolean;\n classNames?: {\n option?: string;\n empty?: string;\n create?: string;\n };\n create?: string;\n empty?: string | null;\n endSlot?: React.ReactNode;\n isClearable?: boolean;\n clearableIcon?: string;\n };\n\nexport const Combobox = ({\n defaultOpened = false,\n creatable,\n setSelectedOption,\n selectedOption,\n endSlot,\n options,\n classNames,\n create,\n empty,\n isClearable,\n clearableIcon,\n ...props\n}: ComboboxProps) => {\n const [query, setQuery] = useState(selectedOption?.value ?? '');\n\n const shouldFilterOptions = options.every((item) => item.value !== query);\n const filteredOptions = shouldFilterOptions\n ? options.filter((item) =>\n item.value.toLowerCase().includes(query.toLowerCase().trim()),\n )\n : options;\n\n const dropdownOptions = filteredOptions.map((option) => (\n <DropdownBase.Option\n value={option.value}\n key={option.id}\n active={selectedOption?.id === option.id}\n classNames={{ option: classNames?.option ?? comboboxOption() }}\n >\n {option.value}\n </DropdownBase.Option>\n ));\n\n const MissingOption = () => {\n if (creatable && query) {\n return (\n <DropdownBase.Option\n value={query}\n key={query}\n classNames={{\n option: classNames?.create ?? comboboxOption({ type: 'create' }),\n }}\n >\n <Icon name='plus' classNames={icon({ size: 'm' })} />\n {`${create ?? 'Create'} '${query}'`}\n </DropdownBase.Option>\n );\n }\n return (\n empty !== null && (\n <DropdownBase.Empty\n classNames={{ empty: classNames?.empty ?? comboboxEmpty() }}\n >\n {empty ?? 'Nothing found'}\n </DropdownBase.Empty>\n )\n );\n };\n\n const onChange = (value: string | undefined) => {\n let selected = options.find((item) => item.value === value);\n if (!selected && creatable && value) {\n selected = { id: 'new', value };\n }\n setSelectedOption(selected);\n };\n\n return (\n <DropdownBase\n classNames={{ dropdown: empty === null ? '' : dropdown() }}\n readOnly={false}\n target={\n <InputText\n value={query}\n classNames={{\n section:\n classNames?.section ??\n cx(\n inputSection(),\n isClearable && query ? clearSection() : selectSection(),\n ),\n }}\n {...props}\n />\n }\n selectedOption={selectedOption}\n setQuery={setQuery}\n setSelectedOption={(option) => onChange(option)}\n endSlot={endSlot}\n width='target'\n isClearable={isClearable}\n clearableIcon={clearableIcon}\n >\n {dropdownOptions.length > 0 ? dropdownOptions : <MissingOption />}\n </DropdownBase>\n );\n};\n"],"mappings":"0cAwCA,MAAa,GAAY,CACvB,gBAAgB,GAChB,YACA,oBACA,iBACA,UACA,UACA,aACA,SACA,QACA,cACA,gBACA,GAAG,KACgB,CACnB,GAAM,CAAC,EAAO,GAAY,EAAS,GAAgB,OAAS,GAAG,CASzD,GAPsB,EAAQ,MAAO,GAAS,EAAK,QAAU,EAAM,CAErE,EAAQ,OAAQ,GACd,EAAK,MAAM,aAAa,CAAC,SAAS,EAAM,aAAa,CAAC,MAAM,CAAC,CAC9D,CACD,GAEoC,IAAK,GAC3C,EAAC,EAAa,OAAA,CACZ,MAAO,EAAO,MAEd,OAAQ,GAAgB,KAAO,EAAO,GACtC,WAAY,CAAE,OAAQ,GAAY,QAAU,GAAgB,CAAE,UAE7D,EAAO,OAJH,EAAO,GAKQ,CACtB,CAEI,MACA,GAAa,EAEb,EAAC,EAAa,OAAA,CACZ,MAAO,EAEP,WAAY,CACV,OAAQ,GAAY,QAAU,EAAe,CAAE,KAAM,SAAU,CAAC,CACjE,WAED,EAAC,EAAA,CAAK,KAAK,OAAO,WAAY,EAAK,CAAE,KAAM,IAAK,CAAC,EAAI,CACpD,GAAG,GAAU,SAAS,IAAI,EAAM,GAAA,EAN5B,EAOe,CAIxB,IAAU,MACR,EAAC,EAAa,MAAA,CACZ,WAAY,CAAE,MAAO,GAAY,OAAS,GAAe,CAAE,UAE1D,GAAS,iBACS,CAKrB,EAAY,GAA8B,CAC9C,IAAI,EAAW,EAAQ,KAAM,GAAS,EAAK,QAAU,EAAM,CACvD,CAAC,GAAY,GAAa,IAC5B,EAAW,CAAE,GAAI,MAAO,QAAO,EAEjC,EAAkB,EAAS,EAG7B,OACE,EAAC,EAAA,CACC,WAAY,CAAE,SAAU,IAAU,KAAO,GAAK,GAAU,CAAE,CAC1D,SAAU,GACV,OACE,EAAC,EAAA,CACC,MAAO,EACP,WAAY,CACV,QACE,GAAY,SACZ,EACE,GAAc,CACd,GAAe,EAAQ,GAAc,CAAG,GAAe,CACxD,CACJ,CACD,GAAI,GACJ,CAEY,iBACN,WACV,kBAAoB,GAAW,EAAS,EAAO,CACtC,UACT,MAAM,SACO,cACE,yBAEd,EAAgB,OAAS,EAAI,EAAkB,EAAC,EAAA,EAAA,CAAgB,EACpD"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/components/navigation/breadcrumbs/Breadcrumbs.d.ts
@@ -17,7 +17,7 @@ declare const Breadcrumbs: {
17
17
  separator,
18
18
  children,
19
19
  classNames
20
- }: BreadcrumbsProps): react_jsx_runtime5.JSX.Element;
20
+ }: BreadcrumbsProps): react_jsx_runtime4.JSX.Element;
21
21
  Item: {
22
22
  ({
23
23
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mage-ui/components",
3
- "version": "0.0.91",
3
+ "version": "0.0.93",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -26,8 +26,8 @@
26
26
  "rimraf": "^6.0.1",
27
27
  "tsdown": "^0.15.6",
28
28
  "typescript": "^5.9.3",
29
- "@mage-ui/preset": "0.0.91",
30
- "@mage-ui/styled-system": "0.0.91"
29
+ "@mage-ui/preset": "0.0.93",
30
+ "@mage-ui/styled-system": "0.0.93"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@hookform/resolvers": "^5.2.2",