jsl-ui 10.4.3 → 10.4.5

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 (95) hide show
  1. package/docs/AutoSuggestComponent.md +17 -17
  2. package/docs/ButtonComponent.md +22 -22
  3. package/docs/CheckBoxComponent.md +12 -12
  4. package/docs/DataBinding.md +19 -19
  5. package/docs/DateComponent.md +12 -12
  6. package/docs/DateRangeComponent.md +13 -13
  7. package/docs/DateTimeComponent.md +14 -14
  8. package/docs/DialogComponent.md +15 -15
  9. package/docs/DropdownMenuComponent.md +22 -22
  10. package/docs/ExpanderComponent.md +13 -13
  11. package/docs/FormComponent.md +15 -15
  12. package/docs/FormFieldComponent.md +15 -15
  13. package/docs/GridComponent.md +39 -39
  14. package/docs/InputComponent.md +15 -15
  15. package/docs/IntervalComponent.md +13 -13
  16. package/docs/LoadingComponent.md +12 -12
  17. package/docs/NavigationComponent.md +17 -17
  18. package/docs/Notification.md +14 -14
  19. package/docs/NotificationComponent.md +13 -13
  20. package/docs/NumberComponent.md +12 -12
  21. package/docs/OverlayComponent.md +13 -13
  22. package/docs/ProgressComponent.md +12 -12
  23. package/docs/README.md +27 -27
  24. package/docs/RibbonMenuComponent.md +14 -14
  25. package/docs/SelectComponent.md +36 -36
  26. package/docs/SliderComponent.md +20 -20
  27. package/docs/SplitterComponent.md +14 -14
  28. package/docs/StackPanelComponent.md +13 -13
  29. package/docs/TabsComponent.md +16 -16
  30. package/docs/TimeComponent.md +13 -13
  31. package/docs/TreeViewComponent.md +16 -16
  32. package/examples/showcase/checks-and-expanders.ts +148 -148
  33. package/examples/showcase/cultures.ts +39 -39
  34. package/examples/showcase/data-binding.ts +138 -138
  35. package/examples/showcase/dates.ts +168 -168
  36. package/examples/showcase/dialogs.ts +184 -184
  37. package/examples/showcase/dropdown-menus.ts +99 -99
  38. package/examples/showcase/feedback-and-navigation.ts +173 -173
  39. package/examples/showcase/fields.ts +166 -166
  40. package/examples/showcase/fonts/OFL-BricolageGrotesque.txt +93 -93
  41. package/examples/showcase/fonts/OFL-Figtree.txt +93 -93
  42. package/examples/showcase/fonts/OFL-Jost.txt +93 -93
  43. package/examples/showcase/generate-sources.cjs +104 -104
  44. package/examples/showcase/grids.ts +484 -484
  45. package/examples/showcase/index.html +71 -71
  46. package/examples/showcase/layout-and-navigation.ts +46 -46
  47. package/examples/showcase/nivona.css +98 -98
  48. package/examples/showcase/package.json +10 -10
  49. package/examples/showcase/selects.ts +184 -184
  50. package/examples/showcase/showcase-sources.ts +94 -94
  51. package/examples/showcase/showcase.css +281 -281
  52. package/examples/showcase/showcase.ts +244 -244
  53. package/examples/showcase/tabs.ts +161 -161
  54. package/examples/showcase/themes.css +83 -83
  55. package/examples/showcase/themes.ts +56 -56
  56. package/examples/showcase/wirtshans.css +65 -65
  57. package/lib/components/checkbox/CheckBoxStyle.scss +73 -73
  58. package/lib/components/date-range/DateRangeStyle.scss +35 -35
  59. package/lib/components/date-time/DateTimeStyle.scss +9 -9
  60. package/lib/components/dialog/DialogComponent.d.ts +9 -2
  61. package/lib/components/dialog/DialogComponent.js +17 -51
  62. package/lib/components/dropdown-menu/DropdownMenuStyle.scss +48 -48
  63. package/lib/components/expander/ExpanderStyle.scss +61 -61
  64. package/lib/components/form-field/FormFieldStyle.scss +36 -36
  65. package/lib/components/host/RenderHost.d.ts +25 -0
  66. package/lib/components/host/RenderHost.js +63 -0
  67. package/lib/components/loading/LoadingStyle.css +18 -18
  68. package/lib/components/navigation/NavigationStyle.scss +61 -61
  69. package/lib/components/notification/Notification.scss +102 -102
  70. package/lib/components/overlay/OverlayComponent.d.ts +9 -1
  71. package/lib/components/overlay/OverlayComponent.js +22 -13
  72. package/lib/components/overlay/overlay.css +15 -15
  73. package/lib/components/progress/ProgressStyle.scss +4 -4
  74. package/lib/components/ribbon-menu/RibbonMenuStyle.scss +5 -5
  75. package/lib/components/select/SelectStyle.scss +207 -207
  76. package/lib/components/slider/SliderStyle.scss +21 -21
  77. package/lib/components/slider/nouislider.css +15 -15
  78. package/lib/components/stack-panel/SplitterStyle.scss +8 -8
  79. package/lib/components/stack-panel/StackPanelStyle.scss +10 -10
  80. package/lib/components/tabs/TabsStyle.scss +139 -139
  81. package/lib/components/time/TimeComponent.scss +3 -3
  82. package/lib/components/tree-view/TreeViewStyle.scss +14 -14
  83. package/lib/core/helper.js +11 -6
  84. package/lib/grid/plugins/slick.headermenu.css +98 -98
  85. package/lib/grid.css +840 -3532
  86. package/lib/index.css.map +1 -1
  87. package/lib/index.js.map +1 -1
  88. package/lib/ui/auto.suggest.css +30 -30
  89. package/lib/ui/button.css +147 -147
  90. package/lib/ui/date-input.css +10 -10
  91. package/lib/ui/date.picker/css/tiny-date-picker.css +124 -124
  92. package/lib/ui/dialog.css +144 -144
  93. package/lib/ui/input.css +35 -35
  94. package/lib/ui/theme.css +28 -28
  95. package/package.json +1 -1
