@foldkit/ui 0.158.2 → 0.159.0-canary.63fa8e97d24a

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.
@@ -51,6 +51,7 @@ export type ViewConfig<Message> = Readonly<{
51
51
  isDisabled?: boolean;
52
52
  isReadOnly?: boolean;
53
53
  isIndeterminate?: boolean;
54
+ hasDescription?: boolean;
54
55
  name?: string;
55
56
  value?: string;
56
57
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkbox/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;;;;;;;;;;sEAmBsE;AACtE,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;yEAiByE;AACzE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CA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AE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,yEAAyE;AACzE,eAAO,MAAM,OAAO,OAAQ,MAAM,KAAG,MAAuB,CAAA;AAE5D,+EAA+E;AAC/E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;UAoBU;AACV,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IA8EF,CAAA"}
@@ -26,7 +26,7 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
26
26
  * }),
27
27
  * ``` */
28
28
  export const view = (config, h) => {
29
- const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, isIndeterminate = false, name, value: formValue = 'on', } = config;
29
+ const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, isIndeterminate = false, hasDescription = false, name, value: formValue = 'on', } = config;
30
30
  const nextChecked = !isChecked;
31
31
  const handleKeyUp = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when(' ', () => __foldkitBrandViewResult((Option.some(onToggle(nextChecked))), "@foldkit/ui/checkbox/index.js#anonymous")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/checkbox/index.js#anonymous~2")))), "@foldkit/ui/checkbox/index.js#handleKeyUp");
32
32
  const resolveStateAttributes = () => {
@@ -47,12 +47,15 @@ export const view = (config, h) => {
47
47
  ? [h.AriaReadonly(true), h.DataAttribute('readonly', '')]
48
48
  : [];
49
49
  const isInteractive = !isDisabled && !isReadOnly;
50
+ const describedByAttributes = hasDescription
51
+ ? [h.AriaDescribedBy(descriptionId(id))]
52
+ : [];
50
53
  const checkboxAttributes = [
51
54
  h.Type('button'),
52
55
  h.Role('checkbox'),
53
56
  h.AriaChecked(isIndeterminate ? 'mixed' : isChecked),
54
57
  h.AriaLabelledBy(labelId(id)),
55
- h.AriaDescribedBy(descriptionId(id)),
58
+ ...describedByAttributes,
56
59
  h.Tabindex(0),
57
60
  ...resolveStateAttributes(),
58
61
  ...disabledAttributes,
@@ -81,9 +81,11 @@ type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
81
81
  /** Locks page scroll and opens the native dialog element through
82
82
  * `Dom.showDialog`, which calls `show()` (not native `showModal()`) so other
83
83
  * high-z-index overlays stay interactive. It layers the dialog with a high
84
- * z-index, traps focus, and dispatches a `cancel` event on Esc. The Dialog
85
- * component supplies its own backdrop. If the dialog element is gone by the
86
- * time the show runs, the lock is released and the Command reports
84
+ * z-index and traps focus. For an unhandled Escape on the topmost Dialog, the
85
+ * helper dispatches a `CustomEvent` named `cancel`; the Dialog view maps that
86
+ * signal to `RequestedClose` while suppressing native `cancel` events. The
87
+ * Dialog component supplies its own backdrop. If the dialog element is gone
88
+ * by the time the show runs, the lock is released and the Command reports
87
89
  * `FailedShowDialog`. A closed dialog has no `OnUnmount`, so nothing else
88
90
  * would release the lock. The update function then closes the Model. Without
89
91
  * this close, the dialog would render open with no lock and no focus trap.
@@ -176,23 +178,26 @@ export declare const close: (model: Model) => UpdateReturn;
176
178
  * calls `getElementById`, a cross-element `aria-describedby`, or a test. Do not
177
179
  * hand-roll the id string. */
178
180
  export declare const titleId: (model: Model) => string;
179
- /** Returns the framework-managed id the dialog's `aria-describedby` points at,
180
- * the `-dialog-description` suffix on `model.id`.
181
+ /** Returns the framework-managed description id, the
182
+ * `-dialog-description` suffix on `model.id`.
181
183
  *
182
184
  * The primary path is spreading `RenderInfo`'s `description` onto your
183
185
  * description element (`h.p([...description], [...])`), which carries this id
184
186
  * for you. Reach for this helper only when you need the id as a value outside
185
187
  * `toView`: a Command that calls `getElementById`, a cross-element
186
- * `aria-describedby`, or a test. Do not hand-roll the id string. */
188
+ * `aria-describedby`, or a test. When the description is rendered, set
189
+ * `ViewInputs.hasDescription` so the dialog points at this id. Do not
190
+ * hand-roll the id string. */
187
191
  export declare const descriptionId: (model: Model) => string;
188
192
  /** Render-time payload published to the consumer's `toView`.
189
193
  *
190
194
  * - `dialog`: attributes for the native `<dialog>` element. Carries
191
- * the id, ARIA labelling, `open` prop, positioning style, the
192
- * `OnCancel` handler that wires Escape to `RequestedClose`, and an
193
- * `OnUnmount` backstop that releases framework hygiene (scroll lock,
194
- * focus trap, return focus) if the element is removed from the DOM
195
- * while still open, such as navigating away from a route-keyed subtree.
195
+ * the id, ARIA labelling, `open` prop, positioning style, a `cancel` handler
196
+ * that prevents a file picker's native cancellation from closing the dialog
197
+ * while mapping `Dom.showDialog`'s Escape signal to `RequestedClose`,
198
+ * and an `OnUnmount` backstop that releases framework hygiene (scroll lock,
199
+ * focus trap, return focus) if the element is removed from the DOM while
200
+ * still open, such as navigating away from a route-keyed subtree.
196
201
  * The consumer MUST render an `h.dialog(...)` element so the framework
197
202
  * can open and close it, and so the unmount backstop can fire.
198
203
  * - `backdrop`: attributes for the backdrop element. Includes the
@@ -206,8 +211,9 @@ export declare const descriptionId: (model: Model) => string;
206
211
  * onto your heading element (`h.h2([...title], [...])`) so labelling
207
212
  * wires up without hand-rolling the id.
208
213
  * - `description`: attributes for the description element. Carries the
209
- * framework-managed id the dialog's `aria-describedby` points at. Spread
210
- * onto your description element (`h.p([...description], [...])`).
214
+ * framework-managed id referenced by `aria-describedby` when
215
+ * `ViewInputs.hasDescription` is true. Spread onto your description element
216
+ * (`h.p([...description], [...])`).
211
217
  * - `initialFocus`: attributes for the element that should receive focus when
212
218
  * the dialog opens. Spread onto that element (`h.input([...initialFocus])`).
213
219
  * A configured `focusSelector` (see `init`) takes precedence, and focus
@@ -235,11 +241,12 @@ export type RenderInfo = Readonly<{
235
241
  /** Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field. */
236
242
  export type ViewInputs = Readonly<{
237
243
  toView: (render: RenderInfo) => Html;
244
+ hasDescription?: boolean;
238
245
  }>;
239
246
  /** Renders a headless dialog component backed by the native `<dialog>`
240
247
  * element. `ShowDialog` opens it through `Dom.showDialog`, which uses `show()`
241
248
  * (not native `showModal()`) with a high z-index, a focus trap, a
242
- * component-supplied backdrop, and a `cancel` event dispatched on Esc. */
249
+ * component-supplied backdrop, and topmost-only Escape handling. */
243
250
  export declare const view: import("foldkit/submodel").View<{
244
251
  readonly id: string;
245
252
  readonly isOpen: boolean;
@@ -277,6 +284,7 @@ export declare const view: import("foldkit/submodel").View<{
277
284
  };
278
285
  }, Readonly<{
279
286
  toView: (render: RenderInfo) => Html;
287
+ hasDescription?: boolean;
280
288
  }>>;
281
289
  export {};
282
290
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAA;AAC5D,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAI9E,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAgBxC,6IAA6I;AAC7I,eAAO,MAAM,KAAK;;;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8DAA8D;AAC9D,eAAO,MAAM,OAAO;;;;;;;;;QAQK,OAAO;;;;;;;EAC9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAA;AAC/D,MAAM,MAAM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,KAAG,YACI,CAAA;AAIzC;;;;;;;+BAO+B;AAC/B,eAAO,MAAM,OAAO,UAAW,KAAK,KAAG,MAAoC,CAAA;AAE3E;;;;;;;;;+BAS+B;AAC/B,eAAO,MAAM,aAAa,UAAW,KAAK,KAAG,MACX,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAsC4B;AAC5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACrC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACvC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC1C,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC3C,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC1C,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC,CAAA;AAEF;;;qEAGqE;AACrE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YARP,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;qBACnB,OAAO;GAoGzB,CAAA"}
@@ -62,9 +62,11 @@ export const initialFocusMarkerSelector = `[data-${initialFocusMarkerAttribute}]
62
62
  /** Locks page scroll and opens the native dialog element through
63
63
  * `Dom.showDialog`, which calls `show()` (not native `showModal()`) so other
64
64
  * high-z-index overlays stay interactive. It layers the dialog with a high
65
- * z-index, traps focus, and dispatches a `cancel` event on Esc. The Dialog
66
- * component supplies its own backdrop. If the dialog element is gone by the
67
- * time the show runs, the lock is released and the Command reports
65
+ * z-index and traps focus. For an unhandled Escape on the topmost Dialog, the
66
+ * helper dispatches a `CustomEvent` named `cancel`; the Dialog view maps that
67
+ * signal to `RequestedClose` while suppressing native `cancel` events. The
68
+ * Dialog component supplies its own backdrop. If the dialog element is gone
69
+ * by the time the show runs, the lock is released and the Command reports
68
70
  * `FailedShowDialog`. A closed dialog has no `OnUnmount`, so nothing else
69
71
  * would release the lock. The update function then closes the Model. Without
70
72
  * this close, the dialog would render open with no lock and no focus trap.
@@ -226,22 +228,24 @@ export const close = (model) => __foldkitBrandViewResult((update(model, Message.
226
228
  * calls `getElementById`, a cross-element `aria-describedby`, or a test. Do not
227
229
  * hand-roll the id string. */
