@plitzi/sdk-variables 0.30.19

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +1097 -0
  2. package/dist/VariablesContext.d.ts +2 -0
  3. package/dist/VariablesContext.mjs +5 -0
  4. package/dist/VariablesHelper.d.ts +4 -0
  5. package/dist/VariablesHelper.mjs +41 -0
  6. package/dist/_virtual/_rolldown/runtime.mjs +11 -0
  7. package/dist/components/SchemaVariables/SchemaVariable.d.ts +19 -0
  8. package/dist/components/SchemaVariables/SchemaVariable.mjs +68 -0
  9. package/dist/components/SchemaVariables/SchemaVariables.d.ts +16 -0
  10. package/dist/components/SchemaVariables/SchemaVariables.mjs +62 -0
  11. package/dist/components/SchemaVariables/VariableActions.d.ts +8 -0
  12. package/dist/components/SchemaVariables/VariableActions.mjs +33 -0
  13. package/dist/components/SchemaVariables/VariableDetails.d.ts +8 -0
  14. package/dist/components/SchemaVariables/VariableDetails.mjs +57 -0
  15. package/dist/components/SchemaVariables/VariableValue.d.ts +7 -0
  16. package/dist/components/SchemaVariables/VariableValue.mjs +16 -0
  17. package/dist/components/SchemaVariables/index.d.ts +3 -0
  18. package/dist/components/SchemaVariables/index.mjs +5 -0
  19. package/dist/components/StyleVariables/StyleVariable.d.ts +11 -0
  20. package/dist/components/StyleVariables/StyleVariable.mjs +63 -0
  21. package/dist/components/StyleVariables/StyleVariables.d.ts +15 -0
  22. package/dist/components/StyleVariables/StyleVariables.mjs +58 -0
  23. package/dist/components/StyleVariables/VariableActions.d.ts +8 -0
  24. package/dist/components/StyleVariables/VariableActions.mjs +33 -0
  25. package/dist/components/StyleVariables/VariableDetails.d.ts +7 -0
  26. package/dist/components/StyleVariables/VariableDetails.mjs +30 -0
  27. package/dist/components/StyleVariables/VariableGroup.d.ts +10 -0
  28. package/dist/components/StyleVariables/VariableGroup.mjs +39 -0
  29. package/dist/components/StyleVariables/VariableList.d.ts +9 -0
  30. package/dist/components/StyleVariables/VariableList.mjs +17 -0
  31. package/dist/components/StyleVariables/VariableValue.d.ts +8 -0
  32. package/dist/components/StyleVariables/VariableValue.mjs +27 -0
  33. package/dist/components/StyleVariables/index.d.ts +3 -0
  34. package/dist/components/StyleVariables/index.mjs +5 -0
  35. package/dist/components/index.d.ts +5 -0
  36. package/dist/components/index.mjs +10 -0
  37. package/dist/index.d.ts +9 -0
  38. package/dist/index.mjs +11 -0
  39. package/dist/models/SchemaVariableForm/SchemaVariableForm.d.ts +39 -0
  40. package/dist/models/SchemaVariableForm/SchemaVariableForm.mjs +171 -0
  41. package/dist/models/SchemaVariableForm/VariableSubValue.d.ts +17 -0
  42. package/dist/models/SchemaVariableForm/VariableSubValue.mjs +55 -0
  43. package/dist/models/SchemaVariableForm/VariableSubValueActions.d.ts +9 -0
  44. package/dist/models/SchemaVariableForm/VariableSubValueActions.mjs +32 -0
  45. package/dist/models/SchemaVariableForm/VariableValue.d.ts +14 -0
  46. package/dist/models/SchemaVariableForm/VariableValue.mjs +76 -0
  47. package/dist/models/SchemaVariableForm/index.d.ts +3 -0
  48. package/dist/models/SchemaVariableForm/index.mjs +5 -0
  49. package/dist/models/StyleVariableForm/StyleVariableForm.d.ts +34 -0
  50. package/dist/models/StyleVariableForm/StyleVariableForm.mjs +150 -0
  51. package/dist/models/StyleVariableForm/index.d.ts +3 -0
  52. package/dist/models/StyleVariableForm/index.mjs +5 -0
  53. package/dist/models/index.d.ts +5 -0
  54. package/dist/models/index.mjs +14 -0
  55. package/package.json +163 -0
