foldkit 0.29.0 → 0.31.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 (50) hide show
  1. package/dist/ui/anchor.d.ts.map +1 -1
  2. package/dist/ui/anchor.js +5 -1
  3. package/dist/ui/button/index.d.ts +17 -0
  4. package/dist/ui/button/index.d.ts.map +1 -0
  5. package/dist/ui/button/index.js +22 -0
  6. package/dist/ui/button/public.d.ts +3 -0
  7. package/dist/ui/button/public.d.ts.map +1 -0
  8. package/dist/ui/button/public.js +1 -0
  9. package/dist/ui/combobox/shared.d.ts.map +1 -1
  10. package/dist/ui/combobox/shared.js +5 -1
  11. package/dist/ui/dialog/index.d.ts +14 -5
  12. package/dist/ui/dialog/index.d.ts.map +1 -1
  13. package/dist/ui/dialog/index.js +96 -20
  14. package/dist/ui/dialog/public.d.ts +1 -1
  15. package/dist/ui/dialog/public.d.ts.map +1 -1
  16. package/dist/ui/dialog/public.js +1 -1
  17. package/dist/ui/disclosure/index.d.ts.map +1 -1
  18. package/dist/ui/disclosure/index.js +3 -5
  19. package/dist/ui/fieldset/index.d.ts +21 -0
  20. package/dist/ui/fieldset/index.d.ts.map +1 -0
  21. package/dist/ui/fieldset/index.js +25 -0
  22. package/dist/ui/fieldset/public.d.ts +3 -0
  23. package/dist/ui/fieldset/public.d.ts.map +1 -0
  24. package/dist/ui/fieldset/public.js +1 -0
  25. package/dist/ui/index.d.ts +5 -0
  26. package/dist/ui/index.d.ts.map +1 -1
  27. package/dist/ui/index.js +5 -0
  28. package/dist/ui/input/index.d.ts +28 -0
  29. package/dist/ui/input/index.d.ts.map +1 -0
  30. package/dist/ui/input/index.js +44 -0
  31. package/dist/ui/input/public.d.ts +3 -0
  32. package/dist/ui/input/public.d.ts.map +1 -0
  33. package/dist/ui/input/public.js +1 -0
  34. package/dist/ui/listbox/public.d.ts +1 -1
  35. package/dist/ui/listbox/public.d.ts.map +1 -1
  36. package/dist/ui/menu/public.d.ts +1 -1
  37. package/dist/ui/menu/public.d.ts.map +1 -1
  38. package/dist/ui/select/index.d.ts +26 -0
  39. package/dist/ui/select/index.d.ts.map +1 -0
  40. package/dist/ui/select/index.js +41 -0
  41. package/dist/ui/select/public.d.ts +3 -0
  42. package/dist/ui/select/public.d.ts.map +1 -0
  43. package/dist/ui/select/public.js +1 -0
  44. package/dist/ui/textarea/index.d.ts +28 -0
  45. package/dist/ui/textarea/index.d.ts.map +1 -0
  46. package/dist/ui/textarea/index.js +45 -0
  47. package/dist/ui/textarea/public.d.ts +3 -0
  48. package/dist/ui/textarea/public.d.ts.map +1 -0
  49. package/dist/ui/textarea/public.js +1 -0
  50. package/package.json +21 -1
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAmBF,2SAA2S;AAC3S,eAAO,MAAM,WAAW,GAAI,QAAQ;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,KAAG,QAAQ,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC,CAuEC,CAAA"}
1
+ {"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAmBF,2SAA2S;AAC3S,eAAO,MAAM,WAAW,GAAI,QAAQ;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,KAAG,QAAQ,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC,CA2EC,CAAA"}
package/dist/ui/anchor.js CHANGED
@@ -36,8 +36,12 @@ export const anchorHooks = (config) => ({
36
36
  flip({ padding: padding ?? 0 }),
37
37
  shift({ padding: padding ?? 0 }),
38
38
  size({
39
- apply({ rects }) {
39
+ padding: padding ?? 0,
40
+ apply({ rects, availableHeight }) {
40
41
  items.style.setProperty('--button-width', `${rects.reference.width}px`);
42
+ items.style.maxHeight = `${availableHeight}px`;
43
+ items.style.overflowY = 'auto';
44
+ items.style.overscrollBehavior = 'none';
41
45
  },
42
46
  }),
43
47
  ],
@@ -0,0 +1,17 @@
1
+ import type { Attribute } from '../../html';
2
+ import type { Html } from '../../html';
3
+ /** Attribute groups the button component provides to the consumer's `toView` callback. */
4
+ export type ButtonAttributes<Message> = Readonly<{
5
+ button: ReadonlyArray<Attribute<Message>>;
6
+ }>;
7
+ /** Configuration for rendering a button with `view`. */
8
+ export type ViewConfig<Message> = Readonly<{
9
+ toView: (attributes: ButtonAttributes<Message>) => Html;
10
+ onClick?: Message;
11
+ isDisabled?: boolean;
12
+ type?: 'button' | 'submit' | 'reset';
13
+ isAutofocus?: boolean;
14
+ }>;
15
+ /** Renders an accessible button by building attribute groups and delegating layout to the consumer's `toView` callback. */
16
+ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/button/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC1C,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC,CAAA;AAEF,2HAA2H;AAC3H,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAgC3D,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Predicate } from 'effect';
2
+ import { html } from '../../html';
3
+ /** Renders an accessible button by building attribute groups and delegating layout to the consumer's `toView` callback. */
4
+ export const view = (config) => {
5
+ const { Autofocus, AriaDisabled, DataAttribute, OnClick, Tabindex, Type } = html();
6
+ const { toView, onClick, isDisabled = false, type = 'button', isAutofocus = false, } = config;
7
+ const disabledAttributes = isDisabled
8
+ ? [AriaDisabled(true), DataAttribute('disabled', '')]
9
+ : [];
10
+ const clickAttributes = Predicate.isNotUndefined(onClick) && !isDisabled ? [OnClick(onClick)] : [];
11
+ const autofocusAttributes = isAutofocus ? [Autofocus(true)] : [];
12
+ const buttonAttributes = [
13
+ Type(type),
14
+ Tabindex(0),
15
+ ...disabledAttributes,
16
+ ...clickAttributes,
17
+ ...autofocusAttributes,
18
+ ];
19
+ return toView({
20
+ button: buttonAttributes,
21
+ });
22
+ };
@@ -0,0 +1,3 @@
1
+ export { view } from './index';
2
+ export type { ViewConfig, ButtonAttributes } from './index';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/button/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export { view } from './index';
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAEN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,YAAY,CAAA;AAK5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,CAAA;AAI1B,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,oCAAmC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,oKAAoK;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OAAO,EAAE,IAAI,SAAS,MAAM,EAC3B,QAAQ,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAC3C,IA6fF,CAAA"}
@@ -464,7 +464,11 @@ export const makeView = (behavior) => (config) => {
464
464
  item: itemToValue(item, index),
465
465
  displayText: itemToDisplayText(item, index),
466
466
  }))),
