@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.
Files changed (144) hide show
  1. package/ai/skills/admin-ui/SKILL.md +1 -0
  2. package/dist/{Component-MSGhHMYk.js → Component-B1piMJHv.js} +2 -2
  3. package/dist/{Component-MSGhHMYk.js.map → Component-B1piMJHv.js.map} +1 -1
  4. package/dist/{Component-DpACJ8IJ.js → Component-BPAXqDXt.js} +2 -2
  5. package/dist/{Component-DpACJ8IJ.js.map → Component-BPAXqDXt.js.map} +1 -1
  6. package/dist/{Component-DSAL6avh.js → Component-BPN5FgKq.js} +2 -2
  7. package/dist/{Component-DSAL6avh.js.map → Component-BPN5FgKq.js.map} +1 -1
  8. package/dist/{Component-BZqLGwzc.js → Component-BuFsNZAH.js} +2 -2
  9. package/dist/{Component-BZqLGwzc.js.map → Component-BuFsNZAH.js.map} +1 -1
  10. package/dist/{Component-IFlvrceZ.js → Component-CBnhxD86.js} +5 -5
  11. package/dist/{Component-IFlvrceZ.js.map → Component-CBnhxD86.js.map} +1 -1
  12. package/dist/{Component-BH5skHn_.js → Component-CDURmZCP.js} +2 -2
  13. package/dist/{Component-BH5skHn_.js.map → Component-CDURmZCP.js.map} +1 -1
  14. package/dist/{Component-Dq7pvkWP.js → Component-CQyBQxAb.js} +2 -2
  15. package/dist/{Component-Dq7pvkWP.js.map → Component-CQyBQxAb.js.map} +1 -1
  16. package/dist/{Component-DGze6SVb.js → Component-D92F9hx-.js} +2 -2
  17. package/dist/{Component-DGze6SVb.js.map → Component-D92F9hx-.js.map} +1 -1
  18. package/dist/{Component-DH7wdC3G.js → Component-DWp04UBh.js} +2 -2
  19. package/dist/{Component-DH7wdC3G.js.map → Component-DWp04UBh.js.map} +1 -1
  20. package/dist/{Component-CkazNd13.js → Component-D_c3xBcb.js} +2 -2
  21. package/dist/{Component-CkazNd13.js.map → Component-D_c3xBcb.js.map} +1 -1
  22. package/dist/Component-DhE4a93B.js +138 -0
  23. package/dist/Component-DhE4a93B.js.map +1 -0
  24. package/dist/Component-DlBYWjUa.js +107 -0
  25. package/dist/Component-DlBYWjUa.js.map +1 -0
  26. package/dist/{Component-C4vHIDMZ.js → Component-dmSX0Khf.js} +2 -2
  27. package/dist/{Component-C4vHIDMZ.js.map → Component-dmSX0Khf.js.map} +1 -1
  28. package/dist/{Component-DOlDNQnu.js → Component-eoUrqznD.js} +2 -2
  29. package/dist/{Component-DOlDNQnu.js.map → Component-eoUrqznD.js.map} +1 -1
  30. package/dist/{Component-6rieHJdg.js → Component-jzDbWkuj.js} +3 -3
  31. package/dist/{Component-6rieHJdg.js.map → Component-jzDbWkuj.js.map} +1 -1
  32. package/dist/{Component-CzwTENBM.js → Component-uHkw3SDR.js} +2 -2
  33. package/dist/{Component-CzwTENBM.js.map → Component-uHkw3SDR.js.map} +1 -1
  34. package/dist/action-popup/index.js +2 -2
  35. package/dist/active-filters/index.js +2 -2
  36. package/dist/arrangement-settings/index.js +2 -2
  37. package/dist/assets/Component.css +1 -1
  38. package/dist/assets/Component10.css +1 -1
  39. package/dist/assets/Component11.css +1 -1
  40. package/dist/assets/Component12.css +1 -1
  41. package/dist/assets/Component13.css +1 -1
  42. package/dist/assets/Component14.css +1 -1
  43. package/dist/assets/Component15.css +1 -1
  44. package/dist/assets/Component16.css +1 -0
  45. package/dist/assets/Component2.css +1 -1
  46. package/dist/assets/Component3.css +1 -1
  47. package/dist/assets/Component4.css +1 -1
  48. package/dist/assets/Component5.css +1 -1
  49. package/dist/assets/Component6.css +1 -1
  50. package/dist/assets/Component7.css +1 -1
  51. package/dist/assets/Component8.css +1 -1
  52. package/dist/assets/Component9.css +1 -1
  53. package/dist/assets/index.css +1 -1
  54. package/dist/assets/index15.css +1 -1
  55. package/dist/autocomplete/index.js +2 -2
  56. package/dist/autocomplete-async/index.js +2 -2
  57. package/dist/button/Component.d.ts +1 -1
  58. package/dist/button/Component.d.ts.map +1 -1
  59. package/dist/button/index.js +1 -1
  60. package/dist/button/types.d.ts +2 -0
  61. package/dist/button/types.d.ts.map +1 -1
  62. package/dist/cascade-menu/index.js +2 -2
  63. package/dist/checkbox/index.js +1 -1
  64. package/dist/checkbox-group/index.js +1 -1
  65. package/dist/color-field/Component.d.ts +5 -0
  66. package/dist/color-field/Component.d.ts.map +1 -0
  67. package/dist/color-field/FormColorField.d.ts +6 -0
  68. package/dist/color-field/FormColorField.d.ts.map +1 -0
  69. package/dist/color-field/index.d.ts +4 -0
  70. package/dist/color-field/index.d.ts.map +1 -0
  71. package/dist/color-field/index.js +284 -0
  72. package/dist/color-field/index.js.map +1 -0
  73. package/dist/{color-picker → color-field}/theme.d.ts +1 -1
  74. package/dist/color-field/theme.d.ts.map +1 -0
  75. package/dist/color-field/types.d.ts +58 -0
  76. package/dist/color-field/types.d.ts.map +1 -0
  77. package/dist/color-field/utils.d.ts +14 -0
  78. package/dist/color-field/utils.d.ts.map +1 -0
  79. package/dist/color-picker/Component.d.ts +1 -1
  80. package/dist/color-picker/Component.d.ts.map +1 -1
  81. package/dist/color-picker/index.d.ts +2 -2
  82. package/dist/color-picker/index.d.ts.map +1 -1
  83. package/dist/color-picker/index.js +3 -344
  84. package/dist/color-picker/index.js.map +1 -1
  85. package/dist/color-picker/types.d.ts +16 -37
  86. package/dist/color-picker/types.d.ts.map +1 -1
  87. package/dist/color-picker/utils.d.ts +7 -14
  88. package/dist/color-picker/utils.d.ts.map +1 -1
  89. package/dist/context-menu/index.js +1 -1
  90. package/dist/copy-button/index.js +1 -1
  91. package/dist/data-table/index.js +1 -1
  92. package/dist/date-picker/index.js +1 -1
  93. package/dist/date-range-picker/index.js +1 -1
  94. package/dist/drawer/index.js +1 -1
  95. package/dist/dropzone/index.js +2 -2
  96. package/dist/field/index.js +1 -1
  97. package/dist/input/index.js +2 -2
  98. package/dist/link/index.js +1 -1
  99. package/dist/mask/Component.d.ts +5 -0
  100. package/dist/mask/Component.d.ts.map +1 -0
  101. package/dist/mask/FormMask.d.ts +6 -0
  102. package/dist/mask/FormMask.d.ts.map +1 -0
  103. package/dist/mask/index.d.ts +4 -0
  104. package/dist/mask/index.d.ts.map +1 -0
  105. package/dist/mask/index.js +104 -0
  106. package/dist/mask/index.js.map +1 -0
  107. package/dist/mask/types.d.ts +20 -0
  108. package/dist/mask/types.d.ts.map +1 -0
  109. package/dist/menu-list/index.js +1 -1
  110. package/dist/modal/index.js +1 -1
  111. package/dist/multi-autocomplete/index.js +2 -2
  112. package/dist/multi-autocomplete-async/index.js +2 -2
  113. package/dist/multi-select/index.js +1 -1
  114. package/dist/number-input/index.js +2 -2
  115. package/dist/number-range/index.js +2 -2
  116. package/dist/popover/index.js +1 -1
  117. package/dist/select/index.js +2 -2
  118. package/dist/slider/index.js +1 -1
  119. package/dist/suggest-checklist/index.js +1 -1
  120. package/dist/switch/index.js +1 -1
  121. package/dist/table/index.js +1 -1
  122. package/dist/textarea/index.js +1 -1
  123. package/dist/time-field/index.js +1 -1
  124. package/dist/tooltip/index.js +1 -1
  125. package/package.json +11 -1
  126. package/src/button/docs/Description.md +9 -8
  127. package/src/button/docs/cssVariables.ts +1 -0
  128. package/src/button/types.ts +2 -0
  129. package/src/color-field/docs/Description.md +46 -0
  130. package/src/color-field/docs/Example.md +5 -0
  131. package/src/color-field/docs/cssVariables.ts +34 -0
  132. package/src/color-field/types.ts +67 -0
  133. package/src/color-picker/docs/Description.md +17 -36
  134. package/src/color-picker/docs/Example.md +1 -1
  135. package/src/color-picker/docs/cssVariables.ts +4 -32
  136. package/src/color-picker/types.ts +16 -44
  137. package/src/mask/docs/Description.md +48 -0
  138. package/src/mask/docs/Example.md +12 -0
  139. package/src/mask/types.ts +21 -0
  140. package/dist/Component-C24OpTxW.js +0 -92
  141. package/dist/Component-C24OpTxW.js.map +0 -1
  142. package/dist/color-picker/FormColorPicker.d.ts +0 -6
  143. package/dist/color-picker/FormColorPicker.d.ts.map +0 -1
  144. package/dist/color-picker/theme.d.ts.map +0 -1