@@ -0,0 +1,39 @@
1
+ import e from "./StyleVariable.mjs";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import r from "@plitzi/plitzi-ui/ContainerCollapsable";
4
+ import i from "@plitzi/plitzi-ui/Icon";
5
+ //#region src/components/StyleVariables/VariableGroup.tsx
6
+ var a = ({ category: a, variables: o = {}, onUpdate: s, onRemove: c }) => {
7
+ let l = Object.keys(o).length;
8
+ return /* @__PURE__ */ n(r, {
9
+ collapsed: !0,
10
+ children: [/* @__PURE__ */ t(r.Header, {
11
+ className: "h-6 text-sm",
12
+ title: /* @__PURE__ */ n("span", {
13
+ className: "flex w-full items-center justify-between gap-1 font-bold",
14
+ children: [a, /* @__PURE__ */ n("span", {
15
+ className: "text-xs font-normal text-gray-500",
16
+ children: [
17
+ "(",
18
+ l,
19
+ ")"
20
+ ]
21
+ })]
22
+ }),
23
+ placement: "right",
24
+ iconCollapsed: /* @__PURE__ */ t(i, { icon: "fa-solid fa-angle-down" }),
25
+ iconExpanded: /* @__PURE__ */ t(i, { icon: "fa-solid fa-angle-up" })
26
+ }), l > 0 && /* @__PURE__ */ t(r.Content, {
27
+ className: "flex flex-col gap-1 py-1",
28
+ children: Object.keys(o).map((n, r) => /* @__PURE__ */ t(e, {
29
+ category: a,
30
+ name: n,
31
+ value: o[n],
32
+ onUpdate: s,
33
+ onRemove: c
34
+ }, `${a}-${r}`))
35
+ })]
36
+ });
37
+ };
38
+ //#endregion
39
+ export { a as default };
@@ -0,0 +1,9 @@
1
+ import { StyleVariableCategory, StyleVariables } from '@plitzi/sdk-shared';
2
+ import { TStyleVariable } from './StyleVariables';
3
+ export type VariableListProps = {
4
+ variables?: Partial<StyleVariables>;
5
+ onUpdate?: (name: string, values: Omit<TStyleVariable, 'name'>) => void;
6
+ onRemove?: (category: StyleVariableCategory, name: string) => void;
7
+ };
8
+ declare const VariableList: ({ variables, onUpdate, onRemove }: VariableListProps) => import("react/jsx-runtime").JSX.Element | undefined;
9
+ export default VariableList;
@@ -0,0 +1,17 @@
1
+ import e from "./VariableGroup.mjs";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { StyleVariableCategory as n } from "@plitzi/sdk-shared";
4
+ //#region src/components/StyleVariables/VariableList.tsx
5
+ var r = ({ variables: r, onUpdate: i, onRemove: a }) => {
6
+ if (r) return /* @__PURE__ */ t("div", {
7
+ className: "flex grow flex-col overflow-y-auto",
8
+ children: Object.values(n).map((n) => /* @__PURE__ */ t(e, {
9
+ category: n,
10
+ variables: r[n],
11
+ onUpdate: i,
12
+ onRemove: a
13
+ }, n))
14
+ });
15
+ };
16
+ //#endregion
17
+ export { r as default };
@@ -0,0 +1,8 @@
1
+ import { StyleVariableValue } from '@plitzi/sdk-shared';
2
+ export type VariableValueProps = {
3
+ className?: string;
4
+ value?: StyleVariableValue;
5
+ type?: string;
6
+ };
7
+ declare const VariableValue: ({ type, value }: VariableValueProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default VariableValue;
@@ -0,0 +1,27 @@
1
+ import { useMemo as e } from "react";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/components/StyleVariables/VariableValue.tsx
4
+ var r = ({ type: r, value: i }) => {
5
+ let a = e(() => typeof i == "object" ? Object.keys(i).sort((e) => e === "default" ? -1 : 1) : [], [i]);
6
+ return /* @__PURE__ */ n("div", {
7
+ className: "flex items-center gap-2 truncate text-xs",
8
+ children: [i && r === "color" && typeof i == "object" && a.map((e) => /* @__PURE__ */ n("div", {
9
+ className: "flex items-center gap-1 capitalize",
10
+ title: `${e}: ${i[e]}`,
11
+ children: [
12
+ e[0],
13
+ ":",
14
+ /* @__PURE__ */ t("div", {
15
+ className: "min-h-4 min-w-4 rounded border border-gray-300",
16
+ style: { backgroundColor: i[e] }
17
+ })
18
+ ]
19
+ }, e)), r === "text" && (typeof i == "string" || typeof i == "number") && /* @__PURE__ */ t("div", {
20
+ className: "truncate",
21
+ title: i,
22
+ children: i
23
+ })]
24
+ });
25
+ };
26
+ //#endregion
27
+ export { r as default };
@@ -0,0 +1,3 @@
1
+ import { default as StyleVariables } from './StyleVariables';
2
+ export * from './StyleVariables';
3
+ export default StyleVariables;
@@ -0,0 +1,5 @@
1
+ import e from "./StyleVariables.mjs";
2
+ //#region src/components/StyleVariables/index.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,5 @@
1
+ import { default as SchemaVariables } from './SchemaVariables';
2
+ import { default as StyleVariables } from './StyleVariables';
3
+ export * from './SchemaVariables';
4
+ export * from './StyleVariables';
5
+ export { SchemaVariables, StyleVariables };
@@ -0,0 +1,10 @@
1
+ import { __exportAll as e } from "../_virtual/_rolldown/runtime.mjs";
2
+ import t from "./SchemaVariables/index.mjs";
3
+ import n from "./StyleVariables/index.mjs";
4
+ //#region src/components/index.ts
5
+ var r = /* @__PURE__ */ e({
6
+ SchemaVariables: () => t,
7
+ StyleVariables: () => n
8
+ });
9
+ //#endregion
10
+ export { t as SchemaVariables, n as StyleVariables, r as components_exports };
@@ -0,0 +1,9 @@
1
+ import { default as VariablesContext } from './VariablesContext';
2
+ import { schemaVariablesToCss, styleVariablesToCss } from './VariablesHelper';
3
+ import * as components from './components';
4
+ import * as forms from './models';
5
+ export * from './models';
6
+ export * from './components';
7
+ export * from './VariablesContext';
8
+ export * from './VariablesHelper';
9
+ export { VariablesContext, schemaVariablesToCss, styleVariablesToCss, components, forms };
package/dist/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import { schemaVariableFormSchema as e } from "./models/SchemaVariableForm/SchemaVariableForm.mjs";
2
+ import t from "./models/SchemaVariableForm/index.mjs";
3
+ import n from "./components/SchemaVariables/index.mjs";
4
+ import { styleVariableFormSchema as r } from "./models/StyleVariableForm/StyleVariableForm.mjs";
5
+ import i from "./models/StyleVariableForm/index.mjs";
6
+ import { models_exports as a } from "./models/index.mjs";
7
+ import o from "./components/StyleVariables/index.mjs";
8
+ import { components_exports as s } from "./components/index.mjs";
9
+ import c from "./VariablesContext.mjs";
10
+ import { schemaVariablesToCss as l, styleSelectorVariablesToCss as u, styleVariablesToCss as d } from "./VariablesHelper.mjs";
11
+ export { t as SchemaVariableForm, n as SchemaVariables, i as StyleVariableForm, o as StyleVariables, c as VariablesContext, s as components, a as forms, e as schemaVariableFormSchema, l as schemaVariablesToCss, u as styleSelectorVariablesToCss, r as styleVariableFormSchema, d as styleVariablesToCss };
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ import { Environment, QueryParams, RouteParams, SchemaVariable } from '@plitzi/sdk-shared';
3
+ import { MouseEvent } from 'react';
4
+ export declare const schemaVariableFormSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ category: z.ZodString;
7
+ type: z.ZodEnum<{
8
+ number: "number";
9
+ color: "color";
10
+ text: "text";
11
+ email: "email";
12
+ password: "password";
13
+ select: "select";
14
+ select2: "select2";
15
+ checkbox: "checkbox";
16
+ textarea: "textarea";
17
+ switch: "switch";
18
+ }>;
19
+ value: z.ZodString;
20
+ subValues: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
21
+ }, z.core.$strip>;
22
+ export type SchemaVariableFormProps = {
23
+ name?: SchemaVariable['name'];
24
+ category?: SchemaVariable['category'];
25
+ value?: SchemaVariable['value'];
26
+ type?: SchemaVariable['type'];
27
+ subValues?: SchemaVariable['subValues'];
28
+ whenData?: {
29
+ routeParams: RouteParams;
30
+ queryParams: QueryParams;
31
+ hostname?: string;
32
+ environment: Environment;
33
+ };
34
+ isNewRecord?: boolean;
35
+ onClose?: (e?: MouseEvent) => void;
36
+ onSubmit?: (values: SchemaVariable) => void;
37
+ };
38
+ declare const SchemaVariableForm: ({ name, category, value, type, subValues, whenData, isNewRecord, onSubmit, onClose }: SchemaVariableFormProps) => import("react/jsx-runtime").JSX.Element;
39
+ export default SchemaVariableForm;
@@ -0,0 +1,171 @@
1
+ import e from "./VariableValue.mjs";
2
+ import t from "./VariableSubValue.mjs";
3
+ import n from "@plitzi/plitzi-ui/Button";
4
+ import { useCallback as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import o from "@plitzi/plitzi-ui/Alert";
7
+ import s, { useFieldArray as c, useForm as l, useFormWatch as u } from "@plitzi/plitzi-ui/Form";
8
+ import { z as d } from "zod";
9
+ //#region src/models/SchemaVariableForm/SchemaVariableForm.tsx
10
+ var f = d.object({
11
+ name: d.string().min(4).regex(/^(?:\w+\s+|)([a-zA-Z_][a-zA-Z0-9_]+)$/i, { message: "Name only can be letters, numbers and _ -" }),
12
+ category: d.string(),
13
+ type: d.enum([
14
+ "text",
15
+ "number",
16
+ "email",
17
+ "password",
18
+ "select",
19
+ "select2",
20
+ "checkbox",
21
+ "textarea",
22
+ "color",
23
+ "switch"
24
+ ]),
25
+ value: d.string().min(3),
26
+ subValues: d.array(d.record(d.string(), d.any())).optional()
27
+ }), p = ({ name: d = "variable", category: p = "", value: m = "", type: h = "text", subValues: g, whenData: _, isNewRecord: v = !1, onSubmit: y, onClose: b }) => {
28
+ let x = l({
29
+ defaultValues: {
30
+ name: d,
31
+ value: m,
32
+ category: p,
33
+ type: h,
34
+ subValues: g
35
+ },
36
+ config: { schema: f }
37
+ }), { fields: S, append: C, remove: w, move: T } = c({
38
+ control: x.formMethods.control,
39
+ name: "subValues",
40
+ rules: { minLength: 0 }
41
+ }), E = u(x.formMethods, "type"), D = u(x.formMethods, "subValues"), O = r((e) => y?.(e), [y]), k = D && D.length > 0, A = r(() => C({
42
+ value: "",
43
+ when: void 0
44
+ }), [C]), j = r((e) => () => {
45
+ e > 0 && T(e, e - 1);
46
+ }, [T]), M = r((e) => () => {
47
+ e < S.length - 1 && T(e, e + 1);
48
+ }, [S, T]), N = r((e) => () => w(e), [w]), P = r(() => {
49
+ x.formMethods.setValue("value", "");
50
+ }, [x]);
51
+ return /* @__PURE__ */ a(s, {
52
+ form: x,
53
+ onSubmit: O,
54
+ className: "gap-4 rounded border border-gray-300 bg-slate-100 p-2",
55
+ children: [/* @__PURE__ */ a(s.Body, {
56
+ gap: 2,
57
+ children: [
58
+ /* @__PURE__ */ a("div", {
59
+ className: "flex gap-4",
60
+ children: [/* @__PURE__ */ i(s.Input, {
61
+ name: "name",
62
+ label: "Name",
63
+ size: "xs",
64
+ disabled: !v,
65
+ className: "w-full grow basis-0"
66
+ }), /* @__PURE__ */ a(s.Select, {
67
+ name: "type",
68
+ label: "Type",
69
+ size: "xs",
70
+ onChange: P,
71
+ className: "w-full grow basis-0",
72
+ children: [
73
+ /* @__PURE__ */ i("option", {
74
+ value: "text",
75
+ children: "Text"
76
+ }),
77
+ /* @__PURE__ */ i("option", {
78
+ value: "number",
79
+ children: "Number"
80
+ }),
81
+ /* @__PURE__ */ i("option", {
82
+ value: "email",
83
+ children: "Email"
84
+ }),
85
+ /* @__PURE__ */ i("option", {
86
+ value: "password",
87
+ children: "Password"
88
+ }),
89
+ /* @__PURE__ */ i("option", {
90
+ value: "select",
91
+ children: "Select"
92
+ }),
93
+ /* @__PURE__ */ i("option", {
94
+ value: "select2",
95
+ children: "Select2"
96
+ }),
97
+ /* @__PURE__ */ i("option", {
98
+ value: "checkbox",
99
+ children: "Checkbox"
100
+ }),
101
+ /* @__PURE__ */ i("option", {
102
+ value: "switch",
103
+ children: "Switch"
104
+ }),
105
+ /* @__PURE__ */ i("option", {
106
+ value: "textarea",
107
+ children: "Text Area"
108
+ }),
109
+ /* @__PURE__ */ i("option", {
110
+ value: "color",
111
+ children: "Color"
112
+ })
113
+ ]
114
+ })]
115
+ }),
116
+ /* @__PURE__ */ i(s.Input, {
117
+ name: "category",
118
+ label: "Category",
119
+ size: "xs",
120
+ className: "w-full grow basis-0"
121
+ }),
122
+ /* @__PURE__ */ i(e, {
123
+ valueType: E,
124
+ hasSubValues: k,
125
+ name: "value"
126
+ }),
127
+ k && /* @__PURE__ */ i(o, {
128
+ intent: "info",
129
+ className: "text-xs text-white",
130
+ children: "Based on the logic the variable will take one of these values from top to down"
131
+ }),
132
+ /* @__PURE__ */ a("div", {
133
+ className: "flex flex-col gap-2",
134
+ children: [/* @__PURE__ */ i("div", {
135
+ className: "flex flex-col gap-2",
136
+ children: S.map((e, n) => /* @__PURE__ */ i("div", {
137
+ className: "flex gap-2",
138
+ children: /* @__PURE__ */ i(t, {
139
+ whenData: _,
140
+ valueType: E,
141
+ index: n,
142
+ indexLimit: S.length - 1,
143
+ onClickRemove: N(n),
144
+ onClickUp: j(n),
145
+ onClickDown: M(n)
146
+ })
147
+ }, e.id))
148
+ }), /* @__PURE__ */ i(n, {
149
+ size: "xs",
150
+ title: "Down",
151
+ onClick: A,
152
+ children: "+ Conditional Value"
153
+ })]
154
+ })
155
+ ]
156
+ }), /* @__PURE__ */ a(s.Footer, {
157
+ justify: "end",
158
+ children: [/* @__PURE__ */ i(n, {
159
+ onClick: b,
160
+ size: "xs",
161
+ children: "Cancel"
162
+ }), /* @__PURE__ */ i(n, {
163
+ type: "submit",
164
+ size: "xs",
165
+ children: v ? "Add" : "Update"
166
+ })]
167
+ })]
168
+ });
169
+ };
170
+ //#endregion
171
+ export { p as default, f as schemaVariableFormSchema };
@@ -0,0 +1,17 @@
1
+ import { Environment, QueryParams, RouteParams, SchemaVariable } from '@plitzi/sdk-shared';
2
+ export type VariableSubValueProps = {
3
+ valueType?: SchemaVariable['type'];
4
+ whenData?: {
5
+ routeParams: RouteParams;
6
+ queryParams: QueryParams;
7
+ hostname?: string;
8
+ environment: Environment;
9
+ };
10
+ index?: number;
11
+ indexLimit?: number;
12
+ onClickRemove?: () => void;
13
+ onClickUp?: () => void;
14
+ onClickDown?: () => void;
15
+ };
16
+ declare const VariableSubValue: ({ index, valueType, whenData, indexLimit, onClickRemove, onClickUp, onClickDown }: VariableSubValueProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default VariableSubValue;
@@ -0,0 +1,55 @@
1
+ import e from "./VariableValue.mjs";
2
+ import { useMemo as t } from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import i from "@plitzi/plitzi-ui/QueryBuilder";
5
+ import a from "@plitzi/plitzi-ui/Form";
6
+ import o from "@plitzi/plitzi-ui/Heading";
7
+ import { getPathsFromObeject as s } from "@plitzi/sdk-shared/helpers/utils";
8
+ //#region src/models/SchemaVariableForm/VariableSubValue.tsx
9
+ var c = ({ index: c = 0, valueType: l = "text", whenData: u, indexLimit: d, onClickRemove: f, onClickUp: p, onClickDown: m }) => {
10
+ let h = t(() => s(u).reduce((e, t) => ({
11
+ ...e,
12
+ [t]: {
13
+ name: t,
14
+ label: t,
15
+ placeholder: `Enter ${t}`
16
+ }
17
+ }), {}), [u]);
18
+ return /* @__PURE__ */ r("div", {
19
+ className: "flex min-w-0 grow basis-0 flex-col gap-3 rounded-sm border border-gray-300 p-2",
20
+ children: [/* @__PURE__ */ n(e, {
21
+ valueType: l,
22
+ name: `subValues.${c}.value`,
23
+ isSubValue: !0,
24
+ index: c,
25
+ indexLimit: d,
26
+ onClickRemove: f,
27
+ onClickUp: p,
28
+ onClickDown: m
29
+ }), /* @__PURE__ */ n(a.Custom, {
30
+ name: `subValues.${c}.when`,
31
+ render: ({ field: { ref: e, value: t, onChange: a }, fieldState: { error: s } }) => /* @__PURE__ */ r("div", {
32
+ className: "flex flex-col gap-1",
33
+ ref: e,
34
+ children: [/* @__PURE__ */ n(o, {
35
+ as: "h5",
36
+ children: "When Happens"
37
+ }), /* @__PURE__ */ n("div", {
38
+ className: "flex flex-col",
39
+ children: /* @__PURE__ */ n(i, {
40
+ direction: "vertical",
41
+ intent: "gray",
42
+ className: "w-full",
43
+ query: t,
44
+ fields: h,
45
+ onChange: a,
46
+ showBranches: !0,
47
+ error: !!s?.message
48
+ })
49
+ })]
50
+ })
51
+ })]
52
+ });
53
+ };
54
+ //#endregion
55
+ export { c as default };
@@ -0,0 +1,9 @@
1
+ export type VariableSubValueActionsProps = {
2
+ indexLimit?: number;
3
+ index?: number;
4
+ onClickRemove?: () => void;
5
+ onClickUp?: () => void;
6
+ onClickDown?: () => void;
7
+ };
8
+ declare const VariableSubValueActions: ({ indexLimit, index, onClickRemove, onClickUp, onClickDown }: VariableSubValueActionsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default VariableSubValueActions;
@@ -0,0 +1,32 @@
1
+ import e from "@plitzi/plitzi-ui/Button";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/models/SchemaVariableForm/VariableSubValueActions.tsx
4
+ var r = ({ indexLimit: r = 0, index: i = 0, onClickRemove: a, onClickUp: o, onClickDown: s }) => /* @__PURE__ */ n("div", {
5
+ className: "flex gap-2",
6
+ children: [
7
+ /* @__PURE__ */ t(e, {
8
+ intent: "danger",
9
+ size: "xs",
10
+ onClick: a,
11
+ title: "Remove",
12
+ className: "aspect-square",
13
+ children: /* @__PURE__ */ t("i", { className: "fas fa-trash-alt" })
14
+ }),
15
+ i > 0 && /* @__PURE__ */ t(e, {
16
+ size: "xs",
17
+ className: "aspect-square",
18
+ title: "Up",
19
+ onClick: o,
20
+ children: /* @__PURE__ */ t("i", { className: "fa-solid fa-arrow-up" })
21
+ }),
22
+ i < r && /* @__PURE__ */ t(e, {
23
+ size: "xs",
24
+ className: "aspect-square",
25
+ title: "Down",
26
+ onClick: s,
27
+ children: /* @__PURE__ */ t("i", { className: "fa-solid fa-arrow-down" })
28
+ })
29
+ ]
30
+ });
31
+ //#endregion
32
+ export { r as default };
@@ -0,0 +1,14 @@
1
+ import { SchemaVariable } from '@plitzi/sdk-shared';
2
+ export type VariableValueProps = {
3
+ valueType?: SchemaVariable['type'];
4
+ hasSubValues?: boolean;
5
+ name?: string;
6
+ index?: number;
7
+ indexLimit?: number;
8
+ isSubValue?: boolean;
9
+ onClickRemove?: () => void;
10
+ onClickUp?: () => void;
11
+ onClickDown?: () => void;
12
+ };
13
+ declare const VariableValue: ({ valueType, hasSubValues, name, index, indexLimit, isSubValue, onClickRemove, onClickUp, onClickDown }: VariableValueProps) => import("react/jsx-runtime").JSX.Element;
14
+ export default VariableValue;
@@ -0,0 +1,76 @@
1
+ import e from "./VariableSubValueActions.mjs";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import r from "@plitzi/plitzi-ui/Form";
4
+ //#region src/models/SchemaVariableForm/VariableValue.tsx
5
+ var i = ({ valueType: i = "text", hasSubValues: a = !1, name: o = "value", index: s, indexLimit: c, isSubValue: l = !1, onClickRemove: u, onClickUp: d, onClickDown: f }) => {
6
+ let p = a ? "Fallback Value" : "Value", m = a ? "Fallback Value" : "Value";
7
+ return /* @__PURE__ */ n("div", {
8
+ className: "flex items-end gap-2",
9
+ children: [
10
+ [
11
+ "text",
12
+ "email",
13
+ "password",
14
+ "number"
15
+ ].includes(i) && /* @__PURE__ */ t(r.Input, {
16
+ type: i,
17
+ name: o,
18
+ label: p,
19
+ placeholder: m,
20
+ size: "xs",
21
+ className: "w-full min-w-0"
22
+ }),
23
+ i === "select" && /* @__PURE__ */ t(r.Select, {
24
+ name: o,
25
+ label: p,
26
+ placeholder: m,
27
+ size: "xs",
28
+ className: "w-full min-w-0"
29
+ }),
30
+ i === "select2" && /* @__PURE__ */ t(r.Select2, {
31
+ name: o,
32
+ label: p,
33
+ placeholder: m,
34
+ size: "xs",
35
+ className: "w-full min-w-0"
36
+ }),
37
+ i === "textarea" && /* @__PURE__ */ t(r.TextArea, {
38
+ name: o,
39
+ label: p,
40
+ placeholder: m,
41
+ size: "xs",
42
+ className: "w-full min-w-0"
43
+ }),
44
+ i === "switch" && /* @__PURE__ */ t(r.Switch, {
45
+ name: o,
46
+ label: p,
47
+ placeholder: m,
48
+ size: "xs",
49
+ className: "w-full min-w-0"
50
+ }),
51
+ i === "checkbox" && /* @__PURE__ */ t(r.Checkbox, {
52
+ name: o,
53
+ label: p,
54
+ placeholder: m,
55
+ size: "xs",
56
+ className: "w-full min-w-0"
57
+ }),
58
+ i === "color" && /* @__PURE__ */ t(r.Color, {
59
+ name: o,
60
+ label: p,
61
+ placeholder: m,
62
+ size: "xs",
63
+ className: "w-full min-w-0"
64
+ }),
65
+ l && /* @__PURE__ */ t(e, {
66
+ index: s,
67
+ indexLimit: c,
68
+ onClickRemove: u,
69
+ onClickUp: d,
70
+ onClickDown: f
71
+ })
72
+ ]
73
+ });
74
+ };
75
+ //#endregion
76
+ export { i as default };
@@ -0,0 +1,3 @@
1
+ import { default as SchemaVariableForm } from './SchemaVariableForm';
2
+ export * from './SchemaVariableForm';
3
+ export default SchemaVariableForm;
@@ -0,0 +1,5 @@
1
+ import e, { schemaVariableFormSchema as t } from "./SchemaVariableForm.mjs";
2
+ //#region src/models/SchemaVariableForm/index.ts
3
+ var n = e;
4
+ //#endregion
5
+ export { n as default, t as schemaVariableFormSchema };
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { StyleVariableCategory, StyleVariableValue } from '@plitzi/sdk-shared';
3
+ import { MouseEvent } from 'react';
4
+ export declare const styleVariableFormSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ name: z.ZodString;
6
+ category: z.ZodLiteral<StyleVariableCategory.COLOR>;
7
+ value: z.ZodObject<{
8
+ light: z.ZodString;
9
+ dark: z.ZodString;
10
+ default: z.ZodString;
11
+ }, z.core.$strip>;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ name: z.ZodString;
14
+ category: z.ZodLiteral<StyleVariableCategory.SHADOW>;
15
+ value: z.ZodString;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ name: z.ZodString;
18
+ category: z.ZodLiteral<StyleVariableCategory.SPACING>;
19
+ value: z.ZodString;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ name: z.ZodString;
22
+ category: z.ZodLiteral<StyleVariableCategory.CUSTOM>;
23
+ value: z.ZodString;
24
+ }, z.core.$strip>], "category">;
25
+ export type StyleVariableFormProps = {
26
+ name?: string;
27
+ category?: StyleVariableCategory;
28
+ value?: StyleVariableValue;
29
+ isNewRecord?: boolean;
30
+ onClose?: (e: MouseEvent) => void;
31
+ onSubmit?: (values: z.infer<typeof styleVariableFormSchema>) => void;
32
+ };
33
+ declare const StyleVariableForm: ({ name, category, value, isNewRecord, onClose, onSubmit }: StyleVariableFormProps) => import("react/jsx-runtime").JSX.Element;
34
+ export default StyleVariableForm;