467
- OnPointerMove((screenX, screenY, pointerType) => OptionExt.when(pointerType !== 'touch', toMessage(MovedPointerOverItem({ index, screenX, screenY })))),
467
+ ...(isActiveItem
468
+ ? []
469
+ : [
470
+ OnPointerMove((screenX, screenY, pointerType) => OptionExt.when(pointerType !== 'touch', toMessage(MovedPointerOverItem({ index, screenX, screenY })))),
471
+ ]),
468
472
  OnPointerLeave(pointerType => OptionExt.when(pointerType !== 'touch', toMessage(DeactivatedItem()))),
469
473
  ]
470
474
  : []),
@@ -1,10 +1,12 @@
1
1
  import { Schema as S } from 'effect';
2
2
  import type { Command } from '../../command';
3
3
  import type { Html } from '../../html';
4
- /** Schema for the dialog component's state, tracking its unique ID and open/closed status. */
4
+ /** Schema for the dialog component's state, tracking its unique ID, open/closed status, animation support, and transition phase. */
5
5
  export declare const Model: S.Struct<{
6
6
  id: typeof S.String;
7
7
  isOpen: typeof S.Boolean;
8
+ isAnimated: typeof S.Boolean;
9
+ transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
8
10
  }>;
9
11
  export type Model = typeof Model.Type;
10
12
  /** Sent when the dialog should open. Triggers the showModal command. */
@@ -13,21 +15,27 @@ export declare const Opened: import("../../schema").CallableTaggedStruct<"Opened
13
15
  export declare const Closed: import("../../schema").CallableTaggedStruct<"Closed", {}>;
14
16
  /** Placeholder message used when no action is needed, such as after a showModal or closeModal command completes. */
15
17
  export declare const NoOp: import("../../schema").CallableTaggedStruct<"NoOp", {}>;
18
+ /** Sent internally when a double-rAF completes, advancing the transition to its animating phase. */
19
+ export declare const AdvancedTransitionFrame: import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>;
20
+ /** Sent internally when all CSS transitions on the dialog panel have completed. */
21
+ export declare const EndedTransition: import("../../schema").CallableTaggedStruct<"EndedTransition", {}>;
16
22
  /** Union of all messages the dialog component can produce. */
