highsoft-ui 1.0.181 → 1.0.183

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/CLAUDE.md CHANGED
@@ -642,13 +642,23 @@ const items = [
642
642
  </FormRow>
643
643
  <SelectGrouped label="Country" options={[...]} />
644
644
  </FormGroup>
645
+
646
+ // Help text, or the error message in the error state
647
+ <InputGrouped label="Email" required hasError showHelpText helpText="Enter a valid email address." />
645
648
  ```
646
649
 
650
+ - **`label`** renders a real `<label for>` tied to the field. **`id`** sets the field's id (and the label's `for`); without it the component generates one with `useId`, so several fields on a page never collide.
651
+ - **`helpText`** shows under the field when **`showHelpText`** is on; with **`hasError`** it is the error message. While shown it gets the id `<field id>-help` and is added to the field's `aria-describedby`, after any ids you pass yourself.
652
+ - **`required`** draws the asterisk and sets `aria-required`. (It does not set the native `required` attribute, so the browser doesn't block submit.)
653
+
647
654
  **The FormGroup frame is static: 1px, `--HS-surface-ui-border-200`, 8px corners** — no hover state, no focus ring, no 2px step. The group is a container; each row inside previews on hover and marks focus with its own left bar, so a frame that reacted too would double up. The separators between stacked rows and between the cells of a `FormRow` use the same border-200 stroke as the frame. `InputGrouped`/`SelectGrouped` draw no frame of their own — rendered outside a `FormGroup` they have square corners and no border, by design.
648
655
 
649
656
  **Form controls share one resting stroke and one corner.** `FormGroup`, `InputSolo` (size 200), `RadioBox` and `Checkbox` all sit on a 1px `--HS-surface-ui-border-200` stroke with an 8px radius, the same corner as `Button`. `RadioBox`/`Checkbox` step to 2px when selected; `InputSolo` sizes 100/300 keep 8px/12px. A `ButtonGroup` container is deliberately rounder (10px at size 200) because it wraps 8px items with padding — a nested corner has to be larger than the one inside it, so don't flatten it to match. Transparent buttons keep an alpha stroke rather than border-200 so they hold up on tinted and dark grounds.
650
657
 
651
658
  **Accessibility:** the frame carries no state, so nothing about it needs announcing — focus lives on the field inside (`InputGrouped` shows it with its left bar and the native caret), and the radius/stroke changes touch no keyboard, ARIA or motion behaviour. `RadioBox`/`Checkbox` focus rings are drawn by the shared a11y-ring mixin at the box's own radius, so they were moved to 8px with the boxes and still hug the corners.
659
+ - **The label names the field** (WCAG 1.3.1, 4.1.2): `<label for>` + the field's `id`, not an `aria-label`, so clicking the label focuses the field natively and autofill and password managers recognise it. The asterisk is `aria-hidden`; `aria-required` carries "required", so the name is "Email", not "Email star".
660
+ - **Help and error text are read with the field** (WCAG 3.3.1): `aria-describedby` points at the shown help text, so focusing the field reads the label, then "invalid entry" from `aria-invalid` in the error state, then the message. The message is not a live region: it is read when the field gets focus, not the moment it appears. Move focus to the first invalid field on submit so it is heard.
661
+ - The label resets its own `margin` and `font-weight`, so a site's `label { … }` rules (Bootstrap's bottom margin, a theme's bold) don't shift or restyle the floating label.
652
662
 
653
663
  ### Label (formerly NewTag)
654
664
  ```tsx
@@ -1092,7 +1102,8 @@ for concrete consumer needs.
1092
1102
  <PromoBanner product="core" video title="Build something great." theme="dark" />
1093
1103
  ```
1094
1104
 
1095
- `product` accepts `core`, `stock`, `maps`, `gantt`, `dashboards`, `grid`, or `orbit`.
1105
+ `product` accepts `core`, `stock`, `maps`, `gantt`, `dashboards`, `grid`, `orbit`
1106
+ or `morningstar`.
1096
1107
  It selects approved light/dark WebP posters, VP9 and Safari HEVC-alpha videos,
1097
1108
  framing, description, price and CTA. `video` is boolean: true animates; omitted or
1098
1109
  false shows the still image. No `image`, `imageAlt`, `videoHevc`, media URL,
@@ -1102,9 +1113,21 @@ text-only banner. Product artwork is decorative and always has empty alt text.
1102
1113
  `title` defaults to "Start building today.". `title`, `description`, `price` and
1103
1114
  `action` remain content overrides; null hides description, price or action.
1104
1115
  `action` accepts `{ label, href?, onClick?, variant?, iconRight?, buttonProps? }`
1105
- and uses a size-300 success Button by default. `headingLevel` defaults to 2.
1116
+ and uses a size-300 Button in the product's CTA variant (success; danger for
1117
+ Morningstar) by default. `headingLevel` defaults to 2.
1106
1118
  `theme` optionally pins light or dark; otherwise the component follows its page.
1107
1119
 
1120
+ The per-product data is exported so wrappers don't copy it:
1121
+ `promoBannerProducts` (`PromoBannerProductDefaults[]`: `slug`, `description`,
1122
+ `price?`, `action: { label, href, variant }`) and `promoBannerFraming`
1123
+ (`Record<PromoBannerProduct, PromoBannerFraming>`: the compact card's
1124
+ `fit`/`scale`/`offsetY`, which the component sets as `--promo-banner-compact-*`).
1125
+ The WordPress block prefills its fields from the first and server-renders the
1126
+ second. Read them; don't mirror them, since a mirror goes stale silently on the
1127
+ next highsoft-ui bump. Both are plain data, so a Node build script can import
1128
+ `highsoft-ui` and generate PHP from them. The data changes nothing for
1129
+ accessibility: the component still renders the same markup.
1130
+
1108
1131
  Each five-second video plays once on visibility, then loops on hover/focus.
1109
1132
  Reduced motion and playback failure retain the poster. Offscreen/hidden-page
1110
1133
  playback pauses. The icon-only pause/play control shares VideoCover's glyphs
@@ -0,0 +1,238 @@
1
+ "use client";
2
+ import { t as e } from "./clsx-BWCAbrjV.js";
3
+ import { K as t, nt as n, q as r } from "./esm-CqcQTziN.js";
4
+ import { t as i } from "./Button-DtCIaVhq.js";
5
+ import { forwardRef as a, useCallback as o, useEffect as s, useId as c, useRef as l, useState as u } from "react";
6
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
7
+ var p = {
8
+ autofilled: "rqAgta_autofilled",
9
+ chevron: "rqAgta_chevron",
10
+ content: "rqAgta_content",
11
+ dirty: "rqAgta_dirty",
12
+ disabled: "rqAgta_disabled",
13
+ focus: "rqAgta_focus",
14
+ formGroup: "rqAgta_formGroup",
15
+ formRow: "rqAgta_formRow",
16
+ hasError: "rqAgta_hasError",
17
+ helpText: "rqAgta_helpText",
18
+ iconRight: "rqAgta_iconRight",
19
+ inputElement: "rqAgta_inputElement",
20
+ inputGrouped: "rqAgta_inputGrouped",
21
+ label: "rqAgta_label",
22
+ labelIcon: "rqAgta_labelIcon",
23
+ labelRow: "rqAgta_labelRow",
24
+ leftContent: "rqAgta_leftContent",
25
+ onAutoFillStart: "rqAgta_onAutoFillStart",
26
+ open: "rqAgta_open",
27
+ required: "rqAgta_required",
28
+ rightContent: "rqAgta_rightContent",
29
+ selectElement: "rqAgta_selectElement",
30
+ selectGrouped: "rqAgta_selectGrouped",
31
+ success: "rqAgta_success"
32
+ }, m = a(({ children: t, className: n, ...r }, i) => /* @__PURE__ */ d("form", {
33
+ ref: i,
34
+ className: e("hsui-form-group", p.formGroup, n),
35
+ ...r,
36
+ children: t
37
+ }));
38
+ m.displayName = "FormGroup";
39
+ function h({ children: t, className: n }) {
40
+ return /* @__PURE__ */ d("div", {
41
+ className: e("hsui-form-row", p.formRow, n),
42
+ children: t
43
+ });
44
+ }
45
+ function g(...e) {
46
+ return e.filter(Boolean).join(" ") || void 0;
47
+ }
48
+ var _ = a(({ label: n, required: a = !1, helpText: m, showHelpText: h = !1, labelIcon: _, iconRight: v, button: y, hasError: b = !1, success: x = !1, disabled: S = !1, className: C, wrapperClassName: w, type: T, onFocus: E, onBlur: D, onChange: O, value: k, defaultValue: A, id: j, "aria-describedby": M, ...N }, P) => {
49
+ let F = c(), I = j ?? F, L = `${I}-help`, R = h && !!m, z = l(null), B = P || z, [V, H] = u(!1), [U, W] = u(!1), [G, K] = u(!1), q = T === "password", [J, Y] = u(A === void 0 ? "" : String(A)), X = k !== void 0, Z = X ? String(k).length > 0 : J.length > 0, Q = o((e) => {
50
+ H(!0), E?.(e);
51
+ }, [E]), $ = o((e) => {
52
+ H(!1), D?.(e);
53
+ }, [D]), ee = o((e) => {
54
+ X || Y(e.target.value), O?.(e);
55
+ }, [X, O]), te = o((e) => {
56
+ e.animationName.includes("onAutoFillStart") && W(!0);
57
+ }, []);
58
+ s(() => {
59
+ let e = B.current;
60
+ if (!e) return;
61
+ let t = () => {
62
+ try {
63
+ e.matches(":-webkit-autofill") && W(!0);
64
+ } catch {}
65
+ }, n = setTimeout(t, 100), r = setTimeout(t, 500);
66
+ return () => {
67
+ clearTimeout(n), clearTimeout(r);
68
+ };
69
+ }, [B]);
70
+ let ne = o(() => {
71
+ !S && B.current && B.current.focus();
72
+ }, [S, B]), re = q && G ? "text" : T;
73
+ return /* @__PURE__ */ d("div", {
74
+ onClick: ne,
75
+ className: e("hsui-input-grouped", p.inputGrouped, {
76
+ [p.focus]: V,
77
+ [p.hasError]: b,
78
+ [p.success]: x,
79
+ [p.disabled]: S,
80
+ [p.dirty]: Z || U,
81
+ [p.autofilled]: U
82
+ }, w),
83
+ children: /* @__PURE__ */ f("div", {
84
+ className: p.content,
85
+ children: [/* @__PURE__ */ f("div", {
86
+ className: p.leftContent,
87
+ children: [
88
+ n && /* @__PURE__ */ f("div", {
89
+ className: p.labelRow,
90
+ children: [_ && /* @__PURE__ */ d("span", {
91
+ className: p.labelIcon,
92
+ children: _
93
+ }), /* @__PURE__ */ f("label", {
94
+ htmlFor: I,
95
+ className: p.label,
96
+ children: [n, a && /* @__PURE__ */ f("span", {
97
+ className: p.required,
98
+ "aria-hidden": "true",
99
+ children: [" ", "*"]
100
+ })]
101
+ })]
102
+ }),
103
+ /* @__PURE__ */ d("input", {
104
+ ref: B,
105
+ id: I,
106
+ type: re,
107
+ className: e(p.inputElement, C),
108
+ disabled: S,
109
+ "aria-required": a,
110
+ "aria-invalid": b,
111
+ "aria-describedby": g(M, R && L),
112
+ value: k,
113
+ defaultValue: A,
114
+ onFocus: Q,
115
+ onBlur: $,
116
+ onChange: ee,
117
+ onAnimationStart: te,
118
+ ...N
119
+ }),
120
+ R && /* @__PURE__ */ d("span", {
121
+ id: L,
122
+ className: p.helpText,
123
+ children: m
124
+ })
125
+ ]
126
+ }), (v || y || q) && /* @__PURE__ */ f("div", {
127
+ className: p.rightContent,
128
+ children: [
129
+ v && /* @__PURE__ */ d("span", {
130
+ className: p.iconRight,
131
+ children: v
132
+ }),
133
+ q && /* @__PURE__ */ d(i, {
134
+ type: "button",
135
+ variant: "plain",
136
+ size: 300,
137
+ onClick: (e) => {
138
+ e.stopPropagation(), K((e) => !e);
139
+ },
140
+ "aria-label": G ? "Hide password" : "Show password",
141
+ children: d(G ? t : r, {})
142
+ }),
143
+ y
144
+ ]
145
+ })]
146
+ })
147
+ });
148
+ });
149
+ _.displayName = "InputGrouped";
150
+ var v = a(({ label: t, required: r = !1, helpText: i, showHelpText: a = !1, labelIcon: s, hasError: m = !1, success: h = !1, disabled: _ = !1, className: v, wrapperClassName: y, placeholder: b, children: x, onFocus: S, onBlur: C, onChange: w, value: T, defaultValue: E, id: D, "aria-describedby": O, ...k }, A) => {
151
+ let j = c(), M = D ?? j, N = `${M}-help`, P = a && !!i, F = l(null), I = A || F, [L, R] = u(!1), [z, B] = u(!1), [V, H] = u(E === void 0 ? "" : String(E)), U = T !== void 0, W = U ? String(T).length > 0 : V.length > 0, G = o((e) => {
152
+ R(!0), S?.(e);
153
+ }, [S]), K = o((e) => {
154
+ R(!1), B(!1), C?.(e);
155
+ }, [C]), q = o((e) => {
156
+ B(!1), U || H(e.target.value), w?.(e);
157
+ }, [U, w]);
158
+ return /* @__PURE__ */ d("div", {
159
+ onClick: o((e) => {
160
+ if (!(_ || !I.current) && (B((e) => !e), e.target !== I.current)) try {
161
+ I.current.showPicker();
162
+ } catch {
163
+ let e = new MouseEvent("mousedown", {
164
+ bubbles: !0,
165
+ cancelable: !0
166
+ });
167
+ I.current.dispatchEvent(e);
168
+ }
169
+ }, [_, I]),
170
+ className: e("hsui-select-grouped", p.inputGrouped, p.selectGrouped, {
171
+ [p.focus]: L,
172
+ [p.open]: z,
173
+ [p.hasError]: m,
174
+ [p.success]: h,
175
+ [p.disabled]: _,
176
+ [p.dirty]: W
177
+ }, y),
178
+ children: /* @__PURE__ */ f("div", {
179
+ className: p.content,
180
+ children: [/* @__PURE__ */ f("div", {
181
+ className: p.leftContent,
182
+ children: [
183
+ t && /* @__PURE__ */ f("div", {
184
+ className: p.labelRow,
185
+ children: [s && /* @__PURE__ */ d("span", {
186
+ className: p.labelIcon,
187
+ children: s
188
+ }), /* @__PURE__ */ f("label", {
189
+ htmlFor: M,
190
+ className: p.label,
191
+ onClick: (e) => e.preventDefault(),
192
+ children: [t, r && /* @__PURE__ */ f("span", {
193
+ className: p.required,
194
+ "aria-hidden": "true",
195
+ children: [" ", "*"]
196
+ })]
197
+ })]
198
+ }),
199
+ /* @__PURE__ */ f("select", {
200
+ ref: I,
201
+ id: M,
202
+ className: e(p.inputElement, p.selectElement, v),
203
+ disabled: _,
204
+ "aria-required": r,
205
+ "aria-invalid": m,
206
+ "aria-describedby": g(O, P && N),
207
+ value: T,
208
+ defaultValue: E,
209
+ onFocus: G,
210
+ onBlur: K,
211
+ onChange: q,
212
+ ...k,
213
+ children: [b && /* @__PURE__ */ d("option", {
214
+ value: "",
215
+ disabled: !0,
216
+ hidden: !1,
217
+ children: b
218
+ }), x]
219
+ }),
220
+ P && /* @__PURE__ */ d("span", {
221
+ id: N,
222
+ className: p.helpText,
223
+ children: i
224
+ })
225
+ ]
226
+ }), /* @__PURE__ */ d("div", {
227
+ className: p.rightContent,
228
+ children: /* @__PURE__ */ d("span", {
229
+ className: e(p.iconRight, p.chevron),
230
+ children: /* @__PURE__ */ d(n, {})
231
+ })
232
+ })]
233
+ })
234
+ });
235
+ });
236
+ v.displayName = "SelectGrouped";
237
+ //#endregion
238
+ export { v as i, h as n, _ as r, m as t };
@@ -1,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "../../InputGrouped-y1UNKVd4.js";
1
+ import { i as e, n as t, r as n, t as r } from "../../InputGrouped-B3WGuESX.js";
2
2
  export { r as FormGroup, t as FormRow, n as InputGrouped, e as SelectGrouped };
@@ -68,7 +68,7 @@ var _ = f(({ product: f, title: _, description: v, price: y, action: b, video: x
68
68
  className: s.price,
69
69
  children: P
70
70
  }), F != null && /* @__PURE__ */ h(n, {
71
- variant: F.variant ?? (f === "morningstar" ? "danger" : "success"),
71
+ variant: F.variant ?? A?.action.variant ?? "success",
72
72
  size: 300,
73
73
  href: F.href,
74
74
  onClick: F.onClick,
@@ -94,4 +94,4 @@ var _ = f(({ product: f, title: _, description: v, price: y, action: b, video: x
94
94
  });
95
95
  _.displayName = "PromoBanner";
96
96
  //#endregion
97
- export { _ as PromoBanner };
97
+ export { _ as PromoBanner, u as promoBannerFraming, d as promoBannerProducts };
@@ -1,7 +1,8 @@
1
1
  //#region lib/components/PromoBanner/products.ts
2
2
  var e = {
3
3
  label: "Get licensed",
4
- href: "https://shop.highcharts.com/"
4
+ href: "https://shop.highcharts.com/",
5
+ variant: "success"
5
6
  }, t = [
6
7
  {
7
8
  slug: "core",
@@ -44,7 +45,8 @@ var e = {
44
45
  description: "Get your Highcharts Orbit license and add analytics to any chart.",
45
46
  action: {
46
47
  label: "Contact us",
47
- href: "https://shop.highcharts.com/contact"
48
+ href: "https://shop.highcharts.com/contact",
49
+ variant: "success"
48
50
  }
49
51
  },
50
52
  {
@@ -52,7 +54,8 @@ var e = {
52
54
  description: "Explore Morningstar integration.",
53
55
  action: {
54
56
  label: "Contact sales",
55
- href: "https://shop.highcharts.com/contact"
57
+ href: "https://shop.highcharts.com/contact",
58
+ variant: "danger"
56
59
  }
57
60
  }
58
61
  ];