@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,309 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookTextfield",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-field.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-textfield.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "name": "Draft"
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-textfield"
54
+ },
55
+ {
56
+ "tagName": "p",
57
+ "textContent": "A native input or textarea with its name, its states and its messages. The first field's value is bound to the page's state both ways."
58
+ },
59
+ {
60
+ "tagName": "div",
61
+ "attributes": {
62
+ "role": "group",
63
+ "aria-label": "Bound value"
64
+ },
65
+ "children": [
66
+ {
67
+ "tagName": "jx-textfield",
68
+ "$props": {
69
+ "label": "Layout name",
70
+ "placeholder": "Untitled",
71
+ "value": {
72
+ "$ref": "#/state/name"
73
+ }
74
+ },
75
+ "oninput": {
76
+ "$prototype": "Function",
77
+ "body": [
78
+ {
79
+ "operator": "=",
80
+ "target": {
81
+ "$ref": "#/state/name"
82
+ },
83
+ "value": {
84
+ "$ref": "event#/target/value"
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ },
90
+ {
91
+ "tagName": "span",
92
+ "textContent": "${state.name}"
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ "tagName": "div",
98
+ "attributes": {
99
+ "role": "group",
100
+ "aria-label": "Sizes"
101
+ },
102
+ "children": [
103
+ {
104
+ "tagName": "jx-textfield",
105
+ "$props": {
106
+ "label": "Small",
107
+ "size": "sm",
108
+ "value": "sm"
109
+ }
110
+ },
111
+ {
112
+ "tagName": "jx-textfield",
113
+ "$props": {
114
+ "label": "Medium",
115
+ "value": "md"
116
+ }
117
+ },
118
+ {
119
+ "tagName": "jx-textfield",
120
+ "$props": {
121
+ "label": "Large",
122
+ "size": "lg",
123
+ "value": "lg"
124
+ }
125
+ }
126
+ ]
127
+ },
128
+ {
129
+ "tagName": "div",
130
+ "attributes": {
131
+ "role": "group",
132
+ "aria-label": "States"
133
+ },
134
+ "children": [
135
+ {
136
+ "tagName": "jx-textfield",
137
+ "$props": {
138
+ "label": "Refused",
139
+ "value": "about",
140
+ "invalid": true,
141
+ "error": "about.md already exists."
142
+ }
143
+ },
144
+ {
145
+ "tagName": "jx-textfield",
146
+ "$props": {
147
+ "label": "With help",
148
+ "help": "Letters, digits and dashes."
149
+ }
150
+ },
151
+ {
152
+ "tagName": "jx-textfield",
153
+ "$props": {
154
+ "label": "Disabled",
155
+ "value": "Cannot edit",
156
+ "disabled": true
157
+ }
158
+ },
159
+ {
160
+ "tagName": "jx-textfield",
161
+ "$props": {
162
+ "label": "Read only",
163
+ "value": "Can select",
164
+ "readonly": true
165
+ }
166
+ }
167
+ ]
168
+ },
169
+ {
170
+ "tagName": "div",
171
+ "attributes": {
172
+ "role": "group",
173
+ "aria-label": "Kinds"
174
+ },
175
+ "children": [
176
+ {
177
+ "tagName": "jx-textfield",
178
+ "$props": {
179
+ "label": "Selector",
180
+ "mono": true,
181
+ "value": ".card > h2"
182
+ }
183
+ },
184
+ {
185
+ "tagName": "jx-textfield",
186
+ "$props": {
187
+ "label": "Search",
188
+ "type": "search",
189
+ "placeholder": "Search…"
190
+ }
191
+ },
192
+ {
193
+ "tagName": "jx-textfield",
194
+ "$props": {
195
+ "label": "Notes",
196
+ "multiline": true,
197
+ "value": "A textarea,\nwith the same contract."
198
+ }
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "tagName": "div",
204
+ "attributes": {
205
+ "role": "group",
206
+ "aria-label": "Clearable at every size"
207
+ },
208
+ "children": [
209
+ {
210
+ "tagName": "jx-textfield",
211
+ "$props": {
212
+ "label": "Filter, small",
213
+ "type": "search",
214
+ "size": "sm",
215
+ "clearable": true,
216
+ "placeholder": "Search…",
217
+ "value": "about"
218
+ }
219
+ },
220
+ {
221
+ "tagName": "jx-textfield",
222
+ "$props": {
223
+ "label": "Filter",
224
+ "type": "search",
225
+ "clearable": true,
226
+ "placeholder": "Search…",
227
+ "value": "about"
228
+ }
229
+ },
230
+ {
231
+ "tagName": "jx-textfield",
232
+ "$props": {
233
+ "label": "Filter, large",
234
+ "type": "search",
235
+ "size": "lg",
236
+ "clearable": true,
237
+ "placeholder": "Search…",
238
+ "value": "about"
239
+ }
240
+ },
241
+ {
242
+ "tagName": "jx-textfield",
243
+ "$props": {
244
+ "label": "Filter, disabled",
245
+ "type": "search",
246
+ "clearable": true,
247
+ "disabled": true,
248
+ "value": "about"
249
+ }
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ "tagName": "div",
255
+ "attributes": {
256
+ "role": "group",
257
+ "aria-label": "Growing"
258
+ },
259
+ "children": [
260
+ {
261
+ "tagName": "jx-textfield",
262
+ "$props": {
263
+ "label": "Description",
264
+ "multiline": true,
265
+ "grows": true,
266
+ "rows": "2",
267
+ "value": "A textarea that takes the height of its text."
268
+ }
269
+ },
270
+ {
271
+ "tagName": "jx-textfield",
272
+ "$props": {
273
+ "label": "Summary",
274
+ "multiline": true,
275
+ "grows": true,
276
+ "clearable": true,
277
+ "value": "No rows asked for, so an engine without field-sizing keeps the three-row box a fixed field gets."
278
+ }
279
+ }
280
+ ]
281
+ },
282
+ {
283
+ "tagName": "h2",
284
+ "textContent": "In a field row"
285
+ },
286
+ {
287
+ "tagName": "p",
288
+ "textContent": "The row is jx-field: one element where the label, the row and the help sentence used to be three classes and four hand-written ids. It mints its own ids and hands them to the field as labelledby and describedby."
289
+ },
290
+ {
291
+ "tagName": "jx-field",
292
+ "$props": {
293
+ "label": "Title",
294
+ "description": "Shown in the Library and in the browser tab."
295
+ },
296
+ "attributes": {
297
+ "data-prop": "title"
298
+ },
299
+ "children": [
300
+ {
301
+ "tagName": "jx-textfield",
302
+ "$props": {
303
+ "placeholder": "Untitled"
304
+ }
305
+ }
306
+ ]
307
+ }
308
+ ]
309
+ }
@@ -0,0 +1,157 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookToastHost",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-button.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-toast.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-toast-host.json"
14
+ }
15
+ ],
16
+ "state": {},
17
+ "style": {
18
+ "fontFamily": "var(--jx-font-sans)",
19
+ "fontSize": "var(--jx-text-md)",
20
+ "color": "var(--jx-fg)",
21
+ "background": "var(--jx-bg)",
22
+ "padding": "var(--jx-space-6)",
23
+ "minHeight": "100vh",
24
+ "& > h1": {
25
+ "fontSize": "var(--jx-text-lg)",
26
+ "fontWeight": "600",
27
+ "margin": "0 0 var(--jx-space-5)"
28
+ },
29
+ "& > h2": {
30
+ "fontSize": "var(--jx-text-md)",
31
+ "fontWeight": "600",
32
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
33
+ },
34
+ "& > p": {
35
+ "color": "var(--jx-fg-dim)",
36
+ "margin": "0 0 var(--jx-space-5)",
37
+ "maxWidth": "60ch"
38
+ },
39
+ "& > ul": {
40
+ "color": "var(--jx-fg-dim)",
41
+ "margin": "0 0 var(--jx-space-5)",
42
+ "paddingInlineStart": "var(--jx-space-5)",
43
+ "maxWidth": "60ch"
44
+ },
45
+ "& > ul > li": {
46
+ "margin": "0 0 var(--jx-space-2)"
47
+ }
48
+ },
49
+ "children": [
50
+ {
51
+ "tagName": "h1",
52
+ "textContent": "jx-toast-host"
53
+ },
54
+ {
55
+ "tagName": "p",
56
+ "textContent": "The stack. It owns the live region every toast in it is announced through, the corner it is pinned to, and the clock policy: pointer or focus anywhere in the stack suspends every toast in it, so an older message cannot vanish out from under a reader answering a newer one."
57
+ },
58
+ {
59
+ "tagName": "p",
60
+ "textContent": "Two hosts are live on this page. The default one is in the bottom-end corner and announces politely. The one in the top-start corner is set to live off, which is the arrangement an application uses when it already announces outcomes somewhere else, and it names a stack of its own."
61
+ },
62
+ {
63
+ "tagName": "h2",
64
+ "textContent": "Reaching a toast from the keyboard"
65
+ },
66
+ {
67
+ "tagName": "p",
68
+ "textContent": "Press F8. Focus moves to the first control in the first stack, and every clock in it stops. Press Escape and focus goes back to where it was. Dismissing the toast you are standing in returns focus the same way, so a keyboard reader is never left on an element that has just been hidden."
69
+ },
70
+ {
71
+ "tagName": "ul",
72
+ "children": [
73
+ {
74
+ "tagName": "li",
75
+ "textContent": "The order is DOM order, in every corner: what a reader hears, what they tab through and what they see are one order."
76
+ },
77
+ {
78
+ "tagName": "li",
79
+ "textContent": "A press carrying Ctrl, Alt or Meta is left alone, so F8 here does not take Ctrl+F8 from anything else."
80
+ },
81
+ {
82
+ "tagName": "li",
83
+ "textContent": "hotkey set to the empty string turns the gesture off, for an application that owns a command of its own for this."
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "tagName": "jx-toast-host",
89
+ "children": [
90
+ {
91
+ "tagName": "jx-toast",
92
+ "$props": {
93
+ "open": true,
94
+ "variant": "positive"
95
+ },
96
+ "children": [
97
+ {
98
+ "tagName": "span",
99
+ "textContent": "Published 14 pages."
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ "tagName": "jx-toast",
105
+ "$props": {
106
+ "open": true,
107
+ "variant": "negative"
108
+ },
109
+ "children": [
110
+ {
111
+ "tagName": "span",
112
+ "textContent": "Could not reach the deploy service."
113
+ },
114
+ {
115
+ "tagName": "jx-button",
116
+ "attributes": {
117
+ "slot": "action"
118
+ },
119
+ "$props": {
120
+ "size": "sm",
121
+ "quiet": true
122
+ },
123
+ "children": [
124
+ {
125
+ "tagName": "span",
126
+ "textContent": "Retry"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "tagName": "jx-toast-host",
136
+ "$props": {
137
+ "label": "Background tasks",
138
+ "live": "off",
139
+ "placement": "top-start"
140
+ },
141
+ "children": [
142
+ {
143
+ "tagName": "jx-toast",
144
+ "$props": {
145
+ "open": true
146
+ },
147
+ "children": [
148
+ {
149
+ "tagName": "span",
150
+ "textContent": "Announced elsewhere: this stack is silent by design."
151
+ }
152
+ ]
153
+ }
154
+ ]
155
+ }
156
+ ]
157
+ }