@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,15 +3,30 @@
3
3
  "$id": "StylebookButton",
4
4
  "tagName": "main",
5
5
  "$elements": [
6
- { "$ref": "../components/jx-icon.json" },
7
- { "$ref": "../components/jx-button.json" }
6
+ {
7
+ "$ref": "../components/jx-icon.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-spinner.json"
11
+ },
12
+ {
13
+ "$ref": "../components/jx-button.json"
14
+ }
8
15
  ],
9
16
  "state": {
10
17
  "variants": ["accent", "primary", "secondary", "negative"],
11
18
  "clicks": 0,
12
19
  "count": {
13
20
  "$prototype": "Function",
14
- "body": [{ "operator": "+=", "target": { "$ref": "#/state/clicks" }, "value": 1 }]
21
+ "body": [
22
+ {
23
+ "operator": "+=",
24
+ "target": {
25
+ "$ref": "#/state/clicks"
26
+ },
27
+ "value": 1
28
+ }
29
+ ]
15
30
  }
16
31
  },
17
32
  "style": {
@@ -26,7 +41,10 @@
26
41
  "fontWeight": "600",
27
42
  "margin": "0 0 var(--jx-space-5)"
28
43
  },
29
- "& > p": { "color": "var(--jx-fg-dim)", "margin": "0 0 var(--jx-space-5)" },
44
+ "& > p": {
45
+ "color": "var(--jx-fg-dim)",
46
+ "margin": "0 0 var(--jx-space-5)"
47
+ },
30
48
  "& [role=\"group\"]": {
31
49
  "display": "flex",
32
50
  "alignItems": "center",
@@ -40,62 +58,147 @@
40
58
  }
41
59
  },
