@jxsuite/ui 0.0.0 → 0.2.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 (105) hide show
  1. package/components/jx-accordion-item.json +281 -0
  2. package/components/jx-accordion.json +33 -0
  3. package/components/jx-action-button.json +268 -34
  4. package/components/jx-action-group.json +131 -0
  5. package/components/jx-button.json +141 -26
  6. package/components/jx-checkbox.json +222 -0
  7. package/components/jx-color-area.json +263 -0
  8. package/components/jx-color-field.json +565 -0
  9. package/components/jx-color-slider.json +216 -0
  10. package/components/jx-combobox.json +551 -0
  11. package/components/jx-dialog.json +416 -0
  12. package/components/jx-divider.json +52 -0
  13. package/components/jx-dot.json +38 -0
  14. package/components/jx-field.json +162 -0
  15. package/components/jx-kbd.json +24 -0
  16. package/components/jx-listbox.json +76 -0
  17. package/components/jx-menu-item.json +6 -13
  18. package/components/jx-menu.json +45 -6
  19. package/components/jx-number-field.json +441 -0
  20. package/components/jx-option.json +350 -0
  21. package/components/jx-popover.json +227 -0
  22. package/components/jx-select.json +637 -0
  23. package/components/jx-spinner.json +129 -0
  24. package/components/jx-split.json +221 -0
  25. package/components/jx-swatch-group.json +107 -0
  26. package/components/jx-swatch.json +262 -0
  27. package/components/jx-switch.json +331 -0
  28. package/components/jx-tab-panel.json +58 -0
  29. package/components/jx-tab.json +296 -0
  30. package/components/jx-tabs.json +124 -0
  31. package/components/jx-textfield.json +645 -0
  32. package/components/jx-toast-host.json +121 -0
  33. package/components/jx-toast.json +255 -0
  34. package/components/jx-toolbar.json +81 -0
  35. package/components/jx-tooltip.json +207 -0
  36. package/components/jx-tree-item.json +325 -0
  37. package/components/jx-tree.json +202 -0
  38. package/icons/list.json +4 -0
  39. package/icons/manifest.json +12 -0
  40. package/package.json +27 -5
  41. package/project.json +164 -153
  42. package/src/behaviors/action-group.ts +255 -0
  43. package/src/behaviors/color-area.ts +303 -0
  44. package/src/behaviors/color-field.ts +465 -0
  45. package/src/behaviors/color-slider.ts +154 -0
  46. package/src/behaviors/combobox.ts +474 -0
  47. package/src/behaviors/dialog.ts +137 -0
  48. package/src/behaviors/listbox.ts +118 -0
  49. package/src/behaviors/menu.ts +80 -48
  50. package/src/behaviors/number-field.ts +161 -0
  51. package/src/behaviors/popover.ts +399 -0
  52. package/src/behaviors/select.ts +154 -0
  53. package/src/behaviors/split.ts +478 -0
  54. package/src/behaviors/swatch-group.ts +297 -0
  55. package/src/behaviors/tabs.ts +319 -0
  56. package/src/behaviors/textfield.ts +164 -0
  57. package/src/behaviors/toast-host.ts +241 -0
  58. package/src/behaviors/toast.ts +261 -0
  59. package/src/behaviors/toolbar.ts +413 -0
  60. package/src/behaviors/tooltip.ts +719 -0
  61. package/src/behaviors/tree.ts +830 -0
  62. package/src/color.ts +433 -0
  63. package/src/documents.ts +91 -1
  64. package/src/index.ts +41 -1
  65. package/src/loaders.ts +47 -0
  66. package/src/testing/anchor-support.ts +28 -0
  67. package/src/testing/popover-shim.ts +39 -6
  68. package/src/theme.ts +30 -6
  69. package/stylebook/jx-accordion-item.json +195 -0
  70. package/stylebook/jx-accordion.json +220 -0
  71. package/stylebook/jx-action-button.json +191 -23
  72. package/stylebook/jx-action-group.json +335 -0
  73. package/stylebook/jx-button.json +129 -26
  74. package/stylebook/jx-checkbox.json +245 -0
  75. package/stylebook/jx-color-area.json +272 -0
  76. package/stylebook/jx-color-field.json +261 -0
  77. package/stylebook/jx-color-slider.json +220 -0
  78. package/stylebook/jx-combobox.json +332 -0
  79. package/stylebook/jx-dialog.json +186 -0
  80. package/stylebook/jx-divider.json +125 -0
  81. package/stylebook/jx-dot.json +92 -0
  82. package/stylebook/jx-field.json +313 -0
  83. package/stylebook/jx-icon.json +4 -0
  84. package/stylebook/jx-kbd.json +90 -0
  85. package/stylebook/jx-listbox.json +337 -0
  86. package/stylebook/jx-menu.json +0 -1
  87. package/stylebook/jx-number-field.json +203 -0
  88. package/stylebook/jx-option.json +285 -0
  89. package/stylebook/jx-popover.json +123 -0
  90. package/stylebook/jx-select.json +407 -0
  91. package/stylebook/jx-spinner.json +111 -0
  92. package/stylebook/jx-split.json +170 -0
  93. package/stylebook/jx-swatch-group.json +175 -0
  94. package/stylebook/jx-swatch.json +249 -0
  95. package/stylebook/jx-switch.json +240 -0
  96. package/stylebook/jx-tab-panel.json +147 -0
  97. package/stylebook/jx-tab.json +201 -0
  98. package/stylebook/jx-tabs.json +278 -0
  99. package/stylebook/jx-textfield.json +309 -0
  100. package/stylebook/jx-toast-host.json +157 -0
  101. package/stylebook/jx-toast.json +266 -0
  102. package/stylebook/jx-toolbar.json +435 -0
  103. package/stylebook/jx-tooltip.json +162 -0
  104. package/stylebook/jx-tree-item.json +258 -0
  105. package/stylebook/jx-tree.json +429 -0
