@jxsuite/ui 0.0.0 → 0.1.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 +261 -33
  4. package/components/jx-action-group.json +123 -0
  5. package/components/jx-button.json +133 -25
  6. package/components/jx-checkbox.json +215 -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 +544 -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 +5 -12
  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 +253 -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 +639 -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 +715 -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,263 @@
1
+ {
2
+ "$schema": "https://jxsuite.com/schema/v1",
3
+ "$id": "JxColorArea",
4
+ "tagName": "jx-color-area",
5
+ "observedAttributes": [
6
+ "label",
7
+ "x-label",
8
+ "y-label",
9
+ "hue",
10
+ "saturation",
11
+ "brightness",
12
+ "step",
13
+ "disabled"
14
+ ],
15
+ "state": {
16
+ "label": {
17
+ "type": "string",
18
+ "default": "",
19
+ "attribute": "label",
20
+ "description": "The accessible name of the square, which is a role=\"group\" holding two sliders. NOT optional: role=\"group\" is in neither the accessibility lint's content-named roles nor its labelled ones, so an unnamed one is invisible to every gate, and a reader entering it is told they have entered a group and nothing more. \"Colour\" or the name of the property being edited is the right answer; the two axes carry their own names."
21
+ },
22
+ "xLabel": {
23
+ "type": "string",
24
+ "default": "Saturation",
25
+ "attribute": "x-label",
26
+ "description": "The horizontal slider's accessible name. A prop rather than a constant because it is words on a screen reader's lips, and a shell in another language must be able to say them; the default is the English one so a consumer who does not care writes nothing."
27
+ },
28
+ "yLabel": {
29
+ "type": "string",
30
+ "default": "Brightness",
31
+ "attribute": "y-label",
32
+ "description": "The vertical slider's accessible name, on the same terms as xLabel."
33
+ },
34
+ "hue": {
35
+ "type": "number",
36
+ "default": 0,
37
+ "attribute": "hue",
38
+ "description": "The hue the square is drawn under, 0-360. The element READS it and never writes it: a saturation/brightness field has no hue of its own, and the control that owns the hue is a jx-color-slider beside it. Dragging into the grey corner therefore leaves the hue exactly where the reader put it, which is the whole reason the two are separate elements."
39
+ },
40
+ "saturation": {
41
+ "type": "number",
42
+ "default": 100,
43
+ "attribute": "saturation",
44
+ "description": "The horizontal axis, 0-100. It is the x coordinate of the thumb and the value of the horizontal range, and those are the same number rather than two that must be kept in step."
45
+ },
46
+ "brightness": {
47
+ "type": "number",
48
+ "default": 100,
49
+ "attribute": "brightness",
50
+ "description": "The vertical axis, 0-100, measured UPWARD from the bottom edge — 100 is the top. The thumb's CSS offset is the complement, computed in the document, because a reader's mental model of a colour square is bright at the top and a stylesheet's is zero at the top, and only one of those two should be in a prop."
51
+ },
52
+ "step": {
53
+ "type": "number",
54
+ "default": 1,
55
+ "attribute": "step",
56
+ "description": "The grid both axes move on, for the platform's own arrow keys, for the kit's cross-axis and ten-step keys, and for the snap a pointer drag is put through. One grid for the pointer and the keyboard is what stops the thumb and the announced value disagreeing during a drag."
57
+ },
58
+ "disabled": {
59
+ "type": "boolean",
60
+ "default": false,
61
+ "attribute": "disabled",
62
+ "description": "Cannot be moved or focused. Forwarded to both ranges, so the refusal is the platform's; the pointer and key handlers check it too, because a pointer on the track never reaches a disabled control to be refused by it."
63
+ },
64
+ "xText": "${Math.round(state.saturation) + '%'}",
65
+ "yText": "${Math.round(state.brightness) + '%'}",
66
+ "onInput": {
67
+ "$prototype": "Function",
68
+ "$src": "jx-ui:/behaviors/color-area.ts",
69
+ "$export": "onAreaAxisInput",
70
+ "emits": [
71
+ {
72
+ "name": "input",
73
+ "description": "An axis is moving under the reader's hand. It comes from the ELEMENT, so e.target.saturation and e.target.brightness are the whole answer."
74
+ }
75
+ ],
76
+ "description": "Mirrors whichever range moved into its axis and re-says input from the host. The native event is stopped: two controls holding half a coordinate each cannot both be e.target for one colour."
77
+ },
78
+ "onChange": {
79
+ "$prototype": "Function",
80
+ "$src": "jx-ui:/behaviors/color-area.ts",
81
+ "$export": "onAreaAxisChange",
82
+ "emits": [
83
+ {
84
+ "name": "change",
85
+ "description": "The reader committed a value; e.target is the element."
86
+ }
87
+ ],
88
+ "description": "The same mirror and the same re-say, for the commit."
89
+ },
90
+ "onKeydown": {
91
+ "$prototype": "Function",
92
+ "$src": "jx-ui:/behaviors/color-area.ts",
93
+ "$export": "onAreaKeydown",
94
+ "description": "The two keyboard jobs a range cannot do for itself: the arrow across the OTHER axis, and Shift+Arrow for ten steps. An along-axis arrow with no Shift is left entirely to the platform, which already clamps, snaps and announces it."
95
+ },
96
+ "onPointerDown": {
97
+ "$prototype": "Function",
98
+ "$src": "jx-ui:/behaviors/color-area.ts",
99
+ "$export": "onAreaPointerDown",
100
+ "description": "Takes the colour under the pointer, captures the gesture on the track, and puts the caret on the horizontal range so the keyboard carries on from where the pointer stopped. A single press with no movement is a complete gesture, which is what keeps this clear of WCAG 2.5.7."
101
+ },
102
+ "onPointerMove": {
103
+ "$prototype": "Function",
104
+ "$src": "jx-ui:/behaviors/color-area.ts",
105
+ "$export": "onAreaPointerMove",
106
+ "description": "The drag. Nothing moves without a press first, so a hover across the square changes no colour."
107
+ },
108
+ "onPointerUp": {
109
+ "$prototype": "Function",
110
+ "$src": "jx-ui:/behaviors/color-area.ts",
111
+ "$export": "onAreaPointerUp",
112
+ "description": "Ends the gesture and commits once. Bound to pointercancel as well as pointerup: a gesture the system takes away is over, and a square left in the dragging state would follow the next pointer that crossed it with no button down."
113
+ }
114
+ },
115
+ "oninput": {
116
+ "$ref": "#/state/onInput"
117
+ },
118
+ "onchange": {
119
+ "$ref": "#/state/onChange"
120
+ },
121
+ "onkeydown": {
122
+ "$ref": "#/state/onKeydown"
123
+ },
124
+ "onpointerdown": {
125
+ "$ref": "#/state/onPointerDown"
126
+ },
127
+ "onpointermove": {
128
+ "$ref": "#/state/onPointerMove"
129
+ },
130
+ "onpointerup": {
131
+ "$ref": "#/state/onPointerUp"
132
+ },
133
+ "onpointercancel": {
134
+ "$ref": "#/state/onPointerUp"
135
+ },
136
+ "attributes": {
137
+ "role": "group",
138
+ "aria-label": "${state.label || null}",
139
+ "data-disabled": "${state.disabled ? '' : null}"
140
+ },
141
+ "style": {
142
+ "display": "block",
143
+ "&[hidden]": {
144
+ "display": "none"
145
+ },
146
+ "boxSizing": "border-box",
147
+ "inlineSize": "100%",
148
+ "--jx-color-area-size": "160px",
149
+ "--jx-color-area-hue": "hsl(${state.hue} 100% 50%)",
150
+ "--jx-color-area-x": "${state.saturation}%",
151
+ "--jx-color-area-y": "${100 - state.brightness}%",
152
+ "&[data-disabled]": {
153
+ "opacity": "0.5"
154
+ },
155
+ "& > [part=\"track\"]": {
156
+ "position": "relative",
157
+ "display": "block",
158
+ "boxSizing": "border-box",
159
+ "inlineSize": "100%",
160
+ "blockSize": "var(--jx-color-area-size)",
161
+ "borderRadius": "var(--jx-radius-sm)",
162
+ "background": "linear-gradient(to bottom, transparent, oklch(0 0 0)), linear-gradient(to right, oklch(1 0 0), var(--jx-color-area-hue))",
163
+ "boxShadow": "inset 0 0 0 1px var(--jx-border-strong)",
164
+ "touchAction": "none",
165
+ "cursor": "crosshair"
166
+ },
167
+ "&[data-disabled] > [part=\"track\"]": {
168
+ "cursor": "default"
169
+ },
170
+ "& [part=\"x\"], & [part=\"y\"]": {
171
+ "$description": "The two ranges are TRANSPARENT rather than hidden, and that is the whole accessibility of this element. display:none or visibility:hidden would take them out of the accessibility tree and out of the tab order, leaving a square only a pointer can operate — a WCAG 2.1.1 failure with a thumb drawn on it. opacity:0 keeps the role, the name, the announced value and the focus; pointer-events:none hands the gesture to the track, whose own handler owns the two-dimensional maths.",
172
+ "appearance": "none",
173
+ "position": "absolute",
174
+ "insetInline": "0",
175
+ "insetBlock": "0",
176
+ "inlineSize": "100%",
177
+ "blockSize": "100%",
178
+ "margin": "0",
179
+ "padding": "0",
180
+ "border": "0",
181
+ "background": "none",
182
+ "font": "inherit",
183
+ "opacity": "0",
184
+ "pointerEvents": "none"
185
+ },
186
+ "& [part=\"y\"]": {
187
+ "writingMode": "vertical-lr",
188
+ "direction": "rtl"
189
+ },
190
+ "& [part=\"thumb\"]": {
191
+ "position": "absolute",
192
+ "insetInlineStart": "var(--jx-color-area-x)",
193
+ "insetBlockStart": "var(--jx-color-area-y)",
194
+ "inlineSize": "14px",
195
+ "blockSize": "14px",
196
+ "translate": "-50% -50%",
197
+ "borderRadius": "50%",
198
+ "border": "2px solid var(--jx-bg)",
199
+ "boxShadow": "0 0 0 1px var(--jx-fg)",
200
+ "background": "transparent",
201
+ "pointerEvents": "none"
202
+ },
203
+ "&:has([part=\"x\"]:focus-visible) [part=\"thumb\"], &:has([part=\"y\"]:focus-visible) [part=\"thumb\"]": {
204
+ "outline": "var(--jx-focus-ring)",
205
+ "outlineOffset": "2px"
206
+ }
207
+ },
208
+ "children": [
209
+ {
210
+ "tagName": "div",
211
+ "attributes": {
212
+ "part": "track"
213
+ },
214
+ "children": [
215
+ {
216
+ "tagName": "input",
217
+ "attributes": {
218
+ "part": "x",
219
+ "type": "range",
220
+ "aria-label": "${state.xLabel}",
221
+ "aria-valuetext": "${state.xText}",
222
+ "min": "0",
223
+ "max": "100",
224
+ "step": "${state.step}",
225
+ "value": "${state.saturation}",
226
+ "disabled": {
227
+ "$ref": "#/state/disabled"
228
+ }
229
+ },
230
+ "value": {
231
+ "$ref": "#/state/saturation"
232
+ }
233
+ },
234
+ {
235
+ "tagName": "input",
236
+ "attributes": {
237
+ "part": "y",
238
+ "type": "range",
239
+ "aria-label": "${state.yLabel}",
240
+ "aria-valuetext": "${state.yText}",
241
+ "min": "0",
242
+ "max": "100",
243
+ "step": "${state.step}",
244
+ "value": "${state.brightness}",
245
+ "disabled": {
246
+ "$ref": "#/state/disabled"
247
+ }
248
+ },
249
+ "value": {
250
+ "$ref": "#/state/brightness"
251
+ }
252
+ },
253
+ {
254
+ "tagName": "span",
255
+ "attributes": {
256
+ "part": "thumb",
257
+ "aria-hidden": "true"
258
+ }
259
+ }
260
+ ]
261
+ }
262
+ ]
263
+ }