42
60
  "children": [
43
- { "tagName": "h1", "textContent": "jx-button" },
61
+ {
62
+ "tagName": "h1",
63
+ "textContent": "jx-button"
64
+ },
44
65
  {
45
66
  "tagName": "p",
46
67
  "textContent": "Every variant in every state. The accent is spent once per surface; secondary is the default. Clicked ${state.clicks} times."
47
68
  },
48
69
  {
49
70
  "$prototype": "Array",
50
- "items": { "$ref": "#/state/variants" },
51
- "key": { "$ref": "$map/item" },
71
+ "items": {
72
+ "$ref": "#/state/variants"
73
+ },
74
+ "key": {
75
+ "$ref": "$map/item"
76
+ },
52
77
  "map": {
53
78
  "tagName": "div",
54
- "attributes": { "role": "group", "aria-label": "${$map.item} buttons" },
79
+ "attributes": {
80
+ "role": "group",
81
+ "aria-label": "${$map.item} buttons"
82
+ },
55
83
  "children": [
56
- { "tagName": "span", "textContent": "${$map.item}" },
84
+ {
85
+ "tagName": "span",
86
+ "textContent": "${$map.item}"
87
+ },
57
88
  {
58
89
  "tagName": "jx-button",
59
- "$props": { "variant": { "$ref": "$map/item" } },
60
- "onclick": { "$ref": "#/state/count" },
61
- "children": [{ "tagName": "span", "textContent": "Label" }]
90
+ "$props": {
91
+ "variant": {
92
+ "$ref": "$map/item"
93
+ }
94
+ },
95
+ "onclick": {
96
+ "$ref": "#/state/count"
97
+ },
98
+ "children": [
99
+ {
100
+ "tagName": "span",
101
+ "textContent": "Label"
102
+ }
103
+ ]
62
104
  },
63
105
  {
64
106
  "tagName": "jx-button",
65
- "$props": { "variant": { "$ref": "$map/item" } },
107
+ "$props": {
108
+ "variant": {
109
+ "$ref": "$map/item"
110
+ }
111
+ },
66
112
  "children": [
67
113
  {
68
114
  "tagName": "jx-icon",
69
- "attributes": { "slot": "icon" },
70
- "$props": { "name": "plus" }
115
+ "attributes": {
116
+ "slot": "icon"
117
+ },
118
+ "$props": {
119
+ "name": "plus"
120
+ }
71
121
  },
72
- { "tagName": "span", "textContent": "With icon" }
122
+ {
123
+ "tagName": "span",
124
+ "textContent": "With icon"
125
+ }
73
126
  ]
74
127
  },
75
128
  {
76
129
  "tagName": "jx-button",
77
- "$props": { "variant": { "$ref": "$map/item" }, "quiet": true },
78
- "children": [{ "tagName": "span", "textContent": "Quiet" }]
130
+ "$props": {
131
+ "variant": {
132
+ "$ref": "$map/item"
133
+ },
134
+ "quiet": true
135
+ },
136
+ "children": [
137
+ {
138
+ "tagName": "span",
139
+ "textContent": "Quiet"
140
+ }
141
+ ]
79
142
  },
80
143
  {
81
144
  "tagName": "jx-button",
82
- "$props": { "variant": { "$ref": "$map/item" }, "disabled": true },
83
- "children": [{ "tagName": "span", "textContent": "Disabled" }]
145
+ "$props": {
146
+ "variant": {
147
+ "$ref": "$map/item"
148
+ },
149
+ "disabled": true
150
+ },
151
+ "children": [
152
+ {
153
+ "tagName": "span",
154
+ "textContent": "Disabled"
155
+ }
156
+ ]
84
157
  },
85
158
  {
86
159
  "tagName": "jx-button",
87
- "$props": { "variant": { "$ref": "$map/item" }, "loading": true },
88
- "children": [{ "tagName": "span", "textContent": "Loading" }]
160
+ "$props": {
161
+ "variant": {
162
+ "$ref": "$map/item"
163
+ },
164
+ "loading": true
165
+ },
166
+ "children": [
167
+ {
168
+ "tagName": "span",
169
+ "textContent": "Loading"
170
+ }
171
+ ]
89
172
  },
90
173
  {
91
174
  "tagName": "jx-button",
92
- "$props": { "variant": { "$ref": "$map/item" }, "size": "sm" },
93
- "children": [{ "tagName": "span", "textContent": "Small" }]
175
+ "$props": {
176
+ "variant": {
177
+ "$ref": "$map/item"
178
+ },
179
+ "size": "sm"
180
+ },
181
+ "children": [
182
+ {
183
+ "tagName": "span",
184
+ "textContent": "Small"
185
+ }
186
+ ]
94
187
  },
95
188
  {
96
189
  "tagName": "jx-button",
97
- "$props": { "variant": { "$ref": "$map/item" }, "size": "lg" },
98
- "children": [{ "tagName": "span", "textContent": "Large" }]
190
+ "$props": {
191
+ "variant": {
192
+ "$ref": "$map/item"
193
+ },
194
+ "size": "lg"
195
+ },
196
+ "children": [
197
+ {
198
+ "tagName": "span",
199
+ "textContent": "Large"
200
+ }
201
+ ]
99
202
  }
100
203
  ]
101
204
  }
@@ -0,0 +1,245 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "StylebookCheckbox",
4
+ "tagName": "main",
5
+ "$elements": [
6
+ {
7
+ "$ref": "../components/jx-field.json"
8
+ },
9
+ {
10
+ "$ref": "../components/jx-checkbox.json"
11
+ }
12
+ ],
13
+ "state": {
14
+ "included": true
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
+ "color": "var(--jx-fg-dim)",
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
+ },
38
+ "& [role=\"group\"]": {
39
+ "display": "flex",
40
+ "alignItems": "flex-start",
41
+ "flexWrap": "wrap",
42
+ "gap": "var(--jx-space-4)",
43
+ "margin": "0 0 var(--jx-space-4)"
44
+ },
45
+ "& [role=\"group\"] > span": {
46
+ "color": "var(--jx-fg-muted)",
47
+ "fontSize": "var(--jx-text-sm)"
48
+ },
49
+ "& code": {
50
+ "fontFamily": "var(--jx-font-mono)",
51
+ "color": "var(--jx-tag)"
52
+ }
53
+ },
54
+ "children": [
55
+ {
56
+ "tagName": "h1",
57
+ "textContent": "jx-checkbox"
58
+ },
59
+ {
60
+ "tagName": "p",
61
+ "textContent": "A native checkbox inside the label that names it. Ticked, clear and mixed are properties of the control, so a host write still moves the box after the reader has touched it."
62
+ },
63
+ {
64
+ "tagName": "h2",
65
+ "textContent": "Bound state"
66
+ },
67
+ {
68
+ "tagName": "div",
69
+ "attributes": {
70
+ "role": "group",
71
+ "aria-label": "Bound state"
72
+ },
73
+ "children": [
74
+ {
75
+ "tagName": "jx-checkbox",
76
+ "$props": {
77
+ "checked": {
78
+ "$ref": "#/state/included"
79
+ }
80
+ },
81
+ "textContent": "Include in the build",
82
+ "onchange": {
83
+ "$prototype": "Function",
84
+ "body": [
85
+ {
86
+ "operator": "=",
87
+ "target": {
88
+ "$ref": "#/state/included"
89
+ },
90
+ "value": {
91
+ "$ref": "event#/target/checked"
92
+ }
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "tagName": "span",
99
+ "textContent": "${state.included ? 'included' : 'left out'}"
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ "tagName": "h2",
105
+ "textContent": "In a field row"
106
+ },
107
+ {
108
+ "tagName": "p",
109
+ "textContent": "The row is jx-field. It mints the id its label carries and hands it to the box as labelledby, so nothing here writes an id."
110
+ },
111
+ {
112
+ "tagName": "jx-field",
113
+ "$props": {
114
+ "label": "Visible",
115
+ "description": "A hidden layer is still exported."
116
+ },
117
+ "attributes": {
118
+ "data-prop": "visible"
119
+ },
120
+ "children": [
121
+ {
122
+ "tagName": "jx-checkbox",
123
+ "$props": {
124
+ "checked": true
125
+ }
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "tagName": "h2",
131
+ "textContent": "States"
132
+ },
133
+ {
134
+ "tagName": "div",
135
+ "attributes": {
136
+ "role": "group",
137
+ "aria-label": "States"
138
+ },
139
+ "children": [
140
+ {
141
+ "tagName": "jx-checkbox",
142
+ "textContent": "Clear"
143
+ },
144
+ {
145
+ "tagName": "jx-checkbox",
146
+ "$props": {
147
+ "checked": true
148
+ },
149
+ "textContent": "Ticked"
150
+ },
151
+ {
152
+ "tagName": "jx-checkbox",
153
+ "$props": {
154
+ "indeterminate": true
155
+ },
156
+ "textContent": "Mixed"
157
+ },
158
+ {
159
+ "tagName": "jx-checkbox",
160
+ "$props": {
161
+ "disabled": true
162
+ },
163
+ "textContent": "Disabled"
164
+ },
165
+ {
166
+ "tagName": "jx-checkbox",
167
+ "$props": {
168
+ "checked": true,
169
+ "disabled": true
170
+ },
171
+ "textContent": "Ticked and disabled"
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ "tagName": "h2",
177
+ "textContent": "Sizes"
178
+ },
179
+ {
180
+ "tagName": "div",
181
+ "attributes": {
182
+ "role": "group",
183
+ "aria-label": "Sizes"
184
+ },
185
+ "children": [
186
+ {
187
+ "tagName": "jx-checkbox",
188
+ "$props": {
189
+ "size": "sm",
190
+ "checked": true
191
+ },
192
+ "textContent": "Small"
193
+ },
194
+ {
195
+ "tagName": "jx-checkbox",
196
+ "$props": {
197
+ "checked": true
198
+ },
199
+ "textContent": "Medium"
200
+ },
201
+ {
202
+ "tagName": "jx-checkbox",
203
+ "$props": {
204
+ "size": "lg",
205
+ "checked": true
206
+ },
207
+ "textContent": "Large"
208
+ }
209
+ ]
210
+ },
211
+ {
212
+ "tagName": "h2",
213
+ "textContent": "Slotted markup, and a bare box"
214
+ },
215
+ {
216
+ "tagName": "div",
217
+ "attributes": {
218
+ "role": "group",
219
+ "aria-label": "Slotted markup"
220
+ },
221
+ "children": [
222
+ {
223
+ "tagName": "jx-checkbox",
224
+ "children": [
225
+ "Register ",
226
+ {
227
+ "tagName": "code",
228
+ "textContent": "<my-element>"
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "tagName": "jx-checkbox",
234
+ "$props": {
235
+ "label": "Select every row"
236
+ }
237
+ },
238
+ {
239
+ "tagName": "span",
240
+ "textContent": "The bare box has no slotted text, so its label collapses and its name is the label prop."
241
+ }
242
+ ]
243
+ }
244
+ ]
245
+ }