@mage-ui/components 0.0.72 → 0.0.73
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/controls/date-picker/DatePicker.d.ts +2 -1
- package/dist/components/controls/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/controls/date-picker/DatePicker.js +1 -1
- package/dist/components/controls/date-picker/DatePicker.js.map +1 -1
- package/dist/components/controls/input-file/InputFile.d.ts +1 -0
- package/dist/components/controls/input-file/InputFile.d.ts.map +1 -1
- package/dist/components/controls/input-file/InputFile.js.map +1 -1
- package/package.json +3 -3
|
@@ -12,6 +12,8 @@ type DatePickerProps = {
|
|
|
12
12
|
classNames?: DatePickerClassNames;
|
|
13
13
|
value?: DatePickerValue;
|
|
14
14
|
locale?: string;
|
|
15
|
+
maxDate?: Date;
|
|
16
|
+
minDate?: Date;
|
|
15
17
|
onChange?: (date: Date | string | null) => void;
|
|
16
18
|
};
|
|
17
19
|
declare const DatePicker: ({
|
|
@@ -20,7 +22,6 @@ declare const DatePicker: ({
|
|
|
20
22
|
placeholder,
|
|
21
23
|
description,
|
|
22
24
|
icon,
|
|
23
|
-
locale,
|
|
24
25
|
...props
|
|
25
26
|
}: DatePickerProps) => ReactNode;
|
|
26
27
|
type DatePickerClassNames = InputClassNamesType & CalenderHeaderClassNamesType & CalendarMonthClassNamesType & CalendarMonthsListClassNamesType & CalendarYearsListClassNamesType & PopoverClassNamesType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","names":[],"sources":["../../../../src/components/controls/date-picker/DatePicker.tsx"],"sourcesContent":[],"mappings":";;;;KAkCY,eAAA;;EAAA,KAAA,CAAA,EAAA,MAAA;EAAe,WAAA,CAAA,EAAA,MAAA;aAKZ,CAAA,EAAA,MAAA;MAEA,CAAA,EAFN,KAAA,CAAM,SAEA;OACL,CAAA,EAAA,MAAA;
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","names":[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B;;;;;;KAvCrB,gCAAA;;;;;;KAoBA,+BAAA;;;;;;KAmBA,qBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{calendarControl as e,calendarDay as t,calendarHeader as n,calendarHeaderControlIcon as r,calendarHeaderLevel as i,calendarMonth as a,calendarMonthRow as o,calendarMonthsList as s,calendarMonthsListCell as c,calendarMonthsListControl as l,calendarMonthsListRow as u,calendarWeekDay as d,calendarWeekDaysRow as f,calendarYearsList as p,calendarYearsListCell as m,calendarYearsListControl as h,calendarYearsListRow as g,datepickerDropdown as _,datepickerInput as v,input as y,inputDescription as b,inputError as x,inputLabel as S,inputPlaceholder as C,inputRoot as w,inputSection as T,inputWrapper as E}from"@mage-ui/styled-system/recipes";import{jsx as D}from"react/jsx-runtime";import{cx as O}from"@mage-ui/styled-system/css";import{DatePickerInput as k}from"@mantine/dates";const A=({classNames:e,label:t,placeholder:n,description:r,icon:i
|
|
1
|
+
import{calendarControl as e,calendarDay as t,calendarHeader as n,calendarHeaderControlIcon as r,calendarHeaderLevel as i,calendarMonth as a,calendarMonthRow as o,calendarMonthsList as s,calendarMonthsListCell as c,calendarMonthsListControl as l,calendarMonthsListRow as u,calendarWeekDay as d,calendarWeekDaysRow as f,calendarYearsList as p,calendarYearsListCell as m,calendarYearsListControl as h,calendarYearsListRow as g,datepickerDropdown as _,datepickerInput as v,input as y,inputDescription as b,inputError as x,inputLabel as S,inputPlaceholder as C,inputRoot as w,inputSection as T,inputWrapper as E}from"@mage-ui/styled-system/recipes";import{jsx as D}from"react/jsx-runtime";import{cx as O}from"@mage-ui/styled-system/css";import{DatePickerInput as k}from"@mantine/dates";const A=({classNames:e,label:t,placeholder:n,description:r,icon:i,...a})=>D(k,{label:t??`Pick date`,placeholder:n??`Pick date`,description:r??`Select a date`,classNames:L(e),popoverProps:{classNames:I(e)},rightSection:i,...a}),j=e=>({root:e?.root??w(),wrapper:e?.wrapper??E(),input:e?.input??O(y(),v()),label:e?.label??S(),error:e?.error??x(),description:e?.description??b(),placeholder:e?.placeholder??C(),section:e?.section??T({pointerEvents:`none`})}),M=t=>({calendarHeaderControl:t?.calendarHeaderControl??e(),calendarHeader:t?.calendarHeader??n(),calendarHeaderLevel:t?.calendarHeaderLevel??i(),calendarHeaderControlIcon:t?.calendarHeaderControlIcon??r()}),N=e=>({month:e?.calendarMonth??a(),weekdaysRow:e?.calendarWeekDaysRow??f(),weekday:e?.calendarWeekDay??d(),monthRow:e?.calendarMonthRow??o(),day:e?.calendarDay??t()}),P=e=>({monthsList:e?.calendarMonthsList??s(),monthsListRow:e?.calendarMonthsListRow??u(),monthsListCell:e?.calendarMonthsListCell??c(),monthsListControl:e?.calendarMonthsListControl??l()}),F=e=>({yearsList:e?.calendarYearsList??p(),yearsListRow:e?.calendarYearsListRow??g(),yearsListCell:e?.calendarYearsListCell??m(),yearsListControl:e?.calendarYearsListControl??h()}),I=e=>({dropdown:e?.datepickerDropdown??_()}),L=e=>({...j(e),...M(e),...N(e),...P(e),...F(e)});export{A as DatePicker};
|
|
2
2
|
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","names":["icon"],"sources":["../../../../src/components/controls/date-picker/DatePicker.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n calendarControl,\n calendarDay,\n calendarHeader,\n calendarHeaderControlIcon,\n calendarHeaderLevel,\n calendarMonth,\n calendarMonthRow,\n calendarMonthsList,\n calendarMonthsListCell,\n calendarMonthsListControl,\n calendarMonthsListRow,\n calendarWeekDay,\n calendarWeekDaysRow,\n calendarYearsList,\n calendarYearsListCell,\n calendarYearsListControl,\n calendarYearsListRow,\n datepickerDropdown,\n datepickerInput,\n input,\n inputDescription,\n inputError,\n inputLabel,\n inputPlaceholder,\n inputRoot,\n inputSection,\n inputWrapper,\n} from '@mage-ui/styled-system/recipes';\nimport { DatePickerInput, type DatePickerValue } from '@mantine/dates';\n\nexport type DatePickerProps = {\n name?: string;\n label?: string;\n placeholder?: string;\n description?: string;\n icon?: React.ReactNode;\n error?: string;\n classNames?: DatePickerClassNames;\n value?: DatePickerValue;\n locale?: string;\n onChange?: (date: Date | string | null) => void;\n};\n\nexport const DatePicker = ({\n classNames,\n label,\n placeholder,\n description,\n icon,\n
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["icon"],"sources":["../../../../src/components/controls/date-picker/DatePicker.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n calendarControl,\n calendarDay,\n calendarHeader,\n calendarHeaderControlIcon,\n calendarHeaderLevel,\n calendarMonth,\n calendarMonthRow,\n calendarMonthsList,\n calendarMonthsListCell,\n calendarMonthsListControl,\n calendarMonthsListRow,\n calendarWeekDay,\n calendarWeekDaysRow,\n calendarYearsList,\n calendarYearsListCell,\n calendarYearsListControl,\n calendarYearsListRow,\n datepickerDropdown,\n datepickerInput,\n input,\n inputDescription,\n inputError,\n inputLabel,\n inputPlaceholder,\n inputRoot,\n inputSection,\n inputWrapper,\n} from '@mage-ui/styled-system/recipes';\nimport { DatePickerInput, type DatePickerValue } from '@mantine/dates';\n\nexport type DatePickerProps = {\n name?: string;\n label?: string;\n placeholder?: string;\n description?: string;\n icon?: React.ReactNode;\n error?: string;\n classNames?: DatePickerClassNames;\n value?: DatePickerValue;\n locale?: string;\n maxDate?: Date;\n minDate?: Date;\n onChange?: (date: Date | string | null) => void;\n};\n\nexport const DatePicker = ({\n classNames,\n label,\n placeholder,\n description,\n icon,\n ...props\n}: DatePickerProps): ReactNode => {\n return (\n <DatePickerInput\n label={label ?? 'Pick date'}\n placeholder={placeholder ?? 'Pick date'}\n description={description ?? 'Select a date'}\n classNames={datePickerClassNames(classNames)}\n popoverProps={{\n classNames: popoverClassNames(classNames),\n }}\n rightSection={icon}\n {...props}\n />\n );\n};\n\ntype DatePickerClassNames = InputClassNamesType &\n CalenderHeaderClassNamesType &\n CalendarMonthClassNamesType &\n CalendarMonthsListClassNamesType &\n CalendarYearsListClassNamesType &\n PopoverClassNamesType;\n\ntype InputClassNamesType = {\n root?: string;\n wrapper?: string;\n input?: string;\n label?: string;\n error?: string;\n description?: string;\n placeholder?: string;\n section?: string;\n};\n\nconst inputClassNames = (classNames?: InputClassNamesType) => {\n return {\n root: classNames?.root ?? inputRoot(),\n wrapper: classNames?.wrapper ?? inputWrapper(),\n input: classNames?.input ?? cx(input(), datepickerInput()),\n label: classNames?.label ?? inputLabel(),\n error: classNames?.error ?? inputError(),\n description: classNames?.description ?? inputDescription(),\n placeholder: classNames?.placeholder ?? inputPlaceholder(),\n section: classNames?.section ?? inputSection({ pointerEvents: 'none' }),\n };\n};\n\ntype CalenderHeaderClassNamesType = {\n datepickerDropdown?: string;\n calendarHeaderControl?: string;\n calendarHeader?: string;\n calendarHeaderLevel?: string;\n calendarHeaderControlIcon?: string;\n};\n\nconst calendarHeaderClassNames = (\n classNames?: CalenderHeaderClassNamesType,\n) => {\n return {\n calendarHeaderControl:\n classNames?.calendarHeaderControl ?? calendarControl(),\n calendarHeader: classNames?.calendarHeader ?? calendarHeader(),\n calendarHeaderLevel:\n classNames?.calendarHeaderLevel ?? calendarHeaderLevel(),\n calendarHeaderControlIcon:\n classNames?.calendarHeaderControlIcon ?? calendarHeaderControlIcon(),\n };\n};\n\ntype CalendarMonthClassNamesType = {\n calendarMonth?: string;\n calendarWeekDaysRow?: string;\n calendarWeekDay?: string;\n calendarMonthRow?: string;\n calendarMonthCell?: string;\n calendarDay?: string;\n};\n\nconst calendarMonthClassNames = (classNames?: CalendarMonthClassNamesType) => {\n return {\n month: classNames?.calendarMonth ?? calendarMonth(),\n weekdaysRow: classNames?.calendarWeekDaysRow ?? calendarWeekDaysRow(),\n weekday: classNames?.calendarWeekDay ?? calendarWeekDay(),\n monthRow: classNames?.calendarMonthRow ?? calendarMonthRow(),\n day: classNames?.calendarDay ?? calendarDay(),\n };\n};\n\ntype CalendarMonthsListClassNamesType = {\n calendarMonthsList?: string;\n calendarMonthsListRow?: string;\n calendarMonthsListCell?: string;\n calendarMonthsListControl?: string;\n};\n\nconst calendarMonthsListClassNames = (\n classNames?: CalendarMonthsListClassNamesType,\n) => {\n return {\n monthsList: classNames?.calendarMonthsList ?? calendarMonthsList(),\n monthsListRow: classNames?.calendarMonthsListRow ?? calendarMonthsListRow(),\n monthsListCell:\n classNames?.calendarMonthsListCell ?? calendarMonthsListCell(),\n monthsListControl:\n classNames?.calendarMonthsListControl ?? calendarMonthsListControl(),\n };\n};\n\ntype CalendarYearsListClassNamesType = {\n calendarYearsList?: string;\n calendarYearsListRow?: string;\n calendarYearsListCell?: string;\n calendarYearsListControl?: string;\n};\n\nconst calendarYearsListClassNames = (\n classNames?: CalendarYearsListClassNamesType,\n) => {\n return {\n yearsList: classNames?.calendarYearsList ?? calendarYearsList(),\n yearsListRow: classNames?.calendarYearsListRow ?? calendarYearsListRow(),\n yearsListCell: classNames?.calendarYearsListCell ?? calendarYearsListCell(),\n yearsListControl:\n classNames?.calendarYearsListControl ?? calendarYearsListControl(),\n };\n};\n\ntype PopoverClassNamesType = {\n datepickerDropdown?: string;\n};\n\nconst popoverClassNames = (classNames?: PopoverClassNamesType) => {\n return {\n dropdown: classNames?.datepickerDropdown ?? datepickerDropdown(),\n };\n};\n\nconst datePickerClassNames = (classNames?: DatePickerClassNames) => {\n return {\n ...inputClassNames(classNames),\n ...calendarHeaderClassNames(classNames),\n ...calendarMonthClassNames(classNames),\n ...calendarMonthsListClassNames(classNames),\n ...calendarYearsListClassNames(classNames),\n };\n};\n"],"mappings":"6wBAiDA,MAAa,GAAc,CACzB,aACA,QACA,cACA,cACA,KAAA,EACA,GAAG,KAGD,EAAC,EAAA,CACC,MAAO,GAAS,YAChB,YAAa,GAAe,YAC5B,YAAa,GAAe,gBAC5B,WAAY,EAAqB,EAAW,CAC5C,aAAc,CACZ,WAAY,EAAkB,EAAW,CAC1C,CACD,aAAcA,EACd,GAAI,G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
|
|
1
|
-
{"version":3,"file":"InputFile.d.ts","names":[],"sources":["../../../../src/components/controls/input-file/InputFile.tsx"],"sourcesContent":[],"mappings":";;;KAmBY,cAAA;;;IAAA,KAAA,CAAA,EAAA,MAAc;IAAA,WAAA,CAAA,EAAA,MAAA;IAiBhB,KAAA,CAAA,EAAA,MAAA;IAAO,OAAA,CAAA,EAAA,MAAA;
|
|
1
|
+
{"version":3,"file":"InputFile.d.ts","names":[],"sources":["../../../../src/components/controls/input-file/InputFile.tsx"],"sourcesContent":[],"mappings":";;;KAmBY,cAAA;;;IAAA,KAAA,CAAA,EAAA,MAAc;IAAA,WAAA,CAAA,EAAA,MAAA;IAiBhB,KAAA,CAAA,EAAA,MAAA;IAAO,OAAA,CAAA,EAAA,MAAA;IAEI,KAAA,CAAA,EAAA,MAAA;IAAO,OAAA,CAAA,EAAA,MAAA;IAAI,WAAA,CAAA,EAAA,MAAA;IA4CnB,WAkCZ,CAAA,EAAA,MAAA;EAAA,CAAA;gBAlCyB,CAAA,EAAA,MAAA;OAAA,CAAA,EAAA,MAAA;aAAA,CAAA,EAAA,MAAA;aAKvB,CAAA,EAAA,MAAA;UAAc,CAAA,EAAA,OAAA;EA6BhB,KAAA,CAAA,EAhFS,IAgFT,GAhFgB,IAgFhB,EAAA,GAAA,IAAA;;qBA9EoB,OAAO;;cA4Cf;;;;;GAKV,mBAAc,mBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputFile.js","names":["props"],"sources":["../../../../src/components/controls/input-file/InputFile.tsx"],"sourcesContent":["import { cx } from '@mage-ui/styled-system/css';\nimport {\n badge,\n icon,\n input,\n inputButton,\n inputDescription,\n inputError,\n inputFileGroup,\n inputFileInput,\n inputFilePlaceholder,\n inputFileSection,\n inputLabel,\n inputRoot,\n inputWrapper,\n} from '@mage-ui/styled-system/recipes';\nimport { Badge, FileInput, Group } from '@mantine/core';\nimport { Icon } from '@/components/data-display';\n\nexport type InputFileProps = {\n classNames?: {\n root?: string;\n label?: string;\n description?: string;\n error?: string;\n wrapper?: string;\n input?: string;\n section?: string;\n placeholder?: string;\n clearButton?: string;\n };\n badgeClassName?: string;\n label?: string;\n description?: string;\n placeholder?: string;\n multiple?: boolean;\n value?: File | File[] | null;\n onChange?: (files: File | File[] | null) => void;\n};\n\nconst ValueComponent = ({\n value,\n badgeClassName,\n}: {\n value: File | File[] | null;\n badgeClassName?: string;\n}) => {\n if (value === null) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return (\n <Group\n classNames={{\n root: cx('group', inputFileGroup()),\n }}\n >\n {value.map((file) => (\n <Badge\n classNames={{\n root: cx(badge({ status: 'neutral' }), badgeClassName),\n }}\n key={file.name}\n >\n {file.name}\n </Badge>\n ))}\n </Group>\n );\n }\n\n return (\n <Badge\n classNames={{ root: cx(badge({ status: 'neutral' }), badgeClassName) }}\n >\n {value.name}\n </Badge>\n );\n};\n\nexport const InputFile = ({\n classNames,\n multiple,\n badgeClassName,\n ...props\n}: InputFileProps) => {\n return (\n <FileInput\n classNames={{\n root: cx(classNames?.root ?? inputRoot(), 'group'),\n label: classNames?.label ?? inputLabel(),\n required: classNames?.label ?? inputLabel(),\n description: classNames?.description ?? inputDescription(),\n error: classNames?.error ?? inputError(),\n wrapper: classNames?.wrapper ?? inputWrapper(),\n input: classNames?.input ?? cx(input(), inputFileInput()),\n section: classNames?.section ?? inputFileSection(),\n placeholder: classNames?.placeholder ?? inputFilePlaceholder(),\n }}\n leftSection={<Icon name='upload-02' classNames={icon({ size: 'm' })} />}\n multiple={multiple}\n valueComponent={(props) => (\n <ValueComponent {...props} badgeClassName={badgeClassName ?? ''} />\n )}\n clearable\n clearButtonProps={{\n className:\n classNames?.clearButton ??\n inputButton({ variant: 'ghost', size: 's', color: 'danger' }),\n children: <Icon name='trash-01' classNames={icon({ size: 's' })} />,\n }}\n {...props}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputFile.js","names":["props"],"sources":["../../../../src/components/controls/input-file/InputFile.tsx"],"sourcesContent":["import { cx } from '@mage-ui/styled-system/css';\nimport {\n badge,\n icon,\n input,\n inputButton,\n inputDescription,\n inputError,\n inputFileGroup,\n inputFileInput,\n inputFilePlaceholder,\n inputFileSection,\n inputLabel,\n inputRoot,\n inputWrapper,\n} from '@mage-ui/styled-system/recipes';\nimport { Badge, FileInput, Group } from '@mantine/core';\nimport { Icon } from '@/components/data-display';\n\nexport type InputFileProps = {\n classNames?: {\n root?: string;\n label?: string;\n description?: string;\n error?: string;\n wrapper?: string;\n input?: string;\n section?: string;\n placeholder?: string;\n clearButton?: string;\n };\n badgeClassName?: string;\n label?: string;\n description?: string;\n placeholder?: string;\n multiple?: boolean;\n value?: File | File[] | null;\n required?: boolean;\n onChange?: (files: File | File[] | null) => void;\n};\n\nconst ValueComponent = ({\n value,\n badgeClassName,\n}: {\n value: File | File[] | null;\n badgeClassName?: string;\n}) => {\n if (value === null) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return (\n <Group\n classNames={{\n root: cx('group', inputFileGroup()),\n }}\n >\n {value.map((file) => (\n <Badge\n classNames={{\n root: cx(badge({ status: 'neutral' }), badgeClassName),\n }}\n key={file.name}\n >\n {file.name}\n </Badge>\n ))}\n </Group>\n );\n }\n\n return (\n <Badge\n classNames={{ root: cx(badge({ status: 'neutral' }), badgeClassName) }}\n >\n {value.name}\n </Badge>\n );\n};\n\nexport const InputFile = ({\n classNames,\n multiple,\n badgeClassName,\n ...props\n}: InputFileProps) => {\n return (\n <FileInput\n classNames={{\n root: cx(classNames?.root ?? inputRoot(), 'group'),\n label: classNames?.label ?? inputLabel(),\n required: classNames?.label ?? inputLabel(),\n description: classNames?.description ?? inputDescription(),\n error: classNames?.error ?? inputError(),\n wrapper: classNames?.wrapper ?? inputWrapper(),\n input: classNames?.input ?? cx(input(), inputFileInput()),\n section: classNames?.section ?? inputFileSection(),\n placeholder: classNames?.placeholder ?? inputFilePlaceholder(),\n }}\n leftSection={<Icon name='upload-02' classNames={icon({ size: 'm' })} />}\n multiple={multiple}\n valueComponent={(props) => (\n <ValueComponent {...props} badgeClassName={badgeClassName ?? ''} />\n )}\n clearable\n clearButtonProps={{\n className:\n classNames?.clearButton ??\n inputButton({ variant: 'ghost', size: 's', color: 'danger' }),\n children: <Icon name='trash-01' classNames={icon({ size: 's' })} />,\n }}\n {...props}\n />\n );\n};\n"],"mappings":"ieAyCA,MAAM,GAAkB,CACtB,QACA,oBAKI,IAAU,KACL,KAGL,MAAM,QAAQ,EAAM,CAEpB,EAAC,EAAA,CACC,WAAY,CACV,KAAM,EAAG,QAAS,GAAgB,CAAC,CACpC,UAEA,EAAM,IAAK,GACV,EAAC,EAAA,CACC,WAAY,CACV,KAAM,EAAG,EAAM,CAAE,OAAQ,UAAW,CAAC,CAAE,EAAe,CACvD,UAGA,EAAK,MAFD,EAAK,KAGJ,CACR,EACI,CAKV,EAAC,EAAA,CACC,WAAY,CAAE,KAAM,EAAG,EAAM,CAAE,OAAQ,UAAW,CAAC,CAAE,EAAe,CAAE,UAErE,EAAM,MACD,CAIC,GAAa,CACxB,aACA,WACA,iBACA,GAAG,KAGD,EAAC,EAAA,CACC,WAAY,CACV,KAAM,EAAG,GAAY,MAAQ,GAAW,CAAE,QAAQ,CAClD,MAAO,GAAY,OAAS,GAAY,CACxC,SAAU,GAAY,OAAS,GAAY,CAC3C,YAAa,GAAY,aAAe,GAAkB,CAC1D,MAAO,GAAY,OAAS,GAAY,CACxC,QAAS,GAAY,SAAW,GAAc,CAC9C,MAAO,GAAY,OAAS,EAAG,GAAO,CAAE,GAAgB,CAAC,CACzD,QAAS,GAAY,SAAW,GAAkB,CAClD,YAAa,GAAY,aAAe,GAAsB,CAC/D,CACD,YAAa,EAAC,EAAA,CAAK,KAAK,YAAY,WAAY,EAAK,CAAE,KAAM,IAAK,CAAC,EAAI,CAC7D,WACV,eAAiB,GACf,EAAC,EAAA,CAAe,GAAIA,EAAO,eAAgB,GAAkB,IAAM,CAErE,UAAA,GACA,iBAAkB,CAChB,UACE,GAAY,aACZ,EAAY,CAAE,QAAS,QAAS,KAAM,IAAK,MAAO,SAAU,CAAC,CAC/D,SAAU,EAAC,EAAA,CAAK,KAAK,WAAW,WAAY,EAAK,CAAE,KAAM,IAAK,CAAC,EAAI,CACpE,CACD,GAAI,GACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mage-ui/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
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.
|
|
30
|
-
"@mage-ui/styled-system": "0.0.
|
|
29
|
+
"@mage-ui/preset": "0.0.73",
|
|
30
|
+
"@mage-ui/styled-system": "0.0.73"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@hookform/resolvers": "^5.2.2",
|