@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,272 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookColorArea",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-color-area.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-color-slider.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "hue": 265,
15
+ "saturation": 72,
16
+ "brightness": 88
17
+ },
18
+ "style": {
19
+ "fontFamily": "var(--jx-font-sans)",
20
+ "fontSize": "var(--jx-text-md)",
21
+ "color": "var(--jx-fg)",
22
+ "background": "var(--jx-bg)",
23
+ "padding": "var(--jx-space-6)",
24
+ "minHeight": "100vh",
25
+ "& > h1": {
26
+ "fontSize": "var(--jx-text-lg)",
27
+ "fontWeight": "600",
28
+ "margin": "0 0 var(--jx-space-5)"
29
+ },
30
+ "& > h2": {
31
+ "fontSize": "var(--jx-text-md)",
32
+ "fontWeight": "600",
33
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
34
+ },
35
+ "& > p": {
36
+ "color": "var(--jx-fg-dim)",
37
+ "margin": "0 0 var(--jx-space-5)"
38
+ },
39
+ "& [role=\"group\"]": {
40
+ "display": "flex",
41
+ "alignItems": "flex-start",
42
+ "flexWrap": "wrap",
43
+ "gap": "var(--jx-space-5)",
44
+ "margin": "0 0 var(--jx-space-4)"
45
+ },
46
+ "& [part=\"cell\"]": {
47
+ "display": "flex",
48
+ "flexDirection": "column",
49
+ "gap": "var(--jx-space-2)",
50
+ "width": "200px"
51
+ },
52
+ "& [part=\"caption\"]": {
53
+ "color": "var(--jx-fg-muted)",
54
+ "fontSize": "var(--jx-text-sm)"
55
+ }
56
+ },
57
+ "children": [
58
+ {
59
+ "tagName": "h1",
60
+ "textContent": "jx-color-area"
61
+ },
62
+ {
63
+ "tagName": "p",
64
+ "textContent": "A saturation and brightness square under one hue. Inside it are two real range inputs, one per axis, transparent rather than hidden: they carry the slider role, the names, the announced values and the tab stops, so the square is fully operable from the keyboard. The element adds the arrow across the other axis, a ten-step Shift+Arrow, and the pointer maths."
65
+ },
66
+ {
67
+ "tagName": "p",
68
+ "textContent": "Every value the pointer can reach is reachable with the arrow keys, and one press with no movement sets the colour outright, so nothing here requires a dragging motion."
69
+ },
70
+ {
71
+ "tagName": "h2",
72
+ "textContent": "Bound to a hue"
73
+ },
74
+ {
75
+ "tagName": "div",
76
+ "attributes": {
77
+ "role": "group",
78
+ "aria-label": "Bound square"
79
+ },
80
+ "children": [
81
+ {
82
+ "tagName": "div",
83
+ "attributes": {
84
+ "part": "cell"
85
+ },
86
+ "children": [
87
+ {
88
+ "tagName": "jx-color-area",
89
+ "$props": {
90
+ "label": "Accent colour",
91
+ "hue": {
92
+ "$ref": "#/state/hue"
93
+ },
94
+ "saturation": {
95
+ "$ref": "#/state/saturation"
96
+ },
97
+ "brightness": {
98
+ "$ref": "#/state/brightness"
99
+ }
100
+ },
101
+ "oninput": {
102
+ "$prototype": "Function",
103
+ "body": [
104
+ {
105
+ "operator": "=",
106
+ "target": {
107
+ "$ref": "#/state/saturation"
108
+ },
109
+ "value": {
110
+ "$ref": "event#/target/saturation"
111
+ }
112
+ },
113
+ {
114
+ "operator": "=",
115
+ "target": {
116
+ "$ref": "#/state/brightness"
117
+ },
118
+ "value": {
119
+ "$ref": "event#/target/brightness"
120
+ }
121
+ }
122
+ ]
123
+ }
124
+ },
125
+ {
126
+ "tagName": "jx-color-slider",
127
+ "$props": {
128
+ "label": "Hue",
129
+ "channel": "hue",
130
+ "value": {
131
+ "$ref": "#/state/hue"
132
+ }
133
+ },
134
+ "oninput": {
135
+ "$prototype": "Function",
136
+ "body": [
137
+ {
138
+ "operator": "=",
139
+ "target": {
140
+ "$ref": "#/state/hue"
141
+ },
142
+ "value": {
143
+ "$ref": "event#/target/value"
144
+ }
145
+ }
146
+ ]
147
+ }
148
+ },
149
+ {
150
+ "tagName": "span",
151
+ "attributes": {
152
+ "part": "caption"
153
+ },
154
+ "textContent": "hue ${Math.round(state.hue)}, saturation ${Math.round(state.saturation)}%, brightness ${Math.round(state.brightness)}%"
155
+ }
156
+ ]
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ "tagName": "h2",
162
+ "textContent": "Variants and states"
163
+ },
164
+ {
165
+ "tagName": "div",
166
+ "attributes": {
167
+ "role": "group",
168
+ "aria-label": "Variants"
169
+ },
170
+ "children": [
171
+ {
172
+ "tagName": "div",
173
+ "attributes": {
174
+ "part": "cell"
175
+ },
176
+ "children": [
177
+ {
178
+ "tagName": "jx-color-area",
179
+ "$props": {
180
+ "label": "Warm",
181
+ "hue": 20,
182
+ "saturation": 90,
183
+ "brightness": 95
184
+ }
185
+ },
186
+ {
187
+ "tagName": "span",
188
+ "attributes": {
189
+ "part": "caption"
190
+ },
191
+ "textContent": "A warm hue, at the top corner"
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "tagName": "div",
197
+ "attributes": {
198
+ "part": "cell"
199
+ },
200
+ "children": [
201
+ {
202
+ "tagName": "jx-color-area",
203
+ "$props": {
204
+ "label": "Coarse grid",
205
+ "hue": 150,
206
+ "step": 10,
207
+ "saturation": 50,
208
+ "brightness": 50
209
+ }
210
+ },
211
+ {
212
+ "tagName": "span",
213
+ "attributes": {
214
+ "part": "caption"
215
+ },
216
+ "textContent": "step 10, so an arrow moves a tenth and Shift takes it to the edge"
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ "tagName": "div",
222
+ "attributes": {
223
+ "part": "cell"
224
+ },
225
+ "children": [
226
+ {
227
+ "tagName": "jx-color-area",
228
+ "$props": {
229
+ "label": "Not yours to change",
230
+ "hue": 265,
231
+ "saturation": 40,
232
+ "brightness": 60,
233
+ "disabled": true
234
+ }
235
+ },
236
+ {
237
+ "tagName": "span",
238
+ "attributes": {
239
+ "part": "caption"
240
+ },
241
+ "textContent": "Disabled: both ranges refuse, and the pointer is refused too"
242
+ }
243
+ ]
244
+ },
245
+ {
246
+ "tagName": "div",
247
+ "attributes": {
248
+ "part": "cell"
249
+ },
250
+ "children": [
251
+ {
252
+ "tagName": "jx-color-area",
253
+ "$props": {
254
+ "label": "Grey",
255
+ "hue": 265,
256
+ "saturation": 0,
257
+ "brightness": 100
258
+ }
259
+ },
260
+ {
261
+ "tagName": "span",
262
+ "attributes": {
263
+ "part": "caption"
264
+ },
265
+ "textContent": "Saturation zero: the hue is still 265, because the square never writes it"
266
+ }
267
+ ]
268
+ }
269
+ ]
270
+ }
271
+ ]
272
+ }
@@ -0,0 +1,261 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookColorField",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-field.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-swatch.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-swatch-group.json"
14
+ },
15
+ {
16
+ "$ref": "../components/jx-color-field.json"
17
+ }
18
+ ],
19
+ "state": {
20
+ "background": "#1d4ed8"
21
+ },
22
+ "style": {
23
+ "fontFamily": "var(--jx-font-sans)",
24
+ "fontSize": "var(--jx-text-md)",
25
+ "color": "var(--jx-fg)",
26
+ "background": "var(--jx-bg)",
27
+ "padding": "var(--jx-space-6)",
28
+ "minHeight": "100vh",
29
+ "& > h1": {
30
+ "fontSize": "var(--jx-text-lg)",
31
+ "fontWeight": "600",
32
+ "margin": "0 0 var(--jx-space-5)"
33
+ },
34
+ "& > h2": {
35
+ "fontSize": "var(--jx-text-md)",
36
+ "fontWeight": "600",
37
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
38
+ },
39
+ "& > p": {
40
+ "color": "var(--jx-fg-dim)",
41
+ "margin": "0 0 var(--jx-space-5)"
42
+ },
43
+ "& [role=\"group\"]": {
44
+ "display": "flex",
45
+ "alignItems": "center",
46
+ "flexWrap": "wrap",
47
+ "gap": "var(--jx-space-4)",
48
+ "margin": "0 0 var(--jx-space-4)"
49
+ },
50
+ "& [role=\"group\"] > span": {
51
+ "color": "var(--jx-fg-muted)",
52
+ "fontFamily": "var(--jx-font-mono)",
53
+ "fontSize": "var(--jx-text-sm)"
54
+ }
55
+ },
56
+ "children": [
57
+ {
58
+ "tagName": "h1",
59
+ "textContent": "jx-color-field"
60
+ },
61
+ {
62
+ "tagName": "p",
63
+ "textContent": "The composed control: a swatch that opens the picker, a text field for the value, and the two doors to the system's own picker. Inside the picker are a saturation and brightness square, a hue track and, with alpha on, an opacity track. Five controls, one value, and one pair of events: input and change come from the element, so e.target.value is the colour whichever control the reader touched."
64
+ },
65
+ {
66
+ "tagName": "p",
67
+ "textContent": "The text field accepts hex, rgb() and oklch() whatever the field writes, and refuses only on the commit, so a half-typed value is never reformatted under the caret."
68
+ },
69
+ {
70
+ "tagName": "h2",
71
+ "textContent": "Bound both ways"
72
+ },
73
+ {
74
+ "tagName": "div",
75
+ "attributes": {
76
+ "role": "group",
77
+ "aria-label": "Bound value"
78
+ },
79
+ "children": [
80
+ {
81
+ "tagName": "jx-color-field",
82
+ "$props": {
83
+ "label": "Background",
84
+ "value": {
85
+ "$ref": "#/state/background"
86
+ }
87
+ },
88
+ "onchange": {
89
+ "$prototype": "Function",
90
+ "body": [
91
+ {
92
+ "operator": "=",
93
+ "target": {
94
+ "$ref": "#/state/background"
95
+ },
96
+ "value": {
97
+ "$ref": "event#/target/value"
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ },
103
+ {
104
+ "tagName": "span",
105
+ "textContent": "${state.background}"
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ "tagName": "h2",
111
+ "textContent": "Formats, alpha and doors"
112
+ },
113
+ {
114
+ "tagName": "div",
115
+ "attributes": {
116
+ "role": "group",
117
+ "aria-label": "Formats"
118
+ },
119
+ "children": [
120
+ {
121
+ "tagName": "jx-color-field",
122
+ "$props": {
123
+ "label": "Border",
124
+ "format": "oklch",
125
+ "value": "oklch(62.8% 0.258 29.2)"
126
+ }
127
+ },
128
+ {
129
+ "tagName": "jx-color-field",
130
+ "$props": {
131
+ "label": "Overlay",
132
+ "alpha": true,
133
+ "value": "#0f172a99"
134
+ }
135
+ },
136
+ {
137
+ "tagName": "jx-color-field",
138
+ "$props": {
139
+ "label": "Ink",
140
+ "system": false,
141
+ "eyedropper": false,
142
+ "value": "#111827"
143
+ }
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ "tagName": "h2",
149
+ "textContent": "Sizes and states"
150
+ },
151
+ {
152
+ "tagName": "div",
153
+ "attributes": {
154
+ "role": "group",
155
+ "aria-label": "Sizes"
156
+ },
157
+ "children": [
158
+ {
159
+ "tagName": "jx-color-field",
160
+ "$props": { "label": "Small", "size": "sm", "value": "#22c55e" }
161
+ },
162
+ {
163
+ "tagName": "jx-color-field",
164
+ "$props": { "label": "Medium", "value": "#22c55e" }
165
+ },
166
+ {
167
+ "tagName": "jx-color-field",
168
+ "$props": { "label": "Large", "size": "lg", "value": "#22c55e" }
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "tagName": "div",
174
+ "attributes": {
175
+ "role": "group",
176
+ "aria-label": "States"
177
+ },
178
+ "children": [
179
+ {
180
+ "tagName": "jx-color-field",
181
+ "$props": { "label": "Unset" }
182
+ },
183
+ {
184
+ "tagName": "jx-color-field",
185
+ "$props": { "label": "Fill", "value": "#8b5cf6", "disabled": true }
186
+ }
187
+ ]
188
+ },
189
+ {
190
+ "tagName": "h2",
191
+ "textContent": "With a project palette in the picker"
192
+ },
193
+ {
194
+ "tagName": "p",
195
+ "textContent": "Anything slotted into tokens is drawn under the sliders. A swatch group there is a second way to the same value: choosing one writes the field's value, and the picker's own controls follow it."
196
+ },
197
+ {
198
+ "tagName": "jx-color-field",
199
+ "$props": {
200
+ "label": "Surface",
201
+ "value": "#0ea5e9"
202
+ },
203
+ "children": [
204
+ {
205
+ "tagName": "jx-swatch-group",
206
+ "attributes": {
207
+ "slot": "tokens"
208
+ },
209
+ "$props": {
210
+ "label": "Project palette",
211
+ "columns": 5,
212
+ "value": "#0ea5e9"
213
+ },
214
+ "children": [
215
+ { "tagName": "jx-swatch", "$props": { "color": "#ef4444", "label": "Red" } },
216
+ { "tagName": "jx-swatch", "$props": { "color": "#f97316", "label": "Orange" } },
217
+ { "tagName": "jx-swatch", "$props": { "color": "#22c55e", "label": "Green" } },
218
+ { "tagName": "jx-swatch", "$props": { "color": "#0ea5e9", "label": "Sky" } },
219
+ { "tagName": "jx-swatch", "$props": { "color": "#8b5cf6", "label": "Violet" } }
220
+ ]
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ "tagName": "h2",
226
+ "textContent": "A reference this page cannot resolve"
227
+ },
228
+ {
229
+ "tagName": "p",
230
+ "textContent": "A value only the browser can resolve is kept and drawn as itself. When the browser cannot resolve it either, because the token is defined in a page other than the one drawing the field, resolved is the host saying what the reference stands for: the swatch draws it, the picker opens on it, and the value stays the reference. This field holds var(--brand-accent), which this page never defines."
231
+ },
232
+ {
233
+ "tagName": "jx-color-field",
234
+ "$props": {
235
+ "label": "Brand accent",
236
+ "value": "var(--brand-accent)",
237
+ "resolved": "#0ea5e9"
238
+ }
239
+ },
240
+ {
241
+ "tagName": "h2",
242
+ "textContent": "In a field row"
243
+ },
244
+ {
245
+ "tagName": "jx-field",
246
+ "$props": {
247
+ "label": "Accent",
248
+ "description": "Used for links, focus rings and the selected state."
249
+ },
250
+ "attributes": {
251
+ "data-prop": "accent"
252
+ },
253
+ "children": [
254
+ {
255
+ "tagName": "jx-color-field",
256
+ "$props": { "label": "Accent", "value": "#3b82f6" }
257
+ }
258
+ ]
259
+ }
260
+ ]
261
+ }