@knkcs/anker 0.0.1 → 0.0.2
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/atoms/index.d.ts +48 -12
- package/dist/atoms/index.js +77 -49
- package/dist/atoms/index.js.map +1 -1
- package/dist/{chunk-FGKGX4UF.js → chunk-7UJ4QEUW.js} +4 -3
- package/dist/chunk-7UJ4QEUW.js.map +1 -0
- package/dist/chunk-C4JI3JNA.js +147 -0
- package/dist/chunk-C4JI3JNA.js.map +1 -0
- package/dist/chunk-GJTQLZ4O.js +73 -0
- package/dist/chunk-GJTQLZ4O.js.map +1 -0
- package/dist/chunk-NJFF6S77.js +108 -0
- package/dist/chunk-NJFF6S77.js.map +1 -0
- package/dist/chunk-QU3FF5WI.js +36 -0
- package/dist/chunk-QU3FF5WI.js.map +1 -0
- package/dist/{chunk-4D3EY2W2.js → chunk-YSFUGIQM.js} +388 -34
- package/dist/chunk-YSFUGIQM.js.map +1 -0
- package/dist/components/index.d.ts +124 -12
- package/dist/components/index.js +291 -50
- package/dist/components/index.js.map +1 -1
- package/dist/forms/index.d.ts +2 -13
- package/dist/forms/index.js +81 -119
- package/dist/forms/index.js.map +1 -1
- package/dist/primitives/index.d.ts +142 -90
- package/dist/primitives/index.js +38 -116
- package/dist/primitives/index.js.map +1 -1
- package/dist/theme/index.d.ts +80 -8
- package/dist/theme/index.js +1 -1
- package/package.json +5 -1
- package/dist/chunk-4D3EY2W2.js.map +0 -1
- package/dist/chunk-4T32UC26.js +0 -81
- package/dist/chunk-4T32UC26.js.map +0 -1
- package/dist/chunk-FGKGX4UF.js.map +0 -1
- package/dist/chunk-QSCNXHMU.js +0 -32
- package/dist/chunk-QSCNXHMU.js.map +0 -1
- package/dist/chunk-YXTW5OAJ.js +0 -303
- package/dist/chunk-YXTW5OAJ.js.map +0 -1
package/dist/forms/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LeavePageConfirmation, NumberInputRoot, NumberInputField, Radio } from '../chunk-
|
|
1
|
+
import { Popover, PopoverTrigger, PopoverContent, PopoverBody, LeavePageConfirmation, NumberInputRoot, NumberInputField, Radio, NativeSelect } from '../chunk-C4JI3JNA.js';
|
|
2
2
|
import { Switch } from '../chunk-RJPEVNMJ.js';
|
|
3
3
|
import { text_input_default } from '../chunk-PZCL4M6I.js';
|
|
4
4
|
export { SearchInput } from '../chunk-PZCL4M6I.js';
|
|
5
|
-
import { Stack, Grid, GridItem, Text, Input, IconButton, Box, ButtonGroup, Button, Field, HStack, Checkbox,
|
|
6
|
-
import { Trash2, Plus, Upload,
|
|
5
|
+
import { Stack, Grid, GridItem, Text, Input, IconButton, Box, ButtonGroup, Button, Field, HStack, Checkbox, Square, Editable, Flex, RadioGroup, Textarea, useEditableContext } from '@chakra-ui/react';
|
|
6
|
+
import { Trash2, Plus, Upload, Pencil } from 'lucide-react';
|
|
7
7
|
import React, { useId, useCallback, useEffect } from 'react';
|
|
8
8
|
import { useFormContext, useFieldArray, Controller } from 'react-hook-form';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -74,7 +74,7 @@ function ArrayField(props) {
|
|
|
74
74
|
emptyState,
|
|
75
75
|
...rest
|
|
76
76
|
} = props;
|
|
77
|
-
return /* @__PURE__ */ jsx(FormField, { name, label, readOnly, ...rest, children: (
|
|
77
|
+
return /* @__PURE__ */ jsx(FormField, { name, label, readOnly, ...rest, children: () => /* @__PURE__ */ jsx(Box, { py: 4, px: 4, bg: "bg", rounded: "md", children: mode === "dynamic" ? /* @__PURE__ */ jsx(
|
|
78
78
|
DynamicArray,
|
|
79
79
|
{
|
|
80
80
|
name,
|
|
@@ -185,7 +185,7 @@ function CheckboxField({
|
|
|
185
185
|
ref,
|
|
186
186
|
...props
|
|
187
187
|
}) {
|
|
188
|
-
const { name, label, value, disabled, children } = props;
|
|
188
|
+
const { name, label, value, disabled, helperText, children } = props;
|
|
189
189
|
const { control } = useFormContext();
|
|
190
190
|
return /* @__PURE__ */ jsx(
|
|
191
191
|
Controller,
|
|
@@ -212,28 +212,32 @@ function CheckboxField({
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
const uniqueId = isArrayMode ? `${name}-${String(value)}` : name;
|
|
215
|
-
return /* @__PURE__ */ jsxs(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
label,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
215
|
+
return /* @__PURE__ */ jsxs(Field.Root, { invalid: !!fieldState.error, disabled, children: [
|
|
216
|
+
/* @__PURE__ */ jsxs(
|
|
217
|
+
Checkbox.Root,
|
|
218
|
+
{
|
|
219
|
+
id: uniqueId,
|
|
220
|
+
name: field.name,
|
|
221
|
+
value: isArrayMode ? String(value) : void 0,
|
|
222
|
+
invalid: !!fieldState.error,
|
|
223
|
+
ref,
|
|
224
|
+
checked: isChecked,
|
|
225
|
+
onCheckedChange: handleCheckedChange,
|
|
226
|
+
onBlur: field.onBlur,
|
|
227
|
+
disabled,
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsx(Checkbox.HiddenInput, {}),
|
|
230
|
+
/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, {}) }),
|
|
231
|
+
(label || children) && /* @__PURE__ */ jsxs(Checkbox.Label, { children: [
|
|
232
|
+
label,
|
|
233
|
+
children
|
|
234
|
+
] })
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
helperText && /* @__PURE__ */ jsx(Field.HelperText, { children: helperText }),
|
|
239
|
+
fieldState.error && /* @__PURE__ */ jsx(Field.ErrorText, { "aria-live": "polite", children: fieldState.error.message })
|
|
240
|
+
] });
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
);
|
|
@@ -289,6 +293,7 @@ function CodeField({
|
|
|
289
293
|
onChange: (e) => field.onChange(e.target.value),
|
|
290
294
|
onBlur: field.onBlur,
|
|
291
295
|
readOnly,
|
|
296
|
+
"aria-describedby": field["aria-describedby"],
|
|
292
297
|
style: {
|
|
293
298
|
fontFamily: "monospace",
|
|
294
299
|
fontSize: "0.875rem",
|
|
@@ -308,8 +313,8 @@ function ColorPickerField({
|
|
|
308
313
|
...props
|
|
309
314
|
}) {
|
|
310
315
|
const { name, label, size = "md", readOnly, ColorPicker, ...rest } = props;
|
|
311
|
-
return /* @__PURE__ */ jsx(FormField, { name, label, readOnly, ...rest, children: (field) => /* @__PURE__ */ jsxs(Popover
|
|
312
|
-
/* @__PURE__ */ jsx(
|
|
316
|
+
return /* @__PURE__ */ jsx(FormField, { name, label, readOnly, ...rest, children: (field) => /* @__PURE__ */ jsxs(Popover, { children: [
|
|
317
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
313
318
|
IconButton,
|
|
314
319
|
{
|
|
315
320
|
ref,
|
|
@@ -321,32 +326,30 @@ function ColorPickerField({
|
|
|
321
326
|
variant: "outline",
|
|
322
327
|
disabled: readOnly,
|
|
323
328
|
"aria-label": `Color: ${field.value || "none"}`,
|
|
329
|
+
"aria-describedby": field["aria-describedby"],
|
|
324
330
|
children: /* @__PURE__ */ jsx(Square, { rounded: "sm", bg: field.value, size: 6 })
|
|
325
331
|
}
|
|
326
332
|
) }),
|
|
327
|
-
/* @__PURE__ */ jsx(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
"
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
border: "none",
|
|
345
|
-
cursor: "pointer"
|
|
346
|
-
}
|
|
333
|
+
/* @__PURE__ */ jsx(PopoverContent, { width: "auto", showArrow: true, children: /* @__PURE__ */ jsx(PopoverBody, { children: ColorPicker ? /* @__PURE__ */ jsx(
|
|
334
|
+
ColorPicker,
|
|
335
|
+
{
|
|
336
|
+
color: field.value,
|
|
337
|
+
onChange: (color) => field.onChange(color)
|
|
338
|
+
}
|
|
339
|
+
) : /* @__PURE__ */ jsx(
|
|
340
|
+
"input",
|
|
341
|
+
{
|
|
342
|
+
type: "color",
|
|
343
|
+
value: field.value || "#000000",
|
|
344
|
+
onChange: (e) => field.onChange(e.target.value),
|
|
345
|
+
style: {
|
|
346
|
+
width: 200,
|
|
347
|
+
height: 200,
|
|
348
|
+
border: "none",
|
|
349
|
+
cursor: "pointer"
|
|
347
350
|
}
|
|
348
|
-
|
|
349
|
-
|
|
351
|
+
}
|
|
352
|
+
) }) })
|
|
350
353
|
] }) });
|
|
351
354
|
}
|
|
352
355
|
ColorPickerField.displayName = "ColorPickerField";
|
|
@@ -523,6 +526,7 @@ function FileField(props) {
|
|
|
523
526
|
accept: accept ? Object.values(accept).flat().join(",") : void 0,
|
|
524
527
|
multiple,
|
|
525
528
|
disabled,
|
|
529
|
+
"aria-describedby": field["aria-describedby"],
|
|
526
530
|
onChange: (e) => {
|
|
527
531
|
const files = e.target.files;
|
|
528
532
|
if (!files) return;
|
|
@@ -703,6 +707,7 @@ function MarkdownField(props) {
|
|
|
703
707
|
onChange: (e) => field.onChange(e.target.value),
|
|
704
708
|
onBlur: field.onBlur,
|
|
705
709
|
readOnly,
|
|
710
|
+
"aria-describedby": field["aria-describedby"],
|
|
706
711
|
style: {
|
|
707
712
|
padding: "0.75rem",
|
|
708
713
|
border: "1px solid var(--chakra-colors-border)",
|
|
@@ -758,7 +763,15 @@ function NumberInputField2({
|
|
|
758
763
|
showStepper: showStepper && !readOnly,
|
|
759
764
|
opacity: readOnly ? 0.8 : 1,
|
|
760
765
|
...numberInputProps,
|
|
761
|
-
children: /* @__PURE__ */ jsx(
|
|
766
|
+
children: /* @__PURE__ */ jsx(
|
|
767
|
+
NumberInputField,
|
|
768
|
+
{
|
|
769
|
+
name: field.name,
|
|
770
|
+
ref,
|
|
771
|
+
onBlur: field.onBlur,
|
|
772
|
+
"aria-describedby": field["aria-describedby"]
|
|
773
|
+
}
|
|
774
|
+
)
|
|
762
775
|
}
|
|
763
776
|
)
|
|
764
777
|
}
|
|
@@ -772,61 +785,13 @@ function RadioGroupField(props) {
|
|
|
772
785
|
{
|
|
773
786
|
value: String(field.value ?? ""),
|
|
774
787
|
onValueChange: (e) => field.onChange(e.value),
|
|
788
|
+
"aria-describedby": field["aria-describedby"],
|
|
775
789
|
...radioGroupProps,
|
|
776
790
|
children: /* @__PURE__ */ jsx(Stack, { direction: "row", ...stackProps, children: options.map((option) => /* @__PURE__ */ jsx(Radio, { value: option.value, children: option.label }, option.value)) })
|
|
777
791
|
}
|
|
778
792
|
) });
|
|
779
793
|
}
|
|
780
794
|
RadioGroupField.displayName = "RadioGroupField";
|
|
781
|
-
var SelectActionField = (props) => {
|
|
782
|
-
const { label, menuItems, onClick, ...rest } = props;
|
|
783
|
-
const hasMenuItems = menuItems && menuItems.length > 0;
|
|
784
|
-
return /* @__PURE__ */ jsxs(HStack, { gap: 0.5, children: [
|
|
785
|
-
onClick && /* @__PURE__ */ jsxs(
|
|
786
|
-
Button,
|
|
787
|
-
{
|
|
788
|
-
...rest,
|
|
789
|
-
colorPalette: "blue",
|
|
790
|
-
onClick,
|
|
791
|
-
size: "lg",
|
|
792
|
-
roundedRight: hasMenuItems ? "none" : void 0,
|
|
793
|
-
children: [
|
|
794
|
-
/* @__PURE__ */ jsx(Plus, { size: 16 }),
|
|
795
|
-
label
|
|
796
|
-
]
|
|
797
|
-
}
|
|
798
|
-
),
|
|
799
|
-
hasMenuItems && /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
800
|
-
/* @__PURE__ */ jsx(Menu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
801
|
-
Button,
|
|
802
|
-
{
|
|
803
|
-
...rest,
|
|
804
|
-
size: "lg",
|
|
805
|
-
colorPalette: "blue",
|
|
806
|
-
roundedLeft: onClick ? "none" : void 0,
|
|
807
|
-
children: [
|
|
808
|
-
/* @__PURE__ */ jsx(ChevronDown, { size: 16 }),
|
|
809
|
-
onClick ? null : label
|
|
810
|
-
]
|
|
811
|
-
}
|
|
812
|
-
) }),
|
|
813
|
-
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { children: /* @__PURE__ */ jsx(Menu.Content, { children: menuItems.map((menuItem) => /* @__PURE__ */ jsxs(
|
|
814
|
-
Menu.Item,
|
|
815
|
-
{
|
|
816
|
-
value: menuItem.label,
|
|
817
|
-
onClick: menuItem.onClick,
|
|
818
|
-
color: menuItem.color,
|
|
819
|
-
children: [
|
|
820
|
-
menuItem.icon,
|
|
821
|
-
menuItem.label
|
|
822
|
-
]
|
|
823
|
-
},
|
|
824
|
-
menuItem.label
|
|
825
|
-
)) }) }) })
|
|
826
|
-
] })
|
|
827
|
-
] });
|
|
828
|
-
};
|
|
829
|
-
SelectActionField.displayName = "SelectActionField";
|
|
830
795
|
function SelectField({
|
|
831
796
|
ref,
|
|
832
797
|
...props
|
|
@@ -849,23 +814,19 @@ function SelectField({
|
|
|
849
814
|
readOnly,
|
|
850
815
|
disabled,
|
|
851
816
|
...rest,
|
|
852
|
-
children: (field) => /* @__PURE__ */
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
),
|
|
867
|
-
/* @__PURE__ */ jsx(NativeSelect.Indicator, {})
|
|
868
|
-
] })
|
|
817
|
+
children: (field) => /* @__PURE__ */ jsx(
|
|
818
|
+
NativeSelect,
|
|
819
|
+
{
|
|
820
|
+
disabled: readOnly || disabled,
|
|
821
|
+
placeholder,
|
|
822
|
+
...field,
|
|
823
|
+
value: String(field.value ?? ""),
|
|
824
|
+
id: name,
|
|
825
|
+
ref,
|
|
826
|
+
...selectProps,
|
|
827
|
+
children
|
|
828
|
+
}
|
|
829
|
+
)
|
|
869
830
|
}
|
|
870
831
|
);
|
|
871
832
|
}
|
|
@@ -894,6 +855,7 @@ function SwitchField({
|
|
|
894
855
|
disabled,
|
|
895
856
|
readOnly,
|
|
896
857
|
opacity: readOnly ? 0.8 : 1,
|
|
858
|
+
"aria-describedby": field["aria-describedby"],
|
|
897
859
|
ref,
|
|
898
860
|
...switchProps
|
|
899
861
|
}
|
|
@@ -942,6 +904,6 @@ function TextareaField({
|
|
|
942
904
|
}
|
|
943
905
|
TextareaField.displayName = "TextareaField";
|
|
944
906
|
|
|
945
|
-
export { ArrayField, CheckboxField, CodeField, ColorPickerField, ControlledFormField, DatePickerField, DirtyFormGuard, EditableHeading, FileField, FormField, InputField, MarkdownField, NumberInputField2 as NumberInputField, RadioGroupField,
|
|
907
|
+
export { ArrayField, CheckboxField, CodeField, ColorPickerField, ControlledFormField, DatePickerField, DirtyFormGuard, EditableHeading, FileField, FormField, InputField, MarkdownField, NumberInputField2 as NumberInputField, RadioGroupField, SelectField, SwitchField, TextareaField };
|
|
946
908
|
//# sourceMappingURL=index.js.map
|
|
947
909
|
//# sourceMappingURL=index.js.map
|