@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
@@ -3,19 +3,32 @@
3
3
  "$id": "StylebookActionButton",
4
4
  "tagName": "main",
5
5
  "$elements": [
6
- { "$ref": "../components/jx-icon.json" },
7
- { "$ref": "../components/jx-action-button.json" }
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-spinner.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-action-button.json"
14
+ },
15
+ {
16
+ "$ref": "../components/jx-toolbar.json"
17
+ }
8
18
  ],
9
19
  "state": {
10
20
  "bold": false,
11
21
  "note": {
12
22
  "$prototype": "Function",
13
- "parameters": ["event"],
14
23
  "body": [
15
24
  {
16
25
  "operator": "=",
17
- "target": { "$ref": "#/state/bold" },
18
- "value": { "$ref": "event#/detail" }
26
+ "target": {
27
+ "$ref": "#/state/bold"
28
+ },
29
+ "value": {
30
+ "$ref": "event#/detail"
31
+ }
19
32
  }
20
33
  ]
21
34
  }
@@ -32,8 +45,11 @@
32
45
  "fontWeight": "600",
33
46
  "margin": "0 0 var(--jx-space-5)"
34
47
  },
35
- "& > p": { "color": "var(--jx-fg-dim)", "margin": "0 0 var(--jx-space-5)" },
36
- "& [role=\"toolbar\"]": {
48
+ "& > p": {
49
+ "color": "var(--jx-fg-dim)",
50
+ "margin": "0 0 var(--jx-space-5)"
51
+ },
52
+ "& [role=\"toolbar\"], & [role=\"radiogroup\"]": {
37
53
  "display": "flex",
38
54
  "alignItems": "center",
39
55
  "gap": "var(--jx-space-1)",
@@ -46,34 +62,62 @@
46
62
  }
47
63
  },
