@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,220 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookColorSlider",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-color-slider.json"
8
+ }
9
+ ],
10
+ "state": {
11
+ "hue": 210,
12
+ "opacity": 60
13
+ },
14
+ "style": {
15
+ "fontFamily": "var(--jx-font-sans)",
16
+ "fontSize": "var(--jx-text-md)",
17
+ "color": "var(--jx-fg)",
18
+ "background": "var(--jx-bg)",
19
+ "padding": "var(--jx-space-6)",
20
+ "minHeight": "100vh",
21
+ "& > h1": {
22
+ "fontSize": "var(--jx-text-lg)",
23
+ "fontWeight": "600",
24
+ "margin": "0 0 var(--jx-space-5)"
25
+ },
26
+ "& > h2": {
27
+ "fontSize": "var(--jx-text-md)",
28
+ "fontWeight": "600",
29
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
30
+ },
31
+ "& > p": {
32
+ "color": "var(--jx-fg-dim)",
33
+ "margin": "0 0 var(--jx-space-5)"
34
+ },
35
+ "& [role=\"group\"]": {
36
+ "display": "flex",
37
+ "alignItems": "center",
38
+ "flexWrap": "wrap",
39
+ "gap": "var(--jx-space-4)",
40
+ "margin": "0 0 var(--jx-space-4)",
41
+ "maxWidth": "420px"
42
+ },
43
+ "& [role=\"group\"] > span": {
44
+ "width": "90px",
45
+ "color": "var(--jx-fg-muted)",
46
+ "fontSize": "var(--jx-text-sm)"
47
+ },
48
+ "& [role=\"group\"] > jx-color-slider": {
49
+ "flex": "1 1 200px"
50
+ }
51
+ },
52
+ "children": [
53
+ {
54
+ "tagName": "h1",
55
+ "textContent": "jx-color-slider"
56
+ },
57
+ {
58
+ "tagName": "p",
59
+ "textContent": "One native range drawn over a gradient. The platform supplies the slider role, the announced value, the thumb, the drag, the arrow keys with their clamping, and Home, End, PageUp and PageDown; the element adds a ten-step Shift+Arrow and re-says the platform's own input and change from itself, so a listener always reads e.target.value off the element."
60
+ },
61
+ {
62
+ "tagName": "h2",
63
+ "textContent": "Channels"
64
+ },
65
+ {
66
+ "tagName": "div",
67
+ "attributes": {
68
+ "role": "group",
69
+ "aria-label": "Hue, bound both ways"
70
+ },
71
+ "children": [
72
+ {
73
+ "tagName": "span",
74
+ "textContent": "Hue"
75
+ },
76
+ {
77
+ "tagName": "jx-color-slider",
78
+ "$props": {
79
+ "label": "Hue",
80
+ "channel": "hue",
81
+ "value": {
82
+ "$ref": "#/state/hue"
83
+ }
84
+ },
85
+ "oninput": {
86
+ "$prototype": "Function",
87
+ "body": [
88
+ {
89
+ "operator": "=",
90
+ "target": {
91
+ "$ref": "#/state/hue"
92
+ },
93
+ "value": {
94
+ "$ref": "event#/target/value"
95
+ }
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "tagName": "span",
102
+ "textContent": "${Math.round(state.hue)} degrees"
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "tagName": "div",
108
+ "attributes": {
109
+ "role": "group",
110
+ "aria-label": "Alpha over the hue above"
111
+ },
112
+ "children": [
113
+ {
114
+ "tagName": "span",
115
+ "textContent": "Opacity"
116
+ },
117
+ {
118
+ "tagName": "jx-color-slider",
119
+ "$props": {
120
+ "label": "Opacity",
121
+ "channel": "alpha",
122
+ "color": "hsl(${state.hue} 100% 50%)",
123
+ "value": {
124
+ "$ref": "#/state/opacity"
125
+ }
126
+ },
127
+ "oninput": {
128
+ "$prototype": "Function",
129
+ "body": [
130
+ {
131
+ "operator": "=",
132
+ "target": {
133
+ "$ref": "#/state/opacity"
134
+ },
135
+ "value": {
136
+ "$ref": "event#/target/value"
137
+ }
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "tagName": "span",
144
+ "textContent": "${Math.round(state.opacity)}%"
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "tagName": "h2",
150
+ "textContent": "States"
151
+ },
152
+ {
153
+ "tagName": "div",
154
+ "attributes": {
155
+ "role": "group",
156
+ "aria-label": "A band, a coarse grid and a refusal"
157
+ },
158
+ "children": [
159
+ {
160
+ "tagName": "span",
161
+ "textContent": "Band"
162
+ },
163
+ {
164
+ "tagName": "jx-color-slider",
165
+ "$props": {
166
+ "label": "Warm hues only",
167
+ "channel": "hue",
168
+ "min": 0,
169
+ "max": 60,
170
+ "value": 30
171
+ }
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ "tagName": "div",
177
+ "attributes": {
178
+ "role": "group",
179
+ "aria-label": "Coarse grid"
180
+ },
181
+ "children": [
182
+ {
183
+ "tagName": "span",
184
+ "textContent": "Step 30"
185
+ },
186
+ {
187
+ "tagName": "jx-color-slider",
188
+ "$props": {
189
+ "label": "Hue, in twelfths",
190
+ "channel": "hue",
191
+ "step": 30,
192
+ "value": 120
193
+ }
194
+ }
195
+ ]
196
+ },
197
+ {
198
+ "tagName": "div",
199
+ "attributes": {
200
+ "role": "group",
201
+ "aria-label": "Disabled"
202
+ },
203
+ "children": [
204
+ {
205
+ "tagName": "span",
206
+ "textContent": "Disabled"
207
+ },
208
+ {
209
+ "tagName": "jx-color-slider",
210
+ "$props": {
211
+ "label": "Hue, not yours to change",
212
+ "channel": "hue",
213
+ "value": 280,
214
+ "disabled": true
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ ]
220
+ }
@@ -0,0 +1,332 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookCombobox",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-field.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-combobox.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "model": "claude-sonnet",
15
+ "font": "Georgia, serif",
16
+ "models": [
17
+ {
18
+ "value": "claude-sonnet",
19
+ "label": "claude-sonnet",
20
+ "description": "anthropic"
21
+ },
22
+ {
23
+ "value": "claude-haiku",
24
+ "label": "claude-haiku",
25
+ "description": "anthropic"
26
+ },
27
+ {
28
+ "value": "gpt-4o",
29
+ "label": "gpt-4o",
30
+ "description": "openai"
31
+ },
32
+ {
33
+ "value": "llama-3.1-70b",
34
+ "label": "llama-3.1-70b",
35
+ "description": "self-hosted"
36
+ }
37
+ ],
38
+ "faces": [
39
+ {
40
+ "value": "Georgia, serif",
41
+ "label": "Georgia",
42
+ "face": "Georgia, serif"
43
+ },
44
+ {
45
+ "value": "\"Courier New\", monospace",
46
+ "label": "Courier New",
47
+ "face": "\"Courier New\", monospace"
48
+ },
49
+ {
50
+ "value": "system-ui",
51
+ "label": "system-ui",
52
+ "description": "system",
53
+ "face": "system-ui"
54
+ }
55
+ ],
56
+ "note": {
57
+ "$prototype": "Function",
58
+ "body": [
59
+ {
60
+ "operator": "=",
61
+ "target": {
62
+ "$ref": "#/state/model"
63
+ },
64
+ "value": {
65
+ "$ref": "event#/target/value"
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ },
71
+ "style": {
72
+ "fontFamily": "var(--jx-font-sans)",
73
+ "fontSize": "var(--jx-text-md)",
74
+ "color": "var(--jx-fg)",
75
+ "background": "var(--jx-bg)",
76
+ "padding": "var(--jx-space-6)",
77
+ "minHeight": "100vh",
78
+ "& > h1": {
79
+ "fontSize": "var(--jx-text-lg)",
80
+ "fontWeight": "600",
81
+ "margin": "0 0 var(--jx-space-5)"
82
+ },
83
+ "& > h2": {
84
+ "fontSize": "var(--jx-text-md)",
85
+ "fontWeight": "600",
86
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
87
+ },
88
+ "& > p": {
89
+ "color": "var(--jx-fg-dim)",
90
+ "margin": "0 0 var(--jx-space-5)"
91
+ },
92
+ "& [role=\"group\"]": {
93
+ "display": "flex",
94
+ "alignItems": "flex-start",
95
+ "flexWrap": "wrap",
96
+ "gap": "var(--jx-space-3)",
97
+ "margin": "0 0 var(--jx-space-4)"
98
+ },
99
+ "& [role=\"group\"] > span": {
100
+ "width": "200px",
101
+ "color": "var(--jx-fg-muted)",
102
+ "fontSize": "var(--jx-text-sm)"
103
+ },
104
+ "& jx-combobox": {
105
+ "width": "280px"
106
+ }
107
+ },
108
+ "children": [
109
+ {
110
+ "tagName": "h1",
111
+ "textContent": "jx-combobox"
112
+ },
113
+ {
114
+ "tagName": "p",
115
+ "textContent": "One native input carrying role=combobox over a jx-listbox it reaches only through aria-controls and aria-activedescendant — id references, which is why the whole kit is light DOM. The arrows open and move through the list, Enter and Tab take the highlighted row, Escape closes the list and nothing else, and Home and End stay with the text caret."
116
+ },
117
+ {
118
+ "tagName": "h2",
119
+ "textContent": "Suggestions, never a whitelist"
120
+ },
121
+ {
122
+ "tagName": "p",
123
+ "textContent": "allows-custom-value is the case this element was asked for: a model id field whose catalogue is what a provider happens to list, not what the field will accept. A keystroke highlights nothing, so Enter commits what you typed until you arrow onto a row."
124
+ },
125
+ {
126
+ "tagName": "div",
127
+ "attributes": {
128
+ "role": "group",
129
+ "aria-label": "Open list"
130
+ },
131
+ "children": [
132
+ {
133
+ "tagName": "jx-combobox",
134
+ "$props": {
135
+ "label": "Model",
136
+ "allowsCustomValue": true,
137
+ "placeholder": "provider/model",
138
+ "options": {
139
+ "$ref": "#/state/models"
140
+ },
141
+ "value": {
142
+ "$ref": "#/state/model"
143
+ },
144
+ "help": "Type any id your gateway accepts."
145
+ },
146
+ "onchange": {
147
+ "$ref": "#/state/note"
148
+ }
149
+ },
150
+ {
151
+ "tagName": "span",
152
+ "textContent": "${state.model}"
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "tagName": "h2",
158
+ "textContent": "A closed list refuses on the commit"
159
+ },
160
+ {
161
+ "tagName": "p",
162
+ "textContent": "Without allows-custom-value the rows are the whole answer: type something no row holds and leave the field, and the last accepted value comes back. The refusal stops the control's own change and says one of its own, so one edit is one change rather than two."
163
+ },
164
+ {
165
+ "tagName": "div",
166
+ "attributes": {
167
+ "role": "group",
168
+ "aria-label": "Closed list"
169
+ },
170
+ "children": [
171
+ {
172
+ "tagName": "jx-combobox",
173
+ "$props": {
174
+ "label": "Model",
175
+ "options": {
176
+ "$ref": "#/state/models"
177
+ },
178
+ "value": "gpt-4o",
179
+ "help": "Only a listed id is accepted."
180
+ }
181
+ },
182
+ {
183
+ "tagName": "jx-combobox",
184
+ "$props": {
185
+ "label": "Refused",
186
+ "invalid": true,
187
+ "error": "That model is not available on this account.",
188
+ "options": {
189
+ "$ref": "#/state/models"
190
+ },
191
+ "value": "gpt-4o"
192
+ }
193
+ }
194
+ ]
195
+ },
196
+ {
197
+ "tagName": "h2",
198
+ "textContent": "Rows that are their own preview"
199
+ },
200
+ {
201
+ "tagName": "p",
202
+ "textContent": "A row may draw a face, a colour chip or a border rule — the same three channels a jx-select row carries, which is what makes this the value selector's replacement rather than a plainer version of it."
203
+ },
204
+ {
205
+ "tagName": "div",
206
+ "attributes": {
207
+ "role": "group",
208
+ "aria-label": "Previews"
209
+ },
210
+ "children": [
211
+ {
212
+ "tagName": "jx-combobox",
213
+ "$props": {
214
+ "label": "Font",
215
+ "allowsCustomValue": true,
216
+ "options": {
217
+ "$ref": "#/state/faces"
218
+ },
219
+ "value": {
220
+ "$ref": "#/state/font"
221
+ }
222
+ }
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "tagName": "h2",
228
+ "textContent": "Sizes and states"
229
+ },
230
+ {
231
+ "tagName": "div",
232
+ "attributes": {
233
+ "role": "group",
234
+ "aria-label": "Sizes"
235
+ },
236
+ "children": [
237
+ {
238
+ "tagName": "jx-combobox",
239
+ "$props": {
240
+ "label": "Small",
241
+ "size": "sm",
242
+ "options": {
243
+ "$ref": "#/state/models"
244
+ },
245
+ "value": "gpt-4o"
246
+ }
247
+ },
248
+ {
249
+ "tagName": "jx-combobox",
250
+ "$props": {
251
+ "label": "Medium",
252
+ "options": {
253
+ "$ref": "#/state/models"
254
+ },
255
+ "value": "gpt-4o"
256
+ }
257
+ },
258
+ {
259
+ "tagName": "jx-combobox",
260
+ "$props": {
261
+ "label": "Large",
262
+ "size": "lg",
263
+ "options": {
264
+ "$ref": "#/state/models"
265
+ },
266
+ "value": "gpt-4o"
267
+ }
268
+ }
269
+ ]
270
+ },
271
+ {
272
+ "tagName": "div",
273
+ "attributes": {
274
+ "role": "group",
275
+ "aria-label": "States"
276
+ },
277
+ "children": [
278
+ {
279
+ "tagName": "jx-combobox",
280
+ "$props": {
281
+ "label": "Disabled",
282
+ "disabled": true,
283
+ "options": {
284
+ "$ref": "#/state/models"
285
+ },
286
+ "value": "gpt-4o"
287
+ }
288
+ },
289
+ {
290
+ "tagName": "jx-combobox",
291
+ "$props": {
292
+ "label": "Read-only",
293
+ "readonly": true,
294
+ "options": {
295
+ "$ref": "#/state/models"
296
+ },
297
+ "value": "gpt-4o",
298
+ "help": "Every row is an edit, so a read-only field never opens its list."
299
+ }
300
+ }
301
+ ]
302
+ },
303
+ {
304
+ "tagName": "h2",
305
+ "textContent": "In a field row"
306
+ },
307
+ {
308
+ "tagName": "jx-field",
309
+ "$props": {
310
+ "label": "Default model",
311
+ "description": "Used by every assistant panel in this project."
312
+ },
313
+ "attributes": {
314
+ "data-prop": "defaultModel"
315
+ },
316
+ "children": [
317
+ {
318
+ "tagName": "jx-combobox",
319
+ "$props": {
320
+ "allowsCustomValue": true,
321
+ "options": {
322
+ "$ref": "#/state/models"
323
+ },
324
+ "value": {
325
+ "$ref": "#/state/model"
326
+ }
327
+ }
328
+ }
329
+ ]
330
+ }
331
+ ]
332
+ }