17
- export declare const Message: S.Union<[import("../../schema").CallableTaggedStruct<"Opened", {}>, import("../../schema").CallableTaggedStruct<"Closed", {}>, import("../../schema").CallableTaggedStruct<"NoOp", {}>]>;
23
+ export declare const Message: S.Union<[import("../../schema").CallableTaggedStruct<"Opened", {}>, import("../../schema").CallableTaggedStruct<"Closed", {}>, import("../../schema").CallableTaggedStruct<"NoOp", {}>, import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedTransition", {}>]>;
18
24
  export type Opened = typeof Opened.Type;
19
25
  export type Closed = typeof Closed.Type;
20
26
  export type NoOp = typeof NoOp.Type;
21
27
  export type Message = typeof Message.Type;
22
- /** Configuration for creating a dialog model with `init`. */
28
+ /** Configuration for creating a dialog model with `init`. `isAnimated` enables CSS transition coordination (default `false`). */
23
29
  export type InitConfig = Readonly<{
24
30
  id: string;
25
31
  isOpen?: boolean;
32
+ isAnimated?: boolean;
26
33
  }>;
27
- /** Creates an initial dialog model from a config. Defaults to closed. */
34
+ /** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
28
35
  export declare const init: (config: InitConfig) => Model;
36
+ type UpdateReturn = [Model, ReadonlyArray<Command<Message>>];
29
37
  /** Processes a dialog message and returns the next model and commands. */
30
- export declare const update: (model: Model, message: Message) => [Model, ReadonlyArray<Command<Message>>];
38
+ export declare const update: (model: Model, message: Message) => UpdateReturn;
31
39
  /** Returns the ID used for `aria-labelledby` on the dialog. Apply this to your title element. */
32
40
  export declare const titleId: (model: Model) => string;
33
41
  /** Returns the ID used for `aria-describedby` on the dialog. Apply this to your description element. */
@@ -46,4 +54,5 @@ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
46
54
  /** Creates a memoized dialog view. Static config is captured in a closure;
47
55
  * only `model` and `toMessage` are compared per render via `createLazy`. */
48
56
  export declare const lazy: <Message>(staticConfig: Omit<ViewConfig<Message>, "model" | "toMessage">) => ((model: Model, toMessage: ViewConfig<Message>["toMessage"]) => Html);
57
+ export {};
49
58
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQtC,8FAA8F;AAC9F,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,wEAAwE;AACxE,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,wHAAwH;AACxH,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,oHAAoH;AACpH,eAAO,MAAM,IAAI,yDAAY,CAAA;AAE7B,8DAA8D;AAC9D,eAAO,MAAM,OAAO,0LAAgC,CAAA;AAEpD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF,yEAAyE;AACzE,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KA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wGAAwG;AACxG,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,KAAG,MAAmC,CAAA;AAEhF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAA;IAC9C,YAAY,EAAE,IAAI,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,sGAAsG;AACtG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA4E3D,CAAA;AAED;6EAC6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,KAC7D,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAgBtE,CAAA"}
@@ -1,14 +1,18 @@
1
- import { Effect, Match as M, Option, Schema as S } from 'effect';
1
+ import { Array, Effect, Match as M, Option, Schema as S } from 'effect';
2
+ import { OptionExt } from '../../effectExtensions';
2
3
  import { html } from '../../html';
3
4
  import { createLazy } from '../../html/lazy';
4
5
  import { m } from '../../message';
5
6
  import { evo } from '../../struct';
6
7
  import * as Task from '../../task';
8
+ import { TransitionState } from '../transition';
7
9
  // MODEL
8
- /** Schema for the dialog component's state, tracking its unique ID and open/closed status. */
10
+ /** Schema for the dialog component's state, tracking its unique ID, open/closed status, animation support, and transition phase. */
9
11
  export const Model = S.Struct({
10
12
  id: S.String,
11
13
  isOpen: S.Boolean,
14
+ isAnimated: S.Boolean,
15
+ transitionState: TransitionState,
12
16
  });
13
17
  // MESSAGE
14
18
  /** Sent when the dialog should open. Triggers the showModal command. */
@@ -17,27 +21,78 @@ export const Opened = m('Opened');
17
21
  export const Closed = m('Closed');
18
22
  /** Placeholder message used when no action is needed, such as after a showModal or closeModal command completes. */
19
23
  export const NoOp = m('NoOp');
24
+ /** Sent internally when a double-rAF completes, advancing the transition to its animating phase. */
25
+ export const AdvancedTransitionFrame = m('AdvancedTransitionFrame');
26
+ /** Sent internally when all CSS transitions on the dialog panel have completed. */
27
+ export const EndedTransition = m('EndedTransition');
20
28
  /** Union of all messages the dialog component can produce. */
21
- export const Message = S.Union(Opened, Closed, NoOp);
22
- /** Creates an initial dialog model from a config. Defaults to closed. */
29
+ export const Message = S.Union(Opened, Closed, NoOp, AdvancedTransitionFrame, EndedTransition);
30
+ /** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
23
31
  export const init = (config) => ({
24
32
  id: config.id,
25
33
  isOpen: config.isOpen ?? false,
34
+ isAnimated: config.isAnimated ?? false,
35
+ transitionState: 'Idle',
26
36
  });
27
37
  // UPDATE
28
38
  const dialogSelector = (id) => `#${id}`;
39
+ const panelSelector = (id) => `#${id}-panel`;
40
+ const withUpdateReturn = M.withReturnType();
29
41
  /** Processes a dialog message and returns the next model and commands. */
30
- export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
31
- Opened: () => {
32
- const maybeShow = Option.liftPredicate(Task.showModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => !model.isOpen);
33
- return [evo(model, { isOpen: () => true }), Option.toArray(maybeShow)];
34
- },
35
- Closed: () => {
36
- const maybeClose = Option.liftPredicate(Task.closeModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => model.isOpen);
37
- return [evo(model, { isOpen: () => false }), Option.toArray(maybeClose)];
38
- },
39
- NoOp: () => [model, []],
40
- }));
42
+ export const update = (model, message) => {
43
+ const maybeNextFrame = OptionExt.when(model.isAnimated, Task.nextFrame.pipe(Effect.as(AdvancedTransitionFrame())));
44
+ return M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
45
+ Opened: () => {
46
+ const maybeShow = Option.liftPredicate(Task.showModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => !model.isOpen);
47
+ return [
48
+ evo(model, {
49
+ isOpen: () => true,
50
+ transitionState: () => (model.isAnimated ? 'EnterStart' : 'Idle'),
51
+ }),
52
+ Array.getSomes([maybeShow, maybeNextFrame]),
53
+ ];
54
+ },
55
+ Closed: () => {
56
+ const isLeaving = model.transitionState === 'LeaveStart' ||
57
+ model.transitionState === 'LeaveAnimating';
58
+ if (isLeaving) {
59
+ return [model, []];
60
+ }
61
+ if (model.isAnimated) {
62
+ return [
63
+ evo(model, {
64
+ isOpen: () => false,
65
+ transitionState: () => 'LeaveStart',
66
+ }),
67
+ Option.toArray(maybeNextFrame),
68
+ ];
69
+ }
70
+ const maybeClose = Option.liftPredicate(Task.closeModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => model.isOpen);
71
+ return [evo(model, { isOpen: () => false }), Option.toArray(maybeClose)];
72
+ },
73
+ AdvancedTransitionFrame: () => M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterStart', () => [
74
+ evo(model, { transitionState: () => 'EnterAnimating' }),
75
+ [
76
+ Task.waitForTransitions(panelSelector(model.id)).pipe(Effect.as(EndedTransition())),
77
+ ],
78
+ ]), M.when('LeaveStart', () => [
79
+ evo(model, { transitionState: () => 'LeaveAnimating' }),
80
+ [
81
+ Task.waitForTransitions(panelSelector(model.id)).pipe(Effect.as(EndedTransition())),
82
+ ],
83
+ ]), M.orElse(() => [model, []])),
84
+ EndedTransition: () => M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterAnimating', () => [
85
+ evo(model, { transitionState: () => 'Idle' }),
86
+ [],
87
+ ]), M.when('LeaveAnimating', () => [
88
+ evo(model, { transitionState: () => 'Idle' }),
89
+ [
90
+ Task.closeModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())),
91
+ ],
92
+ ]), M.orElse(() => [model, []])),
93
+ NoOp: () => [model, []],
94
+ }));
95
+ };
41
96
  // VIEW