228
230
  export const titleId = (model) => __foldkitBrandViewResult((`${model.id}-dialog-title`), "@foldkit/ui/dialog/index.js#titleId");
229
- /** Returns the framework-managed id the dialog's `aria-describedby` points at,
230
- * the `-dialog-description` suffix on `model.id`.
231
+ /** Returns the framework-managed description id, the
232
+ * `-dialog-description` suffix on `model.id`.
231
233
  *
232
234
  * The primary path is spreading `RenderInfo`'s `description` onto your
233
235
  * description element (`h.p([...description], [...])`), which carries this id
234
236
  * for you. Reach for this helper only when you need the id as a value outside
235
237
  * `toView`: a Command that calls `getElementById`, a cross-element
236
- * `aria-describedby`, or a test. Do not hand-roll the id string. */
238
+ * `aria-describedby`, or a test. When the description is rendered, set
239
+ * `ViewInputs.hasDescription` so the dialog points at this id. Do not
240
+ * hand-roll the id string. */
237
241
  export const descriptionId = (model) => __foldkitBrandViewResult((`${model.id}-dialog-description`), "@foldkit/ui/dialog/index.js#descriptionId");
238
242
  /** Renders a headless dialog component backed by the native `<dialog>`
239
243
  * element. `ShowDialog` opens it through `Dom.showDialog`, which uses `show()`
240
244
  * (not native `showModal()`) with a high z-index, a focus trap, a
241
- * component-supplied backdrop, and a `cancel` event dispatched on Esc. */
245
+ * component-supplied backdrop, and topmost-only Escape handling. */
242
246
  export const view = defineView((model, viewInputs, h) => {
243
247
  const { id, isOpen, animation: { transitionState }, } = model;
244
- const { toView } = viewInputs;
248
+ const { toView, hasDescription = false } = viewInputs;
245
249
  const isVisible = isOpen || isLeaving(model);
246
250
  const animationAttributes = Match.value(transitionState).pipe(Match.when('EnterStart', () => __foldkitBrandViewResult(([
247
251
  h.DataAttribute('closed', ''),
@@ -258,11 +262,17 @@ export const view = defineView((model, viewInputs, h) => {
258
262
  h.DataAttribute('leave', ''),
259
263
  h.DataAttribute('transition', ''),
260
264
  ]), "@foldkit/ui/dialog/index.js#anonymous~18")), Match.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/dialog/index.js#anonymous~19")));
265
+ const describedByAttributes = hasDescription
266
+ ? [h.AriaDescribedBy(descriptionId(model))]
267
+ : [];
261
268
  const dialogAttributes = [
262
269
  h.Id(id),
263
270
  h.AriaLabelledBy(titleId(model)),
264
- h.AriaDescribedBy(descriptionId(model)),
265
- h.OnCancel(Message.RequestedClose()),
271
+ ...describedByAttributes,
272
+ // NOTE: Chromium reports canceling a file picker as a native `cancel`
273
+ // event observed by the containing dialog. Dom.showDialog uses a
274
+ // CustomEvent for its unhandled-Escape signal, so the two are separable.
275
+ h.OnCancelPreventDefault(Message.RequestedClose()),
266
276
  h.Open(isVisible),
267
277
  h.Style({
268
278
  width: '100%',
@@ -10,6 +10,7 @@ export type ViewConfig<Message> = Readonly<{
10
10
  id: string;
11
11
  toView: (attributes: FieldsetAttributes<Message>) => Html;
12
12
  isDisabled?: boolean;
13
+ hasDescription?: boolean;
13
14
  }>;
14
15
  /** Returns the legend element id, derived from the fieldset's base id. */
15
16
  export declare const legendId: (id: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fieldset/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE,4FAA4F;AAC5F,MAAM,MAAM,kB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AC1D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC,CAAA;AAEF,0EAA0E;AAC1E,eAAO,MAAM,QAAQ,OAAQ,MAAM,KAAG,MAAwB,CAAA;AAE9D,+EAA+E;AAC/E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IA0BF,CAAA"}
@@ -5,13 +5,16 @@ export const legendId = (id) => __foldkitBrandViewResult((`${id}-legend`), "@fol
5
5
  export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-description`), "@foldkit/ui/fieldset/index.js#descriptionId");
6
6
  /** Renders an accessible fieldset by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
7
7
  export const view = (config, h) => {
8
- const { toView, id, isDisabled = false } = config;
8
+ const { toView, id, isDisabled = false, hasDescription = false } = config;
9
9
  const disabledAttributes = isDisabled
10
10
  ? [h.Disabled(true), h.DataAttribute('disabled', '')]
11
11
  : [];
12
+ const describedByAttributes = hasDescription
13
+ ? [h.AriaDescribedBy(descriptionId(id))]
14
+ : [];
12
15
  const allFieldsetAttributes = [
13
16
  h.Id(id),
14
- h.AriaDescribedBy(descriptionId(id)),
17
+ ...describedByAttributes,
15
18
  ...disabledAttributes,
16
19
  ];
17
20
  const legendAttributes = [h.Id(legendId(id))];
@@ -15,6 +15,7 @@ export type ViewConfig<Message> = Readonly<{
15
15
  isReadOnly?: boolean;
16
16
  isInvalid?: boolean;
17
17
  isAutofocus?: boolean;
18
+ hasDescription?: boolean;
18
19
  name?: string;
19
20
  type?: string;
20
21
  placeholder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE,yFAAyF;AACzF,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC9C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACtD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE,+HAA+H;AAC/H,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB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CAAA"}
@@ -4,7 +4,7 @@ import { Predicate } from 'effect';
4
4
  export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-description`), "@foldkit/ui/input/index.js#descriptionId");
5
5
  /** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
6
6
  export const view = (config, h) => {
7
- const { toView, id, onInput, value, isDisabled = false, isReadOnly = false, isInvalid = false, isAutofocus = false, name, type = 'text', placeholder, } = config;
7
+ const { toView, id, onInput, value, isDisabled = false, isReadOnly = false, isInvalid = false, isAutofocus = false, hasDescription = false, name, type = 'text', placeholder, } = config;
8
8
  const disabledAttributes = isDisabled
9
9
  ? [h.Disabled(true), h.DataAttribute('disabled', '')]
10
10
  : [];
@@ -26,10 +26,13 @@ export const view = (config, h) => {
26
26
  const placeholderAttributes = Predicate.isNotUndefined(placeholder)
27
27
  ? [h.Placeholder(placeholder)]
28
28
  : [];
29
+ const describedByAttributes = hasDescription
30
+ ? [h.AriaDescribedBy(descriptionId(id))]
31
+ : [];
29
32
  const allInputAttributes = [
30
33
  h.Id(id),
31
34
  h.Type(type),
32
- h.AriaDescribedBy(descriptionId(id)),
35
+ ...describedByAttributes,
33
36
  ...disabledAttributes,
34
37
  ...readOnlyAttributes,
35
38
  ...invalidAttributes,
@@ -146,6 +146,7 @@ export type ViewInputs<Value extends string = string> = Readonly<{
146
146
  toView: (render: RenderInfo<Value>) => Html;
147
147
  orientation?: Orientation;
148
148
  isOptionDisabled?: (value: Value, index: number) => boolean;
149
+ hasOptionDescription?: (value: Value, index: number) => boolean;
149
150
  isDisabled?: boolean;
150
151
  isReadOnly?: boolean;
151
152
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radioGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,EAGP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC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AC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IAC3D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAqOF;;;sDAGsD;AACtD,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC3D,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,CACN,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;CACpE,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;sDAiBsD;AACtD,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,KAAK,CAmBpE,CAAA"}
@@ -73,7 +73,7 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
73
73
  })), "@foldkit/ui/radioGroup/index.js#update");
74
74
  const internalView = defineView((model, viewInputs, h) => {
75
75
  const { id, maybeFocusedIndex } = model;
76
- const { options, selectedValue, ariaLabel, toView, orientation = 'Vertical', isOptionDisabled: isOptionDisabledFn, isDisabled: isGroupDisabled = false, isReadOnly = false, name, } = viewInputs;
76
+ const { options, selectedValue, ariaLabel, toView, orientation = 'Vertical', isOptionDisabled: isOptionDisabledFn, hasOptionDescription: hasOptionDescriptionFn, isDisabled: isGroupDisabled = false, isReadOnly = false, name, } = viewInputs;
77
77
  const isDisabled = (index) => {
78
78
  if (isGroupDisabled) {
79
79
  return __foldkitBrandViewResult((true), "@foldkit/ui/radioGroup/index.js#isDisabled");
@@ -130,13 +130,17 @@ const internalView = defineView((model, viewInputs, h) => {
130
130
  const keyDownAttributes = isOptionDisabledNow
131
131
  ? []
132
132
  : [h.OnKeyDownPreventDefault(handleKeyDown(index))];
133
+ const describedByAttributes = Predicate.isNotUndefined(hasOptionDescriptionFn) &&
134
+ hasOptionDescriptionFn(value, index)
135
+ ? [h.AriaDescribedBy(descriptionId(id, index))]
136
+ : [];
133
137
  const optionAttributes = [
134
138
  h.Id(optionId(id, index)),
135
139
  h.Type('button'),
136
140
  h.Role('radio'),
137
141
  h.AriaChecked(isSelected),
138
142
  h.AriaLabelledBy(labelId(id, index)),
139
- h.AriaDescribedBy(descriptionId(id, index)),
143
+ ...describedByAttributes,
140
144
  h.Tabindex(isActive ? 0 : -1),
141
145
  ...checkedAttributes,
142
146
  ...activeAttributes,
@@ -14,6 +14,7 @@ export type ViewConfig<Message> = Readonly<{
14
14
  isDisabled?: boolean;
15
15
  isInvalid?: boolean;
16
16
  isAutofocus?: boolean;
17
+ hasDescription?: boolean;
17
18
  name?: string;
18
19
  }>;
19
20
  /** Returns the description element id, derived from the select's base id. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/select/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACx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CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE,gIAAgI;AAChI,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IA0DF,CAAA"}
@@ -4,7 +4,7 @@ import { Predicate } from 'effect';
4
4
  export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-description`), "@foldkit/ui/select/index.js#descriptionId");
5
5
  /** Renders an accessible select by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
6
6
  export const view = (config, h) => {
7
- const { toView, id, onChange, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, } = config;
7
+ const { toView, id, onChange, value, isDisabled = false, isInvalid = false, isAutofocus = false, hasDescription = false, name, } = config;
8
8
  const disabledAttributes = isDisabled
9
9
  ? [h.Disabled(true), h.DataAttribute('disabled', '')]
10
10
  : [];
@@ -19,9 +19,12 @@ export const view = (config, h) => {
19
19
  : [];
20
20
  const autofocusAttributes = isAutofocus ? [h.Autofocus(true)] : [];
21
21
  const nameAttributes = Predicate.isNotUndefined(name) ? [h.Name(name)] : [];
22
+ const describedByAttributes = hasDescription
23
+ ? [h.AriaDescribedBy(descriptionId(id))]
24
+ : [];
22
25
  const allSelectAttributes = [
23
26
  h.Id(id),
24
- h.AriaDescribedBy(descriptionId(id)),
27
+ ...describedByAttributes,
25
28
  ...disabledAttributes,
26
29
  ...invalidAttributes,
27
30
  ...changeAttributes,
@@ -41,6 +41,7 @@ export type ViewConfig<Message> = Readonly<{
41
41
  toView: (attributes: SwitchAttributes<Message>) => Html;
42
42
  isDisabled?: boolean;
43
43
  isReadOnly?: boolean;
44
+ hasDescription?: boolean;
44
45
  name?: string;
45
46
  value?: string;
46
47
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;sEAUsE;AACtE,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;yEAiByE;AACzE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CA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IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,OAAO,OAAQ,MAAM,KAAG,MAAuB,CAAA;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;UAoBU;AACV,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IAqEF,CAAA"}
@@ -26,7 +26,7 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
26
26
  * }),
27
27
  * ``` */
28
28
  export const view = (config, h) => {
29
- const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, name, value: formValue = 'on', } = config;
29
+ const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, hasDescription = false, name, value: formValue = 'on', } = config;
30
30
  const nextChecked = !isChecked;
31
31
  const handleKeyUp = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when(' ', () => __foldkitBrandViewResult((Option.some(onToggle(nextChecked))), "@foldkit/ui/switch/index.js#anonymous")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/switch/index.js#anonymous~2")))), "@foldkit/ui/switch/index.js#handleKeyUp");
32
32
  const checkedAttributes = isChecked ? [h.DataAttribute('checked', '')] : [];
@@ -37,12 +37,15 @@ export const view = (config, h) => {
37
37
  ? [h.AriaReadonly(true), h.DataAttribute('readonly', '')]
38
38
  : [];
39
39
  const isInteractive = !isDisabled && !isReadOnly;
40
+ const describedByAttributes = hasDescription
41
+ ? [h.AriaDescribedBy(descriptionId(id))]
42
+ : [];
40
43
  const buttonAttributes = [
41
44
  h.Type('button'),
42
45
  h.Role('switch'),
43
46
  h.AriaChecked(isChecked),
44
47
  h.AriaLabelledBy(labelId(id)),
45
- h.AriaDescribedBy(descriptionId(id)),
48
+ ...describedByAttributes,
46
49
  h.Tabindex(0),
47
50
  ...checkedAttributes,
48
51
  ...disabledAttributes,
@@ -15,6 +15,7 @@ export type ViewConfig<Message> = Readonly<{
15
15
  isReadOnly?: boolean;
16
16
  isInvalid?: boolean;
17
17
  isAutofocus?: boolean;
18
+ hasDescription?: boolean;
18
19
  name?: string;
19
20
  rows?: number;
20
21
  placeholder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/textarea/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,WAAW,EACX,iBAAiB,EAClB,MAAM,cAAc,CAAA;AAIrB,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACzD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAA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AE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,OAAQ,MAAM,KAAG,MAA6B,CAAA;AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,CAAC,OAAO,CAAC,KACxB,WAAW,CAAC,OAAO,CAAC,KACtB,IA4EF,CAAA"}
@@ -4,7 +4,7 @@ import { Predicate } from 'effect';
4
4
  export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-description`), "@foldkit/ui/textarea/index.js#descriptionId");
5
5
  /** Renders an accessible textarea by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
6
6
  export const view = (config, h) => {
7
- const { toView, id, onInput, value, isDisabled = false, isReadOnly = false, isInvalid = false, isAutofocus = false, name, rows, placeholder, } = config;
7
+ const { toView, id, onInput, value, isDisabled = false, isReadOnly = false, isInvalid = false, isAutofocus = false, hasDescription = false, name, rows, placeholder, } = config;
8
8
  const disabledAttributes = isDisabled
9
9
  ? [h.Disabled(true), h.DataAttribute('disabled', '')]
10
10
  : [];
@@ -27,9 +27,12 @@ export const view = (config, h) => {
27
27
  const placeholderAttributes = Predicate.isNotUndefined(placeholder)
28
28
  ? [h.Placeholder(placeholder)]
29
29
  : [];
30
+ const describedByAttributes = hasDescription
31
+ ? [h.AriaDescribedBy(descriptionId(id))]
32
+ : [];
30
33
  const allTextareaAttributes = [
31
34
  h.Id(id),
32
- h.AriaDescribedBy(descriptionId(id)),
35
+ ...describedByAttributes,
33
36
  ...disabledAttributes,
34
37
  ...readOnlyAttributes,
35
38
  ...invalidAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldkit/ui",
3
- "version": "0.158.2",
3
+ "version": "0.159.0-canary.63fa8e97d24a",
4
4
  "description": "Headless, accessible UI components for Foldkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -121,21 +121,21 @@
121
121
  "dist"
122
122
  ],
123
123
  "peerDependencies": {
124
- "effect": "4.0.0-rc.112",
125
- "foldkit": ">=0.155.0"
124
+ "effect": "4.0.0-rc.115",
125
+ "foldkit": "0.159.0-canary.63fa8e97d24a"
126
126
  },
127
127
  "dependencies": {
128
128
  "@floating-ui/dom": "^1.8.0"
129
129
  },
130
130
  "devDependencies": {
131
- "@effect/vitest": "4.0.0-rc.112",
132
- "effect": "4.0.0-rc.112",
131
+ "@effect/vitest": "4.0.0-rc.115",
132
+ "effect": "4.0.0-rc.115",
133
133
  "happy-dom": "^20.11.13",
134
134
  "rimraf": "^6.1.3",
135
135
  "typescript": "^7.0.2",
136
- "vitest": "^4.1.11",
137
- "@foldkit/vite-plugin": "0.20.2",
138
- "foldkit": "0.158.2"
136
+ "vitest": "^5.0.0",
137
+ "@foldkit/vite-plugin": "0.21.0-canary.63fa8e97d24a",
138
+ "foldkit": "0.159.0-canary.63fa8e97d24a"
139
139
  },
140
140
  "keywords": [
141
141
  "foldkit",