48
64
  "children": [
49
- { "tagName": "h1", "textContent": "jx-action-button" },
65
+ {
66
+ "tagName": "h1",
67
+ "textContent": "jx-action-button"
68
+ },
50
69
  {
51
70
  "tagName": "p",
52
- "textContent": "Icon-first tool buttons: quiet in a toolbar, a toggle with aria-pressed, an emphasized selection, and a text-and-icon form. Bold is ${state.bold ? 'on' : 'off'}."
71
+ "textContent": "Icon-first tool buttons: quiet in a toolbar, a toggle with aria-pressed, an emphasized selection, a text-and-icon form, and a segmented radiogroup whose selection the HOST owns — one checked segment both announces itself and is drawn selected, tabindex roves, and the button never flips itself. Bold is ${state.bold ? 'on' : 'off'}."
53
72
  },
54
73
  {
55
- "tagName": "div",
56
- "attributes": { "role": "toolbar", "aria-label": "Formatting" },
74
+ "tagName": "jx-toolbar",
75
+ "$props": {
76
+ "label": "Formatting"
77
+ },
57
78
  "children": [
58
79
  {
59
80
  "tagName": "jx-action-button",
60
- "$props": { "label": "Bold", "icon": "text-b", "toggles": true },
61
- "onchange": { "$ref": "#/state/note" }
81
+ "$props": {
82
+ "label": "Bold",
83
+ "icon": "text-b",
84
+ "toggles": true
85
+ },
86
+ "onchange": {
87
+ "$ref": "#/state/note"
88
+ }
62
89
  },
63
90
  {
64
91
  "tagName": "jx-action-button",
65
- "$props": { "label": "Italic", "icon": "text-italic", "toggles": true, "selected": true }
92
+ "$props": {
93
+ "label": "Italic",
94
+ "icon": "text-italic",
95
+ "toggles": true,
96
+ "selected": true
97
+ }
66
98
  },
67
- { "tagName": "jx-action-button", "$props": { "label": "Link", "icon": "link" } },
68
99
  {
69
100
  "tagName": "jx-action-button",
70
- "$props": { "label": "Undo", "icon": "arrow-u-up-left", "disabled": true }
101
+ "$props": {
102
+ "label": "Link",
103
+ "icon": "link"
104
+ }
105
+ },
106
+ {
107
+ "tagName": "jx-action-button",
108
+ "$props": {
109
+ "label": "Undo",
110
+ "icon": "arrow-u-up-left",
111
+ "disabled": true
112
+ }
71
113
  }
72
114
  ]
73
115
  },
74
116
  {
75
- "tagName": "div",
76
- "attributes": { "role": "toolbar", "aria-label": "Emphasized and sized" },
117
+ "tagName": "jx-toolbar",
118
+ "$props": {
119
+ "label": "Emphasized and sized"
120
+ },
77
121
  "children": [
78
122
  {
79
123
  "tagName": "jx-action-button",
@@ -87,20 +131,144 @@
87
131
  },
88
132
  {
89
133
  "tagName": "jx-action-button",
90
- "$props": { "label": "Not quiet", "icon": "gear", "quiet": false }
134
+ "$props": {
135
+ "label": "Not quiet",
136
+ "icon": "gear",
137
+ "quiet": false
138
+ }
139
+ },
140
+ {
141
+ "tagName": "jx-action-button",
142
+ "$props": {
143
+ "label": "Small",
144
+ "icon": "plus",
145
+ "size": "sm"
146
+ }
147
+ },
148
+ {
149
+ "tagName": "jx-action-button",
150
+ "$props": {
151
+ "label": "Large",
152
+ "icon": "plus",
153
+ "size": "lg"
154
+ }
155
+ },
156
+ {
157
+ "tagName": "jx-action-button",
158
+ "$props": {
159
+ "label": "Save",
160
+ "icon": "floppy-disk",
161
+ "quiet": false
162
+ },
163
+ "children": [
164
+ {
165
+ "tagName": "span",
166
+ "textContent": "Save"
167
+ }
168
+ ]
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "tagName": "div",
174
+ "attributes": {
175
+ "role": "radiogroup",
176
+ "aria-label": "Horizontal alignment"
177
+ },
178
+ "children": [
179
+ {
180
+ "tagName": "jx-action-button",
181
+ "$props": {
182
+ "label": "Space between",
183
+ "icon": "arrows-out-line-horizontal",
184
+ "checked": "true",
185
+ "tabindex": "0"
186
+ }
187
+ },
188
+ {
189
+ "tagName": "jx-action-button",
190
+ "$props": {
191
+ "label": "Space around",
192
+ "icon": "arrows-in-line-horizontal",
193
+ "checked": "false",
194
+ "tabindex": "-1"
195
+ }
91
196
  },
92
197
  {
93
198
  "tagName": "jx-action-button",
94
- "$props": { "label": "Small", "icon": "plus", "size": "sm" }
199
+ "$props": {
200
+ "label": "Space evenly",
201
+ "icon": "arrows-horizontal",
202
+ "checked": "false",
203
+ "tabindex": "-1"
204
+ }
95
205
  },
96
206
  {
97
207
  "tagName": "jx-action-button",
98
- "$props": { "label": "Large", "icon": "plus", "size": "lg" }
208
+ "$props": {
209
+ "label": "Baseline",
210
+ "icon": "text-a-underline",
211
+ "checked": "false",
212
+ "tabindex": "-1"
213
+ }
99
214
  },
100
215
  {
101
216
  "tagName": "jx-action-button",
102
- "$props": { "label": "Save", "icon": "floppy-disk", "quiet": false },
103
- "children": [{ "tagName": "span", "textContent": "Save" }]
217
+ "$props": {
218
+ "label": "Stretch",
219
+ "icon": "arrows-out-line-vertical",
220
+ "checked": "false",
221
+ "tabindex": "-1"
222
+ }
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "tagName": "jx-toolbar",
228
+ "$props": {
229
+ "label": "Working, and named from elsewhere"
230
+ },
231
+ "children": [
232
+ {
233
+ "tagName": "jx-action-button",
234
+ "$props": {
235
+ "label": "Refresh",
236
+ "hint": "Refresh the signal list",
237
+ "icon": "arrows-clockwise",
238
+ "loading": true
239
+ }
240
+ },
241
+ {
242
+ "tagName": "jx-action-button",
243
+ "$props": {
244
+ "label": "Refresh",
245
+ "hint": "Refresh the signal list",
246
+ "icon": "arrows-clockwise"
247
+ }
248
+ },
249
+ {
250
+ "tagName": "span",
251
+ "attributes": {
252
+ "id": "ab-desc"
253
+ },
254
+ "textContent": "Runs every signal again."
255
+ },
256
+ {
257
+ "tagName": "jx-action-button",
258
+ "$props": {
259
+ "label": "Rerun",
260
+ "icon": "play",
261
+ "describedby": "ab-desc",
262
+ "labelledby": ""
263
+ }
264
+ },
265
+ {
266
+ "tagName": "jx-action-button",
267
+ "$props": {
268
+ "label": "Problems",
269
+ "icon": "warning-circle",
270
+ "badge": "3"
271
+ }
104
272
  }
105
273
  ]
106
274
  }
@@ -0,0 +1,335 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookActionGroup",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-spinner.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-action-button.json"
14
+ },
15
+ {
16
+ "$ref": "../components/jx-action-group.json"
17
+ }
18
+ ],
19
+ "state": {
20
+ "align": "left",
21
+ "isLeft": {
22
+ "$expression": {
23
+ "operator": "===",
24
+ "target": {
25
+ "$ref": "#/state/align"
26
+ },
27
+ "value": "left"
28
+ }
29
+ },
30
+ "isCenter": {
31
+ "$expression": {
32
+ "operator": "===",
33
+ "target": {
34
+ "$ref": "#/state/align"
35
+ },
36
+ "value": "center"
37
+ }
38
+ },
39
+ "isRight": {
40
+ "$expression": {
41
+ "operator": "===",
42
+ "target": {
43
+ "$ref": "#/state/align"
44
+ },
45
+ "value": "right"
46
+ }
47
+ },
48
+ "choose": {
49
+ "$prototype": "Function",
50
+ "body": [
51
+ {
52
+ "operator": "=",
53
+ "target": {
54
+ "$ref": "#/state/align"
55
+ },
56
+ "value": {
57
+ "$ref": "event#/currentTarget/dataset/value"
58
+ }
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ "style": {
64
+ "fontFamily": "var(--jx-font-sans)",
65
+ "fontSize": "var(--jx-text-md)",
66
+ "color": "var(--jx-fg)",
67
+ "background": "var(--jx-bg)",
68
+ "padding": "var(--jx-space-6)",
69
+ "minHeight": "100vh",
70
+ "& > h1": {
71
+ "fontSize": "var(--jx-text-lg)",
72
+ "fontWeight": "600",
73
+ "margin": "0 0 var(--jx-space-5)"
74
+ },
75
+ "& > h2": {
76
+ "fontSize": "var(--jx-text-md)",
77
+ "fontWeight": "600",
78
+ "color": "var(--jx-fg-dim)",
79
+ "margin": "var(--jx-space-5) 0 var(--jx-space-2)"
80
+ },
81
+ "& > p": {
82
+ "color": "var(--jx-fg-dim)",
83
+ "margin": "0 0 var(--jx-space-5)"
84
+ },
85
+ "& > div": {
86
+ "display": "flex",
87
+ "alignItems": "flex-start",
88
+ "gap": "var(--jx-space-4)",
89
+ "margin": "0 0 var(--jx-space-4)"
90
+ }
91
+ },
92
+ "children": [
93
+ {
94
+ "tagName": "h1",
95
+ "textContent": "jx-action-group"
96
+ },
97
+ {
98
+ "tagName": "p",
99
+ "textContent": "A row of action buttons with ONE tab stop, and one attribute choosing the whole ARIA pattern: selects=\"none\" is a toolbar, \"single\" a radiogroup, \"multiple\" a group. It owns the roving caret and the segmented seam; it does not own the selection. Horizontal alignment is ${state.align}."
100
+ },
101
+ {
102
+ "tagName": "h2",
103
+ "textContent": "selects=\"single\" \u2014 a radiogroup whose selection the host owns"
104
+ },
105
+ {
106
+ "tagName": "div",
107
+ "children": [
108
+ {
109
+ "tagName": "jx-action-group",
110
+ "$props": {
111
+ "label": "Horizontal alignment",
112
+ "selects": "single"
113
+ },
114
+ "children": [
115
+ {
116
+ "tagName": "jx-action-button",
117
+ "$props": {
118
+ "label": "Align left",
119
+ "hint": "Align left",
120
+ "icon": "align-left",
121
+ "checked": "${state.align === 'left' ? 'true' : 'false'}",
122
+ "selected": {
123
+ "$ref": "#/state/isLeft"
124
+ }
125
+ },
126
+ "onclick": {
127
+ "$ref": "#/state/choose"
128
+ },
129
+ "attributes": {
130
+ "data-value": "left"
131
+ }
132
+ },
133
+ {
134
+ "tagName": "jx-action-button",
135
+ "$props": {
136
+ "label": "Align centre",
137
+ "hint": "Align centre",
138
+ "icon": "align-center-horizontal",
139
+ "checked": "${state.align === 'center' ? 'true' : 'false'}",
140
+ "selected": {
141
+ "$ref": "#/state/isCenter"
142
+ }
143
+ },
144
+ "onclick": {
145
+ "$ref": "#/state/choose"
146
+ },
147
+ "attributes": {
148
+ "data-value": "center"
149
+ }
150
+ },
151
+ {
152
+ "tagName": "jx-action-button",
153
+ "$props": {
154
+ "label": "Align right",
155
+ "hint": "Align right",
156
+ "icon": "align-right",
157
+ "checked": "${state.align === 'right' ? 'true' : 'false'}",
158
+ "selected": {
159
+ "$ref": "#/state/isRight"
160
+ }
161
+ },
162
+ "onclick": {
163
+ "$ref": "#/state/choose"
164
+ },
165
+ "attributes": {
166
+ "data-value": "right"
167
+ }
168
+ }
169
+ ]
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ "tagName": "h2",
175
+ "textContent": "selects=\"none\" \u2014 a toolbar, and the same row uncompacted"
176
+ },
177
+ {
178
+ "tagName": "div",
179
+ "children": [
180
+ {
181
+ "tagName": "jx-action-group",
182
+ "$props": {
183
+ "label": "Text style"
184
+ },
185
+ "children": [
186
+ {
187
+ "tagName": "jx-action-button",
188
+ "$props": {
189
+ "label": "Bold",
190
+ "hint": "Bold",
191
+ "icon": "text-b",
192
+ "quiet": false,
193
+ "toggles": true
194
+ }
195
+ },
196
+ {
197
+ "tagName": "jx-action-button",
198
+ "$props": {
199
+ "label": "Italic",
200
+ "hint": "Italic",
201
+ "icon": "text-italic",
202
+ "quiet": false,
203
+ "toggles": true
204
+ }
205
+ },
206
+ {
207
+ "tagName": "jx-action-button",
208
+ "$props": {
209
+ "label": "Underline",
210
+ "hint": "Underline",
211
+ "icon": "text-a-underline",
212
+ "quiet": false,
213
+ "disabled": true
214
+ }
215
+ },
216
+ {
217
+ "tagName": "jx-action-button",
218
+ "$props": {
219
+ "label": "Strikethrough",
220
+ "hint": "Strikethrough",
221
+ "icon": "text-strikethrough",
222
+ "quiet": false,
223
+ "toggles": true
224
+ }
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ "tagName": "jx-action-group",
230
+ "$props": {
231
+ "label": "Text style, separated",
232
+ "compact": false
233
+ },
234
+ "children": [
235
+ {
236
+ "tagName": "jx-action-button",
237
+ "$props": {
238
+ "label": "Bold",
239
+ "hint": "Bold",
240
+ "icon": "text-b",
241
+ "quiet": false,
242
+ "toggles": true
243
+ }
244
+ },
245
+ {
246
+ "tagName": "jx-action-button",
247
+ "$props": {
248
+ "label": "Italic",
249
+ "hint": "Italic",
250
+ "icon": "text-italic",
251
+ "quiet": false,
252
+ "toggles": true
253
+ }
254
+ },
255
+ {
256
+ "tagName": "jx-action-button",
257
+ "$props": {
258
+ "label": "Strikethrough",
259
+ "hint": "Strikethrough",
260
+ "icon": "text-strikethrough",
261
+ "quiet": false,
262
+ "toggles": true
263
+ }
264
+ }
265
+ ]
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ "tagName": "h2",
271
+ "textContent": "selects=\"multiple\" \u2014 a group of independent toggles, drawn vertically"
272
+ },
273
+ {
274
+ "tagName": "div",
275
+ "children": [
276
+ {
277
+ "tagName": "jx-action-group",
278
+ "$props": {
279
+ "label": "Visible panels",
280
+ "selects": "multiple",
281
+ "orientation": "vertical"
282
+ },
283
+ "children": [
284
+ {
285
+ "tagName": "jx-action-button",
286
+ "$props": {
287
+ "label": "Problems",
288
+ "icon": "warning-circle",
289
+ "quiet": false,
290
+ "toggles": true,
291
+ "selected": true
292
+ },
293
+ "children": [
294
+ {
295
+ "tagName": "span",
296
+ "textContent": "Problems"
297
+ }
298
+ ]
299
+ },
300
+ {
301
+ "tagName": "jx-action-button",
302
+ "$props": {
303
+ "label": "Logic",
304
+ "icon": "lightning",
305
+ "quiet": false,
306
+ "toggles": true
307
+ },
308
+ "children": [
309
+ {
310
+ "tagName": "span",
311
+ "textContent": "Logic"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "tagName": "jx-action-button",
317
+ "$props": {
318
+ "label": "Activity",
319
+ "icon": "clock-counter-clockwise",
320
+ "quiet": false,
321
+ "toggles": true
322
+ },
323
+ "children": [
324
+ {
325
+ "tagName": "span",
326
+ "textContent": "Activity"
327
+ }
328
+ ]
329
+ }
330
+ ]
331
+ }
332
+ ]
333
+ }
334
+ ]
335
+ }