42
97
  /** Returns the ID used for `aria-labelledby` on the dialog. Apply this to your title element. */
43
98
  export const titleId = (model) => `${model.id}-title`;
@@ -46,18 +101,39 @@ export const descriptionId = (model) => `${model.id}-description`;
46
101
  /** Renders a headless dialog component backed by the native `<dialog>` element with `showModal()`. */
47
102
  export const view = (config) => {
48
103
  const { AriaDescribedBy, AriaLabelledBy, Class, DataAttribute, Id, OnCancel, OnClick, keyed, } = html();
49
- const { model: { id, isOpen }, toMessage, panelContent, panelClassName, backdropClassName, className, } = config;
104
+ const { model: { id, isOpen, transitionState }, toMessage, panelContent, panelClassName, backdropClassName, className, } = config;
105
+ const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
106
+ const isVisible = isOpen || isLeaving;
107
+ const transitionAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => [
108
+ DataAttribute('closed', ''),
109
+ DataAttribute('enter', ''),
110
+ DataAttribute('transition', ''),
111
+ ]), M.when('EnterAnimating', () => [
112
+ DataAttribute('enter', ''),
113
+ DataAttribute('transition', ''),
114
+ ]), M.when('LeaveStart', () => [
115
+ DataAttribute('leave', ''),
116
+ DataAttribute('transition', ''),
117
+ ]), M.when('LeaveAnimating', () => [
118
+ DataAttribute('closed', ''),
119
+ DataAttribute('leave', ''),
120
+ DataAttribute('transition', ''),
121
+ ]), M.orElse(() => []));
50
122
  const dialogAttributes = [
51
123
  Id(id),
52
124
  AriaLabelledBy(`${id}-title`),
53
125
  AriaDescribedBy(`${id}-description`),
54
126
  OnCancel(toMessage(Closed())),
55
- ...(isOpen ? [DataAttribute('open', '')] : []),
127
+ ...(isVisible ? [DataAttribute('open', '')] : []),
56
128
  ...(className ? [Class(className)] : []),
57
129
  ];
58
- const backdrop = keyed('div')(`${id}-backdrop`, [Class(backdropClassName), OnClick(toMessage(Closed()))], []);
59
- const panel = keyed('div')(`${id}-panel`, [Class(panelClassName)], [panelContent]);
60
- const content = isOpen ? [backdrop, panel] : [];
130
+ const backdrop = keyed('div')(`${id}-backdrop`, [
131
+ Class(backdropClassName),
132
+ ...transitionAttributes,
133
+ ...(isLeaving ? [] : [OnClick(toMessage(Closed()))]),
134
+ ], []);
135
+ const panel = keyed('div')(`${id}-panel`, [Id(`${id}-panel`), Class(panelClassName), ...transitionAttributes], [panelContent]);
136
+ const content = isVisible ? [backdrop, panel] : [];
61
137
  return keyed('dialog')(id, dialogAttributes, content);
62
138
  };
63
139
  /** Creates a memoized dialog view. Static config is captured in a closure;
@@ -1,3 +1,3 @@
1
- export { init, update, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, NoOp, } from './index';
1
+ export { init, update, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, NoOp, AdvancedTransitionFrame, EndedTransition, } from './index';
2
2
  export type { InitConfig, ViewConfig } from './index';
3
3
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,IAAI,GACL,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,IAAI,EACJ,uBAAuB,EACvB,eAAe,GAChB,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- export { init, update, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, NoOp, } from './index';
1
+ export { init, update, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, NoOp, AdvancedTransitionFrame, EndedTransition, } from './index';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/disclosure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAQ/C,kGAAkG;AAClG,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,iFAAiF;AACjF,eAAO,MAAM,OAAO,4DAAe,CAAA;AACnC,gFAAgF;AAChF,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,kGAAkG;AAClG,eAAO,MAAM,IAAI,yDAAY,CAAA;AAE7B,kEAAkE;AAClE,eAAO,MAAM,OAAO,2LAAiC,CAAA;AAErD,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AACzC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,IAAI,GAAI,QAAQ,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,CAAA;IACvB,aAAa,EAAE,IAAI,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,IAAI,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,oGAAoG;AACpG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAwF3D,CAAA;AAED;6EAC6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,KAC7D,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAgBtE,CAAA"}
@@ -45,12 +45,10 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
45
45
  }));
46
46
  /** Renders a headless disclosure component with accessible ARIA attributes and keyboard support. */