@@ -1,45 +1,26 @@
1
- A color field: the swatch opens a palette, and the hex sits beside it.
1
+ A palette: saturation area, hue slider, and preset swatches. The hex field is `ColorField`.
2
2
 
3
3
  ```tsx
4
- import { ColorPicker, FormColorPicker } from '@ensi-platform/admin-ui/color-picker';
4
+ import { ColorPicker } from '@ensi-platform/admin-ui/color-picker';
5
5
  ```
6
6
 
7
7
  ## When to use
8
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 date or a time — see `DatePicker` and `TimeField`
9
+ - the color is chosen on the area, without a code field
10
+ - a short set of allowed colors sits next to the area — the `presets` prop
11
+ - the code must be typed or shown next to a swatch — see `ColorField`
13
12
 
14
13
  ## API (short)
15
14
 
16
- ### ColorPicker
17
-
18
- | Prop | Values | Default | Description |
19
- | -------------------- | -------------------- | --------- | -------------------------------------------------------------------- |
20
- | `value` / `onChange` | `string` | — | `''` or `#rrggbb`. The color object stays inside |
21
- | `defaultValue` | `string` | `''` | initial value without external state |
22
- | `presets` | `string[]` | — | swatches in the panel. Strings that are not colors are dropped |
23
- | `clear` | `boolean` | `false` | clear button |
24
- | `size` | `sm` \| `md` \| `lg` | `md` | size |
25
- | `variant` | `primary` | `primary` | visual variant |
26
- | `invalid` | `boolean` | `false` | error. An unrecognized `value` marks the field too |
27
- | `disabled` | `boolean` | `false` | disabled |
28
- | `block` | `boolean` | `true` | full width |
29
- | `dataTestId` | `string` | — | `data-test-id` attribute |
30
-
31
- 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.
32
-
33
- ### FormColorPicker
34
-
35
- | Prop | Values | Default | Description |
36
- | ---------- | -------------------- | --------- | ------------------ |
37
- | `name` | `string` | — | field name in `Form` |
38
- | `label` | `ReactNode` | — | label |
39
- | `hint` | `ReactNode` | — | hint |
40
- | `clear` | `boolean` | — | clear button |
41
- | `presets` | `string[]` | — | preset swatches |
42
- | `size` | `sm` \| `md` \| `lg` | `md` | size |
43
- | `variant` | `primary` | `primary` | visual variant |
44
- | `disabled` | `boolean` | — | disabled |
45
- | `block` | `boolean` | `true` | full width |
15
+ | Prop | Values | Default | Description |
16
+ | -------------------- | ---------- | ------- | ----------------------------------------------------------------------------------------------- |
17
+ | `value` / `onChange` | `string` | — | `#rrggbb`. An empty string shows a gray draft and is not published until the palette is touched |
18
+ | `defaultValue` | `string` | `''` | initial value without external state |
19
+ | `onPreview` | `function` | — | live `#rrggbb` while the pointer is down. This is not a commit |
20
+ | `presets` | `string[]` | — | preset swatches. Strings that are not colors are dropped |
21
+ | `hue` | `number` | — | hue of a gray color, in degrees. The field keeps it across opens |
22
+ | `onHueChange` | `function` | — | next hue after a palette move. Pair of `hue` |
23
+ | `disabled` | `boolean` | `false` | disabled |
24
+ | `dataTestId` | `string` | — | `data-test-id` attribute |
25
+
26
+ A drag publishes when the pointer is released. Arrow keys on the hue slider publish on each step. The first hue move on an empty value publishes gray `#808080`.
@@ -1,5 +1,5 @@
1
1
  ## Example
