@ensi-platform/admin-ui 0.11.0 → 0.12.0
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/ai/skills/admin-ui/SKILL.md +1 -0
- package/dist/{Component-MSGhHMYk.js → Component-B1piMJHv.js} +2 -2
- package/dist/{Component-MSGhHMYk.js.map → Component-B1piMJHv.js.map} +1 -1
- package/dist/{Component-DpACJ8IJ.js → Component-BPAXqDXt.js} +2 -2
- package/dist/{Component-DpACJ8IJ.js.map → Component-BPAXqDXt.js.map} +1 -1
- package/dist/{Component-DSAL6avh.js → Component-BPN5FgKq.js} +2 -2
- package/dist/{Component-DSAL6avh.js.map → Component-BPN5FgKq.js.map} +1 -1
- package/dist/{Component-BZqLGwzc.js → Component-BuFsNZAH.js} +2 -2
- package/dist/{Component-BZqLGwzc.js.map → Component-BuFsNZAH.js.map} +1 -1
- package/dist/{Component-IFlvrceZ.js → Component-CBnhxD86.js} +5 -5
- package/dist/{Component-IFlvrceZ.js.map → Component-CBnhxD86.js.map} +1 -1
- package/dist/{Component-BH5skHn_.js → Component-CDURmZCP.js} +2 -2
- package/dist/{Component-BH5skHn_.js.map → Component-CDURmZCP.js.map} +1 -1
- package/dist/{Component-Dq7pvkWP.js → Component-CQyBQxAb.js} +2 -2
- package/dist/{Component-Dq7pvkWP.js.map → Component-CQyBQxAb.js.map} +1 -1
- package/dist/{Component-DGze6SVb.js → Component-D92F9hx-.js} +2 -2
- package/dist/{Component-DGze6SVb.js.map → Component-D92F9hx-.js.map} +1 -1
- package/dist/{Component-DH7wdC3G.js → Component-DWp04UBh.js} +2 -2
- package/dist/{Component-DH7wdC3G.js.map → Component-DWp04UBh.js.map} +1 -1
- package/dist/{Component-CkazNd13.js → Component-D_c3xBcb.js} +2 -2
- package/dist/{Component-CkazNd13.js.map → Component-D_c3xBcb.js.map} +1 -1
- package/dist/Component-DhE4a93B.js +138 -0
- package/dist/Component-DhE4a93B.js.map +1 -0
- package/dist/Component-DlBYWjUa.js +107 -0
- package/dist/Component-DlBYWjUa.js.map +1 -0
- package/dist/{Component-C4vHIDMZ.js → Component-dmSX0Khf.js} +2 -2
- package/dist/{Component-C4vHIDMZ.js.map → Component-dmSX0Khf.js.map} +1 -1
- package/dist/{Component-DOlDNQnu.js → Component-eoUrqznD.js} +2 -2
- package/dist/{Component-DOlDNQnu.js.map → Component-eoUrqznD.js.map} +1 -1
- package/dist/{Component-6rieHJdg.js → Component-jzDbWkuj.js} +3 -3
- package/dist/{Component-6rieHJdg.js.map → Component-jzDbWkuj.js.map} +1 -1
- package/dist/{Component-CzwTENBM.js → Component-uHkw3SDR.js} +2 -2
- package/dist/{Component-CzwTENBM.js.map → Component-uHkw3SDR.js.map} +1 -1
- package/dist/action-popup/index.js +2 -2
- package/dist/active-filters/index.js +2 -2
- package/dist/arrangement-settings/index.js +2 -2
- package/dist/assets/Component.css +1 -1
- package/dist/assets/Component10.css +1 -1
- package/dist/assets/Component11.css +1 -1
- package/dist/assets/Component12.css +1 -1
- package/dist/assets/Component13.css +1 -1
- package/dist/assets/Component14.css +1 -1
- package/dist/assets/Component15.css +1 -1
- package/dist/assets/Component16.css +1 -0
- package/dist/assets/Component2.css +1 -1
- package/dist/assets/Component3.css +1 -1
- package/dist/assets/Component4.css +1 -1
- package/dist/assets/Component5.css +1 -1
- package/dist/assets/Component6.css +1 -1
- package/dist/assets/Component7.css +1 -1
- package/dist/assets/Component8.css +1 -1
- package/dist/assets/Component9.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/autocomplete/index.js +2 -2
- package/dist/autocomplete-async/index.js +2 -2
- package/dist/button/Component.d.ts +1 -1
- package/dist/button/Component.d.ts.map +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/types.d.ts +2 -0
- package/dist/button/types.d.ts.map +1 -1
- package/dist/cascade-menu/index.js +2 -2
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox-group/index.js +1 -1
- package/dist/color-field/Component.d.ts +5 -0
- package/dist/color-field/Component.d.ts.map +1 -0
- package/dist/color-field/FormColorField.d.ts +6 -0
- package/dist/color-field/FormColorField.d.ts.map +1 -0
- package/dist/color-field/index.d.ts +4 -0
- package/dist/color-field/index.d.ts.map +1 -0
- package/dist/color-field/index.js +284 -0
- package/dist/color-field/index.js.map +1 -0
- package/dist/{color-picker → color-field}/theme.d.ts +1 -1
- package/dist/color-field/theme.d.ts.map +1 -0
- package/dist/color-field/types.d.ts +58 -0
- package/dist/color-field/types.d.ts.map +1 -0
- package/dist/color-field/utils.d.ts +14 -0
- package/dist/color-field/utils.d.ts.map +1 -0
- package/dist/color-picker/Component.d.ts +1 -1
- package/dist/color-picker/Component.d.ts.map +1 -1
- package/dist/color-picker/index.d.ts +2 -2
- package/dist/color-picker/index.d.ts.map +1 -1
- package/dist/color-picker/index.js +3 -344
- package/dist/color-picker/index.js.map +1 -1
- package/dist/color-picker/types.d.ts +16 -37
- package/dist/color-picker/types.d.ts.map +1 -1
- package/dist/color-picker/utils.d.ts +7 -14
- package/dist/color-picker/utils.d.ts.map +1 -1
- package/dist/context-menu/index.js +1 -1
- package/dist/copy-button/index.js +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/date-picker/index.js +1 -1
- package/dist/date-range-picker/index.js +1 -1
- package/dist/drawer/index.js +1 -1
- package/dist/dropzone/index.js +2 -2
- package/dist/field/index.js +1 -1
- package/dist/input/index.js +2 -2
- package/dist/link/index.js +1 -1
- package/dist/mask/Component.d.ts +5 -0
- package/dist/mask/Component.d.ts.map +1 -0
- package/dist/mask/FormMask.d.ts +6 -0
- package/dist/mask/FormMask.d.ts.map +1 -0
- package/dist/mask/index.d.ts +4 -0
- package/dist/mask/index.d.ts.map +1 -0
- package/dist/mask/index.js +104 -0
- package/dist/mask/index.js.map +1 -0
- package/dist/mask/types.d.ts +20 -0
- package/dist/mask/types.d.ts.map +1 -0
- package/dist/menu-list/index.js +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-autocomplete/index.js +2 -2
- package/dist/multi-autocomplete-async/index.js +2 -2
- package/dist/multi-select/index.js +1 -1
- package/dist/number-input/index.js +2 -2
- package/dist/number-range/index.js +2 -2
- package/dist/popover/index.js +1 -1
- package/dist/select/index.js +2 -2
- package/dist/slider/index.js +1 -1
- package/dist/suggest-checklist/index.js +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/time-field/index.js +1 -1
- package/dist/tooltip/index.js +1 -1
- package/package.json +11 -1
- package/src/button/docs/Description.md +9 -8
- package/src/button/docs/cssVariables.ts +1 -0
- package/src/button/types.ts +2 -0
- package/src/color-field/docs/Description.md +46 -0
- package/src/color-field/docs/Example.md +5 -0
- package/src/color-field/docs/cssVariables.ts +34 -0
- package/src/color-field/types.ts +67 -0
- package/src/color-picker/docs/Description.md +17 -36
- package/src/color-picker/docs/Example.md +1 -1
- package/src/color-picker/docs/cssVariables.ts +4 -32
- package/src/color-picker/types.ts +16 -44
- package/src/mask/docs/Description.md +48 -0
- package/src/mask/docs/Example.md +12 -0
- package/src/mask/types.ts +21 -0
- package/dist/Component-C24OpTxW.js +0 -92
- package/dist/Component-C24OpTxW.js.map +0 -1
- package/dist/color-picker/FormColorPicker.d.ts +0 -6
- package/dist/color-picker/FormColorPicker.d.ts.map +0 -1
- package/dist/color-picker/theme.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/mask/Component.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAc1C,eAAO,MAAM,IAAI,sEAAiF,UAAU;;CA4E1G,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IFormMaskProps } from './types';
|
|
2
|
+
export declare const FormMask: {
|
|
3
|
+
({ name, label, hint, size, block, disabled, readOnly, className, dataTestId, ...maskProps }: IFormMaskProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=FormMask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormMask.d.ts","sourceRoot":"","sources":["../../../src/mask/FormMask.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAU9C,eAAO,MAAM,QAAQ;kGAWlB,cAAc;;CA+BhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mask/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as c, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as g, useCallback as B, useEffect as O } from "react";
|
|
3
|
+
import { useIMask as j } from "react-imask";
|
|
4
|
+
import { s as M } from "../index-h8z54aFR.js";
|
|
5
|
+
import { I as z } from "../Component-BuFsNZAH.js";
|
|
6
|
+
import { F as v, u as D } from "../Component-BPN5FgKq.js";
|
|
7
|
+
import { u as N, g as T } from "../useFieldHook-o47pjrRg.js";
|
|
8
|
+
const C = (r) => ({
|
|
9
|
+
target: { value: r },
|
|
10
|
+
currentTarget: { value: r }
|
|
11
|
+
}), A = (r) => !r.nativeEvent && r.currentTarget.value === "", R = (r) => r == null ? "" : String(r), S = M(({ opts: r, value: o, defaultValue: a, onChange: i, ref: n, ...k }) => {
|
|
12
|
+
const s = g(i), m = g(null), u = g(!1), f = g(null), d = o !== void 0;
|
|
13
|
+
s.current = i;
|
|
14
|
+
const h = B((e) => {
|
|
15
|
+
u.current || s.current?.(C(e));
|
|
16
|
+
}, []), { maskRef: p } = j(r, {
|
|
17
|
+
ref: m,
|
|
18
|
+
onAccept: h
|
|
19
|
+
});
|
|
20
|
+
return O(() => {
|
|
21
|
+
if (!d) return;
|
|
22
|
+
const e = p.current;
|
|
23
|
+
if (!e) return;
|
|
24
|
+
const t = R(o);
|
|
25
|
+
if (e.value === t) {
|
|
26
|
+
f.current = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
u.current = !0, e.value = t;
|
|
30
|
+
const l = String(e.value);
|
|
31
|
+
u.current = !1, !(l === t || f.current === l) && (f.current = l, s.current?.(C(l)));
|
|
32
|
+
}), /* @__PURE__ */ c(
|
|
33
|
+
z,
|
|
34
|
+
{
|
|
35
|
+
...k,
|
|
36
|
+
ref: (e) => {
|
|
37
|
+
if (m.current = e, typeof n == "function") {
|
|
38
|
+
n(e);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
n && (n.current = e);
|
|
42
|
+
},
|
|
43
|
+
...d ? { value: R(o) } : { defaultValue: a },
|
|
44
|
+
onChange: (e) => {
|
|
45
|
+
if (!A(e)) return;
|
|
46
|
+
const t = p.current;
|
|
47
|
+
t && t.value !== "" && (u.current = !0, t.value = "", u.current = !1), s.current?.(C(""));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
S.displayName = "Mask";
|
|
53
|
+
const L = M((r) => {
|
|
54
|
+
const { controlProps: o, size: a, invalid: i, disabled: n } = D();
|
|
55
|
+
return /* @__PURE__ */ c(S, { ...r, ...o, size: a, invalid: i, disabled: n });
|
|
56
|
+
}), P = ({
|
|
57
|
+
name: r,
|
|
58
|
+
label: o,
|
|
59
|
+
hint: a,
|
|
60
|
+
size: i = "md",
|
|
61
|
+
block: n = !0,
|
|
62
|
+
disabled: k,
|
|
63
|
+
readOnly: s,
|
|
64
|
+
className: m,
|
|
65
|
+
dataTestId: u,
|
|
66
|
+
...f
|
|
67
|
+
}) => {
|
|
68
|
+
const { field: d, fieldState: h, inputProps: p, onChangeHandler: e, onBlurHandler: t } = N({ name: r }), { disabled: l, readOnly: b, ...E } = p, F = T(h.error)?.message, x = k ?? l, H = s !== void 0 ? s : b;
|
|
69
|
+
return /* @__PURE__ */ I(
|
|
70
|
+
v,
|
|
71
|
+
{
|
|
72
|
+
invalid: !!F,
|
|
73
|
+
disabled: x,
|
|
74
|
+
size: i,
|
|
75
|
+
block: n,
|
|
76
|
+
className: m,
|
|
77
|
+
dataTestId: u,
|
|
78
|
+
children: [
|
|
79
|
+
o ? /* @__PURE__ */ c(v.Label, { children: o }) : null,
|
|
80
|
+
/* @__PURE__ */ c(
|
|
81
|
+
L,
|
|
82
|
+
{
|
|
83
|
+
...f,
|
|
84
|
+
...E,
|
|
85
|
+
readOnly: H || void 0,
|
|
86
|
+
block: n,
|
|
87
|
+
ref: d.ref,
|
|
88
|
+
value: d.value ?? "",
|
|
89
|
+
onChange: (y) => e(y),
|
|
90
|
+
onBlur: (y) => t(y)
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
a ? /* @__PURE__ */ c(v.Hint, { children: a }) : null,
|
|
94
|
+
/* @__PURE__ */ c(v.Error, { children: F })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
P.displayName = "FormMask";
|
|
100
|
+
export {
|
|
101
|
+
P as FormMask,
|
|
102
|
+
S as Mask
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/mask/Component.tsx","../../src/mask/FormMask.tsx"],"sourcesContent":["import { type ChangeEvent, useCallback, useEffect, useRef } from 'react';\n\nimport { useIMask } from 'react-imask';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Input } from '@/input';\n\nimport { type IMaskProps } from './types';\n\nconst toChangeEvent = (value: string): ChangeEvent<HTMLInputElement> =>\n ({\n target: { value },\n currentTarget: { value },\n }) as ChangeEvent<HTMLInputElement>;\n\n/** Only the clear control emits a change event without `nativeEvent`; IMask reports typed input via `onAccept`. */\nconst isSyntheticClear = (event: ChangeEvent<HTMLInputElement>) =>\n !event.nativeEvent && event.currentTarget.value === '';\n\nconst toMaskString = (value: IMaskProps['value']) => (value == null ? '' : String(value));\n\nexport const Mask = supportRef(({ opts, value: valueProp, defaultValue, onChange, ref, ...rest }: IMaskProps) => {\n const onChangeRef = useRef(onChange);\n const inputRef = useRef<HTMLInputElement | null>(null);\n /** Accepts caused by writing `value` into the mask must not emit. */\n const isSyncing = useRef(false);\n /** Last normalized string already sent for the current raw `value`. */\n const reportedFor = useRef<string | null>(null);\n const isControlled = valueProp !== undefined;\n\n onChangeRef.current = onChange;\n\n const onAccept = useCallback((val: string) => {\n if (isSyncing.current) return;\n\n onChangeRef.current?.(toChangeEvent(val));\n }, []);\n\n const { maskRef } = useIMask<HTMLInputElement>(opts, {\n ref: inputRef,\n onAccept,\n });\n\n useEffect(() => {\n if (!isControlled) return;\n\n const mask = maskRef.current;\n\n if (!mask) return;\n\n const next = toMaskString(valueProp);\n\n if (mask.value === next) {\n reportedFor.current = null;\n return;\n }\n\n isSyncing.current = true;\n mask.value = next;\n const normalized = String(mask.value);\n isSyncing.current = false;\n\n if (normalized === next || reportedFor.current === normalized) return;\n\n reportedFor.current = normalized;\n onChangeRef.current?.(toChangeEvent(normalized));\n });\n\n return (\n <Input\n {...rest}\n ref={node => {\n inputRef.current = node;\n\n if (typeof ref === 'function') {\n ref(node);\n return;\n }\n\n if (ref) ref.current = node;\n }}\n {...(isControlled ? { value: toMaskString(valueProp) } : { defaultValue })}\n onChange={event => {\n if (!isSyntheticClear(event)) return;\n\n const mask = maskRef.current;\n\n if (mask && mask.value !== '') {\n isSyncing.current = true;\n mask.value = '';\n isSyncing.current = false;\n }\n\n onChangeRef.current?.(toChangeEvent(''));\n }}\n />\n );\n});\n\nMask.displayName = 'Mask';\n","import { type ComponentProps } from 'react';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Field, useField } from '@/field';\nimport { useFieldHook } from '@/form/hooks/useFieldHook';\nimport { getError } from '@/form/utils';\n\nimport { Mask } from './Component';\nimport { type IFormMaskProps } from './types';\n\ntype TFormMaskControlProps = Omit<ComponentProps<typeof Mask>, 'size' | 'invalid' | 'disabled'>;\n\nconst FormMaskControl = supportRef((props: TFormMaskControlProps) => {\n const { controlProps, size, invalid, disabled } = useField();\n\n return <Mask {...props} {...controlProps} size={size} invalid={invalid} disabled={disabled} />;\n});\n\nexport const FormMask = ({\n name,\n label,\n hint,\n size = 'md',\n block = true,\n disabled,\n readOnly,\n className,\n dataTestId,\n ...maskProps\n}: IFormMaskProps) => {\n const { field, fieldState, inputProps: rhfInputProps, onChangeHandler, onBlurHandler } = useFieldHook({ name });\n const { disabled: formDisabled, readOnly: formReadOnly, ...restRhf } = rhfInputProps;\n const error = getError(fieldState.error)?.message;\n const isDisabled = disabled ?? formDisabled;\n const isReadOnly = readOnly !== undefined ? readOnly : formReadOnly;\n\n return (\n <Field\n invalid={Boolean(error)}\n disabled={isDisabled}\n size={size}\n block={block}\n className={className}\n dataTestId={dataTestId}\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <FormMaskControl\n {...maskProps}\n {...restRhf}\n readOnly={isReadOnly || undefined}\n block={block}\n ref={field.ref}\n value={field.value ?? ''}\n onChange={event => onChangeHandler(event)}\n onBlur={event => onBlurHandler(event)}\n />\n {hint ? <Field.Hint>{hint}</Field.Hint> : null}\n <Field.Error>{error}</Field.Error>\n </Field>\n );\n};\n\nFormMask.displayName = 'FormMask';\n"],"names":["toChangeEvent","value","isSyntheticClear","event","toMaskString","Mask","supportRef","opts","valueProp","defaultValue","onChange","ref","rest","onChangeRef","useRef","inputRef","isSyncing","reportedFor","isControlled","onAccept","useCallback","val","maskRef","useIMask","useEffect","mask","next","normalized","jsx","Input","node","FormMaskControl","props","controlProps","size","invalid","disabled","useField","FormMask","name","label","hint","block","readOnly","className","dataTestId","maskProps","field","fieldState","rhfInputProps","onChangeHandler","onBlurHandler","useFieldHook","formDisabled","formReadOnly","restRhf","error","getError","isDisabled","isReadOnly","jsxs","Field"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FactoryOpts } from 'imask';
|
|
2
|
+
import { IFormFieldLayoutProps } from '../form/types';
|
|
3
|
+
import { IInputContentProps, IInputProps, IInputThemeProps } from '../input';
|
|
4
|
+
/** IMask options. The mask itself is supplied by the caller. */
|
|
5
|
+
export interface IMaskOwnProps {
|
|
6
|
+
/**
|
|
7
|
+
* IMask factory options (`mask`, `blocks`, `prepare`, …).
|
|
8
|
+
* Keep the same object between renders (`useMemo` or a constant). A new object every render makes IMask refresh.
|
|
9
|
+
*/
|
|
10
|
+
opts: FactoryOpts;
|
|
11
|
+
}
|
|
12
|
+
/** `value` and `onChange` always carry the masked string (not the unmasked or typed value). */
|
|
13
|
+
export interface IMaskProps extends IInputProps, IMaskOwnProps {
|
|
14
|
+
}
|
|
15
|
+
/** Content slice for FormMask. */
|
|
16
|
+
export interface IMaskContentProps extends IInputContentProps, IMaskOwnProps {
|
|
17
|
+
}
|
|
18
|
+
export interface IFormMaskProps extends IFormFieldLayoutProps, Pick<IInputThemeProps, 'variant'>, IMaskContentProps {
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mask/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3F,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC1B;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;CACrB;AAED,+FAA+F;AAC/F,MAAM,WAAW,UAAW,SAAQ,WAAW,EAAE,aAAa;CAAG;AAEjE,kCAAkC;AAClC,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,aAAa;CAAG;AAE/E,MAAM,WAAW,cAAe,SAAQ,qBAAqB,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,iBAAiB;CAAG"}
|
package/dist/menu-list/index.js
CHANGED
package/dist/modal/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { M as v } from "../Component-
|
|
1
|
+
import { M as v } from "../Component-dmSX0Khf.js";
|
|
2
2
|
import { jsxs as A, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import { F as t, u as b } from "../Component-
|
|
4
|
+
import { F as t, u as b } from "../Component-BPN5FgKq.js";
|
|
5
5
|
import { u as x, g as B } from "../useFieldHook-o47pjrRg.js";
|
|
6
6
|
const H = (i) => {
|
|
7
7
|
const { controlProps: o, size: r, invalid: s, disabled: l } = b();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { s as L } from "../index-h8z54aFR.js";
|
|
3
3
|
import { u as v, a as B, i as E } from "../useAsyncSuggest-DuIolQ3l.js";
|
|
4
|
-
import { M as b } from "../Component-
|
|
4
|
+
import { M as b } from "../Component-dmSX0Khf.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { F as c, u as x } from "../Component-
|
|
6
|
+
import { F as c, u as x } from "../Component-BPN5FgKq.js";
|
|
7
7
|
import { u as C, g as H } from "../useFieldHook-o47pjrRg.js";
|
|
8
8
|
const f = L(
|
|
9
9
|
({ useSuggest: n, minLength: o = 0, debounceMs: t = 300, disabled: e = !1, ...r }) => {
|
|
@@ -6,7 +6,7 @@ import { s as R } from "../index-h8z54aFR.js";
|
|
|
6
6
|
import { a as j } from "../utils-DrTtzDsS.js";
|
|
7
7
|
import { C as E } from "../index-DxsuVBkE.js";
|
|
8
8
|
import { cva as P } from "class-variance-authority";
|
|
9
|
-
import { F as f, u as T } from "../Component-
|
|
9
|
+
import { F as f, u as T } from "../Component-BPN5FgKq.js";
|
|
10
10
|
import { u as q, g as w } from "../useFieldHook-o47pjrRg.js";
|
|
11
11
|
import '../assets/index18.css';const z = "aub_styles-module_root_42206", A = "aub_styles-module_block_e0d95", y = {
|
|
12
12
|
root: z,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { N as y } from "../Component-
|
|
1
|
+
import { N as y } from "../Component-BPAXqDXt.js";
|
|
2
2
|
import { jsxs as x, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import { s as B } from "../index-h8z54aFR.js";
|
|
5
|
-
import { F as l, u as C } from "../Component-
|
|
5
|
+
import { F as l, u as C } from "../Component-BPN5FgKq.js";
|
|
6
6
|
import { u as H, g as P } from "../useFieldHook-o47pjrRg.js";
|
|
7
7
|
const f = B(
|
|
8
8
|
({ ref: i, value: e, onChange: o, onBlur: t, ...n }) => {
|
|
@@ -2,8 +2,8 @@ import { jsxs as H, jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as L } from "react";
|
|
3
3
|
import U from "classnames";
|
|
4
4
|
import { s as j } from "../index-h8z54aFR.js";
|
|
5
|
-
import { N as B } from "../Component-
|
|
6
|
-
import { F as b, u as $ } from "../Component-
|
|
5
|
+
import { N as B } from "../Component-BPAXqDXt.js";
|
|
6
|
+
import { F as b, u as $ } from "../Component-BPN5FgKq.js";
|
|
7
7
|
import { u as q, g as w } from "../useFieldHook-o47pjrRg.js";
|
|
8
8
|
import '../assets/index12.css';const C = (o) => o == null || Number.isNaN(o) ? null : o, D = (o, n, t) => {
|
|
9
9
|
const r = C(o.from), l = C(o.to), e = C(t);
|
package/dist/popover/index.js
CHANGED
package/dist/select/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as v } from "../Component-
|
|
1
|
+
import { S as v } from "../Component-DWp04UBh.js";
|
|
2
2
|
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import { F as n, u as x } from "../Component-
|
|
4
|
+
import { F as n, u as x } from "../Component-BPN5FgKq.js";
|
|
5
5
|
import { u as B, g as H } from "../useFieldHook-o47pjrRg.js";
|
|
6
6
|
const j = (s) => {
|
|
7
7
|
const { controlProps: r, size: o, invalid: i, disabled: l } = x();
|
package/dist/slider/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Slider as $, SliderOutput as x, SliderTrack as O, SliderFill as V, Slid
|
|
|
5
5
|
import { s as B } from "../index-h8z54aFR.js";
|
|
6
6
|
import { cva as G } from "class-variance-authority";
|
|
7
7
|
import { typographyStyles as C } from "../typography/index.js";
|
|
8
|
-
import { F as v, u as J } from "../Component-
|
|
8
|
+
import { F as v, u as J } from "../Component-BPN5FgKq.js";
|
|
9
9
|
import { u as K, g as Q } from "../useFieldHook-o47pjrRg.js";
|
|
10
10
|
import '../assets/index19.css';const U = "aub_styles-module_root_34a37", W = "aub_styles-module_block_87638", X = "aub_styles-module_readout_b6c80", Y = "aub_styles-module_value_52215", Z = "aub_styles-module_detail_aad13", ee = "aub_styles-module_track_47316", le = "aub_styles-module_rail_fad39", ae = "aub_styles-module_fill_7f0d9", te = "aub_styles-module_ticks_24abe", re = "aub_styles-module_tick_60d62", se = "aub_styles-module_thumb_edd9d", ie = "aub_styles-module_invalid_cb4ec", oe = "aub_styles-module_sm_d6a8a", de = "aub_styles-module_md_f78ab", ue = "aub_styles-module_lg_32e42", a = {
|
|
11
11
|
root: U,
|
|
@@ -5,7 +5,7 @@ import { u as T, a as W, i as X } from "../useAsyncSuggest-DuIolQ3l.js";
|
|
|
5
5
|
import { c as h, a as Y } from "../theme-C-N1qQjF.js";
|
|
6
6
|
import { u as Z, r as M, C as $ } from "../metrics-Cv_jrA15.js";
|
|
7
7
|
import { C as ee } from "../Check-deng4Zns.js";
|
|
8
|
-
import { I as se } from "../Component-
|
|
8
|
+
import { I as se } from "../Component-BuFsNZAH.js";
|
|
9
9
|
import { u as te } from "../hooks-CekMiYbX.js";
|
|
10
10
|
import '../assets/index4.css';const oe = "aub_styles-module_root_50f42", ae = "aub_styles-module_field_9c54b", le = "aub_styles-module_list_1877b", re = "aub_styles-module_more_5f92c", c = {
|
|
11
11
|
root: oe,
|
package/dist/switch/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { s as v } from "../index-h8z54aFR.js";
|
|
|
5
5
|
import { cva as x } from "class-variance-authority";
|
|
6
6
|
import { typographyStyles as y } from "../typography/index.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { F as _, u as z } from "../Component-
|
|
8
|
+
import { F as _, u as z } from "../Component-BPN5FgKq.js";
|
|
9
9
|
import { u as D, g as H } from "../useFieldHook-o47pjrRg.js";
|
|
10
10
|
import '../assets/index13.css';const V = "aub_styles-module_root_266e7", j = "aub_styles-module_track_88aff", C = "aub_styles-module_thumb_eb2c8", E = "aub_styles-module_label_a0017", I = "aub_styles-module_sm_8ed02", P = "aub_styles-module_md_96718", M = "aub_styles-module_lg_0c078", R = "aub_styles-module_primary_922c6", q = "aub_styles-module_invalid_a628f", a = {
|
|
11
11
|
root: V,
|
package/dist/table/index.js
CHANGED
package/dist/textarea/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { C as B } from "../Clear-DcxADxz6.js";
|
|
|
7
7
|
import { u as O } from "../hooks-CekMiYbX.js";
|
|
8
8
|
import { cva as j } from "class-variance-authority";
|
|
9
9
|
import { typographyStyles as k } from "../typography/index.js";
|
|
10
|
-
import { F as g, u as z } from "../Component-
|
|
10
|
+
import { F as g, u as z } from "../Component-BPN5FgKq.js";
|
|
11
11
|
import { u as L, g as M } from "../useFieldHook-o47pjrRg.js";
|
|
12
12
|
import '../assets/index20.css';const G = "aub_styles-module_root_6dcd6", U = "aub_styles-module_block_9fd7b", $ = "aub_styles-module_sm_8e3c9", q = "aub_styles-module_md_9f5d6", J = "aub_styles-module_lg_459d3", K = "aub_styles-module_fieldInput_f9bcf", Q = "aub_styles-module_clear_97555", W = "aub_styles-module_clearIcon_dd0fc", X = "aub_styles-module_primary_af5fb", o = {
|
|
13
13
|
root: G,
|
package/dist/time-field/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { C as U } from "../Clear-DcxADxz6.js";
|
|
|
7
7
|
import { u as $ } from "../hooks-CekMiYbX.js";
|
|
8
8
|
import { cva as J } from "class-variance-authority";
|
|
9
9
|
import { typographyStyles as k } from "../typography/index.js";
|
|
10
|
-
import { F as h, u as K } from "../Component-
|
|
10
|
+
import { F as h, u as K } from "../Component-BPN5FgKq.js";
|
|
11
11
|
import { u as Q, g as W } from "../useFieldHook-o47pjrRg.js";
|
|
12
12
|
import '../assets/index14.css';const X = "aub_styles-module_root_184e6", Y = "aub_styles-module_block_45f0f", Z = "aub_styles-module_group_9f460", ee = "aub_styles-module_sm_f51c2", le = "aub_styles-module_md_be9a9", re = "aub_styles-module_lg_8553c", oe = "aub_styles-module_primary_43afd", te = "aub_styles-module_input_f5120", se = "aub_styles-module_segment_b8349", ae = "aub_styles-module_clear_04e5c", ne = "aub_styles-module_icon_2d638", l = {
|
|
13
13
|
root: X,
|
package/dist/tooltip/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ensi-platform/admin-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Admin UI for Ensi admin panel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -42,10 +42,12 @@
|
|
|
42
42
|
"@internationalized/date": "^3.12.4",
|
|
43
43
|
"class-variance-authority": "0.7.1",
|
|
44
44
|
"classnames": "2.5.1",
|
|
45
|
+
"imask": "7.6.1",
|
|
45
46
|
"react-aria": "3.52.1",
|
|
46
47
|
"react-aria-components": "^1.21.1",
|
|
47
48
|
"react-dropzone": "^20.1.4",
|
|
48
49
|
"react-fast-compare": "^3.2.2",
|
|
50
|
+
"react-imask": "7.6.1",
|
|
49
51
|
"usehooks-ts": "^3.1.1"
|
|
50
52
|
},
|
|
51
53
|
"peerDependencies": {
|
|
@@ -107,6 +109,10 @@
|
|
|
107
109
|
"types": "./dist/checkbox-group/index.d.ts",
|
|
108
110
|
"import": "./dist/checkbox-group/index.js"
|
|
109
111
|
},
|
|
112
|
+
"./color-field": {
|
|
113
|
+
"types": "./dist/color-field/index.d.ts",
|
|
114
|
+
"import": "./dist/color-field/index.js"
|
|
115
|
+
},
|
|
110
116
|
"./color-picker": {
|
|
111
117
|
"types": "./dist/color-picker/index.d.ts",
|
|
112
118
|
"import": "./dist/color-picker/index.js"
|
|
@@ -183,6 +189,10 @@
|
|
|
183
189
|
"types": "./dist/loader/index.d.ts",
|
|
184
190
|
"import": "./dist/loader/index.js"
|
|
185
191
|
},
|
|
192
|
+
"./mask": {
|
|
193
|
+
"types": "./dist/mask/index.d.ts",
|
|
194
|
+
"import": "./dist/mask/index.js"
|
|
195
|
+
},
|
|
186
196
|
"./menu-list": {
|
|
187
197
|
"types": "./dist/menu-list/index.d.ts",
|
|
188
198
|
"import": "./dist/menu-list/index.js"
|
|
@@ -12,14 +12,15 @@ import { Button } from '@ensi-platform/admin-ui/button';
|
|
|
12
12
|
|
|
13
13
|
## API (short)
|
|
14
14
|
|
|
15
|
-
| Prop | Values | Default | Description
|
|
16
|
-
| ------------ | ---------------------------------------------------------- | --------- |
|
|
17
|
-
| `size` | `sm` \| `md` \| `lg` | `md` | size
|
|
18
|
-
| `variant` | `primary` \| `secondary` \| `danger` | `primary` | visual variant
|
|
19
|
-
| `block` | `boolean` | `false` | full width of the parent
|
|
20
|
-
| `icon` | `{ Component, after?, indent?, size?, className?, fill? }` | — | icon before or after the label (`after`)
|
|
21
|
-
| `dataTestId` | `string` | — | `data-test-id` for tests
|
|
22
|
-
| `as` | tag or component | `button` | root; for a link usually `as="a"`
|
|
15
|
+
| Prop | Values | Default | Description |
|
|
16
|
+
| ------------ | ---------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
17
|
+
| `size` | `sm` \| `md` \| `lg` | `md` | size |
|
|
18
|
+
| `variant` | `primary` \| `secondary` \| `danger` | `primary` | visual variant |
|
|
19
|
+
| `block` | `boolean` | `false` | full width of the parent |
|
|
20
|
+
| `icon` | `{ Component, after?, indent?, size?, className?, fill? }` | — | icon before or after the label (`after`) |
|
|
21
|
+
| `dataTestId` | `string` | — | `data-test-id` for tests |
|
|
22
|
+
| `as` | tag or component | `button` | root; for a link usually `as="a"` |
|
|
23
23
|
| `hidden` | `boolean` | `false` | hides only the text (`children`); the icon stays. `aria-label` is required: hidden text is not the accessible name |
|
|
24
|
+
| `loading` | `boolean` | `false` | hides the label, shows a spinner, and ignores activation |
|
|
24
25
|
|
|
25
26
|
Native button/link attributes (`type`, `disabled`, `onClick`, `href`, …) are accepted for the chosen root element.
|
|
@@ -38,4 +38,5 @@ export const docsCssVariables = `/* CSS variables — Button (--aui-button-*) */
|
|
|
38
38
|
--aui-button-pad-x-lg: var(--aui-spacing-24); /* padding-x lg */
|
|
39
39
|
|
|
40
40
|
--aui-button-duration-fast: var(--aui-control-duration-fast); /* transition duration */
|
|
41
|
+
--aui-button-duration-spin: 0.8s; /* loading spinner turn */
|
|
41
42
|
--aui-button-ease-out: var(--aui-control-ease-out); /* transition easing */`;
|
package/src/button/types.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface IButtonOwnProps extends IDataTestIdProps {
|
|
|
40
40
|
block?: boolean;
|
|
41
41
|
/** Hide only the text (children); the icon stays. Provide aria-label for the accessible name. */
|
|
42
42
|
hidden?: boolean;
|
|
43
|
+
/** Hide the label, show a spinner, and ignore activation. */
|
|
44
|
+
loading?: boolean;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface IButtonBaseProps extends IButtonThemeProps, IButtonOwnProps {}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
A color field: the swatch opens a palette, and the hex sits beside it.
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { ColorField, FormColorField } from '@ensi-platform/admin-ui/color-field';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- one opaque color: a badge, a status, a product attribute
|
|
10
|
+
- the code is already known — type it without opening the palette
|
|
11
|
+
- a short list of allowed colors — the `presets` prop
|
|
12
|
+
- a palette without the field — see `ColorPicker`
|
|
13
|
+
- a date or a time — see `DatePicker` and `TimeField`
|
|
14
|
+
|
|
15
|
+
## API (short)
|
|
16
|
+
|
|
17
|
+
### ColorField
|
|
18
|
+
|
|
19
|
+
| Prop | Values | Default | Description |
|
|
20
|
+
| -------------------- | -------------------- | --------- | -------------------------------------------------------------- |
|
|
21
|
+
| `value` / `onChange` | `string` | — | `''` or `#rrggbb`. The color object stays inside |
|
|
22
|
+
| `defaultValue` | `string` | `''` | initial value without external state |
|
|
23
|
+
| `presets` | `string[]` | — | swatches in the panel. Strings that are not colors are dropped |
|
|
24
|
+
| `clear` | `boolean` | `false` | clear button |
|
|
25
|
+
| `size` | `sm` \| `md` \| `lg` | `md` | size |
|
|
26
|
+
| `variant` | `primary` | `primary` | visual variant |
|
|
27
|
+
| `invalid` | `boolean` | `false` | error. An unrecognized `value` marks the field too |
|
|
28
|
+
| `disabled` | `boolean` | `false` | disabled |
|
|
29
|
+
| `block` | `boolean` | `true` | full width |
|
|
30
|
+
| `dataTestId` | `string` | — | `data-test-id` attribute |
|
|
31
|
+
|
|
32
|
+
Six digits are published immediately. Three digits (`#abc`) expand to `#aabbcc` on blur or Enter. Enter does not submit the form. A drag on the area publishes when the pointer is released; arrow keys on the hue slider publish on each step.
|
|
33
|
+
|
|
34
|
+
### FormColorField
|
|
35
|
+
|
|
36
|
+
| Prop | Values | Default | Description |
|
|
37
|
+
| ---------- | -------------------- | --------- | -------------------- |
|
|
38
|
+
| `name` | `string` | — | field name in `Form` |
|
|
39
|
+
| `label` | `ReactNode` | — | label |
|
|
40
|
+
| `hint` | `ReactNode` | — | hint |
|
|
41
|
+
| `clear` | `boolean` | — | clear button |
|
|
42
|
+
| `presets` | `string[]` | — | preset swatches |
|
|
43
|
+
| `size` | `sm` \| `md` \| `lg` | `md` | size |
|
|
44
|
+
| `variant` | `primary` | `primary` | visual variant |
|
|
45
|
+
| `disabled` | `boolean` | — | disabled |
|
|
46
|
+
| `block` | `boolean` | `true` | full width |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* CSS variables — ColorField (--aui-color-field-*) */
|
|
2
|
+
export const docsCssVariables = `--aui-color-field-bg-primary: var(--aui-input-bg-primary); /* field fill */
|
|
3
|
+
--aui-color-field-fg-primary: var(--aui-input-fg-primary); /* field foreground */
|
|
4
|
+
--aui-color-field-fg-muted: var(--aui-input-fg-muted); /* placeholder and empty mark */
|
|
5
|
+
--aui-color-field-border-primary: var(--aui-input-border-primary); /* field border */
|
|
6
|
+
--aui-color-field-border-focus: var(--aui-input-border-focus); /* focus border */
|
|
7
|
+
--aui-color-field-border-danger: var(--aui-input-border-danger); /* invalid border */
|
|
8
|
+
--aui-color-field-radius-md: var(--aui-input-radius-md); /* field radius */
|
|
9
|
+
--aui-color-field-h-sm: var(--aui-input-h-sm); /* height sm */
|
|
10
|
+
--aui-color-field-h-md: var(--aui-input-h-md); /* height md */
|
|
11
|
+
--aui-color-field-h-lg: var(--aui-input-h-lg); /* height lg */
|
|
12
|
+
--aui-color-field-pad-x-sm: var(--aui-input-pad-x-sm); /* padding-x sm */
|
|
13
|
+
--aui-color-field-pad-x-md: var(--aui-input-pad-x-md); /* padding-x md */
|
|
14
|
+
--aui-color-field-pad-x-lg: var(--aui-input-pad-x-lg); /* padding-x lg */
|
|
15
|
+
--aui-color-field-gap-md: var(--aui-spacing-8); /* gap inside the field */
|
|
16
|
+
--aui-color-field-icon-size: var(--aui-spacing-16); /* clear icon size */
|
|
17
|
+
--aui-color-field-icon-hit: var(--aui-spacing-24); /* clear icon hit area */
|
|
18
|
+
--aui-color-field-clear-radius: var(--aui-control-radius-sm); /* clear button radius */
|
|
19
|
+
--aui-color-field-swatch-sm: var(--aui-spacing-16); /* trigger swatch sm */
|
|
20
|
+
--aui-color-field-swatch-md: var(--aui-spacing-20); /* trigger swatch md */
|
|
21
|
+
--aui-color-field-swatch-lg: var(--aui-spacing-24); /* trigger swatch lg */
|
|
22
|
+
--aui-color-field-swatch-radius: var(--aui-control-radius-sm); /* trigger swatch radius */
|
|
23
|
+
--aui-color-field-empty-inset: 3px; /* empty swatch slash inset */
|
|
24
|
+
--aui-color-field-popover-bg: var(--aui-surface-bg-elevated); /* panel fill */
|
|
25
|
+
--aui-color-field-popover-border: var(--aui-surface-border-primary); /* panel border */
|
|
26
|
+
--aui-color-field-popover-radius: var(--aui-control-radius-md); /* panel radius */
|
|
27
|
+
--aui-color-field-popover-pad: var(--aui-spacing-12); /* panel padding */
|
|
28
|
+
--aui-color-field-popover-border-w: 1px; /* panel border width */
|
|
29
|
+
--aui-color-field-popover-w: calc(var(--aui-color-picker-area) + 2 * var(--aui-color-field-popover-pad) + 2 * var(--aui-color-field-popover-border-w)); /* panel width, flush with the area */
|
|
30
|
+
--aui-color-field-popover-shadow: var(--aui-shadow-sm); /* panel shadow */
|
|
31
|
+
--aui-color-field-popover-z: var(--aui-z-dropdown); /* panel z-index */
|
|
32
|
+
--aui-color-field-duration-fast: var(--aui-control-duration-fast); /* transition duration */
|
|
33
|
+
--aui-color-field-ease-out: var(--aui-control-ease-out); /* transition easing */
|
|
34
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type IDataTestIdProps } from '@ds/common';
|
|
4
|
+
|
|
5
|
+
import { type IFieldStateProps } from '@/field/types';
|
|
6
|
+
import { type IFormFieldLayoutProps } from '@/form/types';
|
|
7
|
+
|
|
8
|
+
/** ColorField size. */
|
|
9
|
+
export type TColorFieldSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
|
|
11
|
+
/** Visual variant. */
|
|
12
|
+
export type TColorFieldVariant = 'primary';
|
|
13
|
+
|
|
14
|
+
/** Theme inputs. */
|
|
15
|
+
export interface IColorFieldThemeProps {
|
|
16
|
+
/** Control size. Inside Field, inherits `Field.size` when omitted. */
|
|
17
|
+
size?: TColorFieldSize;
|
|
18
|
+
/** Visual variant. */
|
|
19
|
+
variant?: TColorFieldVariant;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Own / chrome props (not from RAC). */
|
|
23
|
+
export interface IColorFieldOwnProps extends IDataTestIdProps {
|
|
24
|
+
/** Clear button for the current value. */
|
|
25
|
+
clear?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Preset swatches inside the popover.
|
|
28
|
+
* Values that are not colors are dropped. No row when empty.
|
|
29
|
+
*/
|
|
30
|
+
presets?: string[];
|
|
31
|
+
/** Class name on the root. */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Ref to the field group (React 19 prop). */
|
|
34
|
+
ref?: Ref<HTMLDivElement>;
|
|
35
|
+
/** Ref to the hex input (React 19 prop). */
|
|
36
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
37
|
+
id?: string;
|
|
38
|
+
'aria-label'?: string;
|
|
39
|
+
'aria-labelledby'?: string;
|
|
40
|
+
'aria-describedby'?: string;
|
|
41
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Control state (our names, not RAC). */
|
|
45
|
+
export interface IColorFieldControlProps {
|
|
46
|
+
/** `#rrggbb` or `''`. */
|
|
47
|
+
value?: string;
|
|
48
|
+
/** `#rrggbb` or `''`. */
|
|
49
|
+
defaultValue?: string;
|
|
50
|
+
/** `''` or canonical `#rrggbb`. */
|
|
51
|
+
onChange?: (value: string) => void;
|
|
52
|
+
onBlur?: () => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IColorFieldBaseProps
|
|
56
|
+
extends IColorFieldThemeProps, IFieldStateProps, IColorFieldOwnProps, IColorFieldControlProps {}
|
|
57
|
+
|
|
58
|
+
export interface IColorFieldProps extends IColorFieldBaseProps {}
|
|
59
|
+
|
|
60
|
+
/** Content slice for FormColorField. */
|
|
61
|
+
export interface IColorFieldContentProps {
|
|
62
|
+
clear?: boolean;
|
|
63
|
+
presets?: string[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IFormColorFieldProps
|
|
67
|
+
extends IFormFieldLayoutProps, Pick<IColorFieldThemeProps, 'variant'>, IColorFieldContentProps {}
|