fictoan-react 2.0.0-beta.16 → 2.0.0-beta.18
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/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.js +27 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +56 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +65 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Button/Button.js +28 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +27 -0
- package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/components/Callout/Callout.js +31 -0
- package/dist/components/Callout/Callout.js.map +1 -0
- package/dist/components/Card/Card.js +27 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.js +191 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/components/Divider/Divider.js +29 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +3 -0
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +96 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Element/Element.d.ts +6 -2
- package/dist/components/Element/Element.d.ts.map +1 -1
- package/dist/components/Element/Element.js +152 -0
- package/dist/components/Element/Element.js.map +1 -0
- package/dist/components/Element/Tags.js +31 -0
- package/dist/components/Element/Tags.js.map +1 -0
- package/dist/components/Element/constants.js +8 -0
- package/dist/components/Element/constants.js.map +1 -0
- package/dist/components/Form/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Form/Checkbox/Checkbox.js +78 -0
- package/dist/components/Form/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.d.ts.map +1 -1
- package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.js +177 -0
- package/dist/components/Form/Checkbox/CheckboxAndSwitchGroup.js.map +1 -0
- package/dist/components/Form/Checkbox/Switch.d.ts.map +1 -1
- package/dist/components/Form/Checkbox/Switch.js +78 -0
- package/dist/components/Form/Checkbox/Switch.js.map +1 -0
- package/dist/components/Form/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/Form/FileUpload/FileUpload.js +142 -0
- package/dist/components/Form/FileUpload/FileUpload.js.map +1 -0
- package/dist/components/Form/Form/Form.js +37 -0
- package/dist/components/Form/Form/Form.js.map +1 -0
- package/dist/components/Form/Form/FormGenerator.js +64 -0
- package/dist/components/Form/Form/FormGenerator.js.map +1 -0
- package/dist/components/Form/FormItem/FormItem.d.ts +16 -0
- package/dist/components/Form/FormItem/FormItem.d.ts.map +1 -1
- package/dist/components/Form/FormItem/FormItem.js +127 -0
- package/dist/components/Form/FormItem/FormItem.js.map +1 -0
- package/dist/components/Form/FormItemGroup/FormItemGroup.js +42 -0
- package/dist/components/Form/FormItemGroup/FormItemGroup.js.map +1 -0
- package/dist/components/Form/InputField/InputField.d.ts.map +1 -1
- package/dist/components/Form/InputField/InputField.js +156 -0
- package/dist/components/Form/InputField/InputField.js.map +1 -0
- package/dist/components/Form/InputLabel/InputLabel.js +30 -0
- package/dist/components/Form/InputLabel/InputLabel.js.map +1 -0
- package/dist/components/Form/ListBox/ListBox.d.ts.map +1 -1
- package/dist/components/Form/ListBox/ListBox.js +284 -0
- package/dist/components/Form/ListBox/ListBox.js.map +1 -0
- package/dist/components/Form/ListBox/constants.d.ts +1 -1
- package/dist/components/Form/ListBox/constants.d.ts.map +1 -1
- package/dist/components/Form/ListBox/listBoxUtils.js +49 -0
- package/dist/components/Form/ListBox/listBoxUtils.js.map +1 -0
- package/dist/components/Form/PinInputField/PinInputField.d.ts +6 -1
- package/dist/components/Form/PinInputField/PinInputField.d.ts.map +1 -1
- package/dist/components/Form/PinInputField/PinInputField.js +165 -0
- package/dist/components/Form/PinInputField/PinInputField.js.map +1 -0
- package/dist/components/Form/RadioButton/RadioButton.d.ts.map +1 -1
- package/dist/components/Form/RadioButton/RadioButton.js +82 -0
- package/dist/components/Form/RadioButton/RadioButton.js.map +1 -0
- package/dist/components/Form/RadioButton/RadioGroup.d.ts.map +1 -1
- package/dist/components/Form/RadioButton/RadioGroup.js +97 -0
- package/dist/components/Form/RadioButton/RadioGroup.js.map +1 -0
- package/dist/components/Form/RadioButton/RadioTabGroup.d.ts.map +1 -1
- package/dist/components/Form/RadioButton/RadioTabGroup.js +182 -0
- package/dist/components/Form/RadioButton/RadioTabGroup.js.map +1 -0
- package/dist/components/Form/Range/Range.js +376 -0
- package/dist/components/Form/Range/Range.js.map +1 -0
- package/dist/components/Form/Select/Select.d.ts.map +1 -1
- package/dist/components/Form/Select/Select.js +83 -0
- package/dist/components/Form/Select/Select.js.map +1 -0
- package/dist/components/Form/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/Form/TextArea/TextArea.js +111 -0
- package/dist/components/Form/TextArea/TextArea.js.map +1 -0
- package/dist/components/Meter/Meter.js +110 -0
- package/dist/components/Meter/Meter.js.map +1 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +75 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Notification/NotificationItem/NotificationItem.d.ts.map +1 -1
- package/dist/components/Notification/NotificationItem/NotificationItem.js +70 -0
- package/dist/components/Notification/NotificationItem/NotificationItem.js.map +1 -0
- package/dist/components/Notification/NotificationsProvider/NotificationsProvider.js +88 -0
- package/dist/components/Notification/NotificationsProvider/NotificationsProvider.js.map +1 -0
- package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.d.ts.map +1 -1
- package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.js +35 -0
- package/dist/components/Notification/NotificationsWrapper/NotificationsWrapper.js.map +1 -0
- package/dist/components/OptionCard/OptionCard.js +150 -0
- package/dist/components/OptionCard/OptionCard.js.map +1 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +206 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/usePagination.js +35 -0
- package/dist/components/Pagination/usePagination.js.map +1 -0
- package/dist/components/Portion/Portion.js +34 -0
- package/dist/components/Portion/Portion.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.js +63 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/Row/Row.js +40 -0
- package/dist/components/Row/Row.js.map +1 -0
- package/dist/components/Sidebar/ContentWrapper/ContentWrapper.js +23 -0
- package/dist/components/Sidebar/ContentWrapper/ContentWrapper.js.map +1 -0
- package/dist/components/Sidebar/SidebarFooter/SidebarFooter.js +25 -0
- package/dist/components/Sidebar/SidebarFooter/SidebarFooter.js.map +1 -0
- package/dist/components/Sidebar/SidebarHeader/SidebarHeader.js +25 -0
- package/dist/components/Sidebar/SidebarHeader/SidebarHeader.js.map +1 -0
- package/dist/components/Sidebar/SidebarItem/SidebarItem.js +30 -0
- package/dist/components/Sidebar/SidebarItem/SidebarItem.js.map +1 -0
- package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.js +29 -0
- package/dist/components/Sidebar/SidebarItemsGroup/SidebarItemsGroup.js.map +1 -0
- package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.js +35 -0
- package/dist/components/Sidebar/SidebarWrapper/SidebarWrapper.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +84 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Spinner/Spinner.js +33 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Table/Table.js +53 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +104 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +6 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +52 -0
- package/dist/components/ThemeProvider/ThemeProvider.js.map +1 -0
- package/dist/components/Toast/ToastItem/ToastItem.js +47 -0
- package/dist/components/Toast/ToastItem/ToastItem.js.map +1 -0
- package/dist/components/Toast/ToastsProvider/ToastsProvider.js +45 -0
- package/dist/components/Toast/ToastsProvider/ToastsProvider.js.map +1 -0
- package/dist/components/Toast/ToastsWrapper/ToastsWrapper.d.ts.map +1 -1
- package/dist/components/Toast/ToastsWrapper/ToastsWrapper.js +28 -0
- package/dist/components/Toast/ToastsWrapper/ToastsWrapper.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +62 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Typography/Heading.js +30 -0
- package/dist/components/Typography/Heading.js.map +1 -0
- package/dist/components/Typography/Text.js +15 -0
- package/dist/components/Typography/Text.js.map +1 -0
- package/dist/components/index.js +124 -75
- package/dist/components/index.js.map +1 -1
- package/dist/fictoan-schema.json +2070 -0
- package/dist/hooks/UseClickOutside.js +17 -0
- package/dist/hooks/UseClickOutside.js.map +1 -0
- package/dist/hooks/UseViewTransition.d.ts +2 -0
- package/dist/hooks/UseViewTransition.d.ts.map +1 -0
- package/dist/hooks/UseViewTransition.js +17 -0
- package/dist/hooks/UseViewTransition.js.map +1 -0
- package/dist/index.css +6 -10635
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -151
- package/dist/index.js.map +1 -1
- package/dist/scripts/generateSchema.d.ts +2 -0
- package/dist/scripts/generateSchema.d.ts.map +1 -0
- package/dist/scripts/schema-meta.d.ts +12 -0
- package/dist/scripts/schema-meta.d.ts.map +1 -0
- package/dist/styles/colours.js +55 -0
- package/dist/styles/colours.js.map +1 -0
- package/dist/utils/classNames.js +6 -0
- package/dist/utils/classNames.js.map +1 -0
- package/dist/utils/propSeparation.js +77 -0
- package/dist/utils/propSeparation.js.map +1 -0
- package/package.json +12 -18
- package/dist/Accordion-CeGNgNW8.js +0 -4254
- package/dist/Accordion-CeGNgNW8.js.map +0 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import r, { useMemo as F } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Checkbox as H } from "./Checkbox.js";
|
|
6
|
+
import { deriveAriaIds as M, FormItem as z } from "../FormItem/FormItem.js";
|
|
7
|
+
import { Switch as J } from "./Switch.js";
|
|
8
|
+
import { Element as D } from "../../Element/Element.js";
|
|
9
|
+
const K = r.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
id: a,
|
|
12
|
+
name: m,
|
|
13
|
+
label: h,
|
|
14
|
+
helpText: b,
|
|
15
|
+
errorText: c,
|
|
16
|
+
options: y,
|
|
17
|
+
value: i,
|
|
18
|
+
defaultValue: S,
|
|
19
|
+
onChange: l,
|
|
20
|
+
align: w,
|
|
21
|
+
equaliseWidth: g,
|
|
22
|
+
equalizeWidth: G,
|
|
23
|
+
required: I,
|
|
24
|
+
disabled: N,
|
|
25
|
+
size: V,
|
|
26
|
+
columns: p,
|
|
27
|
+
labelFirst: $,
|
|
28
|
+
...B
|
|
29
|
+
}, C) => {
|
|
30
|
+
const E = F(() => m || a, [m, a]), [n, k] = r.useState(
|
|
31
|
+
i || S || []
|
|
32
|
+
);
|
|
33
|
+
r.useEffect(() => {
|
|
34
|
+
i !== void 0 && k(i);
|
|
35
|
+
}, [i]);
|
|
36
|
+
const R = (t, f) => {
|
|
37
|
+
let e;
|
|
38
|
+
f ? e = [...n, t] : e = n.filter((d) => d !== t), i === void 0 && k(e), l == null || l(e);
|
|
39
|
+
};
|
|
40
|
+
let s = [];
|
|
41
|
+
w && s.push(`align-${w}`), (g || G) && s.push("equalise-width"), p && s.push("with-columns"), $ && s.push("label-first");
|
|
42
|
+
const q = r.useId(), o = a || `checkbox-group-${q.replace(/:/g, "")}`, { describedBy: L } = M(o, b, c);
|
|
43
|
+
return /* @__PURE__ */ u(
|
|
44
|
+
z,
|
|
45
|
+
{
|
|
46
|
+
label: h,
|
|
47
|
+
htmlFor: o,
|
|
48
|
+
helpText: b,
|
|
49
|
+
errorText: c,
|
|
50
|
+
required: I,
|
|
51
|
+
children: /* @__PURE__ */ u(
|
|
52
|
+
D,
|
|
53
|
+
{
|
|
54
|
+
as: "div",
|
|
55
|
+
"data-checkbox-group": !0,
|
|
56
|
+
ref: C,
|
|
57
|
+
id: o,
|
|
58
|
+
classNames: s,
|
|
59
|
+
role: "group",
|
|
60
|
+
"aria-label": h,
|
|
61
|
+
"aria-invalid": !!c || void 0,
|
|
62
|
+
"aria-required": I,
|
|
63
|
+
"aria-describedby": L,
|
|
64
|
+
style: p ? { gridTemplateColumns: `repeat(${p}, 1fr)` } : void 0,
|
|
65
|
+
...B,
|
|
66
|
+
children: y.map((t, f) => {
|
|
67
|
+
const { id: e, value: d, label: P, ...j } = t, v = e || `${o}-option-${f}`, x = n.includes(d);
|
|
68
|
+
return /* @__PURE__ */ u(
|
|
69
|
+
H,
|
|
70
|
+
{
|
|
71
|
+
id: v,
|
|
72
|
+
name: E,
|
|
73
|
+
label: P,
|
|
74
|
+
checked: x,
|
|
75
|
+
disabled: N || t.disabled,
|
|
76
|
+
size: V,
|
|
77
|
+
labelFirst: $,
|
|
78
|
+
onChange: (A) => R(d, A),
|
|
79
|
+
...j
|
|
80
|
+
},
|
|
81
|
+
v
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
K.displayName = "CheckboxGroup";
|
|
91
|
+
const O = r.forwardRef(
|
|
92
|
+
({
|
|
93
|
+
id: a,
|
|
94
|
+
name: m,
|
|
95
|
+
label: h,
|
|
96
|
+
helpText: b,
|
|
97
|
+
errorText: c,
|
|
98
|
+
options: y,
|
|
99
|
+
value: i,
|
|
100
|
+
defaultValue: S,
|
|
101
|
+
onChange: l,
|
|
102
|
+
align: w,
|
|
103
|
+
equaliseWidth: g,
|
|
104
|
+
equalizeWidth: G,
|
|
105
|
+
required: I,
|
|
106
|
+
disabled: N,
|
|
107
|
+
size: V,
|
|
108
|
+
columns: p,
|
|
109
|
+
labelFirst: $,
|
|
110
|
+
...B
|
|
111
|
+
}, C) => {
|
|
112
|
+
const E = F(() => m || a, [m, a]), [n, k] = r.useState(
|
|
113
|
+
i || S || []
|
|
114
|
+
);
|
|
115
|
+
r.useEffect(() => {
|
|
116
|
+
i !== void 0 && k(i);
|
|
117
|
+
}, [i]);
|
|
118
|
+
const R = (t, f) => {
|
|
119
|
+
let e;
|
|
120
|
+
f ? e = [...n, t] : e = n.filter((d) => d !== t), i === void 0 && k(e), l == null || l(e);
|
|
121
|
+
};
|
|
122
|
+
let s = [];
|
|
123
|
+
w && s.push(`align-${w}`), (g || G) && s.push("equalise-width"), p && s.push("with-columns"), $ && s.push("label-first");
|
|
124
|
+
const q = r.useId(), o = a || `switch-group-${q.replace(/:/g, "")}`, { describedBy: L } = M(o, b, c);
|
|
125
|
+
return /* @__PURE__ */ u(
|
|
126
|
+
z,
|
|
127
|
+
{
|
|
128
|
+
label: h,
|
|
129
|
+
htmlFor: o,
|
|
130
|
+
helpText: b,
|
|
131
|
+
errorText: c,
|
|
132
|
+
required: I,
|
|
133
|
+
children: /* @__PURE__ */ u(
|
|
134
|
+
D,
|
|
135
|
+
{
|
|
136
|
+
as: "div",
|
|
137
|
+
"data-switch-group": !0,
|
|
138
|
+
ref: C,
|
|
139
|
+
id: o,
|
|
140
|
+
classNames: s,
|
|
141
|
+
role: "group",
|
|
142
|
+
"aria-label": h,
|
|
143
|
+
"aria-invalid": !!c || void 0,
|
|
144
|
+
"aria-required": I,
|
|
145
|
+
"aria-describedby": L,
|
|
146
|
+
style: p ? { gridTemplateColumns: `repeat(${p}, 1fr)` } : void 0,
|
|
147
|
+
...B,
|
|
148
|
+
children: y.map((t, f) => {
|
|
149
|
+
const { id: e, value: d, label: P, ...j } = t, v = e || `${o}-option-${f}`, x = n.includes(d);
|
|
150
|
+
return /* @__PURE__ */ u(
|
|
151
|
+
J,
|
|
152
|
+
{
|
|
153
|
+
id: v,
|
|
154
|
+
name: E,
|
|
155
|
+
label: P,
|
|
156
|
+
checked: x,
|
|
157
|
+
disabled: N || t.disabled,
|
|
158
|
+
size: V,
|
|
159
|
+
labelFirst: $,
|
|
160
|
+
onChange: (A) => R(d, A),
|
|
161
|
+
...j
|
|
162
|
+
},
|
|
163
|
+
v
|
|
164
|
+
);
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
O.displayName = "SwitchGroup";
|
|
173
|
+
export {
|
|
174
|
+
K as CheckboxGroup,
|
|
175
|
+
O as SwitchGroup
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=CheckboxAndSwitchGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxAndSwitchGroup.js","sources":["../../../../src/components/Form/Checkbox/CheckboxAndSwitchGroup.tsx"],"sourcesContent":["// REACT CORE ==========================================================================================================\nimport React, { useMemo } from \"react\";\n\n// LOCAL COMPONENTS ====================================================================================================\nimport { Element } from \"$element\";\nimport { SpacingTypes } from \"../../Element/constants\";\n\n// STYLES ==============================================================================================================\nimport \"./checkbox-and-switch-group.css\";\n\n// OTHER ===============================================================================================================\nimport { Checkbox, } from \"./Checkbox\";\nimport { FormItem, deriveAriaIds } from \"../FormItem/FormItem\";\nimport { InputLabelCustomProps } from \"../InputLabel/InputLabel\";\nimport { Switch } from \"./Switch\";\n\n// COMMON GROUP OPTIONS ////////////////////////////////////////////////////////////////////////////////////////////////\ninterface BaseGroupOptionProps {\n id : string;\n label : string;\n value : string;\n disabled ? : boolean;\n}\n\n// Props specific to the group functionality\ninterface GroupCustomProps {\n id ? : string;\n name : string;\n options : BaseGroupOptionProps[];\n value ? : string[];\n defaultValue ? : string[];\n onChange ? : (values : string[]) => void;\n align ? : \"horizontal\" | \"vertical\";\n equaliseWidth ? : boolean;\n equalizeWidth ? : boolean;\n size ? : Exclude<SpacingTypes, \"nano\" | \"huge\">;\n columns ? : number;\n labelFirst ? : boolean;\n}\n\n// Combined props for the group component\nexport type InputGroupProps = InputLabelCustomProps & GroupCustomProps & {\n helpText ? : string;\n errorText ? : string;\n required ? : boolean;\n disabled ? : boolean;\n};\n\n// CHECKBOX GROUP //////////////////////////////////////////////////////////////////////////////////////////////////////\nexport const CheckboxGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(\n (\n {\n id,\n name,\n label,\n helpText,\n errorText,\n options,\n value,\n defaultValue,\n onChange,\n align,\n equaliseWidth,\n equalizeWidth,\n required,\n disabled,\n size,\n columns,\n labelFirst,\n ...props\n },\n ref,\n ) => {\n const derivedName = useMemo(() => name || id, [ name, id ]);\n\n const [ selectedValues, setSelectedValues ] = React.useState<string[]>(\n value || defaultValue || [],\n );\n\n React.useEffect(() => {\n if (value !== undefined) {\n setSelectedValues(value);\n }\n }, [ value ]);\n\n const handleChange = (optionValue : string, checked : boolean) => {\n let newValues : string[];\n\n if (checked) {\n newValues = [ ...selectedValues, optionValue ];\n } else {\n newValues = selectedValues.filter(v => v !== optionValue);\n }\n\n // Update internal state if uncontrolled\n if (value === undefined) {\n setSelectedValues(newValues);\n }\n\n onChange?.(newValues);\n };\n\n let classNames : string[] = [];\n\n if (align) {\n classNames.push(`align-${align}`);\n }\n\n if (equaliseWidth || equalizeWidth) {\n classNames.push(`equalise-width`);\n }\n\n if (columns) {\n classNames.push(`with-columns`);\n }\n\n if (labelFirst) {\n classNames.push(`label-first`);\n }\n\n const reactId = React.useId();\n const finalGroupId = id || `checkbox-group-${reactId.replace(/:/g, \"\")}`;\n const { describedBy } = deriveAriaIds(finalGroupId, helpText, errorText);\n\n return (\n <FormItem\n label={label}\n htmlFor={finalGroupId}\n helpText={helpText}\n errorText={errorText}\n required={required}\n >\n <Element\n as=\"div\"\n data-checkbox-group\n ref={ref}\n id={finalGroupId}\n classNames={classNames}\n role=\"group\"\n aria-label={label}\n aria-invalid={Boolean(errorText) || undefined}\n aria-required={required}\n aria-describedby={describedBy}\n style={columns ? {gridTemplateColumns : `repeat(${columns}, 1fr)`} : undefined}\n {...props}\n >\n {options.map((option, index) => {\n const {id : optionId, value : optionValue, label : optionLabel, ...optionProps} = option;\n const finalId = optionId || `${finalGroupId}-option-${index}`;\n const isChecked = selectedValues.includes(optionValue);\n\n return (\n <Checkbox\n key={finalId}\n id={finalId}\n name={derivedName}\n label={optionLabel}\n checked={isChecked}\n disabled={disabled || option.disabled}\n size={size}\n labelFirst={labelFirst}\n onChange={(checked : boolean) => handleChange(optionValue, checked)}\n {...optionProps}\n />\n );\n })}\n </Element>\n </FormItem>\n );\n },\n);\nCheckboxGroup.displayName = \"CheckboxGroup\";\n\n// SWITCH GROUP ////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport const SwitchGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(\n (\n {\n id,\n name,\n label,\n helpText,\n errorText,\n options,\n value,\n defaultValue,\n onChange,\n align,\n equaliseWidth,\n equalizeWidth,\n required,\n disabled,\n size,\n columns,\n labelFirst,\n ...props\n },\n ref,\n ) => {\n const derivedName = useMemo(() => name || id, [ name, id ]);\n\n const [ selectedValues, setSelectedValues ] = React.useState<string[]>(\n value || defaultValue || [],\n );\n\n React.useEffect(() => {\n if (value !== undefined) {\n setSelectedValues(value);\n }\n }, [ value ]);\n\n const handleChange = (optionValue : string, checked : boolean) => {\n let newValues : string[];\n\n if (checked) {\n newValues = [ ...selectedValues, optionValue ];\n } else {\n newValues = selectedValues.filter(v => v !== optionValue);\n }\n\n // Update internal state if uncontrolled\n if (value === undefined) {\n setSelectedValues(newValues);\n }\n\n onChange?.(newValues);\n };\n\n let classNames : string[] = [];\n\n if (align) {\n classNames.push(`align-${align}`);\n }\n\n if (equaliseWidth || equalizeWidth) {\n classNames.push(`equalise-width`);\n }\n\n if (columns) {\n classNames.push(`with-columns`);\n }\n\n if (labelFirst) {\n classNames.push(`label-first`);\n }\n\n const reactId = React.useId();\n const finalGroupId = id || `switch-group-${reactId.replace(/:/g, \"\")}`;\n const { describedBy } = deriveAriaIds(finalGroupId, helpText, errorText);\n\n return (\n <FormItem\n label={label}\n htmlFor={finalGroupId}\n helpText={helpText}\n errorText={errorText}\n required={required}\n >\n <Element\n as=\"div\"\n data-switch-group\n ref={ref}\n id={finalGroupId}\n classNames={classNames}\n role=\"group\"\n aria-label={label}\n aria-invalid={Boolean(errorText) || undefined}\n aria-required={required}\n aria-describedby={describedBy}\n style={columns ? {gridTemplateColumns : `repeat(${columns}, 1fr)`} : undefined}\n {...props}\n >\n {options.map((option, index) => {\n const {id : optionId, value : optionValue, label : optionLabel, ...optionProps} = option;\n const finalId = optionId || `${finalGroupId}-option-${index}`;\n const isChecked = selectedValues.includes(optionValue);\n\n return (\n <Switch\n key={finalId}\n id={finalId}\n name={derivedName}\n label={optionLabel}\n checked={isChecked}\n disabled={disabled || option.disabled}\n size={size}\n labelFirst={labelFirst}\n onChange={(checked : boolean) => handleChange(optionValue, checked)}\n {...optionProps}\n />\n );\n })}\n </Element>\n </FormItem>\n );\n },\n);\nSwitchGroup.displayName = \"SwitchGroup\";\n"],"names":["CheckboxGroup","React","id","name","label","helpText","errorText","options","value","defaultValue","onChange","align","equaliseWidth","equalizeWidth","required","disabled","size","columns","labelFirst","props","ref","derivedName","useMemo","selectedValues","setSelectedValues","handleChange","optionValue","checked","newValues","v","classNames","reactId","finalGroupId","describedBy","deriveAriaIds","jsx","FormItem","Element","option","index","optionId","optionLabel","optionProps","finalId","isChecked","Checkbox","SwitchGroup","Switch"],"mappings":";;;;;;;AAiDO,MAAMA,IAAgBC,EAAM;AAAA,EAC/B,CACI;AAAA,IACI,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEPC,MACC;AACD,UAAMC,IAAcC,EAAQ,MAAMnB,KAAQD,GAAI,CAAEC,GAAMD,CAAG,CAAC,GAEpD,CAAEqB,GAAgBC,CAAkB,IAAIvB,EAAM;AAAA,MAChDO,KAASC,KAAgB,CAAA;AAAA,IAAC;AAG9B,IAAAR,EAAM,UAAU,MAAM;AAClB,MAAIO,MAAU,UACVgB,EAAkBhB,CAAK;AAAA,IAE/B,GAAG,CAAEA,CAAM,CAAC;AAEZ,UAAMiB,IAAe,CAACC,GAAsBC,MAAsB;AAC9D,UAAIC;AAEJ,MAAID,IACAC,IAAY,CAAE,GAAGL,GAAgBG,CAAY,IAE7CE,IAAYL,EAAe,OAAO,CAAAM,MAAKA,MAAMH,CAAW,GAIxDlB,MAAU,UACVgB,EAAkBI,CAAS,GAG/BlB,KAAA,QAAAA,EAAWkB;AAAA,IACf;AAEA,QAAIE,IAAwB,CAAA;AAE5B,IAAInB,KACAmB,EAAW,KAAK,SAASnB,CAAK,EAAE,IAGhCC,KAAiBC,MACjBiB,EAAW,KAAK,gBAAgB,GAGhCb,KACAa,EAAW,KAAK,cAAc,GAG9BZ,KACAY,EAA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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Checkbox/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG;IAC9C,EAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,IAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,OAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,cAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,CAAC,OAAO,EAAG,OAAO,KAAK,IAAI,CAAC;IAC/C,IAAe,CAAC,EAAG,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC1D,QAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,SAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,UAAe,CAAC,EAAG,OAAO,CAAC;CAC9B,CAAC;AAGF,eAAO,MAAM,MAAM;SAdI,MAAM;WACN,MAAM;cACN,OAAO;qBACP,OAAO;eACP,OAAO;eACP,OAAO;eACP,CAAC,OAAO,EAAG,OAAO,KAAK,IAAI;WAC3B,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;eACtC,MAAM;gBACN,MAAM;iBACN,OAAO;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Checkbox/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG;IAC9C,EAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,IAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,OAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,cAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,OAAO,CAAC;IAC3B,QAAe,CAAC,EAAG,CAAC,OAAO,EAAG,OAAO,KAAK,IAAI,CAAC;IAC/C,IAAe,CAAC,EAAG,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC1D,QAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,SAAe,CAAC,EAAG,MAAM,CAAC;IAC1B,UAAe,CAAC,EAAG,OAAO,CAAC;CAC9B,CAAC;AAGF,eAAO,MAAM,MAAM;SAdI,MAAM;WACN,MAAM;cACN,OAAO;qBACP,OAAO;eACP,OAAO;eACP,OAAO;eACP,CAAC,OAAO,EAAG,OAAO,KAAK,IAAI;WAC3B,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;eACtC,MAAM;gBACN,MAAM;iBACN,OAAO;0CA0E7B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as R, jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import p, { useMemo as S } from "react";
|
|
4
|
+
import { separateWrapperProps as $ } from "../../../utils/propSeparation.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { deriveAriaIds as x, FormItem as A } from "../FormItem/FormItem.js";
|
|
7
|
+
import { Element as n } from "../../Element/Element.js";
|
|
8
|
+
const E = p.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
id: t,
|
|
11
|
+
name: s,
|
|
12
|
+
label: f,
|
|
13
|
+
hideLabel: l,
|
|
14
|
+
helpText: c,
|
|
15
|
+
errorText: e,
|
|
16
|
+
onChange: o,
|
|
17
|
+
checked: h,
|
|
18
|
+
defaultChecked: u,
|
|
19
|
+
disabled: v,
|
|
20
|
+
required: a,
|
|
21
|
+
size: m = "medium",
|
|
22
|
+
labelFirst: i,
|
|
23
|
+
...w
|
|
24
|
+
}, I) => {
|
|
25
|
+
const y = S(() => s || t, [s, t]), b = (B) => {
|
|
26
|
+
o == null || o(B.target.checked);
|
|
27
|
+
}, { wrapperProps: N, inputProps: P } = $(w), j = p.useId(), r = t || `switch-${j.replace(/:/g, "")}`, { describedBy: k } = x(r, c, e);
|
|
28
|
+
return /* @__PURE__ */ R(
|
|
29
|
+
A,
|
|
30
|
+
{
|
|
31
|
+
label: f,
|
|
32
|
+
hideLabel: l,
|
|
33
|
+
htmlFor: r,
|
|
34
|
+
helpText: c,
|
|
35
|
+
errorText: e,
|
|
36
|
+
required: a,
|
|
37
|
+
size: m,
|
|
38
|
+
labelFirst: i,
|
|
39
|
+
...N,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ d(
|
|
42
|
+
n,
|
|
43
|
+
{
|
|
44
|
+
as: "input",
|
|
45
|
+
type: "checkbox",
|
|
46
|
+
ref: I,
|
|
47
|
+
id: r,
|
|
48
|
+
name: y,
|
|
49
|
+
checked: h,
|
|
50
|
+
defaultChecked: u,
|
|
51
|
+
disabled: v,
|
|
52
|
+
required: a,
|
|
53
|
+
"aria-invalid": !!e || void 0,
|
|
54
|
+
"aria-required": a,
|
|
55
|
+
"aria-describedby": k,
|
|
56
|
+
onChange: b,
|
|
57
|
+
...P
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ d(
|
|
61
|
+
n,
|
|
62
|
+
{
|
|
63
|
+
as: i ? "label" : "div",
|
|
64
|
+
htmlFor: i ? r : void 0,
|
|
65
|
+
"data-switch": !0,
|
|
66
|
+
className: `size-${m}`
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
E.displayName = "Switch";
|
|
75
|
+
export {
|
|
76
|
+
E as Switch
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../src/components/Form/Checkbox/Switch.tsx"],"sourcesContent":["// REACT CORE ==========================================================================================================\nimport React, { useMemo } from \"react\";\n\n// LOCAL COMPONENTS ====================================================================================================\nimport { Element } from \"$element\";\nimport { SpacingTypes } from \"../../Element/constants\";\n\n// UTILS ===============================================================================================================\nimport { separateWrapperProps } from \"$utils/propSeparation\";\n\n// STYLES ==============================================================================================================\nimport \"./switch.css\";\n\n// OTHER ===============================================================================================================\nimport { FormItem, deriveAriaIds } from \"../FormItem/FormItem\";\nimport { InputLabelCustomProps } from \"../InputLabel/InputLabel\";\n\nexport type SwitchElementType = HTMLInputElement;\nexport type SwitchProps = InputLabelCustomProps & {\n id ? : string;\n name ? : string;\n checked ? : boolean;\n defaultChecked ? : boolean;\n disabled ? : boolean;\n required ? : boolean;\n onChange ? : (checked : boolean) => void;\n size ? : Exclude<SpacingTypes, \"nano\" | \"huge\">;\n helpText ? : string;\n errorText ? : string;\n labelFirst ? : boolean;\n};\n\n// COMPONENT ///////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport const Switch = React.forwardRef(\n (\n {\n id,\n name,\n label,\n hideLabel,\n helpText,\n errorText,\n onChange,\n checked,\n defaultChecked,\n disabled,\n required,\n size = \"medium\",\n labelFirst,\n ...props\n } : SwitchProps,\n ref : React.Ref<SwitchElementType>,\n ) => {\n const derivedName = useMemo(() => name || id, [ name, id ]);\n\n const handleChange = (e : React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked);\n };\n\n // Separate wrapper-level props (margin, padding, etc.) from input-specific props\n const {wrapperProps, inputProps} = separateWrapperProps(props);\n\n const reactId = React.useId();\n const finalId = id || `switch-${reactId.replace(/:/g, \"\")}`;\n const { describedBy } = deriveAriaIds(finalId, helpText, errorText);\n\n return (\n <FormItem\n label={label}\n hideLabel={hideLabel}\n htmlFor={finalId}\n helpText={helpText}\n errorText={errorText}\n required={required}\n size={size}\n labelFirst={labelFirst}\n {...wrapperProps}\n >\n <Element<SwitchElementType>\n as=\"input\"\n type=\"checkbox\"\n ref={ref}\n id={finalId}\n name={derivedName}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n required={required}\n aria-invalid={Boolean(errorText) || undefined}\n aria-required={required}\n aria-describedby={describedBy}\n onChange={handleChange}\n {...inputProps}\n />\n <Element\n as={labelFirst ? \"label\" : \"div\"}\n htmlFor={labelFirst ? finalId : undefined}\n data-switch\n className={`size-${size}`}\n />\n </FormItem>\n );\n },\n);\nSwitch.displayName = \"Switch\";\n"],"names":["Switch","React","id","name","label","hideLabel","helpText","errorText","onChange","checked","defaultChecked","disabled","required","size","labelFirst","props","ref","derivedName","useMemo","handleChange","e","wrapperProps","inputProps","separateWrapperProps","reactId","finalId","describedBy","deriveAriaIds","jsxs","FormItem","jsx","Element"],"mappings":";;;;;;AAiCO,MAAMA,IAASC,EAAM;AAAA,EACxB,CACI;AAAA,IACI,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEPC,MACC;AACD,UAAMC,IAAcC,EAAQ,MAAMf,KAAQD,GA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,CAAC,EAAG,eAAe,CAAC;IACxC,YAAoB,CAAC,EAAG,eAAe,CAAC;IACxC,eAAoB,CAAC,EAAG,eAAe,CAAC;IACxC,cAAoB,CAAC,EAAG,eAAe,CAAC;IACxC,QAAoB,CAAC,EAAG,MAAM,CAAC;IAC/B,SAAoB,CAAC,EAAG,MAAM,CAAC;IAC/B,QAAoB,CAAC,EAAG,OAAO,CAAC;IAChC,QAAoB,CAAC,EAAG,OAAO,CAAC;IAChC,OAAoB,CAAC,EAAG,OAAO,CAAC;IAChC,SAAoB,CAAC,EAAG,MAAM,CAAC;IAC/B,IAAoB,CAAC,EAAG,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAG,MAAM,CAAC;IACvB,cAAc,CAAC,EAAG,OAAO,CAAC;CAC7B,CAAC;AAGF,eAAO,MAAM,UAAU;SAzBK,MAAM;WACN,MAAM;aACN,MAAM;yBACN,OAAO;cACP,MAAM,GAAG,aAAa;aACtB,MAAM;eACN,CAAC,KAAK,EAAG,IAAI,EAAE,KAAK,IAAI;0BACxB,MAAM;yBACN,MAAM;oBACN,eAAe;mBACf,eAAe;sBACf,eAAe;qBACf,eAAe;eACf,MAAM;gBACN,MAAM;eACN,OAAO;eACP,OAAO;cACP,OAAO;gBACP,MAAM;WACN,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;mBAC9C,MAAM;qBACJ,OAAO;0CAsK5B,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import I, { useState as y, useRef as Q } from "react";
|
|
4
|
+
import { Div as i } from "../../Element/Tags.js";
|
|
5
|
+
import { separateWrapperProps as V } from "../../../utils/propSeparation.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Badge as X } from "../../Badge/Badge.js";
|
|
8
|
+
import { deriveAriaIds as Z, FormItem as M } from "../FormItem/FormItem.js";
|
|
9
|
+
import { Text as b } from "../../Typography/Text.js";
|
|
10
|
+
const T = I.forwardRef(
|
|
11
|
+
({
|
|
12
|
+
"aria-label": A,
|
|
13
|
+
"aria-invalid": N,
|
|
14
|
+
label: f,
|
|
15
|
+
helpText: n,
|
|
16
|
+
errorText: t,
|
|
17
|
+
required: m,
|
|
18
|
+
accept: P,
|
|
19
|
+
allowMultipleFiles: u = !1,
|
|
20
|
+
capture: R,
|
|
21
|
+
height: k = "120px",
|
|
22
|
+
onChange: r,
|
|
23
|
+
className: B = "",
|
|
24
|
+
instructionMainText: v = "Drag and drop or click to upload",
|
|
25
|
+
instructionSubText: D = "You can add multiple files",
|
|
26
|
+
invalid: $,
|
|
27
|
+
id: j,
|
|
28
|
+
name: L,
|
|
29
|
+
badgeBgColour: h,
|
|
30
|
+
badgeTextColour: O,
|
|
31
|
+
size: U,
|
|
32
|
+
...x
|
|
33
|
+
}, z) => {
|
|
34
|
+
const [o, s] = y([]), [S, d] = y(!1), g = Q(null), W = (e) => {
|
|
35
|
+
e.preventDefault(), e.stopPropagation(), d(!0);
|
|
36
|
+
}, Y = (e) => {
|
|
37
|
+
e.preventDefault(), e.stopPropagation(), d(!1);
|
|
38
|
+
}, _ = (e) => {
|
|
39
|
+
e.preventDefault(), e.stopPropagation(), d(!1);
|
|
40
|
+
const a = Array.from(e.dataTransfer.files);
|
|
41
|
+
F(a);
|
|
42
|
+
}, F = (e) => {
|
|
43
|
+
if (u)
|
|
44
|
+
s((a) => [...a, ...e]), r == null || r([...o, ...e]);
|
|
45
|
+
else {
|
|
46
|
+
const a = e[0];
|
|
47
|
+
s([a]), r == null || r([a]);
|
|
48
|
+
}
|
|
49
|
+
}, q = (e) => {
|
|
50
|
+
if (e.target.files) {
|
|
51
|
+
const a = Array.from(e.target.files);
|
|
52
|
+
F(a);
|
|
53
|
+
}
|
|
54
|
+
}, w = (e) => {
|
|
55
|
+
const a = o.filter((C, K) => K !== e);
|
|
56
|
+
s(a), r == null || r(a);
|
|
57
|
+
}, E = () => {
|
|
58
|
+
var e;
|
|
59
|
+
(e = g.current) == null || e.click();
|
|
60
|
+
}, { wrapperProps: G } = V(x), H = I.useId(), p = j || `file-upload-${H.replace(/:/g, "")}`, { describedBy: J } = Z(p, n, t);
|
|
61
|
+
return /* @__PURE__ */ l(
|
|
62
|
+
M,
|
|
63
|
+
{
|
|
64
|
+
label: f,
|
|
65
|
+
htmlFor: p,
|
|
66
|
+
helpText: n,
|
|
67
|
+
errorText: t,
|
|
68
|
+
required: m,
|
|
69
|
+
size: U,
|
|
70
|
+
...G,
|
|
71
|
+
children: /* @__PURE__ */ c(
|
|
72
|
+
i,
|
|
73
|
+
{
|
|
74
|
+
"data-file-upload-area": !0,
|
|
75
|
+
ref: z,
|
|
76
|
+
className: [
|
|
77
|
+
"file-upload-wrapper",
|
|
78
|
+
S ? "dragging" : "",
|
|
79
|
+
B
|
|
80
|
+
].filter(Boolean).join(" "),
|
|
81
|
+
"aria-label": A || f,
|
|
82
|
+
"aria-invalid": N || $ || !!t || void 0,
|
|
83
|
+
"aria-required": m,
|
|
84
|
+
"aria-describedby": J,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ c(
|
|
87
|
+
i,
|
|
88
|
+
{
|
|
89
|
+
className: "file-upload-area",
|
|
90
|
+
onDragOver: W,
|
|
91
|
+
onDragLeave: Y,
|
|
92
|
+
onDrop: _,
|
|
93
|
+
onClick: E,
|
|
94
|
+
style: { height: k },
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ l(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
ref: g,
|
|
100
|
+
type: "file",
|
|
101
|
+
id: p,
|
|
102
|
+
name: L,
|
|
103
|
+
onChange: q,
|
|
104
|
+
multiple: u,
|
|
105
|
+
accept: P,
|
|
106
|
+
capture: R,
|
|
107
|
+
className: "file-input"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
v && /* @__PURE__ */ c(i, { className: "file-upload-content", children: [
|
|
111
|
+
/* @__PURE__ */ l(b, { children: v }),
|
|
112
|
+
D && /* @__PURE__ */ l(b, { isSubtext: !0, children: D })
|
|
113
|
+
] })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
o.length > 0 && /* @__PURE__ */ l(i, { className: "uploaded-files", children: o.map((e, a) => /* @__PURE__ */ l(
|
|
118
|
+
X,
|
|
119
|
+
{
|
|
120
|
+
size: "small",
|
|
121
|
+
shape: "rounded",
|
|
122
|
+
actionIcon: "cross",
|
|
123
|
+
onActionClick: () => w(a),
|
|
124
|
+
actionAriaLabel: `Remove ${e.name}`,
|
|
125
|
+
bgColour: h,
|
|
126
|
+
textColour: O,
|
|
127
|
+
children: e.name
|
|
128
|
+
},
|
|
129
|
+
`${e.name}-${a}`
|
|
130
|
+
)) })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
T.displayName = "FileUpload";
|
|
139
|
+
export {
|
|
140
|
+
T as FileUpload
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=FileUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUpload.js","sources":["../../../../src/components/Form/FileUpload/FileUpload.tsx"],"sourcesContent":["// REACT CORE ==========================================================================================================\nimport React, { useRef, useState } from \"react\";\n\n// LOCAL COMPONENTS ====================================================================================================\nimport { ColourPropTypes, CommonProps, SpacingTypes } from \"$components/Element/constants\";\nimport { Div } from \"../../Element/Tags\";\n\n// UTILS ===============================================================================================================\nimport { separateWrapperProps } from \"$utils/propSeparation\";\n\n// STYLES ==============================================================================================================\nimport \"./file-upload.css\";\n\n// OTHER ===============================================================================================================\nimport { Badge } from \"../../Badge/Badge\";\nimport { FormItem, deriveAriaIds } from \"../FormItem/FormItem\";\nimport { InputLabelCustomProps } from \"../InputLabel/InputLabel\";\nimport { Text } from \"../../Typography/Text\";\n\nexport type FileUploadElementType = HTMLInputElement;\nexport type FileUploadProps = InputLabelCustomProps & CommonProps & {\n id ? : string;\n name ? : string;\n accept ? : string;\n allowMultipleFiles ? : boolean;\n capture ? : \"user\" | \"environment\";\n height ? : string;\n onChange ? : (files : File[]) => void;\n instructionMainText ? : string;\n instructionSubText ? : string;\n badgeBgColour ? : ColourPropTypes;\n badgeBgColor ? : ColourPropTypes;\n badgeTextColour ? : ColourPropTypes;\n badgeTextColor ? : ColourPropTypes;\n helpText ? : string;\n errorText ? : string;\n required ? : boolean;\n disabled ? : boolean;\n invalid ? : boolean;\n className ? : string;\n size ? : Exclude<SpacingTypes, \"nano\" | \"huge\">;\n \"aria-label\"? : string;\n \"aria-invalid\"? : boolean;\n};\n\n// COMPONENT ///////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport const FileUpload = React.forwardRef(\n (\n {\n \"aria-label\" : ariaLabel,\n \"aria-invalid\" : ariaInvalid,\n label,\n helpText,\n errorText,\n required,\n accept,\n allowMultipleFiles = false,\n capture,\n height = \"120px\",\n onChange,\n className = \"\",\n instructionMainText = \"Drag and drop or click to upload\",\n instructionSubText = \"You can add multiple files\",\n invalid,\n id,\n name,\n badgeBgColour,\n badgeTextColour,\n size,\n ...props\n } : FileUploadProps,\n ref : React.Ref<FileUploadElementType>,\n ) => {\n const [ files, setFiles ] = useState<File[]>([]);\n const [ isDragging, setIsDragging ] = useState(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const handleDragOver = (e : React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(true);\n };\n\n const handleDragLeave = (e : React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n };\n\n const handleDrop = (e : React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragging(false);\n\n const droppedFiles = Array.from(e.dataTransfer.files);\n handleFiles(droppedFiles);\n };\n\n const handleFiles = (newFiles : File[]) => {\n if (!allowMultipleFiles) {\n const fileToAdd = newFiles[0];\n setFiles([ fileToAdd ]);\n onChange?.([ fileToAdd ]);\n } else {\n setFiles(prevFiles => [ ...prevFiles, ...newFiles ]);\n onChange?.([ ...files, ...newFiles ]);\n }\n };\n\n const handleFileInput = (e : React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n const selectedFiles = Array.from(e.target.files);\n handleFiles(selectedFiles);\n }\n };\n\n const removeFile = (indexToRemove : number) => {\n const updatedFiles = files.filter((_, index) => index !== indexToRemove);\n setFiles(updatedFiles);\n onChange?.(updatedFiles);\n };\n\n const openFileDialog = () => {\n fileInputRef.current?.click();\n };\n\n // Separate wrapper-level props (margin, padding, etc.) from component-specific props\n const { wrapperProps } = separateWrapperProps(props);\n\n const reactId = React.useId();\n const finalId = id || `file-upload-${reactId.replace(/:/g, \"\")}`;\n const { describedBy } = deriveAriaIds(finalId, helpText, errorText);\n\n return (\n <FormItem\n label={label}\n htmlFor={finalId}\n helpText={helpText}\n errorText={errorText}\n required={required}\n size={size}\n {...wrapperProps}\n >\n <Div\n data-file-upload-area\n ref={ref as React.Ref<HTMLDivElement>}\n className={[\n \"file-upload-wrapper\",\n isDragging ? \"dragging\" : \"\",\n className,\n ].filter(Boolean).join(\" \")}\n aria-label={ariaLabel || label}\n aria-invalid={ariaInvalid || invalid || Boolean(errorText) || undefined}\n aria-required={required}\n aria-describedby={describedBy}\n >\n <Div\n className=\"file-upload-area\"\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onClick={openFileDialog}\n style={{height}}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n id={finalId}\n name={name}\n onChange={handleFileInput}\n multiple={allowMultipleFiles}\n accept={accept}\n capture={capture}\n className=\"file-input\"\n />\n\n {instructionMainText &&\n <Div className=\"file-upload-content\">\n <Text>{instructionMainText}</Text>\n {instructionSubText && (\n <Text isSubtext>{instructionSubText}</Text>\n )}\n </Div>\n }\n </Div>\n\n {files.length > 0 && (\n <Div className=\"uploaded-files\">\n {files.map((file, index) => (\n <Badge\n key={`${file.name}-${index}`}\n size=\"small\"\n shape=\"rounded\"\n actionIcon=\"cross\"\n onActionClick={() => removeFile(index)}\n actionAriaLabel={`Remove ${file.name}`}\n bgColour={badgeBgColour}\n textColour={badgeTextColour}\n >\n {file.name}\n </Badge>\n ))}\n </Div>\n )}\n </Div>\n </FormItem>\n );\n },\n);\nFileUpload.displayName = \"FileUpload\";\n"],"names":["FileUpload","React","ariaLabel","ariaInvalid","label","helpText","errorText","required","accept","allowMultipleFiles","capture","height","onChange","className","instructionMainText","instructionSubText","invalid","id","name","badgeBgColour","badgeTextColour","size","props","ref","files","setFiles","useState","isDragging","setIsDragging","fileInputRef","useRef","handleDragOver","handleDragLeave","handleDrop","droppedFiles","handleFiles","newFiles","prevFiles","fileToAdd","handleFileInput","selectedFiles","removeFile","indexToRemove","updatedFiles","_","index","openFileDialog","_a","wrapperProps","separateWrapperProps","reactId","finalId","describedBy","deriveAriaIds","jsx","FormItem","jsxs","Div","Text","file","Badge"],"mappings":";;;;;;;;AA8CO,MAAMA,IAAaC,EAAM;AAAA,EAC5B,CACI;AAAA,IACI,cAAiBC;AAAA,IACjB,gBAAiBC;AAAA,IACjB,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,oBAAAC,IAAqB;AAAA,IACrB,SAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,qBAAAC,IAAsB;AAAA,IACtB,oBAAAC,IAAqB;AAAA,IACrB,SAAAC;AAAA,IACA,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEPC,MACC;AACD,UAAM,CAAEC,GAAOC,CAAS,IAAIC,EAAiB,CAAA,CA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AAAA,sBAC1BC,KACG,gBAAAuC,EAACI,GAAA,EAAK,WAAS,IAAE,UAAA3C,EAAA,CAAmB;AAAA,oBAAA,EAAA,CAE5C;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,cAIPS,EAAM,SAAS,KACZ,gBAAA8B,EAACG,GAAA,EAAI,WAAU,kBACV,UAAAjC,EAAM,IAAI,CAACmC,GAAMd,MACd,gBAAAS;AAAA,gBAACM;AAAA,gBAAA;AAAA,kBAEG,MAAK;AAAA,kBACL,OAAM;AAAA,kBACN,YAAW;AAAA,kBACX,eAAe,MAAMnB,EAAWI,CAAK;AAAA,kBACrC,iBAAiB,UAAUc,EAAK,IAAI;AAAA,kBACpC,UAAUxC;AAAA,kBACV,YAAYC;AAAA,kBAEX,UAAAuC,EAAK;AAAA,gBAAA;AAAA,gBATD,GAAGA,EAAK,IAAI,IAAId,CAAK;AAAA,cAAA,CAWjC,EAAA,CACL;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAER;AAAA,IAAA;AAAA,EAGZ;AACJ;AACA7C,EAAW,cAAc;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import u from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { generateFormThroughConfig as g } from "./FormGenerator.js";
|
|
6
|
+
import { Element as C } from "../../Element/Element.js";
|
|
7
|
+
import { Callout as F } from "../../Callout/Callout.js";
|
|
8
|
+
const d = u.forwardRef(
|
|
9
|
+
({ spacing: o = "small", fields: r, onFieldsChange: m, children: e, errorText: t, ...n }, f) => {
|
|
10
|
+
let a = [];
|
|
11
|
+
o && a.push(`spacing-${o}`);
|
|
12
|
+
const p = (i, l) => {
|
|
13
|
+
m && m({
|
|
14
|
+
[i]: l
|
|
15
|
+
});
|
|
16
|
+
}, h = r != null && r.length ? g(r, p, o) : e;
|
|
17
|
+
return /* @__PURE__ */ c(
|
|
18
|
+
C,
|
|
19
|
+
{
|
|
20
|
+
as: "form",
|
|
21
|
+
"data-form": !0,
|
|
22
|
+
ref: f,
|
|
23
|
+
classNames: a,
|
|
24
|
+
...n,
|
|
25
|
+
children: [
|
|
26
|
+
h,
|
|
27
|
+
t && /* @__PURE__ */ s(F, { kind: "error", children: t })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
d.displayName = "Form";
|
|
34
|
+
export {
|
|
35
|
+
d as Form
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sources":["../../../../src/components/Form/Form/Form.tsx"],"sourcesContent":["// REACT CORE ==========================================================================================================\nimport React from \"react\";\n\n// ELEMENT =============================================================================================================\nimport { CommonAndHTMLProps, SpacingTypes } from \"../../Element/constants\";\nimport { Element } from \"$element\";\n\n// STYLES ==============================================================================================================\nimport \"./form.css\";\n\n// OTHER ===============================================================================================================\nimport { Callout } from \"$components/Callout\";\nimport { FormFieldsConfig, generateFormThroughConfig } from \"./FormGenerator\";\n\n// prettier-ignore\nexport interface FormCustomProps {\n spacing ? : SpacingTypes;\n fields ? : FormFieldsConfig[];\n onFieldsChange ? : (values: Record<string, any>) => void;\n errorText ? : string;\n}\n\nexport type FormElementType = HTMLFormElement;\nexport type FormProps = Omit<CommonAndHTMLProps<FormElementType>, keyof FormCustomProps> &\n FormCustomProps;\n\n// COMPONENT ///////////////////////////////////////////////////////////////////////////////////////////////////////////\nexport const Form = React.forwardRef(\n (\n { spacing = \"small\", fields, onFieldsChange, children, errorText, ...props }: FormProps,\n ref: React.Ref<FormElementType>\n ) => {\n let classNames = [];\n\n if (spacing) {\n classNames.push(`spacing-${spacing}`);\n }\n\n // Handle form field changes to provide direct values\n const handleFieldChange = (fieldName: string, value: any) => {\n if (onFieldsChange) {\n onFieldsChange({\n [fieldName]: value\n });\n }\n };\n\n // Generate form fields if config is provided\n const formContent = fields?.length ? generateFormThroughConfig(fields, handleFieldChange, spacing) : children;\n\n return (\n <Element<FormElementType>\n as=\"form\"\n data-form\n ref={ref}\n classNames={classNames}\n {...props}\n >\n {formContent}\n {errorText && <Callout kind=\"error\">{errorText}</Callout>}\n </Element>\n );\n }\n);\nForm.displayName = \"Form\";\n"],"names":["Form","React","spacing","fields","onFieldsChange","children","errorText","props","ref","classNames","handleFieldChange","fieldName","value","formContent","generateFormThroughConfig","jsxs","Element","jsx","Callout"],"mappings":";;;;;;AA2BO,MAAMA,IAAOC,EAAM;AAAA,EACtB,CACI,EAAE,SAAAC,IAAU,SAAS,QAAAC,GAAQ,gBAAAC,GAAgB,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GACrEC,MACC;AACD,QAAIC,IAAa,CAAA;AAEjB,IAAIP,KACAO,EAAW,KAAK,WAAWP,CAAO,EAAE;AAIxC,UAAMQ,IAAoB,CAACC,GAAmBC,MAAe;AACzD,MAAIR,KACAA,EAAe;AAAA,QACX,CAACO,CAAS,GAAGC;AAAA,MAAA,CAChB;AAAA,IAET,GAGMC,IAAcV,KAAA,QAAAA,EAAQ,SAASW,EAA0BX,GAAQO,GAAmBR,CAAO,IAAIG;AAErG,WACI,gBAAAU;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,IAAG;AAAA,QACH,aAAS;AAAA,QACT,KAAAR;AAAA,QACA,YAAAC;AAAA,QACC,GAAGF;AAAA,QAEH,UAAA;AAAA,UAAAM;AAAA,UACAP,KAAa,gBAAAW,EAACC,GAAA,EAAQ,MAAK,SAAS,UAAAZ,EAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG3D;AACJ;AACAN,EAAK,cAAc;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as u } from "react";
|
|
4
|
+
import { Checkbox as h } from "../Checkbox/Checkbox.js";
|
|
5
|
+
import { FileUpload as F } from "../FileUpload/FileUpload.js";
|
|
6
|
+
import { InputField as s } from "../InputField/InputField.js";
|
|
7
|
+
import { InputLabel as g } from "../InputLabel/InputLabel.js";
|
|
8
|
+
import { Portion as C } from "../../Portion/Portion.js";
|
|
9
|
+
import { RadioButton as S } from "../RadioButton/RadioButton.js";
|
|
10
|
+
import { RadioGroup as b } from "../RadioButton/RadioGroup.js";
|
|
11
|
+
import { Row as E } from "../../Row/Row.js";
|
|
12
|
+
import { Select as P } from "../Select/Select.js";
|
|
13
|
+
import { Switch as x } from "../Checkbox/Switch.js";
|
|
14
|
+
import { TextArea as k } from "../TextArea/TextArea.js";
|
|
15
|
+
import { Element as I } from "../../Element/Element.js";
|
|
16
|
+
const R = {
|
|
17
|
+
Checkbox: h,
|
|
18
|
+
Switch: x,
|
|
19
|
+
InputField: s,
|
|
20
|
+
FileUpload: F,
|
|
21
|
+
InputLabel: g,
|
|
22
|
+
RadioButton: S,
|
|
23
|
+
RadioGroup: b,
|
|
24
|
+
Select: P,
|
|
25
|
+
TextArea: k,
|
|
26
|
+
Empty: "div"
|
|
27
|
+
}, w = (r, e) => {
|
|
28
|
+
const { as: m, name: o, ...t } = r, n = (p) => {
|
|
29
|
+
e(o, p);
|
|
30
|
+
}, i = R[m] || s;
|
|
31
|
+
return /* @__PURE__ */ a(
|
|
32
|
+
I,
|
|
33
|
+
{
|
|
34
|
+
as: i,
|
|
35
|
+
...t,
|
|
36
|
+
name: o,
|
|
37
|
+
isFullWidth: !0,
|
|
38
|
+
onChange: n
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}, D = (r, e, m) => {
|
|
42
|
+
const o = r.map((t, n) => {
|
|
43
|
+
const {
|
|
44
|
+
desktopSpan: i,
|
|
45
|
+
tabletLandscapeSpan: p,
|
|
46
|
+
tabletPortraitSpan: l,
|
|
47
|
+
mobileSpan: f,
|
|
48
|
+
isHorizontal: c,
|
|
49
|
+
...d
|
|
50
|
+
} = t;
|
|
51
|
+
return /* @__PURE__ */ u(C, { ...{
|
|
52
|
+
desktopSpan: i,
|
|
53
|
+
tabletLandscapeSpan: p,
|
|
54
|
+
tabletPortraitSpan: l,
|
|
55
|
+
mobileSpan: f,
|
|
56
|
+
isHorizontal: c
|
|
57
|
+
}, key: `${t.name}-${n}` }, w(d, e));
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ a(E, { gutters: m, children: o });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
D as generateFormThroughConfig
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=FormGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGenerator.js","sources":["../../../../src/components/Form/Form/FormGenerator.tsx"],"sourcesContent":["// REACT CORE ==========================================================================================================\nimport React, { ElementType, ReactNode } from \"react\";\n\n// ELEMENT =============================================================================================================\nimport { ElementProps, SpacingTypes } from \"../../Element/constants\";\n\n// INPUT ===============================================================================================================\n// Common props shared by form inputs\nexport interface InputCommonProps {\n label?: string;\n helpText?: string;\n errorText?: string;\n required?: boolean;\n disabled?: boolean;\n}\n\n// OTHER ===============================================================================================================\nimport { Checkbox } from \"../Checkbox/Checkbox\";\nimport { Element } from \"$element\";\nimport { FileUpload } from \"../FileUpload/FileUpload\";\nimport { InputField } from \"../InputField/InputField\";\nimport { InputLabel, InputLabelCustomProps } from \"../InputLabel/InputLabel\";\nimport { PortionProps, Portion } from \"../../Portion/Portion\";\nimport { RadioButton } from \"../RadioButton/RadioButton\";\nimport { RadioGroup } from \"../RadioButton/RadioGroup\";\nimport { RadioGroupOptionProps } from \"../RadioButton/constants\";\nimport { Row } from \"../../Row/Row\";\nimport { Select } from \"../Select/Select\";\nimport { Switch } from \"../Checkbox/Switch\";\nimport { TextArea } from \"../TextArea/TextArea\";\n\n// Types\nexport type FormFieldsType = ElementProps<HTMLInputElement> &\n ElementProps<HTMLSelectElement> &\n ElementProps<HTMLTextAreaElement> &\n InputLabelCustomProps &\n InputCommonProps;\n\nexport type FormFieldsConfigBase = PortionProps & FormFieldsType;\n\ninterface FormFieldOptionsType extends RadioGroupOptionProps {\n id : string;\n label : string;\n value : string;\n}\n\nexport interface FormFieldsConfig extends FormFieldsConfigBase {\n as : ElementType;\n options ? : FormFieldOptionsType[];\n name : string;\n // Making name required for field identification\n}\n\n// Supported Form elements for \"as\" prop in config\nconst FormElements: Record<string, ElementType> = {\n Checkbox,\n Switch,\n InputField,\n FileUpload,\n InputLabel,\n RadioButton,\n RadioGroup,\n Select,\n TextArea,\n Empty: \"div\",\n};\n\nconst getFormItem = (\n formField: Omit<FormFieldsConfig, \"mobileSpan\" | \"tabletLandscapeSpan\" | \"isHorizontal\" | \"desktopSpan\" | \"tabletPortraitSpan\">,\n onFieldChange: (fieldName: string, value: any) => void\n): React.ReactNode => {\n const { as: elementName, name, ...formFieldProps } = formField;\n\n // Create an onChange handler specific to this field\n const handleChange = (value: any) => {\n onFieldChange(name, value);\n };\n\n const ElementComponent = FormElements[elementName as keyof typeof FormElements] || InputField;\n\n return (\n <Element\n as={ElementComponent}\n {...formFieldProps}\n name={name}\n isFullWidth\n onChange={handleChange}\n />\n );\n};\n\nexport const generateFormThroughConfig = (\n fields: FormFieldsConfig[],\n onFieldChange: (fieldName: string, value: any) => void,\n spacing: SpacingTypes | undefined,\n): React.ReactNode => {\n const formChildren: ReactNode[] = fields.map((field, index) => {\n const {\n desktopSpan,\n tabletLandscapeSpan,\n tabletPortraitSpan,\n mobileSpan,\n isHorizontal,\n ...formField\n } = field;\n\n const portionProps = {\n desktopSpan,\n tabletLandscapeSpan,\n tabletPortraitSpan,\n mobileSpan,\n isHorizontal,\n };\n\n return (\n <Portion {...portionProps} key={`${field.name}-${index}`}>\n {getFormItem(formField, onFieldChange)}\n </Portion>\n );\n });\n\n return <Row gutters={spacing}>{formChildren}</Row>;\n};\n"],"names":["FormElements","Checkbox","Switch","InputField","FileUpload","InputLabel","RadioButton","RadioGroup","Select","TextArea","getFormItem","formField","onFieldChange","elementName","name","formFieldProps","handleChange","value","ElementComponent","jsx","Element","generateFormThroughConfig","fields","spacing","formChildren","field","index","desktopSpan","tabletLandscapeSpan","tabletPortraitSpan","mobileSpan","isHorizontal","createElement","Portion","Row"],"mappings":";;;;;;;;;;;;;;AAsDA,MAAMA,IAA4C;AAAA,EAC9C,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAO;AACX,GAEMC,IAAc,CAChBC,GACAC,MACkB;AAClB,QAAM,EAAE,IAAIC,GAAa,MAAAC,GAAM,GAAGC,MAAmBJ,GAG/CK,IAAe,CAACC,MAAe;AACjC,IAAAL,EAAcE,GAAMG,CAAK;AAAA,EAC7B,GAEMC,IAAmBlB,EAAaa,CAAwC,KAAKV;AAEnF,SACI,gBAAAgB;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,IAAIF;AAAA,MACH,GAAGH;AAAA,MACJ,MAAAD;AAAA,MACA,aAAW;AAAA,MACX,UAAUE;AAAA,IAAA;AAAA,EAAA;AAGtB,GAEaK,IAA4B,CACrCC,GACAV,GACAW,MACkB;AAClB,QAAMC,IAA4BF,EAAO,IAAI,CAACG,GAAOC,MAAU;AAC3D,UAAM;AAAA,MACI,aAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,GAAGpB;AAAA,IAAA,IACHc;AAUV,WACI,gBAAAO,EAACC,GAAA,EAAS,GATO;AAAA,MACjB,aAAAN;AAAA,MACA,qBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,IAAA,GAI2B,KAAK,GAAGN,EAAM,IAAI,IAAIC,CAAK,GAAA,GACjDhB,EAAYC,GAAWC,CAAa,CACzC;AAAA,EAER,CAAC;AAED,SAAO,gBAAAO,EAACe,GAAA,EAAI,SAASX,GAAU,UAAAC,GAAa;AAChD;"}
|