2
2
 
3
3
  ```tsx
4
- <FormColorPicker name="backgroundColor" label="Background" clear presets={['#171717', '#ffffff', '#dc2626']} />
4
+ <ColorPicker value="#2563eb" presets={['#171717', '#ffffff', '#dc2626']} onChange={setColor} />
5
5
  ```
@@ -1,40 +1,12 @@
1
1
  /* CSS variables — ColorPicker (--aui-color-picker-*) */
2
- export const docsCssVariables = `--aui-color-picker-bg-primary: var(--aui-input-bg-primary); /* field fill */
3
- --aui-color-picker-fg-primary: var(--aui-input-fg-primary); /* field foreground */
4
- --aui-color-picker-fg-muted: var(--aui-input-fg-muted); /* placeholder and empty mark */
5
- --aui-color-picker-border-primary: var(--aui-input-border-primary); /* field border */
6
- --aui-color-picker-border-focus: var(--aui-input-border-focus); /* focus border */
7
- --aui-color-picker-border-danger: var(--aui-input-border-danger); /* invalid border */
8
- --aui-color-picker-radius-md: var(--aui-input-radius-md); /* field and area radius */
9
- --aui-color-picker-h-sm: var(--aui-input-h-sm); /* height sm */
10
- --aui-color-picker-h-md: var(--aui-input-h-md); /* height md */
11
- --aui-color-picker-h-lg: var(--aui-input-h-lg); /* height lg */
12
- --aui-color-picker-pad-x-sm: var(--aui-input-pad-x-sm); /* padding-x sm */
13
- --aui-color-picker-pad-x-md: var(--aui-input-pad-x-md); /* padding-x md */
14
- --aui-color-picker-pad-x-lg: var(--aui-input-pad-x-lg); /* padding-x lg */
15
- --aui-color-picker-gap-md: var(--aui-spacing-8); /* gap inside the field and the panel */
16
- --aui-color-picker-icon-size: var(--aui-spacing-16); /* clear icon size */
17
- --aui-color-picker-icon-hit: var(--aui-spacing-24); /* clear icon hit area */
18
- --aui-color-picker-clear-radius: var(--aui-control-radius-sm); /* clear button radius */
19
- --aui-color-picker-swatch-sm: var(--aui-spacing-16); /* trigger swatch sm */
20
- --aui-color-picker-swatch-md: var(--aui-spacing-20); /* trigger swatch md */
21
- --aui-color-picker-swatch-lg: var(--aui-spacing-24); /* trigger swatch lg */
22
- --aui-color-picker-swatch-radius: var(--aui-control-radius-sm); /* swatch radius */
2
+ export const docsCssVariables = `--aui-color-picker-gap-md: var(--aui-spacing-8); /* gap between area, hue, and presets */
3
+ --aui-color-picker-radius-md: var(--aui-control-radius-md); /* area and hue radius */
4
+ --aui-color-picker-swatch-radius: var(--aui-control-radius-sm); /* preset swatch radius */
23
5
  --aui-color-picker-area: calc(var(--aui-spacing) * 48); /* saturation area size */
