@krrli/cm-designsystem 1.34.13 → 1.35.1
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/form/Form.d.ts +13 -17
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/form/Form.js +11 -32
- package/dist/components/input/Input.d.ts +3 -1
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +13 -3
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +20 -7
- package/dist/index.js +1 -3
- package/dist/styles.css +34 -18
- package/package.json +1 -1
|
@@ -33,23 +33,19 @@ declare const formStyles: import('tailwind-variants').TVReturnType<{
|
|
|
33
33
|
}, undefined, unknown, unknown, undefined>>;
|
|
34
34
|
type FormVariants = VariantProps<typeof formStyles>;
|
|
35
35
|
interface FormProps extends FormVariants {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export declare function FormAction({ children }: {
|
|
49
|
-
children: React.ReactElement;
|
|
50
|
-
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
51
|
-
export declare namespace FormAction {
|
|
52
|
-
var displayName: string;
|
|
36
|
+
/**
|
|
37
|
+
* Form fields
|
|
38
|
+
*/
|
|
39
|
+
fields: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Submit button
|
|
42
|
+
*/
|
|
43
|
+
action: React.ReactElement;
|
|
44
|
+
/**
|
|
45
|
+
* Submit handler
|
|
46
|
+
*/
|
|
47
|
+
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
53
48
|
}
|
|
49
|
+
export declare const Form: React.FC<FormProps>;
|
|
54
50
|
export {};
|
|
55
51
|
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAKd,CAAC;AAEH,KAAK,YAAY,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,UAAU,SAAU,SAAQ,YAAY;IACtC,
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAKd,CAAC;AAEH,KAAK,YAAY,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,UAAU,SAAU,SAAQ,YAAY;IACtC;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;CAC9D;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAcpC,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as RadixForm from "@radix-ui/react-form";
|
|
3
|
-
import React from "react";
|
|
4
3
|
import { tv } from "tailwind-variants";
|
|
5
4
|
const formStyles = tv({
|
|
6
5
|
slots: {
|
|
@@ -8,38 +7,18 @@ const formStyles = tv({
|
|
|
8
7
|
fields: ["gap-4", "flex", "flex-col"]
|
|
9
8
|
}
|
|
10
9
|
});
|
|
11
|
-
const Form = (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case FormAction:
|
|
22
|
-
actionElement = child;
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return /* @__PURE__ */ jsxs(RadixForm.Root, { className: base(), children: [
|
|
27
|
-
/* @__PURE__ */ jsx("div", { className: fields(), children: fieldElements }),
|
|
28
|
-
/* @__PURE__ */ jsx(RadixForm.Submit, { asChild: true, children: actionElement })
|
|
10
|
+
const Form = ({
|
|
11
|
+
fields,
|
|
12
|
+
action,
|
|
13
|
+
onSubmit,
|
|
14
|
+
...variantProps
|
|
15
|
+
}) => {
|
|
16
|
+
const { base, fields: fieldsClass } = formStyles(variantProps);
|
|
17
|
+
return /* @__PURE__ */ jsxs(RadixForm.Root, { className: base(), onSubmit, children: [
|
|
18
|
+
/* @__PURE__ */ jsx("div", { className: fieldsClass(), children: fields }),
|
|
19
|
+
/* @__PURE__ */ jsx(RadixForm.Submit, { asChild: true, children: action })
|
|
29
20
|
] });
|
|
30
21
|
};
|
|
31
|
-
FormFields.displayName = "FormField";
|
|
32
|
-
function FormFields({ children }) {
|
|
33
|
-
return children;
|
|
34
|
-
}
|
|
35
|
-
FormAction.displayName = "ModalActions";
|
|
36
|
-
function FormAction({ children }) {
|
|
37
|
-
return children;
|
|
38
|
-
}
|
|
39
|
-
Form.Fields = FormFields;
|
|
40
|
-
Form.Action = FormAction;
|
|
41
22
|
export {
|
|
42
|
-
Form
|
|
43
|
-
FormAction,
|
|
44
|
-
FormFields
|
|
23
|
+
Form
|
|
45
24
|
};
|
|
@@ -56,7 +56,9 @@ interface InputProps extends InputVariants {
|
|
|
56
56
|
isRequired?: boolean;
|
|
57
57
|
children?: React.ReactElement<IconBaseProps>;
|
|
58
58
|
onChange: (value: string) => void;
|
|
59
|
+
value?: string;
|
|
60
|
+
defaultValue?: string;
|
|
59
61
|
}
|
|
60
|
-
export declare const Input: ({ type, isRequired, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare const Input: ({ type, isRequired, value: controlledValue, defaultValue, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
61
63
|
export {};
|
|
62
64
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA8Bf,CAAC;AAEH,KAAK,aAAa,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,UAAU,UAAW,SAAQ,aAAa;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA8Bf,CAAC;AAEH,KAAK,aAAa,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,UAAU,UAAW,SAAQ,aAAa;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,KAAK,GAAI,sEAMnB,UAAU,4CAqDZ,CAAC"}
|
|
@@ -40,13 +40,17 @@ const inputStyles = tv({
|
|
|
40
40
|
const Input = ({
|
|
41
41
|
type = "text",
|
|
42
42
|
isRequired = false,
|
|
43
|
+
value: controlledValue,
|
|
44
|
+
defaultValue = "",
|
|
43
45
|
...props
|
|
44
46
|
}) => {
|
|
45
47
|
const { base, controlContainer, control, message, icon } = inputStyles({
|
|
46
48
|
hasIcon: !!props.children,
|
|
47
49
|
...props
|
|
48
50
|
});
|
|
49
|
-
const [
|
|
51
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
52
|
+
const isControlled = controlledValue !== void 0;
|
|
53
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
50
54
|
return /* @__PURE__ */ jsxs(RadixForm.Field, { name: props.name, className: base(props), children: [
|
|
51
55
|
/* @__PURE__ */ jsx(RadixForm.Label, { children: /* @__PURE__ */ jsx(Label, { size: "md", children: props.label }) }),
|
|
52
56
|
/* @__PURE__ */ jsxs("div", { className: controlContainer(props), children: [
|
|
@@ -57,8 +61,14 @@ const Input = ({
|
|
|
57
61
|
type,
|
|
58
62
|
required: isRequired,
|
|
59
63
|
placeholder: props.placeholder,
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
value,
|
|
65
|
+
onChange: (e) => {
|
|
66
|
+
const newValue = e.target.value;
|
|
67
|
+
if (!isControlled) {
|
|
68
|
+
setInternalValue(newValue);
|
|
69
|
+
}
|
|
70
|
+
props.onChange(newValue);
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
) }),
|
|
64
74
|
props.children && React.cloneElement(props.children, { className: icon(props) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI1D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAwCf,CAAC;AAEH,KAAK,aAAa,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,UAAU,UAAW,SAAQ,aAAa;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG;IACzC,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,OAAO,EAAE,OAAO,YAAY,CAAC;CA6C9B,CAAC;AAGF,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,mBAEpE;yBAFe,SAAS;;;AAKzB,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,mBAEvE;yBAFe,YAAY"}
|
|
@@ -11,7 +11,8 @@ const modalStyles = tv({
|
|
|
11
11
|
"fixed",
|
|
12
12
|
"top-1/2",
|
|
13
13
|
"left-1/2",
|
|
14
|
-
"w-
|
|
14
|
+
"w-[calc(100%-2rem)]",
|
|
15
|
+
"max-w-123",
|
|
15
16
|
"-translate-x-1/2",
|
|
16
17
|
"-translate-y-1/2",
|
|
17
18
|
"rounded-2xl",
|
|
@@ -22,13 +23,25 @@ const modalStyles = tv({
|
|
|
22
23
|
"justify-between",
|
|
23
24
|
"rounded-t-2xl",
|
|
24
25
|
"bg-violet-600",
|
|
25
|
-
"pt-
|
|
26
|
-
"pr-
|
|
27
|
-
"pb-
|
|
28
|
-
"pl-
|
|
26
|
+
"pt-4",
|
|
27
|
+
"pr-4",
|
|
28
|
+
"pb-4",
|
|
29
|
+
"pl-4",
|
|
30
|
+
"sm:pt-6",
|
|
31
|
+
"sm:pr-8",
|
|
32
|
+
"sm:pb-6",
|
|
33
|
+
"sm:pl-8",
|
|
29
34
|
"text-white"
|
|
30
35
|
],
|
|
31
|
-
container: [
|
|
36
|
+
container: [
|
|
37
|
+
"flex",
|
|
38
|
+
"flex-col",
|
|
39
|
+
"items-center",
|
|
40
|
+
"gap-8",
|
|
41
|
+
"p-4",
|
|
42
|
+
"sm:gap-12",
|
|
43
|
+
"sm:p-8"
|
|
44
|
+
],
|
|
32
45
|
actions: ["flex", "items-center", "gap-4", "w-full"]
|
|
33
46
|
}
|
|
34
47
|
});
|
|
@@ -52,7 +65,7 @@ const Modal = (props) => {
|
|
|
52
65
|
/* @__PURE__ */ jsxs(RadixDialog.Content, { className: content(), children: [
|
|
53
66
|
/* @__PURE__ */ jsxs(RadixDialog.Title, { className: title(), children: [
|
|
54
67
|
/* @__PURE__ */ jsx(Heading, { as: "span", size: "3", children: props.title }),
|
|
55
|
-
/* @__PURE__ */ jsx(RadixDialog.Close, { children: /* @__PURE__ */ jsx(Cancel, {}) })
|
|
68
|
+
/* @__PURE__ */ jsx(RadixDialog.Close, { "aria-label": "Close modal", children: /* @__PURE__ */ jsx(Cancel, {}) })
|
|
56
69
|
] }),
|
|
57
70
|
/* @__PURE__ */ jsxs("div", { className: container(), children: [
|
|
58
71
|
modalBody,
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { BrandingGallery } from "./components/branding/BrandingGallery.js";
|
|
|
3
3
|
import { Button } from "./components/button/Button.js";
|
|
4
4
|
import { ColorDoc } from "./components/color/ColorDoc.js";
|
|
5
5
|
import { FileUpload } from "./components/file-upload/FileUpload.js";
|
|
6
|
-
import { Form
|
|
6
|
+
import { Form } from "./components/form/Form.js";
|
|
7
7
|
import { IconButton } from "./components/icon-button/IconButton.js";
|
|
8
8
|
import { IconBase } from "./components/icons/IconBase.js";
|
|
9
9
|
import { ArrowDown } from "./components/icons/generated/ArrowDown.js";
|
|
@@ -75,8 +75,6 @@ export {
|
|
|
75
75
|
Eye,
|
|
76
76
|
FileUpload,
|
|
77
77
|
Form,
|
|
78
|
-
FormAction,
|
|
79
|
-
FormFields,
|
|
80
78
|
Fullscreen,
|
|
81
79
|
Heading,
|
|
82
80
|
HeartFilled,
|
package/dist/styles.css
CHANGED
|
@@ -576,10 +576,6 @@
|
|
|
576
576
|
width: calc(var(--spacing) * 40);
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
.w-123 {
|
|
580
|
-
width: calc(var(--spacing) * 123);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
579
|
.w-170 {
|
|
584
580
|
width: calc(var(--spacing) * 170);
|
|
585
581
|
}
|
|
@@ -588,6 +584,10 @@
|
|
|
588
584
|
width: ` < spacing> ` ;
|
|
589
585
|
}
|
|
590
586
|
|
|
587
|
+
.w-\[calc\(100\%-2rem\)\] {
|
|
588
|
+
width: calc(100% - 2rem);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
591
|
.w-auto {
|
|
592
592
|
width: auto;
|
|
593
593
|
}
|
|
@@ -600,6 +600,10 @@
|
|
|
600
600
|
width: 100%;
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
+
.max-w-123 {
|
|
604
|
+
max-width: calc(var(--spacing) * 123);
|
|
605
|
+
}
|
|
606
|
+
|
|
603
607
|
.max-w-\[680px\] {
|
|
604
608
|
max-width: 680px;
|
|
605
609
|
}
|
|
@@ -716,8 +720,8 @@
|
|
|
716
720
|
gap: calc(var(--spacing) * 6);
|
|
717
721
|
}
|
|
718
722
|
|
|
719
|
-
.gap-
|
|
720
|
-
gap: calc(var(--spacing) *
|
|
723
|
+
.gap-8 {
|
|
724
|
+
gap: calc(var(--spacing) * 8);
|
|
721
725
|
}
|
|
722
726
|
|
|
723
727
|
.gap-16 {
|
|
@@ -1025,10 +1029,6 @@
|
|
|
1025
1029
|
padding: calc(var(--spacing) * 4);
|
|
1026
1030
|
}
|
|
1027
1031
|
|
|
1028
|
-
.p-8 {
|
|
1029
|
-
padding: calc(var(--spacing) * 8);
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
1032
|
.p-10 {
|
|
1033
1033
|
padding: calc(var(--spacing) * 10);
|
|
1034
1034
|
}
|
|
@@ -1081,10 +1081,6 @@
|
|
|
1081
1081
|
padding-right: calc(var(--spacing) * 6);
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
|
-
.pr-8 {
|
|
1085
|
-
padding-right: calc(var(--spacing) * 8);
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
1084
|
.pr-10 {
|
|
1089
1085
|
padding-right: calc(var(--spacing) * 10);
|
|
1090
1086
|
}
|
|
@@ -1125,10 +1121,6 @@
|
|
|
1125
1121
|
padding-left: calc(var(--spacing) * 6);
|
|
1126
1122
|
}
|
|
1127
1123
|
|
|
1128
|
-
.pl-8 {
|
|
1129
|
-
padding-left: calc(var(--spacing) * 8);
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
1124
|
.align-middle {
|
|
1133
1125
|
vertical-align: middle;
|
|
1134
1126
|
}
|
|
@@ -1748,6 +1740,30 @@
|
|
|
1748
1740
|
.sm\:flex-row {
|
|
1749
1741
|
flex-direction: row;
|
|
1750
1742
|
}
|
|
1743
|
+
|
|
1744
|
+
.sm\:gap-12 {
|
|
1745
|
+
gap: calc(var(--spacing) * 12);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
.sm\:p-8 {
|
|
1749
|
+
padding: calc(var(--spacing) * 8);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
.sm\:pt-6 {
|
|
1753
|
+
padding-top: calc(var(--spacing) * 6);
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
.sm\:pr-8 {
|
|
1757
|
+
padding-right: calc(var(--spacing) * 8);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
.sm\:pb-6 {
|
|
1761
|
+
padding-bottom: calc(var(--spacing) * 6);
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
.sm\:pl-8 {
|
|
1765
|
+
padding-left: calc(var(--spacing) * 8);
|
|
1766
|
+
}
|
|
1751
1767
|
}
|
|
1752
1768
|
|
|
1753
1769
|
@media (min-width: 48rem) {
|