@mage-ui/components 0.0.23 → 0.0.24
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/buttons/button/Button.d.ts +2 -2
- package/dist/components/buttons/button-icon/ButtonIcon.d.ts +2 -2
- package/dist/components/controls/dropdown/Select.d.ts.map +1 -1
- package/dist/components/controls/dropdown/Select.js +1 -1
- package/dist/components/controls/dropdown/Select.js.map +1 -1
- package/dist/components/controls/textarea/Textarea.d.ts +2 -2
- package/dist/components/data-display/avatar/Avatar.d.ts +2 -2
- package/dist/components/data-display/badge/Badge.d.ts +2 -2
- package/dist/components/data-display/carousel/Carousel.d.ts +2 -2
- package/dist/components/forms/form/Form.d.ts +27 -15
- package/dist/components/forms/form/Form.d.ts.map +1 -1
- package/dist/components/forms/form/Form.js +1 -1
- package/dist/components/forms/form/Form.js.map +1 -1
- package/dist/components/forms/form/controls/FormIfField.d.ts +15 -0
- package/dist/components/forms/form/controls/FormIfField.d.ts.map +1 -0
- package/dist/components/forms/form/controls/FormIfField.js +2 -0
- package/dist/components/forms/form/controls/FormIfField.js.map +1 -0
- package/dist/components/misc/visually-hidden/VisuallyHidden.d.ts +2 -2
- package/dist/components/misc/visually-hidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/components/navigation/tabs/Tabs.d.ts +5 -5
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime37 from "react/jsx-runtime";
|
|
2
2
|
import { ComponentProps, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/buttons/button/Button.d.ts
|
|
@@ -18,7 +18,7 @@ declare const Button: ({
|
|
|
18
18
|
endSlot,
|
|
19
19
|
children,
|
|
20
20
|
...props
|
|
21
|
-
}: ButtonProps) =>
|
|
21
|
+
}: ButtonProps) => react_jsx_runtime37.JSX.Element;
|
|
22
22
|
//# sourceMappingURL=Button.d.ts.map
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonProps } from "../button/Button.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 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) =>
|
|
18
|
+
}: ButtonIconProps) => react_jsx_runtime1.JSX.Element;
|
|
19
19
|
//# sourceMappingURL=ButtonIcon.d.ts.map
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","names":[],"sources":["../../../../src/components/controls/dropdown/Select.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","names":[],"sources":["../../../../src/components/controls/dropdown/Select.tsx"],"sourcesContent":[],"mappings":";;;;;KAgBY,WAAA,GAAc,KACxB,qEAGA;;;IAJU,KAAA,EAAA,MAAW;EAAA,CAAA,GAAA,SAAA,EAAA,GAAA,IAAA;EAAA,OACrB,EAAA;IADwB,EAAA,EAAA,MAAA,GAAA,MAAA;IAIxB,KAAA,EAAA,MAAA;EAAc,CAAA,EAAA;EAUH,UAiDZ,CAAA,EAAA;IAAA,MAAA,CAAA,EAAA,MAAA;EAAA,CAAA;CAjDsB;AAAA,cAAV,MAAU,EAAA,CAAA;EAAA,aAAA;EAAA,iBAAA;EAAA,cAAA;EAAA,OAAA;EAAA,UAAA;EAAA,GAAA;AAAA,CAAA,EAOpB,WAPoB,EAAA,GAOT,mBAAA,CAAA,GAAA,CAAA,OAPS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DropdownBase as e}from"./DropdownBase.js";import{InputText as t}from"../input-text/InputText.js";import{comboboxOption as n,input as r,
|
|
1
|
+
import{DropdownBase as e}from"./DropdownBase.js";import{InputText as t}from"../input-text/InputText.js";import{comboboxOption as n,input as r,inputLabel as i,inputRoot as a,inputSection as o,selectButton as s,selectSection as c}from"@mage-ui/styled-system/recipes";import{jsx as l}from"react/jsx-runtime";import{useState as u}from"react";import{cx as d}from"@mage-ui/styled-system/css";const f=({defaultOpened:f=!1,setSelectedOption:p,selectedOption:m,options:h,classNames:g,..._})=>{let[v,y]=u(m?.value??``),b=h.map(t=>l(e.Option,{value:t.value,active:m?.id===t.id,classNames:{option:g?.option??n()},children:t.value},t.id)),x=e=>{let t=h.find(t=>t.value===e);p(t)};return l(e,{readOnly:!0,target:l(t,{readOnly:!0,classNames:{root:g?.root??a(),label:g?.label??i(),input:g?.input??d(r(),s()),section:g?.section??d(o(),c())},value:v,..._}),selectedOption:m,setQuery:y,setSelectedOption:e=>x(e),children:b})};export{f as Select};
|
|
2
2
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["value: string | undefined"],"sources":["../../../../src/components/controls/dropdown/Select.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n comboboxOption,\n input,\n inputSection,\n selectButton,\n selectSection,\n} from '@mage-ui/styled-system/recipes';\nimport { InputText, type InputTextProps } from '@/components/controls';\n\nimport { DropdownBase, type DropdownBaseProps } from './DropdownBase';\n\nexport type SelectProps = Omit<\n DropdownBaseProps,\n 'children' | 'onClick' | 'setQuery' | 'target'\n> &\n InputTextProps & {\n setSelectedOption: (\n option: { id: string | number; value: string } | undefined,\n ) => void;\n options: { id: string | number; value: string }[];\n classNames?: {\n option?: string;\n };\n };\n\nexport const Select = ({\n defaultOpened = false,\n setSelectedOption,\n selectedOption,\n options,\n classNames,\n ...props\n}: SelectProps) => {\n const [query, setQuery] = useState(selectedOption?.value ?? '');\n\n const dropdownOptions = options.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 onChange = (value: string | undefined) => {\n const selected = options.find((item) => item.value === value);\n setSelectedOption(selected);\n };\n\n return (\n <DropdownBase\n readOnly={true}\n target={\n <InputText\n readOnly\n classNames={{\n input: classNames?.input ?? cx(input(), selectButton()),\n section: classNames?.section ?? cx(inputSection(), selectSection()),\n }}\n value={query}\n {...props}\n />\n }\n selectedOption={selectedOption}\n setQuery={setQuery}\n setSelectedOption={(option) => onChange(option)}\n >\n {dropdownOptions}\n </DropdownBase>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Select.js","names":["value: string | undefined"],"sources":["../../../../src/components/controls/dropdown/Select.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n comboboxOption,\n input,\n inputLabel,\n inputRoot,\n inputSection,\n selectButton,\n selectSection,\n} from '@mage-ui/styled-system/recipes';\nimport { InputText, type InputTextProps } from '@/components/controls';\n\nimport { DropdownBase, type DropdownBaseProps } from './DropdownBase';\n\nexport type SelectProps = Omit<\n DropdownBaseProps,\n 'children' | 'onClick' | 'setQuery' | 'target'\n> &\n InputTextProps & {\n setSelectedOption: (\n option: { id: string | number; value: string } | undefined,\n ) => void;\n options: { id: string | number; value: string }[];\n classNames?: {\n option?: string;\n };\n };\n\nexport const Select = ({\n defaultOpened = false,\n setSelectedOption,\n selectedOption,\n options,\n classNames,\n ...props\n}: SelectProps) => {\n const [query, setQuery] = useState(selectedOption?.value ?? '');\n\n const dropdownOptions = options.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 onChange = (value: string | undefined) => {\n const selected = options.find((item) => item.value === value);\n setSelectedOption(selected);\n };\n\n return (\n <DropdownBase\n readOnly={true}\n target={\n <InputText\n readOnly\n classNames={{\n root: classNames?.root ?? inputRoot(),\n label: classNames?.label ?? inputLabel(),\n input: classNames?.input ?? cx(input(), selectButton()),\n section: classNames?.section ?? cx(inputSection(), selectSection()),\n }}\n value={query}\n {...props}\n />\n }\n selectedOption={selectedOption}\n setQuery={setQuery}\n setSelectedOption={(option) => onChange(option)}\n >\n {dropdownOptions}\n </DropdownBase>\n );\n};\n"],"mappings":"kYA8BA,MAAa,EAAS,CAAC,CACrB,iBAAgB,EAChB,oBACA,iBACA,UACA,aACA,GAAG,EACS,GAAK,CAcjB,GAbM,CAAC,EAAO,EAAS,CAAG,EAAS,GAAgB,OAAS,GAAG,CAEzD,EAAkB,EAAQ,IAAI,AAAC,GACnC,EAAC,EAAa,OAAA,CACZ,MAAO,EAAO,MAEd,OAAQ,GAAgB,KAAO,EAAO,GACtC,WAAY,CAAE,OAAQ,GAAY,QAAU,GAAgB,AAAE,WAE7D,EAAO,OAJH,EAAO,GAKQ,CACtB,CAEI,EAAW,AAACA,GAA8B,CAC9C,IAAM,EAAW,EAAQ,KAAK,AAAC,GAAS,EAAK,QAAU,EAAM,CAC7D,EAAkB,EAAS,AAC5B,EAED,MACE,GAAC,EAAA,CACC,UAAU,EACV,OACE,EAAC,EAAA,CACC,UAAA,EACA,WAAY,CACV,KAAM,GAAY,MAAQ,GAAW,CACrC,MAAO,GAAY,OAAS,GAAY,CACxC,MAAO,GAAY,OAAS,EAAG,GAAO,CAAE,GAAc,CAAC,CACvD,QAAS,GAAY,SAAW,EAAG,GAAc,CAAE,GAAe,CAAC,AACpE,EACD,MAAO,EACP,GAAI,GACJ,CAEY,iBACN,WACV,kBAAmB,AAAC,GAAW,EAAS,EAAO,UAE9C,GACY,AAElB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime36 from "react/jsx-runtime";
|
|
2
2
|
import { ComponentProps, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/controls/textarea/Textarea.d.ts
|
|
@@ -27,7 +27,7 @@ declare const Textarea: ({
|
|
|
27
27
|
autosize,
|
|
28
28
|
onChange,
|
|
29
29
|
...props
|
|
30
|
-
}: TextareaProps) =>
|
|
30
|
+
}: TextareaProps) => react_jsx_runtime36.JSX.Element;
|
|
31
31
|
//# sourceMappingURL=Textarea.d.ts.map
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime39 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/data-display/avatar/Avatar.d.ts
|
|
4
4
|
type AvatarProps = {
|
|
@@ -13,7 +13,7 @@ type AvatarProps = {
|
|
|
13
13
|
declare const Avatar: ({
|
|
14
14
|
classNames,
|
|
15
15
|
...props
|
|
16
|
-
}: AvatarProps) =>
|
|
16
|
+
}: AvatarProps) => react_jsx_runtime39.JSX.Element;
|
|
17
17
|
//# sourceMappingURL=Avatar.d.ts.map
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime40 from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/data-display/badge/Badge.d.ts
|
|
@@ -17,7 +17,7 @@ declare const Badge: ({
|
|
|
17
17
|
startSlot,
|
|
18
18
|
classNames,
|
|
19
19
|
...props
|
|
20
|
-
}: BadgeProps) =>
|
|
20
|
+
}: BadgeProps) => react_jsx_runtime40.JSX.Element;
|
|
21
21
|
//# sourceMappingURL=Badge.d.ts.map
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime41 from "react/jsx-runtime";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/data-display/carousel/Carousel.d.ts
|
|
@@ -36,7 +36,7 @@ declare const Carousel: {
|
|
|
36
36
|
({
|
|
37
37
|
classNames,
|
|
38
38
|
...props
|
|
39
|
-
}: CarouselProps):
|
|
39
|
+
}: CarouselProps): react_jsx_runtime41.JSX.Element;
|
|
40
40
|
Slide: {
|
|
41
41
|
({
|
|
42
42
|
children
|
|
@@ -10,7 +10,8 @@ import { FormSelectProps } from "./controls/FormSelect.js";
|
|
|
10
10
|
import { FormDatePickerProps } from "./controls/FormDatePicker.js";
|
|
11
11
|
import { FormInputFileProps } from "./controls/FormInputFile.js";
|
|
12
12
|
import { FormInputPasswordProps } from "./controls/FormInputPassword.js";
|
|
13
|
-
import
|
|
13
|
+
import { FormIfFieldProps } from "./controls/FormIfField.js";
|
|
14
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
14
15
|
import { ReactNode } from "react";
|
|
15
16
|
import { ZodRawShape, z } from "zod";
|
|
16
17
|
|
|
@@ -18,7 +19,7 @@ import { ZodRawShape, z } from "zod";
|
|
|
18
19
|
type FormProps = {
|
|
19
20
|
defaultValues?: object;
|
|
20
21
|
rules?: ZodRawShape;
|
|
21
|
-
onSubmit
|
|
22
|
+
onSubmit: (formData: object) => void;
|
|
22
23
|
children: React.ReactNode;
|
|
23
24
|
};
|
|
24
25
|
declare const Form: {
|
|
@@ -28,11 +29,11 @@ declare const Form: {
|
|
|
28
29
|
onSubmit,
|
|
29
30
|
children,
|
|
30
31
|
...props
|
|
31
|
-
}: FormProps):
|
|
32
|
+
}: FormProps): react_jsx_runtime9.JSX.Element;
|
|
32
33
|
InputText: {
|
|
33
34
|
({
|
|
34
35
|
...props
|
|
35
|
-
}: FormInputTextProps):
|
|
36
|
+
}: FormInputTextProps): react_jsx_runtime9.JSX.Element;
|
|
36
37
|
displayName: string;
|
|
37
38
|
rules: {
|
|
38
39
|
required: (message?: string, min?: number) => z.ZodString;
|
|
@@ -43,7 +44,7 @@ declare const Form: {
|
|
|
43
44
|
name,
|
|
44
45
|
control,
|
|
45
46
|
...props
|
|
46
|
-
}: FormCheckboxProps):
|
|
47
|
+
}: FormCheckboxProps): react_jsx_runtime9.JSX.Element;
|
|
47
48
|
displayName: string;
|
|
48
49
|
rules: {
|
|
49
50
|
required: (message?: string) => z.ZodEffects<z.ZodBoolean, boolean, boolean>;
|
|
@@ -57,7 +58,7 @@ declare const Form: {
|
|
|
57
58
|
label,
|
|
58
59
|
description,
|
|
59
60
|
error
|
|
60
|
-
}: FormCheckboxGroupProps):
|
|
61
|
+
}: FormCheckboxGroupProps): react_jsx_runtime9.JSX.Element;
|
|
61
62
|
rules: {
|
|
62
63
|
required: (message?: string) => z.ZodArray<z.ZodString, "many">;
|
|
63
64
|
};
|
|
@@ -71,7 +72,7 @@ declare const Form: {
|
|
|
71
72
|
name,
|
|
72
73
|
control,
|
|
73
74
|
...props
|
|
74
|
-
}: FormComboboxProps):
|
|
75
|
+
}: FormComboboxProps): react_jsx_runtime9.JSX.Element;
|
|
75
76
|
displayName: string;
|
|
76
77
|
rules: {
|
|
77
78
|
required: (message?: string, defaultValue?: {
|
|
@@ -103,23 +104,23 @@ declare const Form: {
|
|
|
103
104
|
label,
|
|
104
105
|
description,
|
|
105
106
|
error
|
|
106
|
-
}: FormRadioGroupProps):
|
|
107
|
+
}: FormRadioGroupProps): react_jsx_runtime9.JSX.Element;
|
|
107
108
|
rules: {
|
|
108
109
|
required: (message?: string) => z.ZodEffects<z.ZodString, string, string>;
|
|
109
110
|
};
|
|
110
111
|
Radio: {
|
|
111
|
-
(props: RadioProps):
|
|
112
|
+
(props: RadioProps): react_jsx_runtime9.JSX.Element;
|
|
112
113
|
displayName: string;
|
|
113
114
|
};
|
|
114
115
|
};
|
|
115
116
|
Radio: {
|
|
116
|
-
(props: RadioProps):
|
|
117
|
+
(props: RadioProps): react_jsx_runtime9.JSX.Element;
|
|
117
118
|
displayName: string;
|
|
118
119
|
};
|
|
119
120
|
Textarea: {
|
|
120
121
|
({
|
|
121
122
|
...props
|
|
122
|
-
}: FormTextareaProps):
|
|
123
|
+
}: FormTextareaProps): react_jsx_runtime9.JSX.Element;
|
|
123
124
|
displayName: string;
|
|
124
125
|
rules: {
|
|
125
126
|
required: (message?: string, min?: number) => z.ZodString;
|
|
@@ -130,7 +131,7 @@ declare const Form: {
|
|
|
130
131
|
name,
|
|
131
132
|
control,
|
|
132
133
|
...props
|
|
133
|
-
}: FormSelectProps):
|
|
134
|
+
}: FormSelectProps): react_jsx_runtime9.JSX.Element;
|
|
134
135
|
displayName: string;
|
|
135
136
|
rules: {
|
|
136
137
|
required: (message?: string, defaultValue?: {
|
|
@@ -159,7 +160,7 @@ declare const Form: {
|
|
|
159
160
|
name,
|
|
160
161
|
control,
|
|
161
162
|
...props
|
|
162
|
-
}: FormDatePickerProps):
|
|
163
|
+
}: FormDatePickerProps): react_jsx_runtime9.JSX.Element;
|
|
163
164
|
displayName: string;
|
|
164
165
|
rules: {
|
|
165
166
|
required: (message?: string) => z.ZodEffects<z.ZodUnion<[z.ZodType<Date, z.ZodTypeDef, Date>, z.ZodEffects<z.ZodString, string, string>]>, string | Date, string | Date>;
|
|
@@ -170,7 +171,7 @@ declare const Form: {
|
|
|
170
171
|
control,
|
|
171
172
|
name,
|
|
172
173
|
...props
|
|
173
|
-
}: FormInputFileProps):
|
|
174
|
+
}: FormInputFileProps): react_jsx_runtime9.JSX.Element;
|
|
174
175
|
displayName: string;
|
|
175
176
|
rules: {
|
|
176
177
|
required: (message?: string, min?: number) => z.ZodEffects<z.ZodAny, any, any>;
|
|
@@ -179,12 +180,23 @@ declare const Form: {
|
|
|
179
180
|
InputPassword: {
|
|
180
181
|
({
|
|
181
182
|
...props
|
|
182
|
-
}: FormInputPasswordProps):
|
|
183
|
+
}: FormInputPasswordProps): react_jsx_runtime9.JSX.Element;
|
|
183
184
|
displayName: string;
|
|
184
185
|
rules: {
|
|
185
186
|
required: (message?: string) => z.ZodString;
|
|
186
187
|
};
|
|
187
188
|
};
|
|
189
|
+
IfField: {
|
|
190
|
+
({
|
|
191
|
+
control,
|
|
192
|
+
field,
|
|
193
|
+
value,
|
|
194
|
+
condition,
|
|
195
|
+
children,
|
|
196
|
+
fallback
|
|
197
|
+
}: FormIfFieldProps): ReactNode;
|
|
198
|
+
displayName: string;
|
|
199
|
+
};
|
|
188
200
|
};
|
|
189
201
|
//# sourceMappingURL=Form.d.ts.map
|
|
190
202
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","names":[],"sources":["../../../../src/components/forms/form/Form.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.d.ts","names":[],"sources":["../../../../src/components/forms/form/Form.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;KAwBY,SAAA;;UAEF;;YAEE,KAAA,CAAM;;cAGL;;;;;;;KAMV,YAAS,kBAAA,CAAA,GAAA,CAAA;;;;OAAA;;;;;;;IAbA,CAAA;MAAA,IAAA;MAAS,OAAA;MAAA,GAAA;IAAA,CAAA,mBAAA,CAAA,gCAAA;IAAA,WAAA,EAAA,MAAA;IAEX,KAAA,EAAA;MAEE,QAAM,EAAA,CAAA,OAAA,CAAA,EAAA,MAAA,EAAA,eAAA,aAAA,EAAA,OAAA,EAAA,OAAA,CAAA;IAAS,CAAA;EAGd,CAAA;EA0BZ,aAAA,EAAA;IAAA,CAAA;MAAA,IAAA;MAAA,OAAA;MAAA,QAAA;MAAA,KAAA;MAAA,WAAA;MAAA;IAAA,CAAA,wBAAA,CAAA,gCAAA;;;;IApBE,QAAA,EAAA,CAAA;MAAA,UAAA;MAAA,GAAA;IAAA,CAAA,eAAA,EAAA,YAAA;EAAS,CAAA;EAAA,QAAA,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{FormCheckbox as e}from"./controls/FormCheckbox.js";import{FormCheckboxGroup as t}from"./controls/FormCheckboxGroup.js";import{FormCombobox as n}from"./controls/FormCombobox.js";import{FormDatePicker as r}from"./controls/FormDatePicker.js";import{
|
|
1
|
+
import{FormCheckbox as e}from"./controls/FormCheckbox.js";import{FormCheckboxGroup as t}from"./controls/FormCheckboxGroup.js";import{FormCombobox as n}from"./controls/FormCombobox.js";import{FormDatePicker as r}from"./controls/FormDatePicker.js";import{FormIfField as i}from"./controls/FormIfField.js";import{FormInputFile as a}from"./controls/FormInputFile.js";import{FormInputPassword as o}from"./controls/FormInputPassword.js";import{FormInputText as s}from"./controls/FormInputText.js";import{FormRadio as c}from"./controls/FormRadio.js";import{FormRadioGroup as l}from"./controls/FormRadioGroup.js";import{FormSelect as u}from"./controls/FormSelect.js";import{FormTextarea as d}from"./controls/FormTextarea.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{Children as m,cloneElement as h,isValidElement as g}from"react";import{FormProvider as _,useForm as v}from"react-hook-form";import{z as y}from"zod";import{zodResolver as b}from"@hookform/resolvers/zod";const x=({defaultValues:e,rules:t={},onSubmit:n,children:r,...i})=>{let a=v({shouldFocusError:!0,resolver:b(y.object(t)),defaultValues:e}),{register:o,handleSubmit:s,formState:{errors:c}}=a;return f(_,{...a,children:p(`form`,{onSubmit:s(n),...i,children:[C(r,o,c),f(`button`,{type:`submit`,children:`Submit`})]})})},S=[s,t,e,n,l,c,d,u,r,a,o,i],C=(e,t,n)=>m.map(e,e=>{if(!g(e))return e;let r=e.props;if(S.some(t=>e.type===t)&&r.name){let i={...r,error:n[r.name]?.message,...t(r.name,{setValueAs:e=>e===``||e===null?void 0:e})};return h(e,i)}return r.children?h(e,r,C(r.children,t,n)):e});x.InputText=s,x.Checkbox=e,x.CheckboxGroup=t,x.Combobox=n,x.RadioGroup=l,x.Radio=c,x.Textarea=d,x.Select=u,x.DatePicker=r,x.InputFile=a,x.InputPassword=o,x.IfField=i;export{x as Form};
|
|
2
2
|
//# sourceMappingURL=Form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["children: React.ReactNode","register: UseFormRegister<Record<string, string>>","errors: FieldErrors","value: unknown"],"sources":["../../../../src/components/forms/form/Form.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, type ReactNode } from 'react';\nimport {\n type FieldErrors,\n FormProvider,\n type UseFormRegister,\n useForm,\n} from 'react-hook-form';\nimport { type ZodRawShape, z } from 'zod';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\n\nimport { FormCheckbox } from './controls/FormCheckbox';\nimport { FormCheckboxGroup } from './controls/FormCheckboxGroup';\nimport { FormCombobox } from './controls/FormCombobox';\nimport { FormDatePicker } from './controls/FormDatePicker';\nimport { FormInputFile } from './controls/FormInputFile';\nimport { FormInputPassword } from './controls/FormInputPassword';\nimport { FormInputText } from './controls/FormInputText';\nimport { FormRadio } from './controls/FormRadio';\nimport { FormRadioGroup } from './controls/FormRadioGroup';\nimport { FormSelect } from './controls/FormSelect';\nimport { FormTextarea } from './controls/FormTextarea';\n\nexport type FormProps = {\n defaultValues?: object;\n rules?: ZodRawShape;\n onSubmit
|
|
1
|
+
{"version":3,"file":"Form.js","names":["children: React.ReactNode","register: UseFormRegister<Record<string, string>>","errors: FieldErrors","value: unknown"],"sources":["../../../../src/components/forms/form/Form.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, type ReactNode } from 'react';\nimport {\n type FieldErrors,\n FormProvider,\n type UseFormRegister,\n useForm,\n} from 'react-hook-form';\nimport { type ZodRawShape, z } from 'zod';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\n\nimport { FormCheckbox } from './controls/FormCheckbox';\nimport { FormCheckboxGroup } from './controls/FormCheckboxGroup';\nimport { FormCombobox } from './controls/FormCombobox';\nimport { FormDatePicker } from './controls/FormDatePicker';\nimport { FormIfField } from './controls/FormIfField';\nimport { FormInputFile } from './controls/FormInputFile';\nimport { FormInputPassword } from './controls/FormInputPassword';\nimport { FormInputText } from './controls/FormInputText';\nimport { FormRadio } from './controls/FormRadio';\nimport { FormRadioGroup } from './controls/FormRadioGroup';\nimport { FormSelect } from './controls/FormSelect';\nimport { FormTextarea } from './controls/FormTextarea';\n\nexport type FormProps = {\n defaultValues?: object;\n rules?: ZodRawShape;\n onSubmit: (formData: object) => void;\n children: React.ReactNode;\n};\n\nexport const Form = ({\n defaultValues,\n rules = {},\n onSubmit,\n children,\n ...props\n}: FormProps) => {\n const form = useForm({\n shouldFocusError: true,\n resolver: zodResolver(z.object(rules)),\n defaultValues,\n });\n const {\n register,\n handleSubmit,\n formState: { errors },\n } = form;\n\n return (\n <FormProvider {...form}>\n <form onSubmit={handleSubmit(onSubmit)} {...props}>\n {renderChildrenRecursively(children, register, errors)}\n <button type='submit'>Submit</button>\n </form>\n </FormProvider>\n );\n};\n\nconst controlList = [\n FormInputText,\n FormCheckboxGroup,\n FormCheckbox,\n FormCombobox,\n FormRadioGroup,\n FormRadio,\n FormTextarea,\n FormSelect,\n FormDatePicker,\n FormInputFile,\n FormInputPassword,\n FormIfField,\n];\n\nconst renderChildrenRecursively = (\n children: React.ReactNode,\n register: UseFormRegister<Record<string, string>>,\n errors: FieldErrors,\n): ReactNode => {\n return Children.map(children, (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const props = child.props as {\n name?: string;\n type?: string;\n children?: ReactNode;\n };\n\n if (controlList.some((control) => child.type === control)) {\n if (props.name) {\n const newProps = {\n ...props,\n error: errors[props.name]?.message,\n ...register(props.name, {\n setValueAs: (value: unknown) =>\n value === '' || value === null ? undefined : value,\n }),\n };\n return cloneElement(child, newProps);\n }\n }\n\n if (props.children) {\n return cloneElement(\n child,\n props,\n renderChildrenRecursively(props.children, register, errors),\n );\n }\n\n return child;\n });\n};\n\nForm.InputText = FormInputText;\nForm.Checkbox = FormCheckbox;\nForm.CheckboxGroup = FormCheckboxGroup;\nForm.Combobox = FormCombobox;\nForm.RadioGroup = FormRadioGroup;\nForm.Radio = FormRadio;\nForm.Textarea = FormTextarea;\nForm.Select = FormSelect;\nForm.DatePicker = FormDatePicker;\nForm.InputFile = FormInputFile;\nForm.InputPassword = FormInputPassword;\nForm.IfField = FormIfField;\n"],"mappings":"+8BA0EA,MA3Ca,EAAO,CAAC,CACnB,gBACA,QAAQ,CAAE,EACV,WACA,WACA,GAAG,EACO,GAAK,CAMf,IALM,EAAO,EAAQ,CACnB,kBAAkB,EAClB,SAAU,EAAY,EAAE,OAAO,EAAM,CAAC,CACtC,eACD,EAAC,CACI,CACJ,WACA,eACA,UAAW,CAAE,SAAQ,CACtB,CAAG,EAEJ,MACE,GAAC,EAAA,CAAa,GAAI,WAChB,EAAC,OAAA,CAAK,SAAU,EAAa,EAAS,CAAE,GAAI,YACzC,EAA0B,EAAU,EAAU,EAAO,CACtD,EAAC,SAAA,CAAO,KAAK,kBAAS,UAAe,GAChC,EACM,AAElB,EAEK,EAAc,CAClB,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CACD,EAEK,EAA4B,CAChCA,EACAC,EACAC,IAEO,EAAS,IAAI,EAAU,AAAC,GAAU,CACvC,IAAK,EAAe,EAAM,CACxB,OAAO,EAGT,IAAM,EAAQ,EAAM,MAMpB,GAAI,EAAY,KAAK,AAAC,GAAY,EAAM,OAAS,EAAQ,EACnD,EAAM,KAAM,CACd,IAAM,EAAW,CACf,GAAG,EACH,MAAO,EAAO,EAAM,OAAO,QAC3B,GAAG,EAAS,EAAM,KAAM,CACtB,WAAY,AAACC,GACX,IAAU,IAAM,IAAU,SAAA,GAAmB,CAChD,EAAC,AACH,EACD,MAAO,GAAa,EAAO,EAAS,AACrC,CAWH,OARI,EAAM,SACD,EACL,EACA,EACA,EAA0B,EAAM,SAAU,EAAU,EAAO,CAC5D,CAGI,CACR,EAAC,CAcJ,AAXA,EAAK,UAAY,EACjB,EAAK,SAAW,EAChB,EAAK,cAAgB,EACrB,EAAK,SAAW,EAChB,EAAK,WAAa,EAClB,EAAK,MAAQ,EACb,EAAK,SAAW,EAChB,EAAK,OAAS,EACd,EAAK,WAAa,EAClB,EAAK,UAAY,EACjB,EAAK,cAAgB,EACrB,EAAK,QAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Control } from "react-hook-form";
|
|
3
|
+
|
|
4
|
+
//#region src/components/forms/form/controls/FormIfField.d.ts
|
|
5
|
+
type FormIfFieldProps = {
|
|
6
|
+
control?: Control;
|
|
7
|
+
field: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
condition?: (fieldValue: unknown) => boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
fallback?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { FormIfFieldProps };
|
|
15
|
+
//# sourceMappingURL=FormIfField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormIfField.d.ts","names":[],"sources":["../../../../../src/components/forms/form/controls/FormIfField.tsx"],"sourcesContent":[],"mappings":";;;;KAGY,gBAAA;YACA;EADA,KAAA,EAAA,MAAA;EAAgB,KAAA,CAAA,EAAA,OAAA;EAAA,SAChB,CAAA,EAAA,CAAA,UAAA,EAAA,OAAA,EAAA,GAAA,OAAA;EAAO,QAIP,EAAA,SAAA;EAAS,QACR,CAAA,EAAA,SAAA;AAAS,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useWatch as e}from"react-hook-form";const t=({control:t,field:n,value:r,condition:i,children:a,fallback:o})=>{let s=e({control:t,name:n}),c=i?i(s):r===void 0?!!s:s===r;return c?a:o===void 0?null:o};t.displayName=`Form.IfField`;export{t as FormIfField};
|
|
2
|
+
//# sourceMappingURL=FormIfField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormIfField.js","names":[],"sources":["../../../../../src/components/forms/form/controls/FormIfField.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { type Control, useWatch } from 'react-hook-form';\n\nexport type FormIfFieldProps = {\n control?: Control;\n field: string;\n value?: unknown;\n condition?: (fieldValue: unknown) => boolean;\n children: ReactNode;\n fallback?: ReactNode;\n};\n\nexport const FormIfField = ({\n control,\n field,\n value,\n condition,\n children,\n fallback,\n}: FormIfFieldProps) => {\n const fieldValue = useWatch({\n control,\n name: field,\n });\n\n const shouldShow = condition\n ? condition(fieldValue)\n : value !== undefined\n ? fieldValue === value\n : Boolean(fieldValue);\n\n if (shouldShow) {\n return children;\n }\n\n if (fallback !== undefined) {\n return fallback;\n }\n\n return null;\n};\n\nFormIfField.displayName = 'Form.IfField';\n"],"mappings":"2CAYA,MAAa,EAAc,CAAC,CAC1B,UACA,QACA,QACA,YACA,WACA,WACiB,GAAK,CAMtB,IALM,EAAa,EAAS,CAC1B,UACA,KAAM,CACP,EAAC,CAEI,EAAa,EACf,EAAU,EAAW,CACrB,QAAA,KAEU,EADR,IAAe,EAWrB,OARI,EACK,EAGL,QAAA,GAIG,KAHE,CAIV,EAED,EAAY,YAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime50 from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/misc/visually-hidden/VisuallyHidden.d.ts
|
|
@@ -7,7 +7,7 @@ type VisuallyHiddenProps = {
|
|
|
7
7
|
};
|
|
8
8
|
declare const VisuallyHidden: ({
|
|
9
9
|
children
|
|
10
|
-
}: VisuallyHiddenProps) =>
|
|
10
|
+
}: VisuallyHiddenProps) => react_jsx_runtime50.JSX.Element;
|
|
11
11
|
//# sourceMappingURL=VisuallyHidden.d.ts.map
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisuallyHidden.d.ts","names":[],"sources":["../../../../src/components/misc/visually-hidden/VisuallyHidden.tsx"],"sourcesContent":[],"mappings":";;;;KAKY,mBAAA;YACA,KAAA,CAAM;;AADN,cAIC,cAJkB,EACnB,CAAA;EAAA;AAAe,CAAT,EAG2B,mBAHlB,EAAA,GAGqC,
|
|
1
|
+
{"version":3,"file":"VisuallyHidden.d.ts","names":[],"sources":["../../../../src/components/misc/visually-hidden/VisuallyHidden.tsx"],"sourcesContent":[],"mappings":";;;;KAKY,mBAAA;YACA,KAAA,CAAM;;AADN,cAIC,cAJkB,EACnB,CAAA;EAAA;AAAe,CAAT,EAG2B,mBAHlB,EAAA,GAGqC,mBAAA,CAAA,GAAA,CAAA,OAHrC;AAG3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime38 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):
|
|
20
|
+
}: BreadcrumbsProps): react_jsx_runtime38.JSX.Element;
|
|
21
21
|
Item: {
|
|
22
22
|
({
|
|
23
23
|
children
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TabsListProps } from "./TabsList.js";
|
|
2
2
|
import { TabsTabProps } from "./TabsTab.js";
|
|
3
3
|
import { TabsPanelProps } from "./TabsPanel.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
5
5
|
import React from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/navigation/tabs/Tabs.d.ts
|
|
@@ -18,14 +18,14 @@ declare const Tabs: {
|
|
|
18
18
|
classNames,
|
|
19
19
|
children,
|
|
20
20
|
...props
|
|
21
|
-
}: TabsProps):
|
|
21
|
+
}: TabsProps): react_jsx_runtime2.JSX.Element;
|
|
22
22
|
displayName: string;
|
|
23
23
|
List: {
|
|
24
24
|
({
|
|
25
25
|
classNames,
|
|
26
26
|
children,
|
|
27
27
|
...props
|
|
28
|
-
}: TabsListProps):
|
|
28
|
+
}: TabsListProps): react_jsx_runtime2.JSX.Element;
|
|
29
29
|
displayName: string;
|
|
30
30
|
};
|
|
31
31
|
Tab: {
|
|
@@ -35,7 +35,7 @@ declare const Tabs: {
|
|
|
35
35
|
endSlot,
|
|
36
36
|
children,
|
|
37
37
|
...props
|
|
38
|
-
}: TabsTabProps):
|
|
38
|
+
}: TabsTabProps): react_jsx_runtime2.JSX.Element;
|
|
39
39
|
displayName: string;
|
|
40
40
|
};
|
|
41
41
|
Panel: {
|
|
@@ -43,7 +43,7 @@ declare const Tabs: {
|
|
|
43
43
|
classNames,
|
|
44
44
|
children,
|
|
45
45
|
...props
|
|
46
|
-
}: TabsPanelProps):
|
|
46
|
+
}: TabsPanelProps): react_jsx_runtime2.JSX.Element;
|
|
47
47
|
displayName: string;
|
|
48
48
|
};
|
|
49
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mage-ui/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"react-dom": "^19.1.0",
|
|
43
43
|
"react-hook-form": "^7.56.4",
|
|
44
44
|
"zod": "^3.25.42",
|
|
45
|
-
"@mage-ui/preset": "0.0.
|
|
46
|
-
"@mage-ui/styled-system": "0.0.
|
|
45
|
+
"@mage-ui/preset": "0.0.24",
|
|
46
|
+
"@mage-ui/styled-system": "0.0.24"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=22.14.0"
|