24
6
  --aui-color-picker-slider-h: var(--aui-spacing-16); /* hue slider height */
25
7
  --aui-color-picker-thumb: var(--aui-spacing-16); /* thumb size */
26
8
  --aui-color-picker-thumb-ring: 2px; /* thumb ring width */
27
- --aui-color-picker-empty-inset: 3px; /* empty swatch slash inset */
28
9
  --aui-color-picker-thumb-border: var(--aui-surface-bg-elevated); /* thumb ring */
29
10
  --aui-color-picker-preset: var(--aui-spacing-24); /* preset swatch size */
30
- --aui-color-picker-popover-bg: var(--aui-surface-bg-elevated); /* panel fill */
31
- --aui-color-picker-popover-border: var(--aui-surface-border-primary); /* panel border */
32
- --aui-color-picker-popover-radius: var(--aui-control-radius-md); /* panel radius */
33
- --aui-color-picker-popover-pad: var(--aui-spacing-12); /* panel padding */
34
- --aui-color-picker-popover-border-w: 1px; /* panel border width */
35
- --aui-color-picker-popover-w: calc(var(--aui-color-picker-area) + 2 * var(--aui-color-picker-popover-pad) + 2 * var(--aui-color-picker-popover-border-w)); /* panel width, flush with the area */
36
- --aui-color-picker-popover-shadow: var(--aui-shadow-sm); /* panel shadow */
37
- --aui-color-picker-popover-z: var(--aui-z-dropdown); /* panel z-index */
38
- --aui-color-picker-duration-fast: var(--aui-control-duration-fast); /* transition duration */
39
- --aui-color-picker-ease-out: var(--aui-control-ease-out); /* transition easing */
11
+ --aui-color-picker-shadow: var(--aui-shadow-sm); /* thumb shadow */
40
12
  `;
@@ -2,66 +2,38 @@ import { type Ref } from 'react';
2
2
 
3
3
  import { type IDataTestIdProps } from '@ds/common';
4
4
 
5
- import { type IFieldStateProps } from '@/field/types';
6
- import { type IFormFieldLayoutProps } from '@/form/types';
7
-
8
- /** ColorPicker size. */
9
- export type TColorPickerSize = 'sm' | 'md' | 'lg';
10
-
11
- /** Visual variant. */
12
- export type TColorPickerVariant = 'primary';
13
-
14
- /** Theme inputs. */
15
- export interface IColorPickerThemeProps {
16
- /** Control size. Inside Field, inherits `Field.size` when omitted. */
17
- size?: TColorPickerSize;
18
- /** Visual variant. */
19
- variant?: TColorPickerVariant;
20
- }
21
-
22
5
  /** Own / chrome props (not from RAC). */
23
6
  export interface IColorPickerOwnProps extends IDataTestIdProps {
24
- /** Clear button for the current value. */
25
- clear?: boolean;
26
7
  /**
27
- * Preset swatches inside the popover.
8
+ * Preset swatches.
28
9
  * Values that are not colors are dropped. No row when empty.
29
10
  */
30
11
  presets?: string[];
31
- /** Class name on the root. */
12
+ /**
13
+ * Hue in degrees for a gray color.
14
+ * The field keeps it so the slider survives a closed popover.
15
+ */
16
+ hue?: number;
17
+ /** Class name on the palette root. */
32
18
  className?: string;
33
- /** Ref to the field group (React 19 prop). */
19
+ /** Ref to the palette root (React 19 prop). */
34
20
  ref?: Ref<HTMLDivElement>;
35
- /** Ref to the hex input (React 19 prop). */
36
- inputRef?: Ref<HTMLInputElement>;
37
- id?: string;
38
21
  'aria-label'?: string;
39
- 'aria-labelledby'?: string;
40
- 'aria-describedby'?: string;
41
- 'aria-invalid'?: boolean | 'true' | 'false';
42
22
  }
43
23
 
44
24
  /** Control state (our names, not RAC). */
45
25
  export interface IColorPickerControlProps {
46
- /** `#rrggbb` or `''`. */
26
+ /** `#rrggbb` or `''`. Empty shows a gray draft and is not emitted. */
47
27
  value?: string;