@@ -0,0 +1,337 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookListbox",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-option.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-listbox.json"
14
+ }
15
+ ],
16
+ "state": {
17
+ "active": "owned-o0",
18
+ "picked": "",
19
+ "hover": {
20
+ "$prototype": "Function",
21
+ "body": [
22
+ {
23
+ "operator": "=",
24
+ "target": {
25
+ "$ref": "#/state/active"
26
+ },
27
+ "value": {
28
+ "$ref": "event#/currentTarget/id"
29
+ }
30
+ }
31
+ ]
32
+ },
33
+ "note": {
34
+ "$prototype": "Function",
35
+ "body": [
36
+ {
37
+ "operator": "=",
38
+ "target": {
39
+ "$ref": "#/state/picked"
40
+ },
41
+ "value": {
42
+ "$ref": "event#/detail"
43
+ }
44
+ }
45
+ ]
46
+ }
47
+ },
48
+ "style": {
49
+ "fontFamily": "var(--jx-font-sans)",
50
+ "fontSize": "var(--jx-text-md)",
51
+ "color": "var(--jx-fg)",
52
+ "background": "var(--jx-bg)",
53
+ "padding": "var(--jx-space-6)",
54
+ "minHeight": "100vh",
55
+ "& > h1": {
56
+ "fontSize": "var(--jx-text-lg)",
57
+ "fontWeight": "600",
58
+ "margin": "0 0 var(--jx-space-5)"
59
+ },
60
+ "& > h2": {
61
+ "fontSize": "var(--jx-text-md)",
62
+ "fontWeight": "600",
63
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
64
+ },
65
+ "& > p": {
66
+ "color": "var(--jx-fg-dim)",
67
+ "margin": "0 0 var(--jx-space-5)"
68
+ },
69
+ "& [part=\"panel\"]": {
70
+ "width": "420px",
71
+ "maxWidth": "100%",
72
+ "display": "flex",
73
+ "flexDirection": "column",
74
+ "minHeight": "0",
75
+ "overflow": "hidden",
76
+ "border": "1px solid var(--jx-border)",
77
+ "borderRadius": "var(--jx-radius-md)",
78
+ "background": "var(--jx-bg-overlay)"
79
+ },
80
+ "& [part=\"filter\"]": {
81
+ "display": "block",
82
+ "width": "100%",
83
+ "boxSizing": "border-box",
84
+ "flex": "0 0 auto",
85
+ "padding": "var(--jx-space-2) var(--jx-space-3)",
86
+ "border": "none",
87
+ "borderBottom": "1px solid var(--jx-border)",
88
+ "background": "transparent",
89
+ "color": "inherit",
90
+ "font": "inherit",
91
+ "outline": "none",
92
+ ":focus-visible": {
93
+ "outline": "var(--jx-focus-ring)",
94
+ "outlineOffset": "-2px"
95
+ }
96
+ },
97
+ "& jx-listbox": {
98
+ "--jx-listbox-max-block-size": "220px",
99
+ "padding": "var(--jx-space-2)"
100
+ },
101
+ "& [part=\"picked\"]": {
102
+ "margin": "var(--jx-space-3) 0 0",
103
+ "color": "var(--jx-fg-muted)",
104
+ "fontSize": "var(--jx-text-sm)"
105
+ }
106
+ },
107
+ "children": [
108
+ {
109
+ "tagName": "h1",
110
+ "textContent": "jx-listbox"
111
+ },
112
+ {
113
+ "tagName": "p",
114
+ "textContent": "A named list of rows whose keyboard belongs to somebody else. It has no tab stop and never calls focus(): one of its two owners is a field that must keep the caret, and the other is nothing at all — a panel filtering for a caret that is somewhere else entirely. A consumer moves the highlight by writing ONE string, active, which is the same id its field points aria-activedescendant at."
115
+ },
116
+ {
117
+ "tagName": "h2",
118
+ "textContent": "Owned by a field"
119
+ },
120
+ {
121
+ "tagName": "p",
122
+ "textContent": "The palette shape: a borderless field over the list, aria-controls naming it and aria-activedescendant naming the row. The field keeps the caret, so every character typed still lands in it. Hover the rows — the pointer writes the same id an arrow key would."
123
+ },
124
+ {
125
+ "tagName": "div",
126
+ "attributes": {
127
+ "part": "panel"
128
+ },
129
+ "children": [
130
+ {
131
+ "tagName": "input",
132
+ "attributes": {
133
+ "part": "filter",
134
+ "type": "text",
135
+ "role": "combobox",
136
+ "autocomplete": "off",
137
+ "aria-autocomplete": "list",
138
+ "aria-controls": "owned",
139
+ "aria-expanded": "true",
140
+ "aria-activedescendant": "${state.active}",
141
+ "aria-label": "Filter commands",
142
+ "placeholder": "Filter…"
143
+ }
144
+ },
145
+ {
146
+ "tagName": "jx-listbox",
147
+ "attributes": {
148
+ "id": "owned"
149
+ },
150
+ "$props": {
151
+ "label": "Commands",
152
+ "active": "${state.active}"
153
+ },
154
+ "onselect": {
155
+ "$ref": "#/state/note"
156
+ },
157
+ "children": [
158
+ {
159
+ "tagName": "jx-option",
160
+ "attributes": {
161
+ "id": "owned-o0"
162
+ },
163
+ "$props": {
164
+ "value": "open",
165
+ "label": "Open file…",
166
+ "description": "workspace"
167
+ },
168
+ "onmouseenter": {
169
+ "$ref": "#/state/hover"
170
+ }
171
+ },
172
+ {
173
+ "tagName": "jx-option",
174
+ "attributes": {
175
+ "id": "owned-o1"
176
+ },
177
+ "$props": {
178
+ "value": "save",
179
+ "label": "Save",
180
+ "description": "document"
181
+ },
182
+ "onmouseenter": {
183
+ "$ref": "#/state/hover"
184
+ }
185
+ },
186
+ {
187
+ "tagName": "jx-option",
188
+ "attributes": {
189
+ "id": "owned-o2"
190
+ },
191
+ "$props": {
192
+ "value": "publish",
193
+ "label": "Publish site",
194
+ "description": "project"
195
+ },
196
+ "onmouseenter": {
197
+ "$ref": "#/state/hover"
198
+ }
199
+ }
200
+ ]
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ "tagName": "p",
206
+ "attributes": {
207
+ "part": "picked"
208
+ },
209
+ "textContent": "Active: ${state.active} · picked: ${state.picked}"
210
+ },
211
+ {
212
+ "tagName": "h2",
213
+ "textContent": "Owned by nothing at all"
214
+ },
215
+ {
216
+ "tagName": "p",
217
+ "textContent": "The slash-menu shape: no field, no focus, nothing in the panel a Tab can reach. The caret it is filtering for is in the canvas, often in another realm, so the panel marks its row and stays out of the way. Its heading and its empty sentence are nodes the consumer writes, carrying part=group-heading and part=empty, which this element draws because it owns the box they sit in."
218
+ },
219
+ {
220
+ "tagName": "div",
221
+ "attributes": {
222
+ "part": "panel"
223
+ },
224
+ "children": [
225
+ {
226
+ "tagName": "jx-listbox",
227
+ "attributes": {
228
+ "id": "unowned"
229
+ },
230
+ "$props": {
231
+ "label": "Elements",
232
+ "active": "unowned-o1"
233
+ },
234
+ "children": [
235
+ {
236
+ "tagName": "div",
237
+ "attributes": {
238
+ "role": "group",
239
+ "aria-label": "Text"
240
+ },
241
+ "children": [
242
+ {
243
+ "tagName": "div",
244
+ "attributes": {
245
+ "part": "group-heading",
246
+ "aria-hidden": "true"
247
+ },
248
+ "textContent": "Text"
249
+ },
250
+ {
251
+ "tagName": "jx-option",
252
+ "attributes": {
253
+ "id": "unowned-o0"
254
+ },
255
+ "$props": {
256
+ "value": "h1",
257
+ "label": "Heading",
258
+ "description": "h1"
259
+ }
260
+ },
261
+ {
262
+ "tagName": "jx-option",
263
+ "attributes": {
264
+ "id": "unowned-o1"
265
+ },
266
+ "$props": {
267
+ "value": "p",
268
+ "label": "Paragraph",
269
+ "description": "p"
270
+ }
271
+ }
272
+ ]
273
+ },
274
+ {
275
+ "tagName": "div",
276
+ "attributes": {
277
+ "role": "group",
278
+ "aria-label": "Media"
279
+ },
280
+ "children": [
281
+ {
282
+ "tagName": "div",
283
+ "attributes": {
284
+ "part": "group-heading",
285
+ "aria-hidden": "true"
286
+ },
287
+ "textContent": "Media"
288
+ },
289
+ {
290
+ "tagName": "jx-option",
291
+ "attributes": {
292
+ "id": "unowned-o2"
293
+ },
294
+ "$props": {
295
+ "value": "img",
296
+ "label": "Image",
297
+ "description": "img"
298
+ }
299
+ }
300
+ ]
301
+ }
302
+ ]
303
+ }
304
+ ]
305
+ },
306
+ {
307
+ "tagName": "h2",
308
+ "textContent": "Nothing matched"
309
+ },
310
+ {
311
+ "tagName": "div",
312
+ "attributes": {
313
+ "part": "panel"
314
+ },
315
+ "children": [
316
+ {
317
+ "tagName": "jx-listbox",
318
+ "attributes": {
319
+ "id": "nothing"
320
+ },
321
+ "$props": {
322
+ "label": "Results"
323
+ },
324
+ "children": [
325
+ {
326
+ "tagName": "div",
327
+ "attributes": {
328
+ "part": "empty"
329
+ },
330
+ "textContent": "No matches"
331
+ }
332
+ ]
333
+ }
334
+ ]
335
+ }
336
+ ]
337
+ }
@@ -108,7 +108,6 @@
108
108
  "last": "",
109
109
  "note": {
110
110
  "$prototype": "Function",
111
- "parameters": ["event"],
112
111
  "body": [
113
112
  {
114
113
  "operator": "=",
@@ -0,0 +1,203 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookNumberField",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-field.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-number-field.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "opacity": "0.5"
15
+ },
16
+ "style": {
17
+ "fontFamily": "var(--jx-font-sans)",
18
+ "fontSize": "var(--jx-text-md)",
19
+ "color": "var(--jx-fg)",
20
+ "background": "var(--jx-bg)",
21
+ "padding": "var(--jx-space-6)",
22
+ "minHeight": "100vh",
23
+ "& > h1": {
24
+ "fontSize": "var(--jx-text-lg)",
25
+ "fontWeight": "600",
26
+ "margin": "0 0 var(--jx-space-5)"
27
+ },
28
+ "& > h2": {
29
+ "fontSize": "var(--jx-text-md)",
30
+ "fontWeight": "600",
31
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
32
+ },
33
+ "& > p": {
34
+ "color": "var(--jx-fg-dim)",
35
+ "margin": "0 0 var(--jx-space-5)"
36
+ },
37
+ "& [role=\"group\"]": {
38
+ "display": "flex",
39
+ "alignItems": "flex-start",
40
+ "flexWrap": "wrap",
41
+ "gap": "var(--jx-space-3)",
42
+ "margin": "0 0 var(--jx-space-4)"
43
+ },
44
+ "& [role=\"group\"] > span": {
45
+ "width": "80px",
46
+ "color": "var(--jx-fg-muted)",
47
+ "fontSize": "var(--jx-text-sm)"
48
+ }
49
+ },
50
+ "children": [
51
+ {
52
+ "tagName": "h1",
53
+ "textContent": "jx-number-field"
54
+ },
55
+ {
56
+ "tagName": "p",
57
+ "textContent": "A native number input. The platform supplies the spinbutton role, the announced value, the Arrow keys and the range; the element adds a ten-step Shift+Arrow, the two stepping buttons, and the difference between an empty value and a half-typed one."
58
+ },
59
+ {
60
+ "tagName": "p",
61
+ "textContent": "The events are the platform's own two names and nothing else. On the reader's own paths the native input and change bubble out of the control untouched, so a host reads event.target.valueAsNumber (NaN when the field is empty), event.target.validity and event.target.form; on the paths the element writes the value itself, the stepper buttons and Shift+Arrow, the same two names come from the element. Whether an empty value is a clear or a half-typed number is read off the element, as its badInput prop or the data-bad-input attribute it mirrors."
62
+ },
63
+ {
64
+ "tagName": "div",
65
+ "attributes": {
66
+ "role": "group",
67
+ "aria-label": "Bound value"
68
+ },
69
+ "children": [
70
+ {
71
+ "tagName": "jx-number-field",
72
+ "$props": {
73
+ "label": "Opacity",
74
+ "min": "0",
75
+ "max": "1",
76
+ "step": "0.1",
77
+ "stepper": true,
78
+ "value": {
79
+ "$ref": "#/state/opacity"
80
+ }
81
+ },
82
+ "onchange": {
83
+ "$prototype": "Function",
84
+ "body": [
85
+ {
86
+ "operator": "=",
87
+ "target": {
88
+ "$ref": "#/state/opacity"
89
+ },
90
+ "value": {
91
+ "$ref": "event#/target/value"
92
+ }
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "tagName": "span",
99
+ "textContent": "${state.opacity}"
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ "tagName": "div",
105
+ "attributes": {
106
+ "role": "group",
107
+ "aria-label": "Sizes"
108
+ },
109
+ "children": [
110
+ {
111
+ "tagName": "jx-number-field",
112
+ "$props": {
113
+ "label": "Small",
114
+ "size": "sm",
115
+ "stepper": true,
116
+ "value": "1"
117
+ }
118
+ },
119
+ {
120
+ "tagName": "jx-number-field",
121
+ "$props": {
122
+ "label": "Medium",
123
+ "stepper": true,
124
+ "value": "2"
125
+ }
126
+ },
127
+ {
128
+ "tagName": "jx-number-field",
129
+ "$props": {
130
+ "label": "Large",
131
+ "size": "lg",
132
+ "stepper": true,
133
+ "value": "3"
134
+ }
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ "tagName": "div",
140
+ "attributes": {
141
+ "role": "group",
142
+ "aria-label": "Range and states"
143
+ },
144
+ "children": [
145
+ {
146
+ "tagName": "jx-number-field",
147
+ "$props": {
148
+ "label": "Unbounded",
149
+ "placeholder": "auto"
150
+ }
151
+ },
152
+ {
153
+ "tagName": "jx-number-field",
154
+ "$props": {
155
+ "label": "Off the step grid",
156
+ "min": "0",
157
+ "step": "0.3",
158
+ "value": "0.5"
159
+ }
160
+ },
161
+ {
162
+ "tagName": "jx-number-field",
163
+ "$props": {
164
+ "label": "Disabled",
165
+ "disabled": true,
166
+ "stepper": true,
167
+ "value": "12"
168
+ }
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "tagName": "h2",
174
+ "textContent": "In a field row"
175
+ },
176
+ {
177
+ "tagName": "p",
178
+ "textContent": "The row is jx-field. It mints the ids its label and its help sentence carry, and hands them to the field as labelledby and describedby, so nothing on this page writes an id."
179
+ },
180
+ {
181
+ "tagName": "jx-field",
182
+ "$props": {
183
+ "label": "Columns",
184
+ "description": "Between 1 and 12. Hold Shift with an Arrow key to move ten at a time."
185
+ },
186
+ "attributes": {
187
+ "data-prop": "columns"
188
+ },
189
+ "children": [
190
+ {
191
+ "tagName": "jx-number-field",
192
+ "$props": {
193
+ "min": "1",
194
+ "max": "12",
195
+ "step": "1",
196
+ "stepper": true,
197
+ "value": "3"
198
+ }
199
+ }
200
+ ]
201
+ }
202
+ ]
203
+ }