@prokodo/ui 0.0.52 → 0.0.53

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 (156) hide show
  1. package/README.md +81 -81
  2. package/dist/components/accordion/Accordion.client.js +3 -1
  3. package/dist/components/accordion/Accordion.view.js +100 -81
  4. package/dist/components/animated/Animated.server.js +3 -1
  5. package/dist/components/animatedText/AnimatedText.client.js +1 -7
  6. package/dist/components/animatedText/AnimatedText.view.js +4 -1
  7. package/dist/components/avatar/Avatar.view.js +2 -2
  8. package/dist/components/base-link/BaseLink.view.js +1 -1
  9. package/dist/components/button/Button.server.js +1 -8
  10. package/dist/components/calendly/Calendly.client.js +63 -54
  11. package/dist/components/calendly/Calendly.server.js +3 -1
  12. package/dist/components/card/Card.client.js +2 -1
  13. package/dist/components/card/Card.effects.client.js +5 -1
  14. package/dist/components/card/Card.view.js +19 -2
  15. package/dist/components/carousel/Carousel.client.js +36 -12
  16. package/dist/components/chip/Chip.view.js +10 -6
  17. package/dist/components/datePicker/DatePicker.client.js +53 -37
  18. package/dist/components/datePicker/DatePicker.view.js +3 -1
  19. package/dist/components/dialog/Dialog.client.js +22 -14
  20. package/dist/components/dialog/Dialog.view.js +10 -2
  21. package/dist/components/drawer/Drawer.client.js +10 -2
  22. package/dist/components/drawer/Drawer.effects.client.js +7 -2
  23. package/dist/components/dynamic-list/DynamicList.client.js +8 -7
  24. package/dist/components/dynamic-list/DynamicList.server.js +10 -4
  25. package/dist/components/dynamic-list/DynamicList.view.js +1 -1
  26. package/dist/components/form/Form.client.js +16 -13
  27. package/dist/components/form/Form.view.js +8 -4
  28. package/dist/components/form/FormField.client.js +5 -5
  29. package/dist/components/form/FormField.server.js +3 -23
  30. package/dist/components/form/FormResponse.js +5 -1
  31. package/dist/components/grid/Grid.js +7 -2
  32. package/dist/components/grid/GridRow.js +12 -2
  33. package/dist/components/headline/Headline.js +3 -1
  34. package/dist/components/icon/Icon.js +8 -4
  35. package/dist/components/image-text/ImageText.js +5 -1
  36. package/dist/components/input/Input.client.js +52 -28
  37. package/dist/components/input/Input.view.js +92 -68
  38. package/dist/components/inputOTP/InputOTP.js +107 -90
  39. package/dist/components/label/Label.js +1 -8
  40. package/dist/components/link/Link.view.js +3 -1
  41. package/dist/components/list/List.js +94 -42
  42. package/dist/components/loading/Loading.client.js +15 -2
  43. package/dist/components/loading/Loading.server.js +8 -1
  44. package/dist/components/loading/Loading.view.js +30 -7
  45. package/dist/components/post-item/PostItem.client.js +18 -0
  46. package/dist/components/post-item/PostItem.js +7 -136
  47. package/dist/components/post-item/PostItem.lazy.js +14 -0
  48. package/dist/components/post-item/PostItem.module.scss.js +3 -1
  49. package/dist/components/post-item/PostItem.server.js +15 -0
  50. package/dist/components/post-item/PostItem.view.js +238 -0
  51. package/dist/components/post-item/PostItemAuthor.js +28 -22
  52. package/dist/components/post-teaser/PostTeaser.client.js +31 -0
  53. package/dist/components/post-teaser/PostTeaser.js +9 -169
  54. package/dist/components/post-teaser/PostTeaser.lazy.js +13 -0
  55. package/dist/components/post-teaser/PostTeaser.module.scss.js +3 -0
  56. package/dist/components/post-teaser/PostTeaser.server.js +23 -0
  57. package/dist/components/post-teaser/PostTeaser.view.js +252 -0
  58. package/dist/components/post-widget/PostWidget.client.js +9 -0
  59. package/dist/components/post-widget/PostWidget.js +11 -156
  60. package/dist/components/post-widget/PostWidget.lazy.js +13 -0
  61. package/dist/components/post-widget/PostWidget.module.scss.js +1 -0
  62. package/dist/components/post-widget/PostWidget.server.js +11 -0
  63. package/dist/components/post-widget/PostWidget.view.js +263 -0
  64. package/dist/components/post-widget-carousel/PostWidgetCarousel.client.js +9 -0
  65. package/dist/components/post-widget-carousel/PostWidgetCarousel.js +9 -160
  66. package/dist/components/post-widget-carousel/PostWidgetCarousel.lazy.js +13 -0
  67. package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +3 -0
  68. package/dist/components/post-widget-carousel/PostWidgetCarousel.server.js +11 -0
  69. package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +244 -0
  70. package/dist/components/rich-text/RichText.client.js +7 -2
  71. package/dist/components/select/Select.view.js +132 -116
  72. package/dist/components/sidenav/SideNav.client.js +19 -18
  73. package/dist/components/sidenav/SideNav.server.js +8 -1
  74. package/dist/components/sidenav/SideNav.view.js +21 -3
  75. package/dist/components/skeleton/Skeleton.effects.client.js +3 -1
  76. package/dist/components/slider/Slider.client.js +56 -38
  77. package/dist/components/slider/Slider.view.js +1 -7
  78. package/dist/components/snackbar/SnackbarProvider.client.js +21 -22
  79. package/dist/components/stepper/Stepper.client.js +1 -8
  80. package/dist/components/switch/Switch.client.js +1 -6
  81. package/dist/components/switch/Switch.server.js +1 -3
  82. package/dist/components/table/Table.js +3 -1
  83. package/dist/components/table/TableCell.js +13 -1
  84. package/dist/components/teaser/Teaser.js +1 -5
  85. package/dist/constants/project.js +1 -1
  86. package/dist/helpers/createIsland.js +3 -1
  87. package/dist/helpers/createLazyWrapper.js +3 -1
  88. package/dist/helpers/date.js +21 -0
  89. package/dist/tsconfig.build.tsbuildinfo +1 -1
  90. package/dist/types/components/accordion/Accordion.model.d.ts +1 -1
  91. package/dist/types/components/animated/Animated.client.d.ts +2 -2
  92. package/dist/types/components/animated/Animated.model.d.ts +1 -1
  93. package/dist/types/components/button/Button.client.d.ts +1 -1
  94. package/dist/types/components/button/Button.d.ts +1 -1
  95. package/dist/types/components/button/Button.lazy.d.ts +1 -1
  96. package/dist/types/components/button/Button.server.d.ts +1 -1
  97. package/dist/types/components/button/Button.view.d.ts +1 -1
  98. package/dist/types/components/card/Card.effects.client.d.ts +1 -1
  99. package/dist/types/components/card/index.d.ts +1 -1
  100. package/dist/types/components/carousel/Carousel.d.ts +3 -0
  101. package/dist/types/components/carousel/Carousel.lazy.d.ts +3 -0
  102. package/dist/types/components/carousel/Carousel.model.d.ts +4 -0
  103. package/dist/types/components/dialog/Dialog.client.d.ts +1 -1
  104. package/dist/types/components/dialog/Dialog.model.d.ts +4 -4
  105. package/dist/types/components/dialog/Dialog.view.d.ts +2 -2
  106. package/dist/types/components/drawer/Drawer.client.d.ts +1 -1
  107. package/dist/types/components/drawer/Drawer.d.ts +1 -1
  108. package/dist/types/components/drawer/Drawer.effects.client.d.ts +1 -1
  109. package/dist/types/components/drawer/Drawer.lazy.d.ts +1 -1
  110. package/dist/types/components/drawer/Drawer.model.d.ts +6 -6
  111. package/dist/types/components/drawer/Drawer.server.d.ts +1 -1
  112. package/dist/types/components/drawer/Drawer.view.d.ts +2 -2
  113. package/dist/types/components/drawer/index.d.ts +1 -1
  114. package/dist/types/components/icon/IconList.d.ts +1 -1
  115. package/dist/types/components/icon/index.d.ts +1 -1
  116. package/dist/types/components/image/Image.model.d.ts +2 -2
  117. package/dist/types/components/link/Link.d.ts +1 -1
  118. package/dist/types/components/link/Link.model.d.ts +1 -1
  119. package/dist/types/components/link/Link.server.d.ts +1 -1
  120. package/dist/types/components/loading/index.d.ts +1 -1
  121. package/dist/types/components/post-item/PostItem.client.d.ts +4 -0
  122. package/dist/types/components/post-item/PostItem.d.ts +3 -2
  123. package/dist/types/components/post-item/PostItem.lazy.d.ts +5 -0
  124. package/dist/types/components/post-item/PostItem.model.d.ts +46 -6
  125. package/dist/types/components/post-item/PostItem.server.d.ts +3 -0
  126. package/dist/types/components/post-item/PostItem.view.d.ts +3 -0
  127. package/dist/types/components/post-item/PostItemAuthor.model.d.ts +5 -8
  128. package/dist/types/components/post-item/index.d.ts +2 -2
  129. package/dist/types/components/post-teaser/PostTeaser.client.d.ts +4 -0
  130. package/dist/types/components/post-teaser/PostTeaser.d.ts +3 -2
  131. package/dist/types/components/post-teaser/PostTeaser.lazy.d.ts +5 -0
  132. package/dist/types/components/post-teaser/PostTeaser.model.d.ts +49 -3
  133. package/dist/types/components/post-teaser/PostTeaser.server.d.ts +3 -0
  134. package/dist/types/components/post-teaser/PostTeaser.view.d.ts +3 -0
  135. package/dist/types/components/post-teaser/index.d.ts +1 -1
  136. package/dist/types/components/post-widget/PostWidget.client.d.ts +4 -0
  137. package/dist/types/components/post-widget/PostWidget.d.ts +13 -3
  138. package/dist/types/components/post-widget/PostWidget.lazy.d.ts +14 -0
  139. package/dist/types/components/post-widget/PostWidget.model.d.ts +53 -3
  140. package/dist/types/components/post-widget/PostWidget.server.d.ts +3 -0
  141. package/dist/types/components/post-widget/PostWidget.view.d.ts +3 -0
  142. package/dist/types/components/post-widget/index.d.ts +1 -1
  143. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.client.d.ts +3 -0
  144. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.d.ts +11 -3
  145. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.lazy.d.ts +12 -0
  146. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.model.d.ts +39 -0
  147. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.server.d.ts +3 -0
  148. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +3 -0
  149. package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
  150. package/dist/types/components/sidenav/index.d.ts +1 -1
  151. package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +2 -2
  152. package/dist/types/helpers/createIsland.d.ts +1 -1
  153. package/dist/types/helpers/createLazyWrapper.d.ts +1 -1
  154. package/dist/types/helpers/date.d.ts +5 -0
  155. package/dist/ui.css +116 -35
  156. package/package.json +3 -2
