@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,162 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookTooltip",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-tooltip.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "names": ["floppy-disk", "copy"]
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
+ "& > p": {
29
+ "color": "var(--jx-fg-dim)",
30
+ "margin": "0 0 var(--jx-space-5)",
31
+ "maxWidth": "60ch"
32
+ },
33
+ "& [role=\"group\"]": {
34
+ "display": "flex",
35
+ "alignItems": "center",
36
+ "gap": "var(--jx-space-3)",
37
+ "margin": "0 0 var(--jx-space-4)"
38
+ },
39
+ "& [role=\"group\"] > span": {
40
+ "width": "180px",
41
+ "color": "var(--jx-fg-muted)",
42
+ "fontSize": "var(--jx-text-sm)"
43
+ },
44
+ "& button": {
45
+ "display": "inline-flex",
46
+ "alignItems": "center",
47
+ "justifyContent": "center",
48
+ "width": "var(--jx-control-h)",
49
+ "height": "var(--jx-control-h)",
50
+ "padding": "0",
51
+ "appearance": "none",
52
+ "border": "1px solid var(--jx-border)",
53
+ "borderRadius": "var(--jx-radius-sm)",
54
+ "background": "var(--jx-bg-input)",
55
+ "color": "var(--jx-fg)",
56
+ "cursor": "pointer"
57
+ },
58
+ "& button:focus-visible": {
59
+ "outline": "var(--jx-focus-ring)",
60
+ "outlineOffset": "1px"
61
+ }
62
+ },
63
+ "children": [
64
+ {
65
+ "tagName": "h1",
66
+ "textContent": "jx-tooltip"
67
+ },
68
+ {
69
+ "tagName": "p",
70
+ "textContent": "A tip is a hint popover: it can sit over an open menu explaining a row, because a hint does not dismiss an auto popover the way a second auto one would. It is never focusable, and it never names itself onto anything — the control points at it with aria-describedby, which resolves because the kit is light DOM."
71
+ },
72
+ {
73
+ "tagName": "p",
74
+ "textContent": "Both buttons below are icon-only, so the tip is the only sentence a reader gets. The first is wired the declarative way, with interestfor on the control; the second names its control with for. Both work on every engine — where interest invokers are missing the element binds the control it is wired to itself — and either way the tip stays up for as long as the pointer or the focus is on it, and Escape puts it away."
75
+ },
76
+ {
77
+ "tagName": "div",
78
+ "attributes": {
79
+ "role": "group",
80
+ "aria-label": "Declarative"
81
+ },
82
+ "children": [
83
+ {
84
+ "tagName": "span",
85
+ "textContent": "interestfor"
86
+ },
87
+ {
88
+ "tagName": "button",
89
+ "attributes": {
90
+ "type": "button",
91
+ "aria-label": "Save",
92
+ "aria-describedby": "sb-tip-save",
93
+ "interestfor": "sb-tip-save"
94
+ },
95
+ "children": [
96
+ {
97
+ "tagName": "jx-icon",
98
+ "$props": {
99
+ "name": "floppy-disk"
100
+ }
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "tagName": "jx-tooltip",
106
+ "id": "sb-tip-save",
107
+ "children": [
108
+ {
109
+ "tagName": "span",
110
+ "textContent": "Save the file — ⌘S"
111
+ }
112
+ ]
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ "tagName": "div",
118
+ "attributes": {
119
+ "role": "group",
120
+ "aria-label": "Fallback"
121
+ },
122
+ "children": [
123
+ {
124
+ "tagName": "span",
125
+ "textContent": "for, with an arrow"
126
+ },
127
+ {
128
+ "tagName": "button",
129
+ "id": "sb-copy-button",
130
+ "attributes": {
131
+ "type": "button",
132
+ "aria-label": "Copy",
133
+ "aria-describedby": "sb-tip-copy"
134
+ },
135
+ "children": [
136
+ {
137
+ "tagName": "jx-icon",
138
+ "$props": {
139
+ "name": "copy"
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "tagName": "jx-tooltip",
146
+ "id": "sb-tip-copy",
147
+ "$props": {
148
+ "for": "sb-copy-button",
149
+ "arrow": true,
150
+ "delay": 250
151
+ },
152
+ "children": [
153
+ {
154
+ "tagName": "span",
155
+ "textContent": "Copy the selection"
156
+ }
157
+ ]
158
+ }
159
+ ]
160
+ }
161
+ ]
162
+ }
@@ -0,0 +1,258 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookTreeItem",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-action-button.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-dot.json"
14
+ },
15
+ {
16
+ "$ref": "../components/jx-tree-item.json"
17
+ },
18
+ {
19
+ "$ref": "../components/jx-tree.json"
20
+ }
21
+ ],
22
+ "state": {
23
+ "names": ["folder", "file", "dots-three-vertical"]
24
+ },
25
+ "style": {
26
+ "fontFamily": "var(--jx-font-sans)",
27
+ "fontSize": "var(--jx-text-md)",
28
+ "color": "var(--jx-fg)",
29
+ "background": "var(--jx-bg)",
30
+ "padding": "var(--jx-space-6)",
31
+ "minHeight": "100vh",
32
+ "& > h1": {
33
+ "fontSize": "var(--jx-text-lg)",
34
+ "fontWeight": "600",
35
+ "margin": "0 0 var(--jx-space-5)"
36
+ },
37
+ "& > h2": {
38
+ "fontSize": "var(--jx-text-md)",
39
+ "fontWeight": "600",
40
+ "margin": "var(--jx-space-6) 0 var(--jx-space-3)"
41
+ },
42
+ "& > p": {
43
+ "color": "var(--jx-fg-dim)",
44
+ "margin": "0 0 var(--jx-space-5)",
45
+ "maxWidth": "72ch"
46
+ },
47
+ "& jx-tree": {
48
+ "maxWidth": "280px",
49
+ "border": "1px solid var(--jx-border)",
50
+ "borderRadius": "var(--jx-radius-sm)",
51
+ "background": "var(--jx-bg-panel)",
52
+ "padding": "var(--jx-space-1) 0"
53
+ },
54
+ "& [part=\"badge\"]": {
55
+ "$description": "A consumer's mark, slotted into `icon`. It is the consumer's box and the consumer's declarations: the row generates none of its own for the three zones, so a badge, a chip and a pin all sit on the row's one flex line.",
56
+ "flex": "none",
57
+ "maxWidth": "12ch",
58
+ "overflow": "hidden",
59
+ "padding": "0 var(--jx-space-2)",
60
+ "borderRadius": "var(--jx-radius-xs)",
61
+ "background": "var(--jx-tag)",
62
+ "color": "var(--jx-accent-fg)",
63
+ "fontSize": "var(--jx-text-xs)",
64
+ "textOverflow": "ellipsis"
65
+ }
66
+ },
67
+ "children": [
68
+ {
69
+ "tagName": "h1",
70
+ "textContent": "jx-tree-item"
71
+ },
72
+ {
73
+ "tagName": "p",
74
+ "textContent": "One row, and a row is all it is. Its level, its position among its siblings and how many siblings it has are PROPS, because a windowed tree holds a slice: a row that counted its own siblings would count the drawn ones and tell a reader a directory holds four files when it holds eight hundred."
75
+ },
76
+ {
77
+ "tagName": "h2",
78
+ "textContent": "Levels, twisty and leaf"
79
+ },
80
+ {
81
+ "tagName": "p",
82
+ "textContent": "An empty expanded means a LEAF: no aria-expanded, no chevron, and the box the chevron would occupy is kept so every name lines up. The indent is --jx-tree-indent times one less than the level."
83
+ },
84
+ {
85
+ "tagName": "jx-tree",
86
+ "attributes": {
87
+ "label": "Row states"
88
+ },
89
+ "children": [
90
+ {
91
+ "tagName": "jx-tree-item",
92
+ "attributes": {
93
+ "value": "open",
94
+ "label": "An open branch",
95
+ "level": "1",
96
+ "posinset": "1",
97
+ "setsize": "3",
98
+ "expanded": "true"
99
+ }
100
+ },
101
+ {
102
+ "tagName": "jx-tree-item",
103
+ "attributes": {
104
+ "value": "shut",
105
+ "label": "A closed branch",
106
+ "level": "2",
107
+ "posinset": "1",
108
+ "setsize": "2",
109
+ "expanded": "false"
110
+ }
111
+ },
112
+ {
113
+ "tagName": "jx-tree-item",
114
+ "attributes": {
115
+ "value": "leaf",
116
+ "label": "A leaf",
117
+ "level": "3",
118
+ "posinset": "1",
119
+ "setsize": "1"
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "tagName": "h2",
126
+ "textContent": "Selected, disabled and cut"
127
+ },
128
+ {
129
+ "tagName": "p",
130
+ "textContent": "aria-selected is written only when the row IS selected: a false on every row is what tells assistive technology a tree supports multiple selection, and that answer belongs on the tree. A cut row is faded and says nothing to a reader, because the host announces the move through its own live region."
131
+ },
132
+ {
133
+ "tagName": "jx-tree",
134
+ "attributes": {
135
+ "label": "Selection states"
136
+ },
137
+ "children": [
138
+ {
139
+ "tagName": "jx-tree-item",
140
+ "attributes": {
141
+ "value": "picked",
142
+ "label": "Selected",
143
+ "level": "1",
144
+ "posinset": "1",
145
+ "setsize": "3",
146
+ "selected": ""
147
+ }
148
+ },
149
+ {
150
+ "tagName": "jx-tree-item",
151
+ "attributes": {
152
+ "value": "off",
153
+ "label": "Disabled",
154
+ "level": "1",
155
+ "posinset": "2",
156
+ "setsize": "3",
157
+ "disabled": ""
158
+ }
159
+ },
160
+ {
161
+ "tagName": "jx-tree-item",
162
+ "attributes": {
163
+ "value": "lifted",
164
+ "label": "Cut, waiting for a paste",
165
+ "level": "1",
166
+ "posinset": "3",
167
+ "setsize": "3",
168
+ "cut": ""
169
+ }
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ "tagName": "h2",
175
+ "textContent": "The three slots and the grip"
176
+ },
177
+ {
178
+ "tagName": "p",
179
+ "textContent": "icon draws before the name, status and actions after it. The division is the CLICK: status holds a mark about the row and clicking it selects the row, while actions holds a control and the click stops there. The grip is the pointer's grab affordance for the drag island and never a second way to move a row — the keyboard path is cut and paste."
180
+ },
181
+ {
182
+ "tagName": "jx-tree",
183
+ "attributes": {
184
+ "label": "Slotted rows"
185
+ },
186
+ "children": [
187
+ {
188
+ "tagName": "jx-tree-item",
189
+ "attributes": {
190
+ "value": "src",
191
+ "label": "src",
192
+ "level": "1",
193
+ "posinset": "1",
194
+ "setsize": "2",
195
+ "expanded": "true"
196
+ },
197
+ "children": [
198
+ {
199
+ "tagName": "jx-icon",
200
+ "attributes": {
201
+ "slot": "icon"
202
+ },
203
+ "$props": {
204
+ "name": "folder"
205
+ }
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "tagName": "jx-tree-item",
211
+ "attributes": {
212
+ "value": "src/hero",
213
+ "label": "Hero",
214
+ "level": "2",
215
+ "posinset": "1",
216
+ "setsize": "1",
217
+ "grip": ""
218
+ },
219
+ "children": [
220
+ {
221
+ "tagName": "span",
222
+ "attributes": {
223
+ "part": "badge",
224
+ "slot": "icon"
225
+ },
226
+ "textContent": "section"
227
+ },
228
+ {
229
+ "tagName": "jx-dot",
230
+ "attributes": {
231
+ "slot": "status",
232
+ "aria-hidden": "true"
233
+ },
234
+ "$props": {
235
+ "tone": "warning"
236
+ }
237
+ },
238
+ {
239
+ "tagName": "jx-action-button",
240
+ "attributes": {
241
+ "slot": "actions"
242
+ },
243
+ "$props": {
244
+ "label": "More actions",
245
+ "hint": "More actions",
246
+ "icon": "dots-three-vertical",
247
+ "haspopup": "menu",
248
+ "size": "sm",
249
+ "quiet": true,
250
+ "tabindex": "-1"
251
+ }
252
+ }
253
+ ]
254
+ }
255
+ ]
256
+ }
257
+ ]
258
+ }