@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.
- package/components/jx-accordion-item.json +281 -0
- package/components/jx-accordion.json +33 -0
- package/components/jx-action-button.json +268 -34
- package/components/jx-action-group.json +131 -0
- package/components/jx-button.json +141 -26
- package/components/jx-checkbox.json +222 -0
- package/components/jx-color-area.json +263 -0
- package/components/jx-color-field.json +565 -0
- package/components/jx-color-slider.json +216 -0
- package/components/jx-combobox.json +551 -0
- package/components/jx-dialog.json +416 -0
- package/components/jx-divider.json +52 -0
- package/components/jx-dot.json +38 -0
- package/components/jx-field.json +162 -0
- package/components/jx-kbd.json +24 -0
- package/components/jx-listbox.json +76 -0
- package/components/jx-menu-item.json +6 -13
- package/components/jx-menu.json +45 -6
- package/components/jx-number-field.json +441 -0
- package/components/jx-option.json +350 -0
- package/components/jx-popover.json +227 -0
- package/components/jx-select.json +637 -0
- package/components/jx-spinner.json +129 -0
- package/components/jx-split.json +221 -0
- package/components/jx-swatch-group.json +107 -0
- package/components/jx-swatch.json +262 -0
- package/components/jx-switch.json +331 -0
- package/components/jx-tab-panel.json +58 -0
- package/components/jx-tab.json +296 -0
- package/components/jx-tabs.json +124 -0
- package/components/jx-textfield.json +645 -0
- package/components/jx-toast-host.json +121 -0
- package/components/jx-toast.json +255 -0
- package/components/jx-toolbar.json +81 -0
- package/components/jx-tooltip.json +207 -0
- package/components/jx-tree-item.json +325 -0
- package/components/jx-tree.json +202 -0
- package/icons/list.json +4 -0
- package/icons/manifest.json +12 -0
- package/package.json +27 -5
- package/project.json +164 -153
- package/src/behaviors/action-group.ts +255 -0
- package/src/behaviors/color-area.ts +303 -0
- package/src/behaviors/color-field.ts +465 -0
- package/src/behaviors/color-slider.ts +154 -0
- package/src/behaviors/combobox.ts +474 -0
- package/src/behaviors/dialog.ts +137 -0
- package/src/behaviors/listbox.ts +118 -0
- package/src/behaviors/menu.ts +80 -48
- package/src/behaviors/number-field.ts +161 -0
- package/src/behaviors/popover.ts +399 -0
- package/src/behaviors/select.ts +154 -0
- package/src/behaviors/split.ts +478 -0
- package/src/behaviors/swatch-group.ts +297 -0
- package/src/behaviors/tabs.ts +319 -0
- package/src/behaviors/textfield.ts +164 -0
- package/src/behaviors/toast-host.ts +241 -0
- package/src/behaviors/toast.ts +261 -0
- package/src/behaviors/toolbar.ts +413 -0
- package/src/behaviors/tooltip.ts +719 -0
- package/src/behaviors/tree.ts +830 -0
- package/src/color.ts +433 -0
- package/src/documents.ts +91 -1
- package/src/index.ts +41 -1
- package/src/loaders.ts +47 -0
- package/src/testing/anchor-support.ts +28 -0
- package/src/testing/popover-shim.ts +39 -6
- package/src/theme.ts +30 -6
- package/stylebook/jx-accordion-item.json +195 -0
- package/stylebook/jx-accordion.json +220 -0
- package/stylebook/jx-action-button.json +191 -23
- package/stylebook/jx-action-group.json +335 -0
- package/stylebook/jx-button.json +129 -26
- package/stylebook/jx-checkbox.json +245 -0
- package/stylebook/jx-color-area.json +272 -0
- package/stylebook/jx-color-field.json +261 -0
- package/stylebook/jx-color-slider.json +220 -0
- package/stylebook/jx-combobox.json +332 -0
- package/stylebook/jx-dialog.json +186 -0
- package/stylebook/jx-divider.json +125 -0
- package/stylebook/jx-dot.json +92 -0
- package/stylebook/jx-field.json +313 -0
- package/stylebook/jx-icon.json +4 -0
- package/stylebook/jx-kbd.json +90 -0
- package/stylebook/jx-listbox.json +337 -0
- package/stylebook/jx-menu.json +0 -1
- package/stylebook/jx-number-field.json +203 -0
- package/stylebook/jx-option.json +285 -0
- package/stylebook/jx-popover.json +123 -0
- package/stylebook/jx-select.json +407 -0
- package/stylebook/jx-spinner.json +111 -0
- package/stylebook/jx-split.json +170 -0
- package/stylebook/jx-swatch-group.json +175 -0
- package/stylebook/jx-swatch.json +249 -0
- package/stylebook/jx-switch.json +240 -0
- package/stylebook/jx-tab-panel.json +147 -0
- package/stylebook/jx-tab.json +201 -0
- package/stylebook/jx-tabs.json +278 -0
- package/stylebook/jx-textfield.json +309 -0
- package/stylebook/jx-toast-host.json +157 -0
- package/stylebook/jx-toast.json +266 -0
- package/stylebook/jx-toolbar.json +435 -0
- package/stylebook/jx-tooltip.json +162 -0
- package/stylebook/jx-tree-item.json +258 -0
- package/stylebook/jx-tree.json +429 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jxsuite.com/schema/v1",
|
|
3
|
+
"$id": "StylebookSwatchGroup",
|
|
4
|
+
"tagName": "main",
|
|
5
|
+
"$elements": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "../components/jx-swatch.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "../components/jx-swatch-group.json"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"state": {
|
|
14
|
+
"chosen": "#3b82f6",
|
|
15
|
+
"palette": [
|
|
16
|
+
{ "value": "#ef4444", "label": "Red" },
|
|
17
|
+
{ "value": "#f97316", "label": "Orange" },
|
|
18
|
+
{ "value": "#f5d90a", "label": "Lemon" },
|
|
19
|
+
{ "value": "#22c55e", "label": "Green" },
|
|
20
|
+
{ "value": "#3b82f6", "label": "Blue" },
|
|
21
|
+
{ "value": "#8b5cf6", "label": "Violet" },
|
|
22
|
+
{ "value": "#8b8b8b", "label": "Slate" },
|
|
23
|
+
{ "value": "#000000", "label": "Black" }
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"style": {
|
|
27
|
+
"fontFamily": "var(--jx-font-sans)",
|
|
28
|
+
"fontSize": "var(--jx-text-md)",
|
|
29
|
+
"color": "var(--jx-fg)",
|
|
30
|
+
"background": "var(--jx-bg)",
|
|
31
|
+
"padding": "var(--jx-space-6)",
|
|
32
|
+
"minHeight": "100vh",
|
|
33
|
+
"& > h1": {
|
|
34
|
+
"fontSize": "var(--jx-text-lg)",
|
|
35
|
+
"fontWeight": "600",
|
|
36
|
+
"margin": "0 0 var(--jx-space-5)"
|
|
37
|
+
},
|
|
38
|
+
"& > h2": {
|
|
39
|
+
"fontSize": "var(--jx-text-md)",
|
|
40
|
+
"fontWeight": "600",
|
|
41
|
+
"margin": "var(--jx-space-6) 0 var(--jx-space-3)"
|
|
42
|
+
},
|
|
43
|
+
"& > p": {
|
|
44
|
+
"color": "var(--jx-fg-dim)",
|
|
45
|
+
"margin": "0 0 var(--jx-space-5)"
|
|
46
|
+
},
|
|
47
|
+
"& [part=\"readout\"]": {
|
|
48
|
+
"display": "block",
|
|
49
|
+
"margin": "var(--jx-space-3) 0 var(--jx-space-5)",
|
|
50
|
+
"color": "var(--jx-fg-muted)",
|
|
51
|
+
"fontFamily": "var(--jx-font-mono)",
|
|
52
|
+
"fontSize": "var(--jx-text-sm)"
|
|
53
|
+
},
|
|
54
|
+
"& jx-swatch-group": {
|
|
55
|
+
"maxWidth": "320px"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"children": [
|
|
59
|
+
{
|
|
60
|
+
"tagName": "h1",
|
|
61
|
+
"textContent": "jx-swatch-group"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"tagName": "p",
|
|
65
|
+
"textContent": "A radio group of swatches. The group is the one writer of each swatch's chosen state and of the roving caret, so a host owns the group's value and nothing else. Either arrow pair moves between swatches with wrap, Home and End go to the ends, and the swatch the caret lands on is chosen, which is what a radio group does."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"tagName": "h2",
|
|
69
|
+
"textContent": "A palette, bound both ways"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"tagName": "jx-swatch-group",
|
|
73
|
+
"$props": {
|
|
74
|
+
"label": "Brand palette",
|
|
75
|
+
"value": {
|
|
76
|
+
"$ref": "#/state/chosen"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"onchange": {
|
|
80
|
+
"$prototype": "Function",
|
|
81
|
+
"body": [
|
|
82
|
+
{
|
|
83
|
+
"operator": "=",
|
|
84
|
+
"target": {
|
|
85
|
+
"$ref": "#/state/chosen"
|
|
86
|
+
},
|
|
87
|
+
"value": {
|
|
88
|
+
"$ref": "event#/target/value"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"children": [
|
|
94
|
+
{
|
|
95
|
+
"$prototype": "Array",
|
|
96
|
+
"items": {
|
|
97
|
+
"$ref": "#/state/palette"
|
|
98
|
+
},
|
|
99
|
+
"key": {
|
|
100
|
+
"$ref": "$map/item/value"
|
|
101
|
+
},
|
|
102
|
+
"map": {
|
|
103
|
+
"tagName": "jx-swatch",
|
|
104
|
+
"$props": {
|
|
105
|
+
"color": "${$map.item.value}",
|
|
106
|
+
"value": "${$map.item.value}",
|
|
107
|
+
"label": "${$map.item.label}"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"tagName": "span",
|
|
115
|
+
"attributes": {
|
|
116
|
+
"part": "readout"
|
|
117
|
+
},
|
|
118
|
+
"textContent": "${state.chosen}"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"tagName": "h2",
|
|
122
|
+
"textContent": "A fixed grid, and a member that cannot be chosen"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"tagName": "jx-swatch-group",
|
|
126
|
+
"$props": {
|
|
127
|
+
"label": "Theme colours",
|
|
128
|
+
"columns": 4,
|
|
129
|
+
"value": "#22c55e"
|
|
130
|
+
},
|
|
131
|
+
"children": [
|
|
132
|
+
{
|
|
133
|
+
"tagName": "jx-swatch",
|
|
134
|
+
"$props": { "color": "#ef4444", "label": "Red" }
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"tagName": "jx-swatch",
|
|
138
|
+
"$props": { "color": "#22c55e", "label": "Green" }
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"tagName": "jx-swatch",
|
|
142
|
+
"$props": { "color": "#3b82f6", "label": "Blue", "disabled": true }
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"tagName": "jx-swatch",
|
|
146
|
+
"$props": { "label": "No colour", "value": "none" }
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"tagName": "h2",
|
|
152
|
+
"textContent": "Captioned, in one column"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"tagName": "jx-swatch-group",
|
|
156
|
+
"$props": {
|
|
157
|
+
"label": "Named tokens",
|
|
158
|
+
"columns": 1,
|
|
159
|
+
"value": "brand.cool"
|
|
160
|
+
},
|
|
161
|
+
"children": [
|
|
162
|
+
{
|
|
163
|
+
"tagName": "jx-swatch",
|
|
164
|
+
"$props": { "color": "#f97316", "value": "brand.warm", "label": "Warm" },
|
|
165
|
+
"children": [{ "tagName": "span", "textContent": "Warm" }]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"tagName": "jx-swatch",
|
|
169
|
+
"$props": { "color": "#0ea5e9", "value": "brand.cool", "label": "Cool" },
|
|
170
|
+
"children": [{ "tagName": "span", "textContent": "Cool" }]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jxsuite.com/schema/v1",
|
|
3
|
+
"$id": "StylebookSwatch",
|
|
4
|
+
"tagName": "main",
|
|
5
|
+
"$elements": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "../components/jx-swatch.json"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"style": {
|
|
11
|
+
"fontFamily": "var(--jx-font-sans)",
|
|
12
|
+
"fontSize": "var(--jx-text-md)",
|
|
13
|
+
"color": "var(--jx-fg)",
|
|
14
|
+
"background": "var(--jx-bg)",
|
|
15
|
+
"padding": "var(--jx-space-6)",
|
|
16
|
+
"minHeight": "100vh",
|
|
17
|
+
"& > h1": {
|
|
18
|
+
"fontSize": "var(--jx-text-lg)",
|
|
19
|
+
"fontWeight": "600",
|
|
20
|
+
"margin": "0 0 var(--jx-space-5)"
|
|
21
|
+
},
|
|
22
|
+
"& > h2": {
|
|
23
|
+
"fontSize": "var(--jx-text-md)",
|
|
24
|
+
"fontWeight": "600",
|
|
25
|
+
"margin": "var(--jx-space-6) 0 var(--jx-space-3)"
|
|
26
|
+
},
|
|
27
|
+
"& > p": {
|
|
28
|
+
"color": "var(--jx-fg-dim)",
|
|
29
|
+
"margin": "0 0 var(--jx-space-5)"
|
|
30
|
+
},
|
|
31
|
+
"& [role=\"group\"]": {
|
|
32
|
+
"display": "flex",
|
|
33
|
+
"alignItems": "center",
|
|
34
|
+
"flexWrap": "wrap",
|
|
35
|
+
"gap": "var(--jx-space-3)",
|
|
36
|
+
"margin": "0 0 var(--jx-space-4)"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"children": [
|
|
40
|
+
{
|
|
41
|
+
"tagName": "h1",
|
|
42
|
+
"textContent": "jx-swatch"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"tagName": "p",
|
|
46
|
+
"textContent": "A colour chip that is a real button. Its name is the label rather than the colour, because a hex code read one character at a time is not a name. The chip's boundary and its tick are drawn in whichever of black or white can be seen on the colour, which the element works out from its own colour with no host involved."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"tagName": "h2",
|
|
50
|
+
"textContent": "Sizes"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"tagName": "div",
|
|
54
|
+
"attributes": {
|
|
55
|
+
"role": "group",
|
|
56
|
+
"aria-label": "Sizes"
|
|
57
|
+
},
|
|
58
|
+
"children": [
|
|
59
|
+
{
|
|
60
|
+
"tagName": "jx-swatch",
|
|
61
|
+
"$props": {
|
|
62
|
+
"size": "sm",
|
|
63
|
+
"color": "#3b82f6",
|
|
64
|
+
"label": "Blue"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"tagName": "jx-swatch",
|
|
69
|
+
"$props": {
|
|
70
|
+
"color": "#3b82f6",
|
|
71
|
+
"label": "Blue"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"tagName": "jx-swatch",
|
|
76
|
+
"$props": {
|
|
77
|
+
"size": "lg",
|
|
78
|
+
"color": "#3b82f6",
|
|
79
|
+
"label": "Blue"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"tagName": "h2",
|
|
86
|
+
"textContent": "Ink against the colour"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"tagName": "div",
|
|
90
|
+
"attributes": {
|
|
91
|
+
"role": "group",
|
|
92
|
+
"aria-label": "Chosen swatches across the range"
|
|
93
|
+
},
|
|
94
|
+
"children": [
|
|
95
|
+
{
|
|
96
|
+
"tagName": "jx-swatch",
|
|
97
|
+
"$props": {
|
|
98
|
+
"color": "#ffffff",
|
|
99
|
+
"label": "Paper",
|
|
100
|
+
"selected": true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"tagName": "jx-swatch",
|
|
105
|
+
"$props": {
|
|
106
|
+
"color": "#f5d90a",
|
|
107
|
+
"label": "Lemon",
|
|
108
|
+
"selected": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"tagName": "jx-swatch",
|
|
113
|
+
"$props": {
|
|
114
|
+
"color": "#8b8b8b",
|
|
115
|
+
"label": "Slate",
|
|
116
|
+
"selected": true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"tagName": "jx-swatch",
|
|
121
|
+
"$props": {
|
|
122
|
+
"color": "#1d4ed8",
|
|
123
|
+
"label": "Ink",
|
|
124
|
+
"selected": true
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"tagName": "jx-swatch",
|
|
129
|
+
"$props": {
|
|
130
|
+
"color": "#000000",
|
|
131
|
+
"label": "Black",
|
|
132
|
+
"selected": true
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"tagName": "h2",
|
|
139
|
+
"textContent": "States"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"tagName": "div",
|
|
143
|
+
"attributes": {
|
|
144
|
+
"role": "group",
|
|
145
|
+
"aria-label": "States"
|
|
146
|
+
},
|
|
147
|
+
"children": [
|
|
148
|
+
{
|
|
149
|
+
"tagName": "jx-swatch",
|
|
150
|
+
"$props": {
|
|
151
|
+
"color": "#22c55e",
|
|
152
|
+
"label": "Green"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"tagName": "jx-swatch",
|
|
157
|
+
"$props": {
|
|
158
|
+
"color": "#22c55e",
|
|
159
|
+
"label": "Green, chosen",
|
|
160
|
+
"checked": "true"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"tagName": "jx-swatch",
|
|
165
|
+
"$props": {
|
|
166
|
+
"color": "#22c55e",
|
|
167
|
+
"label": "Green, one of a set",
|
|
168
|
+
"checked": "false"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"tagName": "jx-swatch",
|
|
173
|
+
"$props": {
|
|
174
|
+
"color": "#22c55e",
|
|
175
|
+
"label": "Green, not yours to choose",
|
|
176
|
+
"disabled": true
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"tagName": "jx-swatch",
|
|
181
|
+
"$props": {
|
|
182
|
+
"label": "No colour"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"tagName": "jx-swatch",
|
|
187
|
+
"$props": {
|
|
188
|
+
"color": "rgb(59 130 246 / 35%)",
|
|
189
|
+
"label": "Blue, a third opaque"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"tagName": "jx-swatch",
|
|
194
|
+
"$props": {
|
|
195
|
+
"color": "var(--jx-accent-solid)",
|
|
196
|
+
"value": "accent",
|
|
197
|
+
"label": "Accent token"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"tagName": "h2",
|
|
204
|
+
"textContent": "With a caption"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"tagName": "p",
|
|
208
|
+
"textContent": "Slotted text sits beside the chip. The label still names the swatch, so the two must agree: aria-label wins over anything slotted, and a caption that said something else would be a name nobody can see."
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"tagName": "div",
|
|
212
|
+
"attributes": {
|
|
213
|
+
"role": "group",
|
|
214
|
+
"aria-label": "Captioned"
|
|
215
|
+
},
|
|
216
|
+
"children": [
|
|
217
|
+
{
|
|
218
|
+
"tagName": "jx-swatch",
|
|
219
|
+
"$props": {
|
|
220
|
+
"color": "#f97316",
|
|
221
|
+
"value": "brand.warm",
|
|
222
|
+
"label": "Warm"
|
|
223
|
+
},
|
|
224
|
+
"children": [
|
|
225
|
+
{
|
|
226
|
+
"tagName": "span",
|
|
227
|
+
"textContent": "Warm"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"tagName": "jx-swatch",
|
|
233
|
+
"$props": {
|
|
234
|
+
"color": "#0ea5e9",
|
|
235
|
+
"value": "brand.cool",
|
|
236
|
+
"label": "Cool",
|
|
237
|
+
"checked": "true"
|
|
238
|
+
},
|
|
239
|
+
"children": [
|
|
240
|
+
{
|
|
241
|
+
"tagName": "span",
|
|
242
|
+
"textContent": "Cool"
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jxsuite.com/schema/v1",
|
|
3
|
+
"$id": "StylebookSwitch",
|
|
4
|
+
"tagName": "main",
|
|
5
|
+
"$elements": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "../components/jx-field.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "../components/jx-switch.json"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"state": {
|
|
14
|
+
"wrap": 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
|
+
"& > p": {
|
|
29
|
+
"color": "var(--jx-fg-dim)",
|
|
30
|
+
"margin": "0 0 var(--jx-space-5)"
|
|
31
|
+
},
|
|
32
|
+
"& [role=\"group\"]": {
|
|
33
|
+
"display": "flex",
|
|
34
|
+
"alignItems": "center",
|
|
35
|
+
"flexWrap": "wrap",
|
|
36
|
+
"gap": "var(--jx-space-4)",
|
|
37
|
+
"margin": "0 0 var(--jx-space-4)"
|
|
38
|
+
},
|
|
39
|
+
"& [role=\"group\"] > span": {
|
|
40
|
+
"width": "80px",
|
|
41
|
+
"color": "var(--jx-fg-muted)",
|
|
42
|
+
"fontSize": "var(--jx-text-sm)"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"children": [
|
|
46
|
+
{
|
|
47
|
+
"tagName": "h1",
|
|
48
|
+
"textContent": "jx-switch"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"tagName": "p",
|
|
52
|
+
"textContent": "A native checkbox with role=switch, drawn as a track and a thumb. The platform supplies the on/off state, Space, and the click target of the wrapping label; the element writes no aria-checked of its own. The first switch is bound to the page's state both ways."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"tagName": "div",
|
|
56
|
+
"attributes": {
|
|
57
|
+
"role": "group",
|
|
58
|
+
"aria-label": "Bound state"
|
|
59
|
+
},
|
|
60
|
+
"children": [
|
|
61
|
+
{
|
|
62
|
+
"tagName": "jx-switch",
|
|
63
|
+
"$props": {
|
|
64
|
+
"checked": {
|
|
65
|
+
"$ref": "#/state/wrap"
|
|
66
|
+
},
|
|
67
|
+
"hint": "Long lines fold at the pane's edge."
|
|
68
|
+
},
|
|
69
|
+
"onchange": {
|
|
70
|
+
"$prototype": "Function",
|
|
71
|
+
"body": [
|
|
72
|
+
{
|
|
73
|
+
"operator": "=",
|
|
74
|
+
"target": {
|
|
75
|
+
"$ref": "#/state/wrap"
|
|
76
|
+
},
|
|
77
|
+
"value": {
|
|
78
|
+
"$ref": "event#/target/checked"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"children": [
|
|
84
|
+
{
|
|
85
|
+
"tagName": "span",
|
|
86
|
+
"textContent": "Wrap long lines"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"tagName": "span",
|
|
92
|
+
"textContent": "${state.wrap ? 'on' : 'off'}"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"tagName": "div",
|
|
98
|
+
"attributes": {
|
|
99
|
+
"role": "group",
|
|
100
|
+
"aria-label": "Sizes"
|
|
101
|
+
},
|
|
102
|
+
"children": [
|
|
103
|
+
{
|
|
104
|
+
"tagName": "jx-switch",
|
|
105
|
+
"$props": {
|
|
106
|
+
"size": "sm",
|
|
107
|
+
"checked": true
|
|
108
|
+
},
|
|
109
|
+
"children": [
|
|
110
|
+
{
|
|
111
|
+
"tagName": "span",
|
|
112
|
+
"textContent": "Small"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"tagName": "jx-switch",
|
|
118
|
+
"$props": {
|
|
119
|
+
"checked": true
|
|
120
|
+
},
|
|
121
|
+
"children": [
|
|
122
|
+
{
|
|
123
|
+
"tagName": "span",
|
|
124
|
+
"textContent": "Medium"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"tagName": "jx-switch",
|
|
130
|
+
"$props": {
|
|
131
|
+
"size": "lg",
|
|
132
|
+
"checked": true
|
|
133
|
+
},
|
|
134
|
+
"children": [
|
|
135
|
+
{
|
|
136
|
+
"tagName": "span",
|
|
137
|
+
"textContent": "Large"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"tagName": "div",
|
|
145
|
+
"attributes": {
|
|
146
|
+
"dir": "rtl",
|
|
147
|
+
"role": "group",
|
|
148
|
+
"aria-label": "Right to left"
|
|
149
|
+
},
|
|
150
|
+
"children": [
|
|
151
|
+
{
|
|
152
|
+
"tagName": "jx-switch",
|
|
153
|
+
"$props": {
|
|
154
|
+
"checked": true
|
|
155
|
+
},
|
|
156
|
+
"children": [
|
|
157
|
+
{
|
|
158
|
+
"tagName": "span",
|
|
159
|
+
"textContent": "On, in a right-to-left row"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"tagName": "jx-switch",
|
|
165
|
+
"children": [
|
|
166
|
+
{
|
|
167
|
+
"tagName": "span",
|
|
168
|
+
"textContent": "Off, in a right-to-left row"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"tagName": "div",
|
|
176
|
+
"attributes": {
|
|
177
|
+
"role": "group",
|
|
178
|
+
"aria-label": "States"
|
|
179
|
+
},
|
|
180
|
+
"children": [
|
|
181
|
+
{
|
|
182
|
+
"tagName": "jx-switch",
|
|
183
|
+
"children": [
|
|
184
|
+
{
|
|
185
|
+
"tagName": "span",
|
|
186
|
+
"textContent": "Off"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"tagName": "jx-switch",
|
|
192
|
+
"$props": {
|
|
193
|
+
"checked": true,
|
|
194
|
+
"disabled": true
|
|
195
|
+
},
|
|
196
|
+
"children": [
|
|
197
|
+
{
|
|
198
|
+
"tagName": "span",
|
|
199
|
+
"textContent": "On, and not yours to change"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"tagName": "jx-switch",
|
|
205
|
+
"$props": {
|
|
206
|
+
"disabled": true,
|
|
207
|
+
"hint": "Sign in to publish from here."
|
|
208
|
+
},
|
|
209
|
+
"children": [
|
|
210
|
+
{
|
|
211
|
+
"tagName": "span",
|
|
212
|
+
"textContent": "Off, with a reason"
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"tagName": "jx-switch",
|
|
218
|
+
"$props": {
|
|
219
|
+
"label": "Unlabelled switch"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"tagName": "jx-field",
|
|
226
|
+
"$props": {
|
|
227
|
+
"label": "Minify",
|
|
228
|
+
"description": "Strips whitespace from the built CSS and JavaScript."
|
|
229
|
+
},
|
|
230
|
+
"attributes": {
|
|
231
|
+
"data-prop": "minify"
|
|
232
|
+
},
|
|
233
|
+
"children": [
|
|
234
|
+
{
|
|
235
|
+
"tagName": "jx-switch"
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
}
|