@@ -34,9 +34,7 @@ const FormClient = memo((props) => {
34
34
  hideResponse,
35
35
  ...restProps
36
36
  } = props;
37
- const [formState, setFormState] = useState(
38
- () => fields ?? []
39
- );
37
+ const [formState, setFormState] = useState(() => fields ?? []);
40
38
  const [formMessages, setFormMessages] = useState(
41
39
  initialMessages
42
40
  );
@@ -51,7 +49,10 @@ const FormClient = memo((props) => {
51
49
  (index, update) => {
52
50
  setFormState((prev) => {
53
51
  const next = [...prev];
54
- const nextField = { ...next[index], ...update };
52
+ const nextField = {
53
+ ...next[index],
54
+ ...update
55
+ };
55
56
  next[index] = nextField;
56
57
  notifyChange(nextField);
57
58
  return next;
@@ -106,7 +107,9 @@ const FormClient = memo((props) => {
106
107
  }
107
108
  if (Array.isArray(equalTo)) {
108
109
  if (typeof v === "string" || typeof v === "number") {
109
- return equalTo.includes(v);
110
+ return equalTo.includes(
111
+ v
112
+ );
110
113
  }
111
114
  if (Array.isArray(v)) {
112
115
  const vv = v;
@@ -118,10 +121,13 @@ const FormClient = memo((props) => {
118
121
  }, "matches");
119
122
  const defaultsByName = /* @__PURE__ */ new Map();
120
123
  for (const df of defaultFields ?? []) {
121
- if (isString(df == null ? void 0 : df.name)) defaultsByName.set(df.name, df);
124
+ if (isString(df == null ? void 0 : df.name))
125
+ defaultsByName.set(df.name, df);
122
126
  }
123
127
  const conds = Array.isArray(field.conditions) ? field.conditions : [];
124
- const targetNames = Array.from(new Set(conds.map((c) => c.fieldId).filter(Boolean)));
128
+ const targetNames = Array.from(
129
+ new Set(conds.map((c) => c.fieldId).filter(Boolean))
130
+ );
125
131
  for (const targetName of targetNames) {
126
132
  const depIdx = next.findIndex((f) => f.name === targetName);
127
133
  if (depIdx < 0) continue;
@@ -177,12 +183,9 @@ const FormClient = memo((props) => {
177
183
  },
178
184
  [defaultFields, notifyChange]
179
185
  );
180
- const handleHpChange = useCallback(
181
- (e) => {
182
- setHoneypotValue(e.target.value);
183
- },
184
- []
185
- );
186
+ const handleHpChange = useCallback((e) => {
187
+ setHoneypotValue(e.target.value);
188
+ }, []);
186
189
  const validateFullForm = useCallback(() => {
187
190
  const errors = {};
188
191
  formState.forEach((field) => {
@@ -53,9 +53,13 @@ const FormView = /* @__PURE__ */ __name(({
53
53
  type: "h2",
54
54
  ...headlineProps,
55
55
  id: `${id}-heading`,
56
- className: bem("label", {
57
- "is-hidden": Boolean(hideHeadline)
58
- }, headlineProps == null ? void 0 : headlineProps.className),
56
+ className: bem(
57
+ "label",
58
+ {
59
+ "is-hidden": Boolean(hideHeadline)
60
+ },
61
+ headlineProps == null ? void 0 : headlineProps.className
62
+ ),
59
63
  children: label
60
64
  }
61
65
  ),
@@ -65,9 +69,9 @@ const FormView = /* @__PURE__ */ __name(({
65
69
  {
66
70
  ...field,
67
71
  key: field.name,
72
+ disabled: disabled !== void 0 ? disabled : field == null ? void 0 : field.disabled,
68
73
  messagesFields,
69
74
  variant,
70
- disabled: disabled !== void 0 ? disabled : field == null ? void 0 : field.disabled,
71
75
  ...fieldProps
72
76
  }
73
77
  )),
@@ -23,7 +23,10 @@ function FormFieldClient({
23
23
  ...props
24
24
  }) {
25
25
  var _a, _b, _c;
26
- const renderFieldContainer = useCallback((children) => /* @__PURE__ */ jsx(GridRow, { className: bem(), xs: 12, children }), []);
26
+ const renderFieldContainer = useCallback(
27
+ (children) => /* @__PURE__ */ jsx(GridRow, { className: bem(), xs: 12, children }),
28
+ []
29
+ );
27
30
  if (visible === false) return null;
28
31
  switch (fieldType) {
29
32
  case "switch":
@@ -103,10 +106,7 @@ function FormFieldClient({
103
106
  ...field,
104
107
  onValidate: /* @__PURE__ */ __name((_, err) => onValidate == null ? void 0 : onValidate(p, err), "onValidate")
105
108
  })),
106
- onChange: /* @__PURE__ */ __name((items) => onChange == null ? void 0 : onChange(
107
- props,
108
- items
109
- ), "onChange")
109
+ onChange: /* @__PURE__ */ __name((items) => onChange == null ? void 0 : onChange(props, items), "onChange")
110
110
  }
111
111
  )
112
112
  );
@@ -25,32 +25,12 @@ function FormFieldServer({
25
25
  switch (fieldType) {
26
26
  case "switch":
27
27
  return renderFieldContainer(
28
- /* @__PURE__ */ jsx(
29
- Switch,
30
- {
31
- color: variant,
32
- ...props
33
- }
34
- )
28
+ /* @__PURE__ */ jsx(Switch, { color: variant, ...props })
35
29
  );
36
30
  case "slider":
37
- return renderFieldContainer(
38
- /* @__PURE__ */ jsx(
39
- Slider,
40
- {
41
- ...props
42
- }
43
- )
44
- );
31
+ return renderFieldContainer(/* @__PURE__ */ jsx(Slider, { ...props }));
45
32
  case "select":
46
- return renderFieldContainer(
47
- /* @__PURE__ */ jsx(
48
- Select,
49
- {
50
- ...props
51
- }
52
- )
53
- );
33
+ return renderFieldContainer(/* @__PURE__ */ jsx(Select, { ...props }));
54
34
  case "input":
55
35
  return renderFieldContainer(
56
36
  /* @__PURE__ */ jsx(
@@ -6,7 +6,11 @@ import { isArray, isNull } from "../../helpers/validations.js";
6
6
  import styles from "./FormResponse.module.scss.js";
7
7
  import { List } from "../list/List.js";
8
8
  const bem = create(styles, "FormResponse");
9
- const FormResponse = /* @__PURE__ */ __name(({ className, messages, ...props }) => {
9
+ const FormResponse = /* @__PURE__ */ __name(({
10
+ className,
11
+ messages,
12
+ ...props
13
+ }) => {
10
14
  const errorKeys = Object.keys((messages == null ? void 0 : messages.errors) || {});
11
15
  const listItems = errorKeys.map((key) => {
12
16
  var _a, _b;
@@ -4,7 +4,12 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { create } from "../../helpers/bem.js";
5
5
  import styles from "./Grid.module.scss.js";
6
6
  const bem = create(styles, "Grid");
7
- const Grid = /* @__PURE__ */ __name((({ spacing = 2, className, children, ...props }) => /* @__PURE__ */ jsx(
7
+ const Grid = /* @__PURE__ */ __name(({
8
+ spacing = 2,
9
+ className,
10
+ children,
11
+ ...props
12
+ }) => /* @__PURE__ */ jsx(
8
13
  "div",
9
14
  {
10
15
  className: bem(void 0, void 0, className),
@@ -14,7 +19,7 @@ const Grid = /* @__PURE__ */ __name((({ spacing = 2, className, children, ...pro
14
19
  ...props,
15
20
  children
16
21
  }
17
- )), "Grid");
22
+ ), "Grid");
18
23
  Grid.displayName = "Grid";
19
24
  export {
20
25
  Grid
@@ -4,7 +4,17 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { create } from "../../helpers/bem.js";
5
5
  import styles from "./GridRow.module.scss.js";
6
6
  const bem = create(styles, "GridRow");
7
- const GridRow = /* @__PURE__ */ __name((({ align, className, children, xs, sm, md, lg, xl, ...props }) => /* @__PURE__ */ jsx(
7
+ const GridRow = /* @__PURE__ */ __name(({
8
+ align,
9
+ className,
10
+ children,
11
+ xs,
12
+ sm,
13
+ md,
14
+ lg,
15
+ xl,
16
+ ...props
17
+ }) => /* @__PURE__ */ jsx(
8
18
  "div",
9
19
  {
10
20
  className: bem(
@@ -22,7 +32,7 @@ const GridRow = /* @__PURE__ */ __name((({ align, className, children, xs, sm, m
22
32
  ...props,
23
33
  children
24
34
  }
25
- )), "GridRow");
35
+ ), "GridRow");
26
36
  GridRow.displayName = "GridRow";
27
37
  export {
28
38
  GridRow
@@ -48,7 +48,9 @@ const Headline = /* @__PURE__ */ __name(({
48
48
  }
49
49
  return /* @__PURE__ */ jsx(AnimatedText, { ...animationProps, children: text });
50
50
  }, "animateText");
51
- const renderHTag = /* @__PURE__ */ __name(({ children: headingChildren }) => {
51
+ const renderHTag = /* @__PURE__ */ __name(({
52
+ children: headingChildren
53
+ }) => {
52
54
  const HTag = type;
53
55
  const headingLevel = parseInt(type.charAt(1), 10);
54
56
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6,7 +6,7 @@ import { create } from "../../helpers/bem.js";
6
6
  import { isString } from "../../helpers/validations.js";
7
7
  import styles from "./Icon.module.scss.js";
8
8
  const bem = create(styles, "Icon");
9
- const getIconSize = /* @__PURE__ */ __name((s) => ({ xs: 15, sm: 20, md: 30, lg: 40, xl: 50 })[s] ?? (s ?? 16), "getIconSize");
9
+ const getIconSize = /* @__PURE__ */ __name((s) => ({ xs: 15, sm: 20, md: 30, lg: 40, xl: 50 })[s] ?? s ?? 16, "getIconSize");
10
10
  const iconUrl = /* @__PURE__ */ __name((n) => `https://cdn.jsdelivr.net/gh/prokodo-agency/ui@v${PROKODO_UI_VERSION}/assets/icons/${n.replace(/Icon$/, "").replace(/([a-z])([A-Z0-9])/g, "$1_$2").replace(/([0-9])([a-zA-Z])/g, "$1_$2").toLowerCase()}_icon.svg`, "iconUrl");
11
11
  const Icon = /* @__PURE__ */ __name(({
12
12
  name,
@@ -35,9 +35,13 @@ const Icon = /* @__PURE__ */ __name(({
35
35
  "aria-label": label,
36
36
  role: isString(label) ? "img" : "presentation",
37
37
  style: { ...mask },
38
- className: bem(void 0, {
39
- [`${color}`]: Boolean(color)
40
- }, className)
38
+ className: bem(
39
+ void 0,
40
+ {
41
+ [`${color}`]: Boolean(color)
42
+ },
43
+ className
44
+ )
41
45
  }
42
46
  );
43
47
  }, "Icon");
@@ -42,7 +42,11 @@ const ImageText = /* @__PURE__ */ __name(({
42
42
  type: "h3",
43
43
  variant: "primary",
44
44
  ...subTitleProps,
45
- className: bem("sub__headline", void 0, subTitleProps == null ? void 0 : subTitleProps.className),
45
+ className: bem(
46
+ "sub__headline",
47
+ void 0,
48
+ subTitleProps == null ? void 0 : subTitleProps.className
49
+ ),
46
50
  children: subTitle
47
51
  }
48
52
  ),
@@ -69,34 +69,58 @@ function InputClient({
69
69
  onChange
70
70
  ]
71
71
  );
72
- const handleFocus = useCallback((e) => {
73
- setFocused(true);
74
- onFocus == null ? void 0 : onFocus(e);
75
- }, [onFocus]);
76
- const handleBlur = useCallback((e) => {
77
- setFocused(false);
78
- onBlur == null ? void 0 : onBlur(e);
79
- }, [onBlur]);
80
- const viewBase = useMemo(() => ({
81
- ...rest,
82
- name,
83
- isFocused: isFocused !== void 0 ? Boolean(isFocused) : focused,
84
- value: val,
85
- errorText: err,
86
- required,
87
- // keep required
88
- min,
89
- // ← if you want DOM to know about min
90
- max,
91
- // ← and max
92
- maxLength,
93
- // ← and maxLength (used by view counter)
94
- readOnly,
95
- // ← if you ever pass readOnly to client too
96
- onChange: handleChange,
97
- onFocus: handleFocus,
98
- onBlur: handleBlur
99
- }), [isFocused, focused, val, err, name, required, min, max, maxLength, readOnly, handleChange, handleFocus, handleBlur, rest]);
72
+ const handleFocus = useCallback(
73
+ (e) => {
74
+ setFocused(true);
75
+ onFocus == null ? void 0 : onFocus(e);
76
+ },
77
+ [onFocus]
78
+ );
79
+ const handleBlur = useCallback(
80
+ (e) => {
81
+ setFocused(false);
82
+ onBlur == null ? void 0 : onBlur(e);
83
+ },
84
+ [onBlur]
85
+ );
86
+ const viewBase = useMemo(
87
+ () => ({
88
+ ...rest,
89
+ name,
90
+ isFocused: isFocused !== void 0 ? Boolean(isFocused) : focused,
91
+ value: val,
92
+ errorText: err,
93
+ required,
94
+ // ← keep required
95
+ min,
96
+ // ← if you want DOM to know about min
97
+ max,
98
+ // ← and max
99
+ maxLength,
100
+ // ← and maxLength (used by view counter)
101
+ readOnly,
102
+ // ← if you ever pass readOnly to client too
103
+ onChange: handleChange,
104
+ onFocus: handleFocus,
105
+ onBlur: handleBlur
106
+ }),
107
+ [
108
+ isFocused,
109
+ focused,
110
+ val,
111
+ err,
112
+ name,
113
+ required,
114
+ min,
115
+ max,
116
+ maxLength,
117
+ readOnly,
118
+ handleChange,
119
+ handleFocus,
120
+ handleBlur,
121
+ rest
122
+ ]
123
+ );
100
124
  const viewProps = Boolean(multiline) ? {
101
125
  ...viewBase,
102
126
  multiline: true
@@ -53,83 +53,107 @@ function InputView({
53
53
  htmlFor: name,
54
54
  label,
55
55
  required,
56
- className: bem("label", {
57
- "is-focused": Boolean(isFocused) || hasValue
58
- }, labelProps.className)
59
- }
60
- ),
61
- /* @__PURE__ */ jsx("div", { className: bem("field", void 0, fieldClassName), children: /* @__PURE__ */ jsx("div", { className: bem("input", {
62
- "is-focused": Boolean(isFocused),
63
- disabled: Boolean(disabled),
64
- multiline: Boolean(multiline),
65
- fullWidth: Boolean(fullWidth)
66
- }, inputContainerClassName), children: Boolean(multiline) ? /* @__PURE__ */ jsx(
67
- "textarea",
68
- {
69
- ...rest,
70
- ref: inputRef,
71
- "aria-describedby": describedBy,
72
- "aria-invalid": isError,
73
- "aria-required": required,
74
- className: bem("input__node", { multiline: true }, inputClassName),
75
- disabled,
76
- id: name,
77
- name,
78
- placeholder,
79
- required: Boolean(required),
80
- rows,
81
- value: value ?? ""
82
- }
83
- ) : /* @__PURE__ */ jsx(
84
- "input",
85
- {
86
- ...rest,
87
- ref: inputRef,
88
- "aria-describedby": describedBy,
89
- "aria-invalid": isError,
90
- "aria-required": required,
91
- disabled,
92
- id: name,
93
- name,
94
- placeholder,
95
- required: Boolean(required),
96
- type,
97
- value: value ?? "",
98
56
  className: bem(
99
- "input__node",
100
- { multiline: false },
101
- inputClassName
57
+ "label",
58
+ {
59
+ "is-focused": Boolean(isFocused) || hasValue
60
+ },
61
+ labelProps.className
102
62
  )
103
63
  }
104
- ) }) })
105
- ] }),
106
- (isError || hasHelperText || typeof maxLength === "number") && /* @__PURE__ */ jsxs("div", { className: bem("footer", {
107
- "counter-only": !hasHelperText && typeof maxLength === "number"
108
- }), children: [
109
- (isError || hasHelperText) && /* @__PURE__ */ jsx(
64
+ ),
65
+ /* @__PURE__ */ jsx("div", { className: bem("field", void 0, fieldClassName), children: /* @__PURE__ */ jsx(
110
66
  "div",
111
67
  {
112
- "aria-live": isError ? "assertive" : "polite",
113
- className: bem("helperText"),
114
- id: errorId ?? helperId,
115
- role: isError ? "alert" : void 0,
116
- children: /* @__PURE__ */ jsx(
117
- "span",
68
+ className: bem(
69
+ "input",
70
+ {
71
+ "is-focused": Boolean(isFocused),
72
+ disabled: Boolean(disabled),
73
+ multiline: Boolean(multiline),
74
+ fullWidth: Boolean(fullWidth)
75
+ },
76
+ inputContainerClassName
77
+ ),
78
+ children: Boolean(multiline) ? /* @__PURE__ */ jsx(
79
+ "textarea",
80
+ {
81
+ ...rest,
82
+ ref: inputRef,
83
+ "aria-describedby": describedBy,
84
+ "aria-invalid": isError,
85
+ "aria-required": required,
86
+ disabled,
87
+ id: name,
88
+ name,
89
+ placeholder,
90
+ required: Boolean(required),
91
+ rows,
92
+ value: value ?? "",
93
+ className: bem(
94
+ "input__node",
95
+ { multiline: true },
96
+ inputClassName
97
+ )
98
+ }
99
+ ) : /* @__PURE__ */ jsx(
100
+ "input",
118
101
  {
119
- className: bem("helperText__content", {
120
- "is-error": isError
121
- }),
122
- children: errorText ?? helperText
102
+ ...rest,
103
+ ref: inputRef,
104
+ "aria-describedby": describedBy,
105
+ "aria-invalid": isError,
106
+ "aria-required": required,
107
+ disabled,
108
+ id: name,
109
+ name,
110
+ placeholder,
111
+ required: Boolean(required),
112
+ type,
113
+ value: value ?? "",
114
+ className: bem(
115
+ "input__node",
116
+ { multiline: false },
117
+ inputClassName
118
+ )
123
119
  }
124
120
  )
125
121
  }
126
- ),
127
- !Boolean(hideCounter) && typeof maxLength === "number" && /* @__PURE__ */ jsx("div", { className: bem("counter"), children: /* @__PURE__ */ jsxs("span", { children: [
128
- value != null ? String(value).length : 0,
129
- " / ",
130
- maxLength
131
- ] }) })
132
- ] })
122
+ ) })
123
+ ] }),
124
+ (isError || hasHelperText || typeof maxLength === "number") && /* @__PURE__ */ jsxs(
125
+ "div",
126
+ {
127
+ className: bem("footer", {
128
+ "counter-only": !hasHelperText && typeof maxLength === "number"
129
+ }),
130
+ children: [
131
+ (isError || hasHelperText) && /* @__PURE__ */ jsx(
132
+ "div",
133
+ {
134
+ "aria-live": isError ? "assertive" : "polite",
135
+ className: bem("helperText"),
136
+ id: errorId ?? helperId,
137
+ role: isError ? "alert" : void 0,
138
+ children: /* @__PURE__ */ jsx(
139
+ "span",
140
+ {
141
+ className: bem("helperText__content", {
142
+ "is-error": isError
143
+ }),
144
+ children: errorText ?? helperText
145
+ }
146
+ )
147
+ }
148
+ ),
149
+ !Boolean(hideCounter) && typeof maxLength === "number" && /* @__PURE__ */ jsx("div", { className: bem("counter"), children: /* @__PURE__ */ jsxs("span", { children: [
150
+ value != null ? String(value).length : 0,
151
+ " / ",
152
+ maxLength
153
+ ] }) })
154
+ ]
155
+ }
156
+ )
133
157
  ] });
134
158
  }
135
159
  __name(InputView, "InputView");