47
47
  export const view = (config) => {
48
- const { div, empty, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDown, Tabindex, Type, keyed, } = html();
48
+ const { div, empty, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Tabindex, Type, keyed, } = html();
49
49
  const { model: { id, isOpen }, toMessage, buttonClassName, buttonContent, panelClassName, panelContent, isDisabled, persistPanel, buttonElement = 'button', panelElement = 'div', className, } = config;
50
50
  const isNativeButton = buttonElement === 'button';
51
- const handleKeyDown = (key) =>
52
- /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
53
- M.value(key).pipe(M.whenOr('Enter', ' ', () => toMessage(Toggled())), M.orElse(() => toMessage(NoOp())));
51
+ const handleKeyDown = (key) => M.value(key).pipe(M.whenOr('Enter', ' ', () => Option.some(toMessage(Toggled()))), M.orElse(() => Option.none()));
54
52
  const disabledAttributes = [
55
53
  Disabled(true),
56
54
  AriaDisabled(true),
@@ -60,7 +58,7 @@ export const view = (config) => {
60
58
  ? disabledAttributes
61
59
  : [
62
60
  OnClick(toMessage(Toggled())),
63
- ...(!isNativeButton ? [OnKeyDown(handleKeyDown)] : []),
61
+ ...(!isNativeButton ? [OnKeyDownPreventDefault(handleKeyDown)] : []),
64
62
  ];
65
63
  const buttonAttributes = [
66
64
  Class(buttonClassName),
@@ -0,0 +1,21 @@
1
+ import type { Attribute } from '../../html';
2
+ import type { Html } from '../../html';
3
+ /** Attribute groups the fieldset component provides to the consumer's `toView` callback. */
4
+ export type FieldsetAttributes<Message> = Readonly<{
5
+ fieldset: ReadonlyArray<Attribute<Message>>;
6
+ legend: ReadonlyArray<Attribute<Message>>;
7
+ description: ReadonlyArray<Attribute<Message>>;
8
+ }>;
9
+ /** Configuration for rendering a fieldset with `view`. */
10
+ export type ViewConfig<Message> = Readonly<{
11
+ id: string;
12
+ toView: (attributes: FieldsetAttributes<Message>) => Html;
13
+ isDisabled?: boolean;
14
+ }>;
15
+ /** Generates the legend element ID from the fieldset's base ID. */
16
+ export declare const legendId: (id: string) => string;
17
+ /** Generates the description element ID from the fieldset's base ID. */
18
+ export declare const descriptionId: (id: string) => string;
19
+ /** Renders an accessible fieldset by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
20
+ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/fieldset/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,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,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC,CAAA;AAEF,mEAAmE;AACnE,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,KAAG,MAAwB,CAAA;AAE9D,wEAAwE;AACxE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAwB3D,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { html } from '../../html';
2
+ /** Generates the legend element ID from the fieldset's base ID. */
3
+ export const legendId = (id) => `${id}-legend`;
4
+ /** Generates the description element ID from the fieldset's base ID. */
5
+ export const descriptionId = (id) => `${id}-description`;
6
+ /** Renders an accessible fieldset by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
7
+ export const view = (config) => {
8
+ const { AriaDescribedBy, DataAttribute, Disabled, Id } = html();
9
+ const { toView, id, isDisabled = false } = config;
10
+ const disabledAttributes = isDisabled
11
+ ? [Disabled(true), DataAttribute('disabled', '')]
12
+ : [];
13
+ const allFieldsetAttributes = [
14
+ Id(id),
15
+ AriaDescribedBy(descriptionId(id)),
16
+ ...disabledAttributes,
17
+ ];
18
+ const legendAttributes = [Id(legendId(id))];
19
+ const descriptionAttributes = [Id(descriptionId(id))];
20
+ return toView({
21
+ fieldset: allFieldsetAttributes,
22
+ legend: legendAttributes,
23
+ description: descriptionAttributes,
24
+ });
25
+ };
@@ -0,0 +1,3 @@
1
+ export { view, legendId, descriptionId } from './index';
2
+ export type { ViewConfig, FieldsetAttributes } from './index';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/fieldset/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvD,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export { view, legendId, descriptionId } from './index';
@@ -1,11 +1,16 @@
1
+ export * as Button from './button/public';
1
2
  export * as Checkbox from './checkbox/public';
2
3
  export * as Combobox from './combobox/public';
3
4
  export * as Dialog from './dialog/public';
4
5
  export * as Disclosure from './disclosure/public';
6
+ export * as Fieldset from './fieldset/public';
7
+ export * as Input from './input/public';
5
8
  export * as Listbox from './listbox/public';
6
9
  export * as Menu from './menu/public';
7
10
  export * as Popover from './popover/public';
8
11
  export * as RadioGroup from './radioGroup/public';
12
+ export * as Select from './select/public';
9
13
  export * as Switch from './switch/public';
14
+ export * as Textarea from './textarea/public';
10
15
  export * as Tabs from './tabs/public';
11
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA"}
package/dist/ui/index.js CHANGED
@@ -1,10 +1,15 @@
1
+ export * as Button from './button/public';
1
2
  export * as Checkbox from './checkbox/public';
2
3
  export * as Combobox from './combobox/public';
3
4
  export * as Dialog from './dialog/public';
4
5
  export * as Disclosure from './disclosure/public';
6
+ export * as Fieldset from './fieldset/public';
7
+ export * as Input from './input/public';
5
8
  export * as Listbox from './listbox/public';
6
9
  export * as Menu from './menu/public';
7
10
  export * as Popover from './popover/public';
8
11
  export * as RadioGroup from './radioGroup/public';
12
+ export * as Select from './select/public';
9
13
  export * as Switch from './switch/public';
14
+ export * as Textarea from './textarea/public';
10
15
  export * as Tabs from './tabs/public';
@@ -0,0 +1,28 @@
1
+ import type { Attribute } from '../../html';
2
+ import type { Html } from '../../html';
3
+ /** Attribute groups the input component provides to the consumer's `toView` callback. */
4
+ export type InputAttributes<Message> = Readonly<{
5
+ input: ReadonlyArray<Attribute<Message>>;
6
+ label: ReadonlyArray<Attribute<Message>>;
7
+ description: ReadonlyArray<Attribute<Message>>;
8
+ }>;
9
+ /** Configuration for rendering an input with `view`. */
10
+ export type ViewConfig<Message> = Readonly<{
11
+ id: string;
12
+ toView: (attributes: InputAttributes<Message>) => Html;
13
+ onInput?: (value: string) => Message;
14
+ value?: string;
15
+ isDisabled?: boolean;
16
+ isInvalid?: boolean;
17
+ isAutofocus?: boolean;
18
+ name?: string;
19
+ type?: string;
20
+ placeholder?: string;
21
+ }>;
22
+ /** Generates the label element ID from the input's base ID. */
23
+ export declare const labelId: (id: string) => string;
24
+ /** Generates the description element ID from the input's base ID. */
25
+ export declare const descriptionId: (id: string) => string;
26
+ /** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
27
+ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/input/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,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,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,+DAA+D;AAC/D,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,+HAA+H;AAC/H,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA0E3D,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { Predicate } from 'effect';
2
+ import { html } from '../../html';
3
+ /** Generates the label element ID from the input's base ID. */
4
+ export const labelId = (id) => `${id}-label`;
5
+ /** Generates the description element ID from the input's base ID. */
6
+ export const descriptionId = (id) => `${id}-description`;
7
+ /** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
8
+ export const view = (config) => {
9
+ const { AriaDescribedBy, AriaDisabled, AriaInvalid, AriaLabelledBy, Autofocus, DataAttribute, Disabled, Id, Name, OnInput, Placeholder, Type, Value, } = html();
10
+ const { toView, id, onInput, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, type = 'text', placeholder, } = config;
11
+ const disabledAttributes = isDisabled
12
+ ? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
13
+ : [];
14
+ const invalidAttributes = isInvalid
15
+ ? [AriaInvalid(true), DataAttribute('invalid', '')]
16
+ : [];
17
+ const inputAttributes = Predicate.isNotUndefined(onInput) && !isDisabled ? [OnInput(onInput)] : [];
18
+ const valueAttributes = Predicate.isNotUndefined(value) ? [Value(value)] : [];
19
+ const autofocusAttributes = isAutofocus ? [Autofocus(true)] : [];
20
+ const nameAttributes = Predicate.isNotUndefined(name) ? [Name(name)] : [];
21
+ const placeholderAttributes = Predicate.isNotUndefined(placeholder)
22
+ ? [Placeholder(placeholder)]
23
+ : [];
24
+ const allInputAttributes = [
25
+ Id(id),
26
+ Type(type),
27
+ AriaLabelledBy(labelId(id)),
28
+ AriaDescribedBy(descriptionId(id)),
29
+ ...disabledAttributes,
30
+ ...invalidAttributes,
31
+ ...inputAttributes,
32
+ ...valueAttributes,
33
+ ...autofocusAttributes,
34
+ ...nameAttributes,
35
+ ...placeholderAttributes,
36
+ ];
37
+ const labelAttributes = [Id(labelId(id))];
38
+ const descriptionAttributes = [Id(descriptionId(id))];
39
+ return toView({
40
+ input: allInputAttributes,
41
+ label: labelAttributes,
42
+ description: descriptionAttributes,
43
+ });
44
+ };
@@ -0,0 +1,3 @@
1
+ export { view, labelId, descriptionId } from './index';
2
+ export type { ViewConfig, InputAttributes } from './index';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/input/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export { view, labelId, descriptionId } from './index';
@@ -1,7 +1,7 @@
1
1
  export { init, update, view, lazy, Model } from './single';
2
2
  export { Message, Orientation } from './shared';
3
3
  export { TransitionState } from '../transition';
4
- export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, Searched, ClearedSearch, NoOp, AdvancedTransitionFrame, EndedTransition, ItemConfig, GroupHeading, } from './shared';
4
+ export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, Searched, ClearedSearch, PressedPointerOnButton, DetectedButtonMovement, NoOp, AdvancedTransitionFrame, EndedTransition, ItemConfig, GroupHeading, } from './shared';
5
5
  export type { InitConfig, ViewConfig } from './single';
6
6
  export type { AnchorConfig } from '../anchor';
7
7
  export * as Multi from './multiPublic';
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,IAAI,EACJ,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA"}
@@ -1,5 +1,5 @@
1
1
  export { init, update, view, lazy, Model, Message } from './index';
2
2
  export { TransitionState } from '../transition';
3
- export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, Searched, ClearedSearch, NoOp, AdvancedTransitionFrame, EndedTransition, InitConfig, ViewConfig, ItemConfig, GroupHeading, } from './index';
3
+ export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, Searched, ClearedSearch, PressedPointerOnButton, ReleasedPointerOnItems, NoOp, AdvancedTransitionFrame, EndedTransition, DetectedButtonMovement, InitConfig, ViewConfig, ItemConfig, GroupHeading, } from './index';
4
4
  export type { AnchorConfig } from '../anchor';
5
5
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,IAAI,EACJ,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { Attribute } from '../../html';
2
+ import type { Html } from '../../html';
3
+ /** Attribute groups the select component provides to the consumer's `toView` callback. */
4
+ export type SelectAttributes<Message> = Readonly<{
5
+ select: ReadonlyArray<Attribute<Message>>;
6
+ label: ReadonlyArray<Attribute<Message>>;
7
+ description: ReadonlyArray<Attribute<Message>>;
8
+ }>;
9
+ /** Configuration for rendering a select with `view`. */
10
+ export type ViewConfig<Message> = Readonly<{
11
+ id: string;
12
+ toView: (attributes: SelectAttributes<Message>) => Html;
13
+ onChange?: (value: string) => Message;
14
+ value?: string;
15
+ isDisabled?: boolean;
16
+ isInvalid?: boolean;
17
+ isAutofocus?: boolean;
18
+ name?: string;
19
+ }>;
20
+ /** Generates the label element ID from the select's base ID. */
21
+ export declare const labelId: (id: string) => string;
22
+ /** Generates the description element ID from the select's base ID. */
23
+ export declare const descriptionId: (id: string) => string;
24
+ /** Renders an accessible select by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
25
+ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/select/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,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;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,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,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,gEAAgE;AAChE,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,sEAAsE;AACtE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,gIAAgI;AAChI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAkE3D,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { Predicate } from 'effect';
2
+ import { html } from '../../html';
3
+ /** Generates the label element ID from the select's base ID. */
4
+ export const labelId = (id) => `${id}-label`;
5
+ /** Generates the description element ID from the select's base ID. */
6
+ export const descriptionId = (id) => `${id}-description`;
7
+ /** Renders an accessible select by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
8
+ export const view = (config) => {
9
+ const { AriaDescribedBy, AriaDisabled, AriaInvalid, AriaLabelledBy, Autofocus, DataAttribute, Disabled, Id, Name, OnChange, Value, } = html();
10
+ const { toView, id, onChange, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, } = config;
11
+ const disabledAttributes = isDisabled
12
+ ? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
13
+ : [];
14
+ const invalidAttributes = isInvalid
15
+ ? [AriaInvalid(true), DataAttribute('invalid', '')]
16
+ : [];
17
+ const changeAttributes = Predicate.isNotUndefined(onChange) && !isDisabled
18
+ ? [OnChange(onChange)]
19
+ : [];
20
+ const valueAttributes = Predicate.isNotUndefined(value) ? [Value(value)] : [];
21
+ const autofocusAttributes = isAutofocus ? [Autofocus(true)] : [];
22
+ const nameAttributes = Predicate.isNotUndefined(name) ? [Name(name)] : [];
23
+ const allSelectAttributes = [
24
+ Id(id),
25
+ AriaLabelledBy(labelId(id)),
26
+ AriaDescribedBy(descriptionId(id)),
27
+ ...disabledAttributes,
28
+ ...invalidAttributes,
29
+ ...changeAttributes,
30
+ ...valueAttributes,
31
+ ...autofocusAttributes,
32
+ ...nameAttributes,
33
+ ];
34
+ const labelAttributes = [Id(labelId(id))];
35
+ const descriptionAttributes = [Id(descriptionId(id))];
36
+ return toView({
37
+ select: allSelectAttributes,
38
+ label: labelAttributes,
39
+ description: descriptionAttributes,
40
+ });
41
+ };
@@ -0,0 +1,3 @@
1
+ export { view, labelId, descriptionId } from './index';
2
+ export type { ViewConfig, SelectAttributes } from './index';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/select/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtD,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export { view, labelId, descriptionId } from './index';
@@ -0,0 +1,28 @@
1
+ import type { Attribute } from '../../html';
2
+ import type { Html } from '../../html';
3
+ /** Attribute groups the textarea component provides to the consumer's `toView` callback. */
4
+ export type TextareaAttributes<Message> = Readonly<{
5
+ textarea: ReadonlyArray<Attribute<Message>>;
6
+ label: ReadonlyArray<Attribute<Message>>;
7
+ description: ReadonlyArray<Attribute<Message>>;
8
+ }>;
9
+ /** Configuration for rendering a textarea with `view`. */
10
+ export type ViewConfig<Message> = Readonly<{
11
+ id: string;
12
+ toView: (attributes: TextareaAttributes<Message>) => Html;
13
+ onInput?: (value: string) => Message;
14
+ value?: string;
15
+ isDisabled?: boolean;
16
+ isInvalid?: boolean;
17
+ isAutofocus?: boolean;
18
+ name?: string;
19
+ rows?: number;
20
+ placeholder?: string;
21
+ }>;
22
+ /** Generates the label element ID from the textarea's base ID. */
23
+ export declare const labelId: (id: string) => string;
24
+ /** Generates the description element ID from the textarea's base ID. */
25
+ export declare const descriptionId: (id: string) => string;
26
+ /** Renders an accessible textarea by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
27
+ export declare const view: <Message>(config: ViewConfig<Message>) => Html;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/textarea/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAItC,4FAA4F;AAC5F,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;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,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,kEAAkE;AAClE,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,wEAAwE;AACxE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA4E3D,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { Predicate } from 'effect';
2
+ import { html } from '../../html';
3
+ /** Generates the label element ID from the textarea's base ID. */
4
+ export const labelId = (id) => `${id}-label`;
5
+ /** Generates the description element ID from the textarea's base ID. */
6
+ export const descriptionId = (id) => `${id}-description`;
7
+ /** Renders an accessible textarea by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
8
+ export const view = (config) => {
9
+ const { AriaDescribedBy, AriaDisabled, AriaInvalid, AriaLabelledBy, Autofocus, DataAttribute, Disabled, Id, Name, OnInput, Placeholder, Rows, Value, } = html();
10
+ const { toView, id, onInput, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, rows, placeholder, } = config;
11
+ const disabledAttributes = isDisabled
12
+ ? [AriaDisabled(true), Disabled(true), DataAttribute('disabled', '')]
13
+ : [];
14
+ const invalidAttributes = isInvalid
15
+ ? [AriaInvalid(true), DataAttribute('invalid', '')]
16
+ : [];
17
+ const inputAttributes = Predicate.isNotUndefined(onInput) && !isDisabled ? [OnInput(onInput)] : [];
18
+ const valueAttributes = Predicate.isNotUndefined(value) ? [Value(value)] : [];
19
+ const autofocusAttributes = isAutofocus ? [Autofocus(true)] : [];
20
+ const nameAttributes = Predicate.isNotUndefined(name) ? [Name(name)] : [];
21
+ const rowsAttributes = Predicate.isNotUndefined(rows) ? [Rows(rows)] : [];
22
+ const placeholderAttributes = Predicate.isNotUndefined(placeholder)
23
+ ? [Placeholder(placeholder)]
24
+ : [];
25
+ const allTextareaAttributes = [
26
+ Id(id),
27
+ AriaLabelledBy(labelId(id)),
28
+ AriaDescribedBy(descriptionId(id)),
29
+ ...disabledAttributes,
30
+ ...invalidAttributes,
31
+ ...inputAttributes,
32
+ ...valueAttributes,
33
+ ...autofocusAttributes,
34
+ ...nameAttributes,
35
+ ...rowsAttributes,
36
+ ...placeholderAttributes,
37
+ ];
38
+ const labelAttributes = [Id(labelId(id))];
39
+ const descriptionAttributes = [Id(descriptionId(id))];
40
+ return toView({
41
+ textarea: allTextareaAttributes,
42
+ label: labelAttributes,
43
+ description: descriptionAttributes,
44
+ });
45
+ };
@@ -0,0 +1,3 @@
1
+ export { view, labelId, descriptionId } from './index';
2
+ export type { ViewConfig, TextareaAttributes } from './index';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/textarea/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtD,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1 @@
1
+ export { view, labelId, descriptionId } from './index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "Elm-inspired UI framework powered by Effect",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -63,6 +63,10 @@
63
63
  "types": "./dist/ui/index.d.ts",
64
64
  "import": "./dist/ui/index.js"
65
65
  },
66
+ "./ui/button": {
67
+ "types": "./dist/ui/button/public.d.ts",
68
+ "import": "./dist/ui/button/public.js"
69
+ },
66
70
  "./ui/checkbox": {
67
71
  "types": "./dist/ui/checkbox/public.d.ts",
68
72
  "import": "./dist/ui/checkbox/public.js"
@@ -75,6 +79,14 @@
75
79
  "types": "./dist/ui/disclosure/public.d.ts",
76
80
  "import": "./dist/ui/disclosure/public.js"
77
81
  },
82
+ "./ui/fieldset": {
83
+ "types": "./dist/ui/fieldset/public.d.ts",
84
+ "import": "./dist/ui/fieldset/public.js"
85
+ },
86
+ "./ui/input": {
87
+ "types": "./dist/ui/input/public.d.ts",
88
+ "import": "./dist/ui/input/public.js"
89
+ },
78
90
  "./ui/listbox": {
79
91
  "types": "./dist/ui/listbox/public.d.ts",
80
92
  "import": "./dist/ui/listbox/public.js"
@@ -95,10 +107,18 @@
95
107
  "types": "./dist/ui/radioGroup/public.d.ts",
96
108
  "import": "./dist/ui/radioGroup/public.js"
97
109
  },
110
+ "./ui/select": {
111
+ "types": "./dist/ui/select/public.d.ts",
112
+ "import": "./dist/ui/select/public.js"
113
+ },
98
114
  "./ui/switch": {
99
115
  "types": "./dist/ui/switch/public.d.ts",
100
116
  "import": "./dist/ui/switch/public.js"
101
117
  },
118
+ "./ui/textarea": {
119
+ "types": "./dist/ui/textarea/public.d.ts",
120
+ "import": "./dist/ui/textarea/public.js"
121
+ },
102
122
  "./ui/tabs": {
103
123
  "types": "./dist/ui/tabs/public.d.ts",
104
124
  "import": "./dist/ui/tabs/public.js"