@@ -1,166 +1,166 @@
1
- import { IJSLComponent, IJSLVNode } from "jsl-render";
2
- import { InputComponent } from "../../components/input/InputComponent";
3
- import { NumberComponent } from "../../components/number/NumberComponent";
4
- import { DateComponent } from "../../components/date/DateComponent";
5
- import { SelectComponent } from "../../components/select/SelectComponent";
6
- import { FormFieldComponent } from "../../components/form-field/FormFieldComponent";
7
- import { FormComponent } from "../../components/form-field/FormComponent";
8
- import { ButtonComponent } from "../../components/button/ButtonComponent";
9
- import { date } from "../../core/date";
10
- import { numeric } from "../../core/numeric";
11
-
12
- type Content = IJSLVNode | IJSLComponent;
13
- const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
14
- const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
15
- const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
16
- const action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: "button", outlined: true, size: "small" });
17
- const sampleField = (id: string, label: string, control: Content) => group([
18
- { tag: "label", content: label, attr: { for: id } }, control
19
- ], "field-sample");
20
- function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
21
- return { tag: "article", attr: { id, class: "sample-card" }, children: [
22
- group([text("span", number, "sample-number"), text("h3", title)], "card-heading"),
23
- text("p", description, "card-description"), ...children
24
- ] };
25
- }
26
- function section(id: string, number: string, title: string, description: string, preview: Content, cards: IJSLVNode[], usage: Content[]): IJSLVNode {
27
- return { tag: "section", attr: { id, class: "component-section", "aria-labelledby": id + "-title" }, children: [
28
- group([
29
- group([text("p", "THE ESSENTIALS / " + number, "eyebrow"),
30
- { tag: "h2", content: title, attr: { id: id + "-title", class: "section-title" } },
31
- text("p", description, "hero-description")], "hero-copy"),
32
- group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview], "hero-preview fields-preview")
33
- ], "hero"),
34
- group(cards, "sample-grid fields-sample-grid"),
35
- { tag: "details", attr: { class: "usage" }, children: [text("summary", title + " usage & compatibility"), ...usage] }
36
- ] };
37
- }
38
- const inputStatus = status("Start typing to see the input event.");
39
- const notesStatus = status("A few notes for the team.");
40
- export const inputShowcase = section("inputs", "11", "Inputs",
41
- "A consistent place to type. Simple defaults for text, passwords, and longer notes.",
42
- new InputComponent({ id: "input-preview", placeholder: "What are you working on?", ariaLabel: "Preview input" }), [
43
- card("input-basic", "01", "Text as you type", "Input and change events keep their familiar string values. Add an external label or use a FormField.", [
44
- sampleField("input-name", "Project name", new InputComponent({
45
- id: "input-name", placeholder: "Give your project a name", maxLength: 40,
46
- onInput: value => { inputStatus.content = value ? "Typing: " + value : "The field is empty."; },
47
- onChange: value => { inputStatus.content = "Committed: " + (value || "empty"); }
48
- })), inputStatus
49
- ]),
50
- card("input-textarea", "02", "Room for a longer thought", "Use the same familiar events with a multiline field.", [
51
- sampleField("input-notes", "Notes", new InputComponent({
52
- id: "input-notes", type: "textarea", rows: 4, value: "A few notes for the team.",
53
- onInput: value => { notesStatus.content = value.length + " characters in the notes."; }
54
- })), notesStatus
55
- ]),
56
- card("input-states", "03", "Useful native input types", "Passwords, email, read-only values, and disabled fields share the same base appearance.", [
57
- sampleField("input-password", "Password", new InputComponent({ id: "input-password", type: "password", value: "A little privacy" })),
58
- sampleField("input-readonly", "Read-only identifier", new InputComponent({ id: "input-readonly", value: "PROJ-2026-010", readOnly: true })),
59
- sampleField("input-disabled", "Unavailable value", new InputComponent({ id: "input-disabled", value: "Managed by your team", enabled: false }))
60
- ]),
61
- card("input-unstyled", "04", "A building block when needed", "Opt out of the library surface for a grid cell or a custom editor while keeping normal input behavior.", [
62
- group([
63
- text("span", "PROJECT /", "inline-note"),
64
- new InputComponent({ id: "input-plain", value: "An inline title", ariaLabel: "Inline title", unstyled: true, class: "showcase-inline-input" })
65
- ], "unstyled-input-sample"),
66
- text("pre", '{ unstyled: true, class: "my-editor" }', "sample-code")
67
- ])
68
- ], [
69
- text("pre", 'new InputComponent({\n value: "A project", placeholder: "Project name",\n onChange: value => console.log(value)\n});', "sample-code"),
70
- text("p", "Existing options, events, getValue(), and setValue() remain supported. The input alias for type is retained. setValue() stays silent. unstyled skips the base CSS class; ariaLabel, readOnly, rows, autocomplete, and focus() are optional additions."),
71
- text("p", "Use bindOnInput to choose when a bound model updates. Binding modes and model synchronization are demonstrated in the Data binding section.")
72
- ]);
73
-
74
- const numberStatus = status("Commit a value with Enter or by leaving the field.");
75
- export const numberShowcase = section("numbers", "12", "Numbers",
76
- "The same surface, with numeric behavior. Formats and converters stay close to the value.",
77
- new NumberComponent({ id: "number-preview", value: 1250.5, format: "#,0.00", ariaLabel: "Preview amount" }), [
78
- card("number-basic", "01", "A number with a format", "Edit a decimal, then commit it. Formatting happens on blur or Enter.", [
79
- sampleField("number-amount", "Amount", new NumberComponent({
80
- id: "number-amount", value: 1250.5, format: "#,0.00",
81
- onChange: value => { numberStatus.content = value == null ? "Amount cleared." : "Numeric value: " + value; }
82
- })), numberStatus,
83
- sampleField("number-zero", "Whole number", new NumberComponent({ id: "number-zero", value: 0, format: "0" }))
84
- ]),
85
- card("number-options", "02", "Choose when to format", "Formatting and Enter commits can be disabled independently.", [
86
- sampleField("number-live", "Format preserved while editing", new NumberComponent({
87
- id: "number-live", value: 12.5, format: "0.00", formatOnBlur: false, commitOnEnter: false
88
- })),
89
- text("pre", "{ formatOnBlur: false, commitOnEnter: false }", "sample-code")
90
- ]),
91
- card("number-states", "03", "Consistent states", "Disabled and read-only values match the other controls. Unstyled mode remains available for embedded editors.", [
92
- sampleField("number-disabled", "Unavailable amount", new NumberComponent({ id: "number-disabled", value: 99, format: "0.00", enabled: false })),
93
- sampleField("number-readonly", "Calculated total", new NumberComponent({ id: "number-readonly", value: 149.95, format: "0.00", readOnly: true })),
94
- text("pre", '{ unstyled: true }', "sample-code")
95
- ])
96
- ], [
97
- text("pre", 'new NumberComponent({\n value: 1250.5, format: "#,0.00",\n onChange: value => console.log(value)\n});', "sample-code"),
98
- text("p", "getValue() returns the displayed string; getValueAsNumber() returns its parsed number. Formatting follows the existing culture settings and numeric helpers. Empty values remain undefined. setValue() updates the control silently."),
99
- text("p", "commitOnEnter is now honored. Enter followed by blur does not publish the same commit twice. Malformed numeric drafts remain visible for correction and do not write NaN to the model.")
100
- ]);
101
-
102
- const projectOptions = [{ value: "design", text: "Design system" }, { value: "website", text: "Website refresh" }, { value: "research", text: "Customer research" }];
103
- const cities = ["Vienna", "Berlin", "Copenhagen", "London", "New York", "Singapore", "Sydney", "Tokyo"];
104
- const validationStatus = status("Validate the form to see messages below its controls.");
105
- const emailField = new FormFieldComponent({
106
- label: "Email address", required: true, description: "Use your work email.",
107
- control: new InputComponent({ id: "field-email", type: "email", placeholder: "you@example.com" })
108
- });
109
- const projectField = new FormFieldComponent({
110
- label: "Project", required: true,
111
- control: new SelectComponent({ id: "field-project", data: projectOptions, placeholder: "Choose a project" })
112
- });
113
- const validationForm = new FormComponent([emailField, projectField, action("Validate form", () => {
114
- validationStatus.content = validationForm.validate() ? "All fields are valid." : "Please correct the marked fields.";
115
- }), validationStatus]);
116
-
117
- export const formFieldShowcase = section("form-fields", "13", "Form fields",
118
- "A label and a little guidance. Wrap the control that fits the job.",
119
- new FormFieldComponent({
120
- label: "Project name", description: "Clear names help everyone find their work.",
121
- control: new InputComponent({ id: "field-preview", value: "Component library" })
122
- }), [
123
- card("field-composition", "01", "Controls that belong together", "Text, numbers, and selects keep their own behavior while sharing a consistent field layout.", [
124
- group([
125
- new FormFieldComponent({ label: "Project name", control: new InputComponent({ id: "field-name", value: "A new project" }) }),
126
- new FormFieldComponent({ label: "Budget", control: new NumberComponent({ id: "field-budget", value: 1200, format: "#,0.00" }) }),
127
- new FormFieldComponent({ label: "Team", control: new SelectComponent({ id: "field-team", data: projectOptions, value: "design" }) })
128
- ], "composed-fields"),
129
- text("pre", 'new FormFieldComponent({\n label: "Team", control: new SelectComponent({ data })\n});', "sample-code")
130
- ]),
131
- card("field-legacy", "02", "Existing field types still work", "The original shorthand creates the same input components internally. Existing getValue(), setValue(), and validation calls continue to work.", [
132
- new FormFieldComponent({ id: "field-legacy-text", label: "User name", type: "text", value: "Alex" }),
133
- new FormFieldComponent({ id: "field-legacy-password", label: "Password", type: "password", value: "A private value" }),
134
- text("pre", 'new FormFieldComponent({ label: "User name", type: "text" });', "sample-code")
135
- ]),
136
- card("field-specialized", "03", "Dates and formatted numbers", "Specialized controls handle their values and popups. The field adds the label and supporting text.", [
137
- new FormFieldComponent({
138
- id: "field-date", label: "Start date", type: "date", value: "15/10/2026",
139
- dateOptions: { format: value => date.format(value, "dd/mm/yy"), parse: value => date.parse(value, "dd/mm/yy") }
140
- }),
141
- new FormFieldComponent({ id: "field-number", label: "Estimated cost", type: "number", value: numeric.format(1250.5, "0.00"), numberOptions: { format: "#,0.00" } }),
142
- new FormFieldComponent({ label: "Milestone", control: new DateComponent({ id: "field-wrapped-date", value: new Date(2026, 9, 21) }) })
143
- ]),
144
- card("field-autosuggest", "04", "Suggestions while you type", "AutoSuggestComponent now uses the shared input styling and owns its suggestion lifecycle.", [
145
- new FormFieldComponent({
146
- id: "field-city", label: "Office city", type: "autosuggest", placeholder: "Start typing a city",
147
- description: "Try Vienna, Berlin, or Tokyo.",
148
- autoSuggestOptions: { minChars: 1, delay: 0, source: (term, suggest) => suggest(cities.filter(city => city.toLowerCase().includes(term.toLowerCase()))) }
149
- }),
150
- text("p", "The original autoSuggestOptions source and callbacks remain available.", "inline-note")
151
- ]),
152
- card("field-validation", "05", "Guidance near the control", "Required and custom validation messages appear separately from the label and are associated with the control.", [
153
- validationForm
154
- ]),
155
- card("field-layout", "06", "An optional floating label", "Keep labels above controls by default, or place them on the outline. Disabled fields disable their wrapped native controls.", [
156
- new FormFieldComponent({ id: "field-floating", label: "Workspace", labelPosition: "floating", value: "Design workspace", description: "The label stays visible when the field is empty." }),
157
- new FormFieldComponent({ label: "Managed project", disabled: true, control: new SelectComponent({ id: "field-disabled-select", data: projectOptions, value: "design" }) }),
158
- new FormFieldComponent({ id: "field-disabled-input", label: "Managed identifier", disabled: true, value: "PROJ-2026-010" })
159
- ])
160
- ], [
161
- text("pre", 'const input = new InputComponent({ value: "Project name" });\nconst field = new FormFieldComponent({\n label: "Project name", control: input,\n description: "Choose a name your team will recognize.",\n required: true\n});', "sample-code"),
162
- text("p", "FormField owns labels, layout, descriptions, required indicators, and validation feedback. The child owns editing, formatting, and popup cleanup. Supply control to compose an existing component; legacy type, value, dateOptions, numberOptions, and autoSuggestOptions use a compatibility factory."),
163
- text("p", "getValue() and setValue() delegate to the wrapped control, so supplied controls use their own setter types (for example, a number or Date). Legacy number and date fields continue to accept string values. getControl() returns the child component. A generic return type can describe custom controls, for example FormFieldComponent<string[]> for a multi-select."),
164
- text("p", "A native label targets the wrapped control's existing ID. id or controlId can specify the target. Helper and validation messages extend existing aria-describedby associations. disabled uses a native fieldset so controls such as SelectComponent are disabled together."),
165
- text("p", "The default labelPosition is above. The optional floating presentation places an always-visible label on the outline, preserving space for a placeholder. Custom controls keep their own surfaces.")
166
- ]);
1
+ import { IJSLComponent, IJSLVNode } from "jsl-render";
2
+ import { InputComponent } from "../../components/input/InputComponent";
3
+ import { NumberComponent } from "../../components/number/NumberComponent";
4
+ import { DateComponent } from "../../components/date/DateComponent";
5
+ import { SelectComponent } from "../../components/select/SelectComponent";
6
+ import { FormFieldComponent } from "../../components/form-field/FormFieldComponent";
7
+ import { FormComponent } from "../../components/form-field/FormComponent";
8
+ import { ButtonComponent } from "../../components/button/ButtonComponent";
9
+ import { date } from "../../core/date";
10
+ import { numeric } from "../../core/numeric";
11
+
12
+ type Content = IJSLVNode | IJSLComponent;
13
+ const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
14
+ const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
15
+ const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
16
+ const action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: "button", outlined: true, size: "small" });
17
+ const sampleField = (id: string, label: string, control: Content) => group([
18
+ { tag: "label", content: label, attr: { for: id } }, control
19
+ ], "field-sample");
20
+ function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
21
+ return { tag: "article", attr: { id, class: "sample-card" }, children: [
22
+ group([text("span", number, "sample-number"), text("h3", title)], "card-heading"),
23
+ text("p", description, "card-description"), ...children
24
+ ] };
25
+ }
26
+ function section(id: string, number: string, title: string, description: string, preview: Content, cards: IJSLVNode[], usage: Content[]): IJSLVNode {
27
+ return { tag: "section", attr: { id, class: "component-section", "aria-labelledby": id + "-title" }, children: [
28
+ group([
29
+ group([text("p", "THE ESSENTIALS / " + number, "eyebrow"),
30
+ { tag: "h2", content: title, attr: { id: id + "-title", class: "section-title" } },
31
+ text("p", description, "hero-description")], "hero-copy"),
32
+ group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview], "hero-preview fields-preview")
33
+ ], "hero"),
34
+ group(cards, "sample-grid fields-sample-grid"),
35
+ { tag: "details", attr: { class: "usage" }, children: [text("summary", title + " usage & compatibility"), ...usage] }
36
+ ] };
37
+ }
38
+ const inputStatus = status("Start typing to see the input event.");
39
+ const notesStatus = status("A few notes for the team.");
40
+ export const inputShowcase = section("inputs", "11", "Inputs",
41
+ "A consistent place to type. Simple defaults for text, passwords, and longer notes.",
42
+ new InputComponent({ id: "input-preview", placeholder: "What are you working on?", ariaLabel: "Preview input" }), [
43
+ card("input-basic", "01", "Text as you type", "Input and change events keep their familiar string values. Add an external label or use a FormField.", [
44
+ sampleField("input-name", "Project name", new InputComponent({
45
+ id: "input-name", placeholder: "Give your project a name", maxLength: 40,
46
+ onInput: value => { inputStatus.content = value ? "Typing: " + value : "The field is empty."; },
47
+ onChange: value => { inputStatus.content = "Committed: " + (value || "empty"); }
48
+ })), inputStatus
49
+ ]),
50
+ card("input-textarea", "02", "Room for a longer thought", "Use the same familiar events with a multiline field.", [
51
+ sampleField("input-notes", "Notes", new InputComponent({
52
+ id: "input-notes", type: "textarea", rows: 4, value: "A few notes for the team.",
53
+ onInput: value => { notesStatus.content = value.length + " characters in the notes."; }
54
+ })), notesStatus
55
+ ]),
56
+ card("input-states", "03", "Useful native input types", "Passwords, email, read-only values, and disabled fields share the same base appearance.", [
57
+ sampleField("input-password", "Password", new InputComponent({ id: "input-password", type: "password", value: "A little privacy" })),
58
+ sampleField("input-readonly", "Read-only identifier", new InputComponent({ id: "input-readonly", value: "PROJ-2026-010", readOnly: true })),
59
+ sampleField("input-disabled", "Unavailable value", new InputComponent({ id: "input-disabled", value: "Managed by your team", enabled: false }))
60
+ ]),
61
+ card("input-unstyled", "04", "A building block when needed", "Opt out of the library surface for a grid cell or a custom editor while keeping normal input behavior.", [
62
+ group([
63
+ text("span", "PROJECT /", "inline-note"),
64
+ new InputComponent({ id: "input-plain", value: "An inline title", ariaLabel: "Inline title", unstyled: true, class: "showcase-inline-input" })
65
+ ], "unstyled-input-sample"),
66
+ text("pre", '{ unstyled: true, class: "my-editor" }', "sample-code")
67
+ ])
68
+ ], [
69
+ text("pre", 'new InputComponent({\n value: "A project", placeholder: "Project name",\n onChange: value => console.log(value)\n});', "sample-code"),
70
+ text("p", "Existing options, events, getValue(), and setValue() remain supported. The input alias for type is retained. setValue() stays silent. unstyled skips the base CSS class; ariaLabel, readOnly, rows, autocomplete, and focus() are optional additions."),
71
+ text("p", "Use bindOnInput to choose when a bound model updates. Binding modes and model synchronization are demonstrated in the Data binding section.")
72
+ ]);
73
+
74
+ const numberStatus = status("Commit a value with Enter or by leaving the field.");
75
+ export const numberShowcase = section("numbers", "12", "Numbers",
76
+ "The same surface, with numeric behavior. Formats and converters stay close to the value.",
77
+ new NumberComponent({ id: "number-preview", value: 1250.5, format: "#,0.00", ariaLabel: "Preview amount" }), [
78
+ card("number-basic", "01", "A number with a format", "Edit a decimal, then commit it. Formatting happens on blur or Enter.", [
79
+ sampleField("number-amount", "Amount", new NumberComponent({
80
+ id: "number-amount", value: 1250.5, format: "#,0.00",
81
+ onChange: value => { numberStatus.content = value == null ? "Amount cleared." : "Numeric value: " + value; }
82
+ })), numberStatus,
83
+ sampleField("number-zero", "Whole number", new NumberComponent({ id: "number-zero", value: 0, format: "0" }))
84
+ ]),
85
+ card("number-options", "02", "Choose when to format", "Formatting and Enter commits can be disabled independently.", [
86
+ sampleField("number-live", "Format preserved while editing", new NumberComponent({
87
+ id: "number-live", value: 12.5, format: "0.00", formatOnBlur: false, commitOnEnter: false
88
+ })),
89
+ text("pre", "{ formatOnBlur: false, commitOnEnter: false }", "sample-code")
90
+ ]),
91
+ card("number-states", "03", "Consistent states", "Disabled and read-only values match the other controls. Unstyled mode remains available for embedded editors.", [
92
+ sampleField("number-disabled", "Unavailable amount", new NumberComponent({ id: "number-disabled", value: 99, format: "0.00", enabled: false })),
93
+ sampleField("number-readonly", "Calculated total", new NumberComponent({ id: "number-readonly", value: 149.95, format: "0.00", readOnly: true })),
94
+ text("pre", '{ unstyled: true }', "sample-code")
95
+ ])
96
+ ], [
97
+ text("pre", 'new NumberComponent({\n value: 1250.5, format: "#,0.00",\n onChange: value => console.log(value)\n});', "sample-code"),
98
+ text("p", "getValue() returns the displayed string; getValueAsNumber() returns its parsed number. Formatting follows the existing culture settings and numeric helpers. Empty values remain undefined. setValue() updates the control silently."),
99
+ text("p", "commitOnEnter is now honored. Enter followed by blur does not publish the same commit twice. Malformed numeric drafts remain visible for correction and do not write NaN to the model.")
100
+ ]);
101
+
102
+ const projectOptions = [{ value: "design", text: "Design system" }, { value: "website", text: "Website refresh" }, { value: "research", text: "Customer research" }];
103
+ const cities = ["Vienna", "Berlin", "Copenhagen", "London", "New York", "Singapore", "Sydney", "Tokyo"];
104
+ const validationStatus = status("Validate the form to see messages below its controls.");
105
+ const emailField = new FormFieldComponent({
106
+ label: "Email address", required: true, description: "Use your work email.",
107
+ control: new InputComponent({ id: "field-email", type: "email", placeholder: "you@example.com" })
108
+ });
109
+ const projectField = new FormFieldComponent({
110
+ label: "Project", required: true,
111
+ control: new SelectComponent({ id: "field-project", data: projectOptions, placeholder: "Choose a project" })
112
+ });
113
+ const validationForm = new FormComponent([emailField, projectField, action("Validate form", () => {
114
+ validationStatus.content = validationForm.validate() ? "All fields are valid." : "Please correct the marked fields.";
115
+ }), validationStatus]);
116
+
117
+ export const formFieldShowcase = section("form-fields", "13", "Form fields",
118
+ "A label and a little guidance. Wrap the control that fits the job.",
119
+ new FormFieldComponent({
120
+ label: "Project name", description: "Clear names help everyone find their work.",
121
+ control: new InputComponent({ id: "field-preview", value: "Component library" })
122
+ }), [
123
+ card("field-composition", "01", "Controls that belong together", "Text, numbers, and selects keep their own behavior while sharing a consistent field layout.", [
124
+ group([
125
+ new FormFieldComponent({ label: "Project name", control: new InputComponent({ id: "field-name", value: "A new project" }) }),
126
+ new FormFieldComponent({ label: "Budget", control: new NumberComponent({ id: "field-budget", value: 1200, format: "#,0.00" }) }),
127
+ new FormFieldComponent({ label: "Team", control: new SelectComponent({ id: "field-team", data: projectOptions, value: "design" }) })
128
+ ], "composed-fields"),
129
+ text("pre", 'new FormFieldComponent({\n label: "Team", control: new SelectComponent({ data })\n});', "sample-code")
130
+ ]),
131
+ card("field-legacy", "02", "Existing field types still work", "The original shorthand creates the same input components internally. Existing getValue(), setValue(), and validation calls continue to work.", [
132
+ new FormFieldComponent({ id: "field-legacy-text", label: "User name", type: "text", value: "Alex" }),
133
+ new FormFieldComponent({ id: "field-legacy-password", label: "Password", type: "password", value: "A private value" }),
134
+ text("pre", 'new FormFieldComponent({ label: "User name", type: "text" });', "sample-code")
135
+ ]),
136
+ card("field-specialized", "03", "Dates and formatted numbers", "Specialized controls handle their values and popups. The field adds the label and supporting text.", [
137
+ new FormFieldComponent({
138
+ id: "field-date", label: "Start date", type: "date", value: "15/10/2026",
139
+ dateOptions: { format: value => date.format(value, "dd/mm/yy"), parse: value => date.parse(value, "dd/mm/yy") }
140
+ }),
141
+ new FormFieldComponent({ id: "field-number", label: "Estimated cost", type: "number", value: numeric.format(1250.5, "0.00"), numberOptions: { format: "#,0.00" } }),
142
+ new FormFieldComponent({ label: "Milestone", control: new DateComponent({ id: "field-wrapped-date", value: new Date(2026, 9, 21) }) })
143
+ ]),
144
+ card("field-autosuggest", "04", "Suggestions while you type", "AutoSuggestComponent now uses the shared input styling and owns its suggestion lifecycle.", [
145
+ new FormFieldComponent({
146
+ id: "field-city", label: "Office city", type: "autosuggest", placeholder: "Start typing a city",
147
+ description: "Try Vienna, Berlin, or Tokyo.",
148
+ autoSuggestOptions: { minChars: 1, delay: 0, source: (term, suggest) => suggest(cities.filter(city => city.toLowerCase().includes(term.toLowerCase()))) }
149
+ }),
150
+ text("p", "The original autoSuggestOptions source and callbacks remain available.", "inline-note")
151
+ ]),
152
+ card("field-validation", "05", "Guidance near the control", "Required and custom validation messages appear separately from the label and are associated with the control.", [
153
+ validationForm
154
+ ]),
155
+ card("field-layout", "06", "An optional floating label", "Keep labels above controls by default, or place them on the outline. Disabled fields disable their wrapped native controls.", [
156
+ new FormFieldComponent({ id: "field-floating", label: "Workspace", labelPosition: "floating", value: "Design workspace", description: "The label stays visible when the field is empty." }),
157
+ new FormFieldComponent({ label: "Managed project", disabled: true, control: new SelectComponent({ id: "field-disabled-select", data: projectOptions, value: "design" }) }),
158
+ new FormFieldComponent({ id: "field-disabled-input", label: "Managed identifier", disabled: true, value: "PROJ-2026-010" })
159
+ ])
160
+ ], [
161
+ text("pre", 'const input = new InputComponent({ value: "Project name" });\nconst field = new FormFieldComponent({\n label: "Project name", control: input,\n description: "Choose a name your team will recognize.",\n required: true\n});', "sample-code"),
162
+ text("p", "FormField owns labels, layout, descriptions, required indicators, and validation feedback. The child owns editing, formatting, and popup cleanup. Supply control to compose an existing component; legacy type, value, dateOptions, numberOptions, and autoSuggestOptions use a compatibility factory."),
163
+ text("p", "getValue() and setValue() delegate to the wrapped control, so supplied controls use their own setter types (for example, a number or Date). Legacy number and date fields continue to accept string values. getControl() returns the child component. A generic return type can describe custom controls, for example FormFieldComponent<string[]> for a multi-select."),
164
+ text("p", "A native label targets the wrapped control's existing ID. id or controlId can specify the target. Helper and validation messages extend existing aria-describedby associations. disabled uses a native fieldset so controls such as SelectComponent are disabled together."),
165
+ text("p", "The default labelPosition is above. The optional floating presentation places an always-visible label on the outline, preserving space for a placeholder. Custom controls keep their own surfaces.")
166
+ ]);
@@ -1,93 +1,93 @@
1
- Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage)
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- https://scripts.sil.org/OFL
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.
1
+ Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.