48
28
  /** `#rrggbb` or `''`. */
49
29
  defaultValue?: string;
50
- /** `''` or canonical `#rrggbb`. */
30
+ /** Canonical `#rrggbb`. Empty is never emitted. */
51
31
  onChange?: (value: string) => void;
52
- onBlur?: () => void;
53
- }
54
-
55
- export interface IColorPickerBaseProps
56
- extends IColorPickerThemeProps, IFieldStateProps, IColorPickerOwnProps, IColorPickerControlProps {}
57
-
58
- export interface IColorPickerProps extends IColorPickerBaseProps {}
59
-
60
- /** Content slice for FormColorPicker. */
61
- export interface IColorPickerContentProps {
62
- clear?: boolean;
63
- presets?: string[];
32
+ /** Live `#rrggbb` while the pointer is down. Not a commit. */
33
+ onPreview?: (value: string) => void;
34
+ /** Hue channel after a palette change. */
35
+ onHueChange?: (hue: number) => void;
36
+ disabled?: boolean;
64
37
  }
65
38
 
66
- export interface IFormColorPickerProps
67
- extends IFormFieldLayoutProps, Pick<IColorPickerThemeProps, 'variant'>, IColorPickerContentProps {}
39
+ export interface IColorPickerProps extends IColorPickerOwnProps, IColorPickerControlProps {}
@@ -0,0 +1,48 @@
1
+ Single-line field that formats input with an IMask pattern. The mask is passed in from outside via `opts`.
2
+
3
+ ```tsx
4
+ import { Mask, FormMask } from '@ensi-platform/admin-ui/mask';
5
+ ```
6
+
7
+ ## When to use
8
+
9
+ - phone, tax id, code, and other text whose format the app defines
10
+ - a date — see `DatePicker`
11
+ - a number — see `NumberInput`
12
+ - free text — see `Input`
13
+
14
+ ## API (short)
15
+
16
+ `value` and `onChange` carry the string as shown in the field, including mask literals. An empty field is `''`. A partial value is emitted immediately. If the mask rewrites the passed `value`, `onChange` fires once with the normalized string. Until the parent stores it, the field keeps showing `value`.
17
+
18
+ Pass the same `opts` object between renders: a constant or `useMemo`. A new object on every render makes IMask refresh the mask.
19
+
20
+ ### Mask
21
+
22
+ | Prop | Values | Default | Description |
23
+ | ------------ | -------------------- | ------- | ------------------------------------------- |
24
+ | `opts` | `FactoryOpts` | — | IMask options (`mask`, `blocks`, `prepare`) |
25
+ | `size` | `sm` \| `md` \| `lg` | `md` | size; inside Field inherits `Field.size` |
26
+ | `invalid` | `boolean` | `false` | invalid state |
27
+ | `disabled` | `boolean` | `false` | disabled |
28
+ | `readOnly` | `boolean` | `false` | visible and copyable, not editable |
29
+ | `clear` | `boolean` | `false` | clear button → `onChange` with `''` |
30
+ | `dataTestId` | `string` | — | `data-test-id` for tests |
31
+
32
+ Chrome matches `Input`. No `as`.
33
+
34
+ ### FormMask
35
+
36
+ | Prop | Values | Default | Description |
37
+ | ------------ | -------------------- | ------- | ---------------------------------- |
38
+ | `name` | `string` | — | field name in `Form` |
39
+ | `opts` | `FactoryOpts` | — | IMask options |
40
+ | `label` | `ReactNode` | — | label (`Field.Label`) |
41
+ | `hint` | `ReactNode` | — | hint |
42
+ | `clear` | `boolean` | — | clear button |
43
+ | `size` | `sm` \| `md` \| `lg` | `md` | size (on Field) |
44
+ | `disabled` | `boolean` | — | disabled |
45
+ | `readOnly` | `boolean` | — | visible and copyable, not editable |
46
+ | `dataTestId` | `string` | — | `data-test-id` for tests |
47
+
48
+ value / onChange / onBlur / validity come from `Form`.
@@ -0,0 +1,12 @@
1
+ ## Example
2
+
3
+ ```tsx
4
+ const PHONE_MASK = { mask: '+7 (000) 000-00-00' };
5
+
6
+ <Mask aria-label="Phone" opts={PHONE_MASK} clear />
7
+
8
+ <Form initialValues={{ phone: '' }} onSubmit={save}>
9
+ <FormMask name="phone" label="Phone" opts={PHONE_MASK} clear />
10
+ <Button type="submit">Save</Button>
11
+ </Form>
12
+ ```
@@ -0,0 +1,21 @@
1
+ import { type FactoryOpts } from 'imask';
2
+
3
+ import { type IFormFieldLayoutProps } from '@/form/types';
4
+ import { type IInputContentProps, type IInputProps, type IInputThemeProps } from '@/input';
5
+
6
+ /** IMask options. The mask itself is supplied by the caller. */
7
+ export interface IMaskOwnProps {
8
+ /**
9
+ * IMask factory options (`mask`, `blocks`, `prepare`, …).
10
+ * Keep the same object between renders (`useMemo` or a constant). A new object every render makes IMask refresh.
11
+ */
12
+ opts: FactoryOpts;
13
+ }
14
+
15
+ /** `value` and `onChange` always carry the masked string (not the unmasked or typed value). */
16
+ export interface IMaskProps extends IInputProps, IMaskOwnProps {}
17
+
18
+ /** Content slice for FormMask. */
19
+ export interface IMaskContentProps extends IInputContentProps, IMaskOwnProps {}
20
+
21
+ export interface IFormMaskProps extends IFormFieldLayoutProps, Pick<IInputThemeProps, 'variant'>, IMaskContentProps {}
@@ -1,92 +0,0 @@
1
- import { jsxs as O, jsx as r } from "react/jsx-runtime";
2
- import "react";
3
- import i from "classnames";
4
- import { s as k } from "./index-h8z54aFR.js";
5
- import { cva as v } from "class-variance-authority";
6
- import './assets/Component6.css';const x = 16, y = (t) => {
7
- if (t !== void 0)
8
- return typeof t == "number" ? `${t / x}rem` : t;
9
- }, z = "aub_styles-module_root_21ec5", B = "aub_styles-module_block_6b432", j = "aub_styles-module_sm_1b540", C = "aub_styles-module_md_52f28", N = "aub_styles-module_lg_f20a1", R = "aub_styles-module_iconOnly_e0c71", S = "aub_styles-module_primary_792f0", V = "aub_styles-module_secondary_b1b78", h = "aub_styles-module_danger_1f22b", E = "aub_styles-module_icon_3df5a", o = {
10
- root: z,
11
- block: B,
12
- sm: j,
13
- md: C,
14
- lg: N,
15
- iconOnly: R,
16
- primary: S,
17
- secondary: V,
18
- danger: h,
19
- icon: E
20
- }, I = v(o.root, {
21
- variants: {
22
- size: {
23
- sm: o.sm,
24
- md: o.md,
25
- lg: o.lg
26
- },
27
- variant: {
28
- primary: o.primary,
29
- secondary: o.secondary,
30
- danger: o.danger
31
- },
32
- block: {
33
- true: o.block,
34
- false: null
35
- },
36
- iconOnly: {
37
- true: o.iconOnly,
38
- false: null
39
- }
40
- },
41
- defaultVariants: {
42
- size: "md",
43
- variant: "primary",
44
- block: !1,
45
- iconOnly: !1
46
- }
47
- }), u = ({ Component: t, size: n, fill: e, className: a }) => {
48
- const l = {
49
- ...n !== void 0 && { "--icon-size": y(n) },
50
- ...e !== void 0 && { "--icon-fill": e }
51
- };
52
- return /* @__PURE__ */ r(t, { className: i(o.icon, a), style: l, "aria-hidden": !0, focusable: !1 });
53
- }, w = k(
54
- ({
55
- as: t,
56
- type: n = "button",
57
- size: e = "md",
58
- variant: a = "primary",
59
- block: l = !1,
60
- hidden: c = !1,
61
- children: m,
62
- icon: s,
63
- className: _,
64
- dataTestId: b,
65
- style: f,
66
- ...p
67
- }) => {
68
- const d = t ?? "button", g = {
69
- ...f,
70
- ...s?.indent !== void 0 && { "--button-icon-indent": y(s.indent) }
71
- };
72
- return /* @__PURE__ */ O(
73
- d,
74
- {
75
- ...d === "button" ? { type: n } : {},
76
- className: i(I({ size: e, variant: a, block: l, iconOnly: c }), _),
77
- "data-test-id": b,
78
- style: g,
79
- ...p,
80
- children: [
81
- s && !s.after ? /* @__PURE__ */ r(u, { ...s }) : null,
82
- c ? /* @__PURE__ */ r("span", { hidden: !0, children: m }) : m,
83
- s && s.after ? /* @__PURE__ */ r(u, { ...s }) : null
84
- ]
85
- }
86
- );
87
- }
88
- );
89
- export {
90
- w as B
91
- };
92
- //# sourceMappingURL=Component-C24OpTxW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Component-C24OpTxW.js","sources":["../src/ds/common/utils.ts","../src/button/theme.ts","../src/button/Component.tsx"],"sourcesContent":["/** Pixels in 1rem at the html root. */\nconst REM_PX = 16;\n\nexport const toCssSize = (value: number | string | undefined): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n\n return typeof value === 'number' ? `${value / REM_PX}rem` : value;\n};\n","import { cva } from 'class-variance-authority';\n\nimport styles from './styles.module.css';\n\nexport const buttonVariants = cva(styles.root, {\n variants: {\n size: {\n sm: styles.sm,\n md: styles.md,\n lg: styles.lg,\n },\n variant: {\n primary: styles.primary,\n secondary: styles.secondary,\n danger: styles.danger,\n },\n block: {\n true: styles.block,\n false: null,\n },\n iconOnly: {\n true: styles.iconOnly,\n false: null,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n block: false,\n iconOnly: false,\n },\n});\n","import { type CSSProperties, type ElementType } from 'react';\n\nimport cn from 'classnames';\n\nimport { supportRef } from '@ds/common/support-ref';\nimport { toCssSize } from '@ds/common/utils';\n\nimport { buttonVariants } from './theme';\nimport { type IButtonIconProps, type TButtonProps } from './types';\n\nimport styles from './styles.module.css';\n\nconst ButtonIcon = ({ Component, size, fill, className }: IButtonIconProps) => {\n const style = {\n ...(size !== undefined && { '--icon-size': toCssSize(size) }),\n ...(fill !== undefined && { '--icon-fill': fill }),\n } as CSSProperties;\n\n return <Component className={cn(styles.icon, className)} style={style} aria-hidden focusable={false} />;\n};\n\nexport const Button = supportRef(\n <P extends ElementType = 'button'>({\n as,\n type = 'button',\n size = 'md',\n variant = 'primary',\n block = false,\n hidden = false,\n children,\n icon,\n className,\n dataTestId,\n style,\n ...props\n }: TButtonProps<P>) => {\n const Component = as ?? 'button';\n\n const rootStyle = {\n ...style,\n ...(icon?.indent !== undefined && { '--button-icon-indent': toCssSize(icon.indent) }),\n } as CSSProperties;\n\n return (\n <Component\n {...(Component === 'button' ? { type } : {})}\n className={cn(buttonVariants({ size, variant, block, iconOnly: hidden }), className)}\n data-test-id={dataTestId}\n style={rootStyle}\n {...props}\n >\n {icon && !icon.after ? <ButtonIcon {...icon} /> : null}\n {hidden ? <span hidden>{children}</span> : children}\n {icon && icon.after ? <ButtonIcon {...icon} /> : null}\n </Component>\n );\n }\n);\n"],"names":["REM_PX","toCssSize","value","buttonVariants","cva","styles","ButtonIcon","Component","size","fill","className","style","jsx","cn","Button","supportRef","as","type","variant","block","hidden","children","icon","dataTestId","props","rootStyle","jsxs"],"mappings":";;;;;AACA,MAAMA,IAAS,IAEFC,IAAY,CAACC,MAA2D;AACjF,MAAIA,MAAU;AAId,WAAO,OAAOA,KAAU,WAAW,GAAGA,IAAQF,CAAM,QAAQE;AAChE;;;;;;;;;;;GCLaC,IAAiBC,EAAIC,EAAO,MAAM;AAAA,EAC3C,UAAU;AAAA,IACN,MAAM;AAAA,MACF,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,IAAA;AAAA,IAEf,SAAS;AAAA,MACL,SAASA,EAAO;AAAA,MAChB,WAAWA,EAAO;AAAA,MAClB,QAAQA,EAAO;AAAA,IAAA;AAAA,IAEnB,OAAO;AAAA,MACH,MAAMA,EAAO;AAAA,MACb,OAAO;AAAA,IAAA;AAAA,IAEX,UAAU;AAAA,MACN,MAAMA,EAAO;AAAA,MACb,OAAO;AAAA,IAAA;AAAA,EACX;AAAA,EAEJ,iBAAiB;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,EAAA;AAElB,CAAC,GCnBKC,IAAa,CAAC,EAAE,WAAAC,GAAW,MAAAC,GAAM,MAAAC,GAAM,WAAAC,QAAkC;AAC3E,QAAMC,IAAQ;AAAA,IACV,GAAIH,MAAS,UAAa,EAAE,eAAeP,EAAUO,CAAI,EAAA;AAAA,IACzD,GAAIC,MAAS,UAAa,EAAE,eAAeA,EAAA;AAAA,EAAK;AAGpD,SAAO,gBAAAG,EAACL,GAAA,EAAU,WAAWM,EAAGR,EAAO,MAAMK,CAAS,GAAG,OAAAC,GAAc,eAAW,IAAC,WAAW,GAAA,CAAO;AACzG,GAEaG,IAASC;AAAA,EAClB,CAAmC;AAAA,IAC/B,IAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,MAAAT,IAAO;AAAA,IACP,SAAAU,IAAU;AAAA,IACV,OAAAC,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAZ;AAAA,IACA,YAAAa;AAAA,IACA,OAAAZ;AAAA,IACA,GAAGa;AAAA,EAAA,MACgB;AACnB,UAAMjB,IAAYS,KAAM,UAElBS,IAAY;AAAA,MACd,GAAGd;AAAA,MACH,GAAIW,GAAM,WAAW,UAAa,EAAE,wBAAwBrB,EAAUqB,EAAK,MAAM,EAAA;AAAA,IAAE;AAGvF,WACI,gBAAAI;AAAA,MAACnB;AAAA,MAAA;AAAA,QACI,GAAIA,MAAc,WAAW,EAAE,MAAAU,EAAA,IAAS,CAAA;AAAA,QACzC,WAAWJ,EAAGV,EAAe,EAAE,MAAAK,GAAM,SAAAU,GAAS,OAAAC,GAAO,UAAUC,GAAQ,GAAGV,CAAS;AAAA,QACnF,gBAAca;AAAA,QACd,OAAOE;AAAA,QACN,GAAGD;AAAA,QAEH,UAAA;AAAA,UAAAF,KAAQ,CAACA,EAAK,0BAAShB,GAAA,EAAY,GAAGgB,GAAM,IAAK;AAAA,UACjDF,IAAS,gBAAAR,EAAC,QAAA,EAAK,QAAM,IAAE,UAAAS,GAAS,IAAUA;AAAA,UAC1CC,KAAQA,EAAK,0BAAShB,GAAA,EAAY,GAAGgB,GAAM,IAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG7D;AACJ;"}
@@ -1,6 +0,0 @@
1
- import { IFormColorPickerProps } from './types';
2
- export declare const FormColorPicker: {
3
- ({ name, label, hint, size, block, disabled, className, dataTestId, ...inputProps }: IFormColorPickerProps): import("react").JSX.Element;
4
- displayName: string;
5
- };
6
- //# sourceMappingURL=FormColorPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormColorPicker.d.ts","sourceRoot":"","sources":["../../../src/color-picker/FormColorPicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA0B7E,eAAO,MAAM,eAAe;yFAUzB,qBAAqB;;CA8BvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/color-picker/theme.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB;;;;8EAoBnC,CAAC"}