@sharadox/graphical-user-interface-web-library 0.2.0-fields.9 → 0.2.0-interface-refinement.34

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 (252) hide show
  1. package/README.md +45 -7
  2. package/distribution/accordion/index.d.ts +11 -0
  3. package/distribution/accordion/index.d.ts.map +1 -0
  4. package/distribution/accordion/index.js +36 -0
  5. package/distribution/accordion/index.js.map +1 -0
  6. package/distribution/accordion/index.module.css +1 -0
  7. package/distribution/accordion/index.module.scss +56 -0
  8. package/distribution/accordion/type.d.ts +21 -0
  9. package/distribution/accordion/type.d.ts.map +1 -0
  10. package/distribution/accordion/type.js +2 -0
  11. package/distribution/accordion/type.js.map +1 -0
  12. package/distribution/avatar/index.d.ts +20 -0
  13. package/distribution/avatar/index.d.ts.map +1 -0
  14. package/distribution/avatar/index.js +35 -0
  15. package/distribution/avatar/index.js.map +1 -0
  16. package/distribution/avatar/index.module.css +1 -0
  17. package/distribution/avatar/index.module.scss +16 -0
  18. package/distribution/avatar/type.d.ts +9 -0
  19. package/distribution/avatar/type.d.ts.map +1 -0
  20. package/distribution/avatar/type.js +2 -0
  21. package/distribution/avatar/type.js.map +1 -0
  22. package/distribution/badge/index.d.ts +10 -0
  23. package/distribution/badge/index.d.ts.map +1 -0
  24. package/distribution/badge/index.js +15 -0
  25. package/distribution/badge/index.js.map +1 -0
  26. package/distribution/badge/index.module.css +1 -0
  27. package/distribution/badge/index.module.scss +7 -0
  28. package/distribution/badge/type.d.ts +4 -0
  29. package/distribution/badge/type.d.ts.map +1 -0
  30. package/distribution/badge/type.js +2 -0
  31. package/distribution/badge/type.js.map +1 -0
  32. package/distribution/box/index.d.ts +2 -1
  33. package/distribution/box/index.d.ts.map +1 -1
  34. package/distribution/box/index.js +11 -4
  35. package/distribution/box/index.js.map +1 -1
  36. package/distribution/box/index.module.css +1 -1
  37. package/distribution/box/index.module.scss +37 -3
  38. package/distribution/box/type.d.ts +18 -3
  39. package/distribution/box/type.d.ts.map +1 -1
  40. package/distribution/box-axis/index.d.ts +3 -1
  41. package/distribution/box-axis/index.d.ts.map +1 -1
  42. package/distribution/box-axis/index.js +70 -16
  43. package/distribution/box-axis/index.js.map +1 -1
  44. package/distribution/button/index.d.ts +2 -2
  45. package/distribution/button/index.d.ts.map +1 -1
  46. package/distribution/button/index.js +6 -5
  47. package/distribution/button/index.js.map +1 -1
  48. package/distribution/button/type.d.ts +4 -1
  49. package/distribution/button/type.d.ts.map +1 -1
  50. package/distribution/button-axis/index.d.ts +1 -1
  51. package/distribution/button-axis/index.js +1 -1
  52. package/distribution/button-axis/index.js.map +1 -1
  53. package/distribution/card/index.d.ts +11 -0
  54. package/distribution/card/index.d.ts.map +1 -0
  55. package/distribution/card/index.js +18 -0
  56. package/distribution/card/index.js.map +1 -0
  57. package/distribution/card/index.module.css +1 -0
  58. package/distribution/card/index.module.scss +22 -0
  59. package/distribution/card/type.d.ts +15 -0
  60. package/distribution/card/type.d.ts.map +1 -0
  61. package/distribution/card/type.js +2 -0
  62. package/distribution/card/type.js.map +1 -0
  63. package/distribution/code-boxes/index.d.ts +11 -0
  64. package/distribution/code-boxes/index.d.ts.map +1 -0
  65. package/distribution/code-boxes/index.js +64 -0
  66. package/distribution/code-boxes/index.js.map +1 -0
  67. package/distribution/code-boxes/index.module.css +1 -0
  68. package/distribution/code-boxes/index.module.scss +28 -0
  69. package/distribution/code-boxes/type.d.ts +17 -0
  70. package/distribution/code-boxes/type.d.ts.map +1 -0
  71. package/distribution/code-boxes/type.js +2 -0
  72. package/distribution/code-boxes/type.js.map +1 -0
  73. package/distribution/combobox/index.d.ts +18 -0
  74. package/distribution/combobox/index.d.ts.map +1 -0
  75. package/distribution/combobox/index.js +105 -0
  76. package/distribution/combobox/index.js.map +1 -0
  77. package/distribution/combobox/index.module.css +1 -0
  78. package/distribution/combobox/index.module.scss +25 -0
  79. package/distribution/combobox/type.d.ts +8 -0
  80. package/distribution/combobox/type.d.ts.map +1 -0
  81. package/distribution/combobox/type.js +2 -0
  82. package/distribution/combobox/type.js.map +1 -0
  83. package/distribution/copy-button/index.d.ts +10 -0
  84. package/distribution/copy-button/index.d.ts.map +1 -0
  85. package/distribution/copy-button/index.js +26 -0
  86. package/distribution/copy-button/index.js.map +1 -0
  87. package/distribution/copy-button/type.d.ts +11 -0
  88. package/distribution/copy-button/type.d.ts.map +1 -0
  89. package/distribution/copy-button/type.js +2 -0
  90. package/distribution/copy-button/type.js.map +1 -0
  91. package/distribution/date-picker/index.d.ts +35 -0
  92. package/distribution/date-picker/index.d.ts.map +1 -0
  93. package/distribution/date-picker/index.js +161 -0
  94. package/distribution/date-picker/index.js.map +1 -0
  95. package/distribution/date-picker/index.module.css +1 -0
  96. package/distribution/date-picker/index.module.scss +70 -0
  97. package/distribution/date-picker/type.d.ts +41 -0
  98. package/distribution/date-picker/type.d.ts.map +1 -0
  99. package/distribution/date-picker/type.js +2 -0
  100. package/distribution/date-picker/type.js.map +1 -0
  101. package/distribution/dialog/index.d.ts +12 -0
  102. package/distribution/dialog/index.d.ts.map +1 -0
  103. package/distribution/dialog/index.js +56 -0
  104. package/distribution/dialog/index.js.map +1 -0
  105. package/distribution/dialog/index.module.css +1 -0
  106. package/distribution/dialog/index.module.scss +59 -0
  107. package/distribution/dialog/type.d.ts +11 -0
  108. package/distribution/dialog/type.d.ts.map +1 -0
  109. package/distribution/dialog/type.js +2 -0
  110. package/distribution/dialog/type.js.map +1 -0
  111. package/distribution/field/index.d.ts +1 -1
  112. package/distribution/field/index.d.ts.map +1 -1
  113. package/distribution/field/index.js +2 -2
  114. package/distribution/field/index.js.map +1 -1
  115. package/distribution/glow-layer/index.d.ts +13 -0
  116. package/distribution/glow-layer/index.d.ts.map +1 -0
  117. package/distribution/glow-layer/index.js +38 -0
  118. package/distribution/glow-layer/index.js.map +1 -0
  119. package/distribution/glow-layer/index.module.css +1 -0
  120. package/distribution/glow-layer/index.module.scss +31 -0
  121. package/distribution/glow-layer/type.d.ts +5 -0
  122. package/distribution/glow-layer/type.d.ts.map +1 -0
  123. package/distribution/glow-layer/type.js +2 -0
  124. package/distribution/glow-layer/type.js.map +1 -0
  125. package/distribution/interface-configuration/index.d.ts +1 -1
  126. package/distribution/interface-configuration/index.d.ts.map +1 -1
  127. package/distribution/interface-configuration/index.js +16 -4
  128. package/distribution/interface-configuration/index.js.map +1 -1
  129. package/distribution/interface-configuration/type.d.ts +10 -2
  130. package/distribution/interface-configuration/type.d.ts.map +1 -1
  131. package/distribution/listbox/index.d.ts +11 -0
  132. package/distribution/listbox/index.d.ts.map +1 -0
  133. package/distribution/listbox/index.js +21 -0
  134. package/distribution/listbox/index.js.map +1 -0
  135. package/distribution/listbox/index.module.css +1 -0
  136. package/distribution/listbox/index.module.scss +38 -0
  137. package/distribution/listbox/type.d.ts +22 -0
  138. package/distribution/listbox/type.d.ts.map +1 -0
  139. package/distribution/listbox/type.js +2 -0
  140. package/distribution/listbox/type.js.map +1 -0
  141. package/distribution/navigation/index.d.ts +13 -0
  142. package/distribution/navigation/index.d.ts.map +1 -0
  143. package/distribution/navigation/index.js +27 -0
  144. package/distribution/navigation/index.js.map +1 -0
  145. package/distribution/navigation/index.module.css +1 -0
  146. package/distribution/navigation/index.module.scss +64 -0
  147. package/distribution/navigation/type.d.ts +24 -0
  148. package/distribution/navigation/type.d.ts.map +1 -0
  149. package/distribution/navigation/type.js +2 -0
  150. package/distribution/navigation/type.js.map +1 -0
  151. package/distribution/notification/index.d.ts +19 -0
  152. package/distribution/notification/index.d.ts.map +1 -0
  153. package/distribution/notification/index.js +48 -0
  154. package/distribution/notification/index.js.map +1 -0
  155. package/distribution/notification/index.module.css +1 -0
  156. package/distribution/notification/index.module.scss +35 -0
  157. package/distribution/notification/type.d.ts +23 -0
  158. package/distribution/notification/type.d.ts.map +1 -0
  159. package/distribution/notification/type.js +2 -0
  160. package/distribution/notification/type.js.map +1 -0
  161. package/distribution/number-field/index.d.ts +10 -0
  162. package/distribution/number-field/index.d.ts.map +1 -0
  163. package/distribution/number-field/index.js +46 -0
  164. package/distribution/number-field/index.js.map +1 -0
  165. package/distribution/number-field/index.module.css +1 -0
  166. package/distribution/number-field/index.module.scss +29 -0
  167. package/distribution/number-field/type.d.ts +29 -0
  168. package/distribution/number-field/type.d.ts.map +1 -0
  169. package/distribution/number-field/type.js +2 -0
  170. package/distribution/number-field/type.js.map +1 -0
  171. package/distribution/select/index.d.ts +13 -0
  172. package/distribution/select/index.d.ts.map +1 -0
  173. package/distribution/select/index.js +102 -0
  174. package/distribution/select/index.js.map +1 -0
  175. package/distribution/select/index.module.css +1 -0
  176. package/distribution/select/index.module.scss +42 -0
  177. package/distribution/select/type.d.ts +25 -0
  178. package/distribution/select/type.d.ts.map +1 -0
  179. package/distribution/select/type.js +2 -0
  180. package/distribution/select/type.js.map +1 -0
  181. package/distribution/separator/index.d.ts +11 -0
  182. package/distribution/separator/index.d.ts.map +1 -0
  183. package/distribution/separator/index.js +16 -0
  184. package/distribution/separator/index.js.map +1 -0
  185. package/distribution/separator/index.module.css +1 -0
  186. package/distribution/separator/index.module.scss +12 -0
  187. package/distribution/separator/type.d.ts +7 -0
  188. package/distribution/separator/type.d.ts.map +1 -0
  189. package/distribution/separator/type.js +2 -0
  190. package/distribution/separator/type.js.map +1 -0
  191. package/distribution/skeleton/index.d.ts +11 -0
  192. package/distribution/skeleton/index.d.ts.map +1 -0
  193. package/distribution/skeleton/index.js +20 -0
  194. package/distribution/skeleton/index.js.map +1 -0
  195. package/distribution/skeleton/index.module.css +1 -0
  196. package/distribution/skeleton/index.module.scss +96 -0
  197. package/distribution/skeleton/type.d.ts +16 -0
  198. package/distribution/skeleton/type.d.ts.map +1 -0
  199. package/distribution/skeleton/type.js +2 -0
  200. package/distribution/skeleton/type.js.map +1 -0
  201. package/distribution/skeleton-value/index.d.ts +10 -0
  202. package/distribution/skeleton-value/index.d.ts.map +1 -0
  203. package/distribution/skeleton-value/index.js +15 -0
  204. package/distribution/skeleton-value/index.js.map +1 -0
  205. package/distribution/skeleton-value/index.module.css +1 -0
  206. package/distribution/skeleton-value/index.module.scss +35 -0
  207. package/distribution/skeleton-value/type.d.ts +9 -0
  208. package/distribution/skeleton-value/type.d.ts.map +1 -0
  209. package/distribution/skeleton-value/type.js +2 -0
  210. package/distribution/skeleton-value/type.js.map +1 -0
  211. package/distribution/style-sheet/index.d.ts.map +1 -1
  212. package/distribution/style-sheet/index.js +109 -28
  213. package/distribution/style-sheet/index.js.map +1 -1
  214. package/distribution/switch/index.js +1 -1
  215. package/distribution/switch/index.js.map +1 -1
  216. package/distribution/switch/index.module.css +1 -1
  217. package/distribution/switch/index.module.scss +5 -3
  218. package/distribution/tabs/index.d.ts +11 -0
  219. package/distribution/tabs/index.d.ts.map +1 -0
  220. package/distribution/tabs/index.js +45 -0
  221. package/distribution/tabs/index.js.map +1 -0
  222. package/distribution/tabs/index.module.css +1 -0
  223. package/distribution/tabs/index.module.scss +13 -0
  224. package/distribution/tabs/type.d.ts +19 -0
  225. package/distribution/tabs/type.d.ts.map +1 -0
  226. package/distribution/tabs/type.js +2 -0
  227. package/distribution/tabs/type.js.map +1 -0
  228. package/distribution/text-field/index.js +1 -1
  229. package/distribution/text-field/index.js.map +1 -1
  230. package/distribution/tip/index.d.ts +10 -0
  231. package/distribution/tip/index.d.ts.map +1 -0
  232. package/distribution/tip/index.js +22 -0
  233. package/distribution/tip/index.js.map +1 -0
  234. package/distribution/tip/index.module.css +1 -0
  235. package/distribution/tip/index.module.scss +24 -0
  236. package/distribution/tip/type.d.ts +7 -0
  237. package/distribution/tip/type.d.ts.map +1 -0
  238. package/distribution/tip/type.js +2 -0
  239. package/distribution/tip/type.js.map +1 -0
  240. package/distribution/toggle-mark/index.js +1 -1
  241. package/distribution/toggle-mark/index.js.map +1 -1
  242. package/distribution/wrapper/index.d.ts +11 -0
  243. package/distribution/wrapper/index.d.ts.map +1 -0
  244. package/distribution/wrapper/index.js +16 -0
  245. package/distribution/wrapper/index.js.map +1 -0
  246. package/distribution/wrapper/index.module.css +1 -0
  247. package/distribution/wrapper/index.module.scss +9 -0
  248. package/distribution/wrapper/type.d.ts +4 -0
  249. package/distribution/wrapper/type.d.ts.map +1 -0
  250. package/distribution/wrapper/type.js +2 -0
  251. package/distribution/wrapper/type.js.map +1 -0
  252. package/package.json +4 -2
package/README.md CHANGED
@@ -49,19 +49,26 @@ everything below it: on the page, in one part of it, or on one piece.
49
49
  | `--red-color-rgb-alpha` | its alpha: `var(--color-rgb-alpha)` (100%) |
50
50
  | `--red-color` | `rgb(var(--red-color-rgb) / var(--red-color-rgb-alpha))` |
51
51
  | `--red-transparent-color-rgb` | the transparent color's channels (red's own) |
52
- | `--red-transparent-color-rgb-alpha`, `--red-transparent-color` | from `--transparent-color-rgb-alpha` (10%) |
52
+ | `--red-transparent-color-rgb-alpha`, `--red-transparent-color` | from `--transparent-color-rgb-alpha` (12.5%) |
53
53
  | `--red-transparent-hover-color`, `--red-transparent-active-color` | from `--transparent-hover-…` and `--transparent-active-color-rgb-alpha` |
54
54
  | `--red-border-color` | the transparent color |
55
55
  | `--red-on-color` | text on a red fill (foreground) |
56
56
  | `--red-hover-color` | its text when hovered (red's own) |
57
57
  | `--red-color-paint` | its fill: its gradient, or the flat color |
58
+ | `--red-filled-hover-color`, `--red-filled-hover-on-color` | its fill and text when hovered (red's own) |
59
+ | `--red-color-gradient`, `--red-transparent-color-gradient`… | a gradient color's gradients, at each alpha (unset when flat) |
58
60
 
59
61
  - **Colors that are other colors:** foreground (black in white, white in black), background, brand (foreground),
60
62
  information (blue), success (green), warn (yellow), error (red). They take everything from that color. Text on
61
63
  foreground and brand is the background color; on black it is white, on white black. Middleground's border and
62
- hover background use foreground's channels, and its text turns foreground when hovered.
64
+ hover background use foreground's channels, its text turns foreground when hovered, and its fill turns foreground
65
+ (with foreground's text) when hovered.
66
+ - **Gradient colors** list the colors they pass through: `rainbow` is red, yellow, green, cyan, blue and magenta, in
67
+ the direction of `--gradient-angle` (90deg). Its fill, text (outlined, transparent, inline), hover backgrounds and
68
+ outlined border (on whole lines) are the gradient at each alpha; where one flat color is needed (icons, focus rings,
69
+ dotted and dashed borders) it is foreground, and text on its fill is foreground.
63
70
  - **A new color** needs only its channels: `defineInterface({ colors: { gold: { rgb: { white, black } } } })`,
64
- optionally a `gradient` per color style, `on`, `transparent` and `hover`.
71
+ optionally a `gradient` (color names), `on`, `transparent`, `hover` and `filledHover`.
65
72
  - **Styles** switch only sources. `data-style-color` (`white`, `black`, `inherit` for the device's preference),
66
73
  `data-style-corner` (`square` 0, `rounded-square` 4px, `circle`) and `data-style-line` (`line`, `dotted`,
67
74
  `dashed`) work on `<html>` (through `@sharadox/style-web-library`, which remembers the choice) and on any element,
@@ -70,7 +77,8 @@ everything below it: on the page, in one part of it, or on one piece.
70
77
  changing an alpha on one piece changes only that piece.
71
78
  - **Shared values** sit once on the root: the scale (`--scale-0` … `--scale-128`: 0 4 8 12 14 16 24 32 64 128), the
72
79
  breakpoints (640, 960, 1280), sizes, corners, lines, timings (`--quick-duration` 0.1s, `--duration` 0.25s), the
73
- glass blur, font weights, the wrapper (1280 wide, 16 a side).
80
+ glass blur, font weights, the wrapper (1280 wide with its 16 a side inside), the glow (`--glow-start-angle`
81
+ 90deg, `--glow-range` 128, `--glow-spread` 32, `--glow-radius` 64, `--glow-opacity` 50%).
74
82
  - **Per breakpoint:** every attribute has a version per breakpoint, mobile first (`data-color-960="blue"`), set by any
75
83
  property given as `{ base: "red", 960: "blue" }`.
76
84
 
@@ -96,6 +104,26 @@ everything below it: on the page, in one part of it, or on one piece.
96
104
  | `…/checkbox` | `Checkbox({ label, checked?, defaultChecked?, onChange? })` | Outlined, filled once checked, the check growing in |
97
105
  | `…/radio-group` | `RadioGroup({ label, options, value?, defaultValue?, onChange?, error? })` | Native radios sharing a name, round, filled once chosen |
98
106
  | `…/switch` | `Switch({ label, checked?, defaultChecked?, onChange? })` | On/off; flips at once, busy while an async change runs, back if refused |
107
+ | `…/wrapper` | `Wrapper(box)` | The page's width: up to 1280 with its 16 a side inside, centered |
108
+ | `…/card` | `Card({ title?, headingLevel?, description?, action?, children })` | One thing: content on one side, its actions centered on the other |
109
+ | `…/separator` | `Separator({ orientation?, color?, line? })` | A horizontal (or vertical) line in the line style |
110
+ | `…/badge` | `Badge(box)` | A short label in running text: small, filled, brand |
111
+ | `…/avatar` | `Avatar({ name, src?, size?, color?, corner? })`, `initials(name)` | A picture, or the initials when there is none; round |
112
+ | `…/listbox` | `Listbox({ id, labelledBy, options, chosen, active, onActive, onChoose, empty? })` | The list a select or combobox opens: a glass panel, the chosen one checked |
113
+ | `…/select` | `Select({ label, options, value?, defaultValue?, onChange?, name?, placeholder? })` | A select drawn by the interface, with a native select's keyboard |
114
+ | `…/combobox` | `Combobox({ label, options, … , empty? })`, `matches(label, typed)` | A text field that filters its options as you type |
115
+ | `…/number-field` | `NumberField({ label, value?, min?, max?, step?, decreaseLabel, increaseLabel })` | A number between a minus and a plus section |
116
+ | `…/dialog` | `Dialog({ open, onClose, title, closeLabel, children })` | A modal in the middle of the screen that leaves the way it came |
117
+ | `…/tip` | `Tip({ text, label })` | A question mark showing a tip on hover, focus or tap |
118
+ | `…/notification` | `NotificationProvider({ label, dismissLabel, duration? })`, `useNotification()` | Notifications at the top right, in their tone's color, hiding themselves |
119
+ | `…/skeleton` | `Skeleton({ label, shape?, lines?, rows?, height? })` | Shimmering shapes like what is loading |
120
+ | `…/skeleton-value` | `SkeletonValue({ label?, width?, circle? })` | A shimmering shape for one value |
121
+ | `…/copy-button` | `CopyButton({ value, label, copiedLabel, onCopied? })` | Copies a value and says so for two seconds |
122
+ | `…/code-boxes` | `CodeBoxes({ label, digitLabel, ofLabel, name?, length?, onComplete? })` | One field box per digit of a one-time code |
123
+ | `…/navigation` | `Navigation({ brand, label, links, actions?, menuLabel, closeLabel, collapse? })` | The sticky bar, and a phone menu below `collapse` (960) |
124
+ | `…/tabs` | `Tabs({ label, tabs, value?, defaultValue?, onChange? })` | Tab buttons over the chosen tab's panel, with the arrow keys |
125
+ | `…/accordion` | `Accordion({ items, multiple?, open?, defaultOpen?, onChange? })` | Titles that open and close their content smoothly |
126
+ | `…/date-picker` | `DatePicker({ label, value?, min?, max?, locale?, previousLabel, nextLabel })`, `parseDay`, `formatDay`, `monthDays` | A field opening a calendar grid |
99
127
 
100
128
  ### Box
101
129
 
@@ -118,7 +146,9 @@ everything below it: on the page, in one part of it, or on one piece.
118
146
  suffix="→"
119
147
  square // one icon or character, no padding
120
148
  interactive // hover and pressed looks, a pointer cursor, states
121
- state="hover" // enabled | hover | active | loading | disabled, forced
149
+ state="hover" // none (default: follows the pointer) | enabled | hover | active | loading | disabled, set for good
150
+ modifications={["glass", "glow"]} // glass by default; [] for none
151
+ glowStart="top" // top | end | bottom (default) | start
122
152
  >
123
153
  …
124
154
  </Box>
@@ -132,8 +162,16 @@ variants:
132
162
  - **transparent:** like outlined, with no border;
133
163
  - **inline:** no padding, no background and no border, inside running text.
134
164
 
135
- Outlined and transparent blur what is behind them (glass). Disabled is at 50% opacity. While loading, the spinner
136
- replaces the words and keeps their size. Hover and pressed looks never apply while loading or disabled.
165
+ States: `none` (the default) leaves a box to the pointer, so it turns when hovered and pressed. Any other state is set
166
+ and stays: `enabled` never turns, `hover` looks hovered, `active` and `loading` look pressed with the default cursor
167
+ (a button then ignores clicks), `disabled` is at 50% opacity. While loading, the spinner replaces the words and keeps
168
+ their size.
169
+
170
+ Modifications add to any variant, together: **glass** (the default) blurs what is behind outlined and transparent
171
+ boxes; **glow** lights the box from around and behind in its color, resting at `glowStart` and turning toward the
172
+ pointer while it is within `--glow-range` of the box. A filled box hides the glow's middle; an outlined one lets it
173
+ show through. The glow is a layer right after the box, anchored to it (CSS anchor positioning), and costs nothing
174
+ off screen (`followPointerAngle` from `@sharadox/pointer-web-library`).
137
175
 
138
176
  ### Button
139
177
 
@@ -0,0 +1,11 @@
1
+ import type { AccordionProperties } from "@sharadox/graphical-user-interface-web-library/accordion/type";
2
+ /**
3
+ * An accordion: titles that open and close their content, smoothly (its height grows and shrinks). Each title is a
4
+ * heading holding a button, which says whether its region is open; a closed region is inert. One item open at a time,
5
+ * or several with `multiple`. Each item is a box (outlined foreground by default).
6
+ *
7
+ * @example
8
+ * <Accordion items={[{ value: "price", title: "How much is it?", content: <p>…</p> }]} />
9
+ */
10
+ export declare function Accordion(properties: AccordionProperties): import("react").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/accordion/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AAGzG;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,mBAAmB,+BA6DxD"}
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { Icon } from "@sharadox/icon-web-library/icon";
5
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
6
+ import styles from "./index.module.css";
7
+ /**
8
+ * An accordion: titles that open and close their content, smoothly (its height grows and shrinks). Each title is a
9
+ * heading holding a button, which says whether its region is open; a closed region is inert. One item open at a time,
10
+ * or several with `multiple`. Each item is a box (outlined foreground by default).
11
+ *
12
+ * @example
13
+ * <Accordion items={[{ value: "price", title: "How much is it?", content: <p>…</p> }]} />
14
+ */
15
+ export function Accordion(properties) {
16
+ const { items, multiple, open, defaultOpen = [], onChange, headingLevel = 3, className, variant = "outlined", color = "foreground", ...look } = properties;
17
+ const id = useId();
18
+ const [own, setOwn] = useState(defaultOpen);
19
+ const current = open ?? own;
20
+ const Heading = `h${headingLevel}`;
21
+ const toggle = (value) => {
22
+ const next = current.includes(value)
23
+ ? current.filter((entry) => entry !== value)
24
+ : multiple
25
+ ? [...current, value]
26
+ : [value];
27
+ if (open === undefined)
28
+ setOwn(next);
29
+ onChange?.(next);
30
+ };
31
+ return (_jsx(Box, { direction: "top-to-bottom", align: "stretch", gap: 8, className: className, children: items.map((item, index) => {
32
+ const expanded = current.includes(item.value);
33
+ return (_jsxs(Box, { variant: variant, color: color, direction: "top-to-bottom", align: "stretch", ...look, children: [_jsx(Heading, { className: styles.heading, children: _jsxs("button", { type: "button", id: `${id}-${index}`, "aria-expanded": expanded, "aria-controls": `${id}-${index}-region`, onClick: () => toggle(item.value), className: styles.button, children: [_jsx("span", { children: item.title }), _jsx(Icon, { name: "chevron-down", className: styles.chevron })] }) }), _jsx("div", { id: `${id}-${index}-region`, role: "region", "aria-labelledby": `${id}-${index}`, ...(expanded ? { "data-open": "" } : { inert: true }), className: styles.region, children: _jsx("div", { className: styles.inner, children: _jsx("div", { className: styles.content, children: item.content }) }) })] }, item.value));
34
+ }) }));
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/accordion/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,UAA+B;IACvD,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,EAAE,EAChB,QAAQ,EACR,YAAY,GAAG,CAAC,EAChB,SAAS,EACT,OAAO,GAAG,UAAU,EACpB,KAAK,GAAG,YAAY,EACpB,GAAG,IAAI,EACR,GAAG,UAAU,CAAC;IACf,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAoB,WAAW,CAAC,CAAC;IAC/D,MAAM,OAAO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,MAAM,aAExB,yBAAO,IAAI,CAAC,KAAK,GAAQ,EACzB,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,EAAC,SAAS,EAAE,MAAM,CAAC,OAAO,GAAI,IAChD,GACD,EACV,cACE,EAAE,EAAE,GAAG,EAAE,IAAI,KAAK,SAAS,EAC3B,IAAI,EAAC,QAAQ,qBACI,GAAG,EAAE,IAAI,KAAK,EAAE,KAC7B,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtD,SAAS,EAAE,MAAM,CAAC,MAAM,YAExB,cAAK,SAAS,EAAE,MAAM,CAAC,KAAK,YAC1B,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,IAAI,CAAC,OAAO,GAAO,GAChD,GACF,KAxBE,IAAI,CAAC,KAAK,CAyBd,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ :where(.heading){margin:0;font-size:inherit}:where(.button){display:flex;justify-content:space-between;align-items:center;gap:var(--scale-16);inline-size:100%;min-block-size:var(--large-minimum-size);padding:var(--scale-12) var(--scale-16);border:0;background:none;color:inherit;font:inherit;font-weight:var(--interactive-font-weight);text-align:start;cursor:pointer}:where(.button):focus-visible{outline:var(--focus-thickness) solid var(--current-color);outline-offset:calc(-1*var(--focus-thickness))}:where(.chevron){flex:none;transition:transform var(--duration) var(--easing)}:where(.button[aria-expanded=true]) :where(.chevron){transform:rotate(180deg)}:where(.region){display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--duration) var(--easing)}:where(.region[data-open]){grid-template-rows:1fr}:where(.inner){min-block-size:0;overflow:hidden}:where(.content){padding:0 var(--scale-16) var(--scale-16);text-align:start}
@@ -0,0 +1,56 @@
1
+ :where(.heading) {
2
+ margin: 0;
3
+ font-size: inherit;
4
+ }
5
+
6
+ :where(.button) {
7
+ display: flex;
8
+ justify-content: space-between;
9
+ align-items: center;
10
+ gap: var(--scale-16);
11
+ inline-size: 100%;
12
+ min-block-size: var(--large-minimum-size);
13
+ padding: var(--scale-12) var(--scale-16);
14
+ border: 0;
15
+ background: none;
16
+ color: inherit;
17
+ font: inherit;
18
+ font-weight: var(--interactive-font-weight);
19
+ text-align: start;
20
+ cursor: pointer;
21
+
22
+ &:focus-visible {
23
+ outline: var(--focus-thickness) solid var(--current-color);
24
+ outline-offset: calc(-1 * var(--focus-thickness));
25
+ }
26
+ }
27
+
28
+ :where(.chevron) {
29
+ flex: none;
30
+ transition: transform var(--duration) var(--easing);
31
+ }
32
+
33
+ :where(.button[aria-expanded="true"]) :where(.chevron) {
34
+ transform: rotate(180deg);
35
+ }
36
+
37
+ // The region grows from nothing to its content's height (a grid row from 0fr to 1fr), and back.
38
+ :where(.region) {
39
+ display: grid;
40
+ grid-template-rows: 0fr;
41
+ transition: grid-template-rows var(--duration) var(--easing);
42
+ }
43
+
44
+ :where(.region[data-open]) {
45
+ grid-template-rows: 1fr;
46
+ }
47
+
48
+ :where(.inner) {
49
+ min-block-size: 0;
50
+ overflow: hidden;
51
+ }
52
+
53
+ :where(.content) {
54
+ padding: 0 var(--scale-16) var(--scale-16);
55
+ text-align: start;
56
+ }
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from "react";
2
+ import type { BoxLook } from "@sharadox/graphical-user-interface-web-library/box/type";
3
+ export interface AccordionItem {
4
+ value: string;
5
+ title: ReactNode;
6
+ content: ReactNode;
7
+ }
8
+ export interface AccordionProperties extends Pick<BoxLook, "variant" | "color" | "corner" | "line"> {
9
+ items: readonly AccordionItem[];
10
+ /** Several open at once (one at a time by default). */
11
+ multiple?: boolean;
12
+ /** Controlled: the open items. */
13
+ open?: readonly string[];
14
+ /** Uncontrolled: the items open at first. */
15
+ defaultOpen?: readonly string[];
16
+ onChange?: (open: string[]) => void;
17
+ /** The titles' heading level (3 by default), to fit the page's outline. */
18
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
19
+ className?: string;
20
+ }
21
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/accordion/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAEvF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjG,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,2EAA2E;IAC3E,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/accordion/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { AvatarProperties } from "@sharadox/graphical-user-interface-web-library/avatar/type";
2
+ /**
3
+ * A name's initials: the first letter of its first and last words, upper case.
4
+ *
5
+ * @example
6
+ * initials("Ana Maria Silva"); // "AS"
7
+ */
8
+ export declare function initials(name: string): string;
9
+ /**
10
+ * A person's (or a company's) picture: a square box of the size's height, round by default. Without a picture, or
11
+ * when it can't load, their initials on a filled box (brand by default). Either way it is an image named by `name`.
12
+ *
13
+ * The picture is a plain `img`: avatars come from anywhere (uploads, other services), which next/image would need
14
+ * each site to allow by address.
15
+ *
16
+ * @example
17
+ * <Avatar name="Ana Silva" src={account.picture} size="large" />
18
+ */
19
+ export declare function Avatar({ name, src, color, corner, size, className, ...look }: AvatarProperties): import("react").JSX.Element;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/avatar/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAGnG;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,EACH,KAAe,EACf,MAAiB,EACjB,IAAe,EACf,SAAS,EACT,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAsBlB"}
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { classNames } from "@sharadox/web-library/class-name";
5
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
6
+ import styles from "./index.module.css";
7
+ /**
8
+ * A name's initials: the first letter of its first and last words, upper case.
9
+ *
10
+ * @example
11
+ * initials("Ana Maria Silva"); // "AS"
12
+ */
13
+ export function initials(name) {
14
+ const words = name.trim().split(/\s+/).filter(Boolean);
15
+ if (words.length === 0)
16
+ return "";
17
+ const letters = words.length === 1 ? [words[0]] : [words[0], words.at(-1)];
18
+ return letters.map((word) => [...word][0].toLocaleUpperCase()).join("");
19
+ }
20
+ /**
21
+ * A person's (or a company's) picture: a square box of the size's height, round by default. Without a picture, or
22
+ * when it can't load, their initials on a filled box (brand by default). Either way it is an image named by `name`.
23
+ *
24
+ * The picture is a plain `img`: avatars come from anywhere (uploads, other services), which next/image would need
25
+ * each site to allow by address.
26
+ *
27
+ * @example
28
+ * <Avatar name="Ana Silva" src={account.picture} size="large" />
29
+ */
30
+ export function Avatar({ name, src, color = "brand", corner = "circle", size = "medium", className, ...look }) {
31
+ const [failed, setFailed] = useState(false);
32
+ const picture = src !== undefined && !failed;
33
+ return (_jsx(Box, { as: "span", square: true, corner: corner, size: size, color: color, ...look, ...(picture ? {} : { variant: "filled", role: "img", "aria-label": name }), className: classNames(styles.avatar, className), children: picture ? (_jsx("img", { src: src, alt: name, className: styles.picture, onError: () => setFailed(true) })) : (initials(name)) }));
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/avatar/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,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um-size);font-size:calc(var(--current-minimum-size)*.4);font-weight:600;line-height:1}:where(.picture){display:block;inline-size:100%;block-size:100%;object-fit:cover}
@@ -0,0 +1,16 @@
1
+ :where(.avatar) {
2
+ overflow: hidden;
3
+ inline-size: var(--current-minimum-size);
4
+ block-size: var(--current-minimum-size);
5
+ // Two letters always fit: the initials grow with the avatar.
6
+ font-size: calc(var(--current-minimum-size) * 0.4);
7
+ font-weight: 600;
8
+ line-height: 1;
9
+ }
10
+
11
+ :where(.picture) {
12
+ display: block;
13
+ inline-size: 100%;
14
+ block-size: 100%;
15
+ object-fit: cover;
16
+ }
@@ -0,0 +1,9 @@
1
+ import type { BoxLook } from "@sharadox/graphical-user-interface-web-library/box/type";
2
+ export interface AvatarProperties extends Pick<BoxLook, "color" | "colorStyle" | "corner" | "line" | "size"> {
3
+ /** Whose picture: its accessible name, and the initials without a picture. */
4
+ name: string;
5
+ /** The picture's address; without one (or when it fails) the initials show. */
6
+ src?: string;
7
+ className?: string;
8
+ }
9
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/avatar/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAEvF,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1G,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/avatar/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { BadgeProperties } from "@sharadox/graphical-user-interface-web-library/badge/type";
2
+ /**
3
+ * A badge: a short label (a status, a count, "New") sitting in running text. A small filled brand box by default,
4
+ * with every box look, a prefix and a suffix.
5
+ *
6
+ * @example
7
+ * <Badge color="success" variant="outlined">Online</Badge>
8
+ */
9
+ export declare function Badge({ className, ...box }: BadgeProperties): import("react").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/badge/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAGjG;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,EAAE,eAAe,+BAY3D"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "@sharadox/web-library/class-name";
3
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
4
+ import styles from "./index.module.css";
5
+ /**
6
+ * A badge: a short label (a status, a count, "New") sitting in running text. A small filled brand box by default,
7
+ * with every box look, a prefix and a suffix.
8
+ *
9
+ * @example
10
+ * <Badge color="success" variant="outlined">Online</Badge>
11
+ */
12
+ export function Badge({ className, ...box }) {
13
+ return (_jsx(Box, { as: "span", variant: "filled", color: "brand", size: "small", ...box, "data-badge": "", className: classNames(styles.badge, className) }));
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/badge/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,EAAmB;IAC1D,OAAO,CACL,KAAC,GAAG,IACF,EAAE,EAAC,MAAM,EACT,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,OAAO,KACR,GAAG,gBACI,EAAE,EACb,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ .badge{display:inline-flex;vertical-align:middle;padding-inline:var(--scale-8);white-space:nowrap}
@@ -0,0 +1,7 @@
1
+ // A plain class, so its padding beats the box's own (zero-weight) padding.
2
+ .badge {
3
+ display: inline-flex;
4
+ vertical-align: middle;
5
+ padding-inline: var(--scale-8);
6
+ white-space: nowrap;
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { BoxProperties } from "@sharadox/graphical-user-interface-web-library/box/type";
2
+ /** A badge takes everything a box does. */
3
+ export type BadgeProperties = BoxProperties;
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/badge/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAC;AAE7F,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/badge/type.ts"],"names":[],"mappings":""}
@@ -5,7 +5,8 @@ export declare function lookAttributes(look: BoxLook): Record<string, string>;
5
5
  * The base of every piece: a flex box, centered on both axes and in its text unless told otherwise, wearing any
6
6
  * variant, color, color style, corner, line and size, each for every width or per breakpoint, with an optional
7
7
  * prefix and suffix section (at least square). An interactive box adds the hover and pressed looks, a pointer cursor
8
- * and its states; while loading, the spinner covers its content, which keeps its size and its name.
8
+ * and its states; while loading, the spinner covers its content, which keeps its size and its name. Modifications add
9
+ * to any look: glass (the default) and a glow that turns toward the pointer.
9
10
  *
10
11
  * @example
11
12
  * <Box variant="outlined" color="brand" padding={16} direction={{ base: "top-to-bottom", 960: "left-to-right" }}>…</Box>
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/box/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAC;AAoBtG,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,aAAa,+BA6C5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/box/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAC;AAqBtG,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,aAAa,+BAiE5C"}
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { classNames } from "@sharadox/web-library/class-name";
3
3
  import { responsiveAttributes } from "@sharadox/graphical-user-interface-web-library/responsive";
4
4
  import { Spinner } from "@sharadox/graphical-user-interface-web-library/spinner";
5
+ import { GlowLayer } from "@sharadox/graphical-user-interface-web-library/glow-layer";
5
6
  import styles from "./index.module.css";
6
7
  /** Each look and the attribute that carries it to the interface's style sheet. */
7
8
  const LOOK_ATTRIBUTES = [
@@ -18,6 +19,7 @@ const LOOK_ATTRIBUTES = [
18
19
  ["wrap", "data-wrap"],
19
20
  ["gap", "data-gap"],
20
21
  ["padding", "data-padding"],
22
+ ["glowStart", "data-glow-start"],
21
23
  ];
22
24
  /** The attributes for a set of looks, each for every width or per breakpoint. */
23
25
  export function lookAttributes(look) {
@@ -27,13 +29,14 @@ export function lookAttributes(look) {
27
29
  * The base of every piece: a flex box, centered on both axes and in its text unless told otherwise, wearing any
28
30
  * variant, color, color style, corner, line and size, each for every width or per breakpoint, with an optional
29
31
  * prefix and suffix section (at least square). An interactive box adds the hover and pressed looks, a pointer cursor
30
- * and its states; while loading, the spinner covers its content, which keeps its size and its name.
32
+ * and its states; while loading, the spinner covers its content, which keeps its size and its name. Modifications add
33
+ * to any look: glass (the default) and a glow that turns toward the pointer.
31
34
  *
32
35
  * @example
33
36
  * <Box variant="outlined" color="brand" padding={16} direction={{ base: "top-to-bottom", 960: "left-to-right" }}>…</Box>
34
37
  */
35
38
  export function Box(properties) {
36
- const { as: Element = "div", prefix, suffix, square, field, state, className, children, ...rest } = properties;
39
+ const { as: Element = "div", prefix, suffix, square, field, state, modifications, className, children, ...rest } = properties;
37
40
  const interactive = properties.interactive || field;
38
41
  const look = {};
39
42
  const element = {};
@@ -46,7 +49,11 @@ export function Box(properties) {
46
49
  element[key] = value;
47
50
  }
48
51
  const sectioned = prefix !== undefined || suffix !== undefined || square || interactive;
49
- const currentState = interactive ? (state ?? "enabled") : undefined;
50
- return (_jsx(Element, { ...element, className: classNames(styles.box, className), ...lookAttributes(look), ...(square && { "data-square": "" }), ...(field && { "data-field": "" }), ...(interactive && { "data-interactive": "", "data-state": currentState }), ...(currentState === "disabled" && { "aria-disabled": "true" }), ...(currentState === "loading" && { "aria-busy": "true" }), children: sectioned ? (_jsxs(_Fragment, { children: [prefix !== undefined && (_jsx("span", { className: styles.section, "data-section": "prefix", children: prefix })), _jsx("span", { className: styles.content, "data-section": "content", children: children }), suffix !== undefined && (_jsx("span", { className: styles.section, "data-section": "suffix", children: suffix })), currentState === "loading" && _jsx(Spinner, { className: styles.spinner })] })) : (children) }));
52
+ const currentState = interactive ? (state ?? "none") : undefined;
53
+ const box = (_jsx(Element, { ...element, className: classNames(styles.box, className), ...lookAttributes(look), ...(square && { "data-square": "" }), ...(field && { "data-field": "" }), ...(modifications && { "data-modifications": modifications.join(" ") }), ...(interactive && { "data-interactive": "", "data-state": currentState }), ...(currentState === "disabled" && { "aria-disabled": "true" }), ...(currentState === "loading" && { "aria-busy": "true" }), children: sectioned ? (_jsxs(_Fragment, { children: [prefix !== undefined && (_jsx("span", { className: styles.section, "data-section": "prefix", children: prefix })), _jsx("span", { className: styles.content, "data-section": "content", children: children }), suffix !== undefined && (_jsx("span", { className: styles.section, "data-section": "suffix", children: suffix })), currentState === "loading" && _jsx(Spinner, { className: styles.spinner })] })) : (children) }));
54
+ if (!modifications?.includes("glow"))
55
+ return box;
56
+ const { color, colorStyle, glowStart } = look;
57
+ return (_jsxs(_Fragment, { children: [box, _jsx(GlowLayer, { attributes: lookAttributes({ color, colorStyle, glowStart }) })] }));
51
58
  }
52
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/box/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAC;AAEjG,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEjF,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,kFAAkF;AAClF,MAAM,eAAe,GAA2C;IAC9D,CAAC,SAAS,EAAE,cAAc,CAAC;IAC3B,CAAC,OAAO,EAAE,YAAY,CAAC;IACvB,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAClC,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IAC/B,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAC3B,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAC/B,CAAC,SAAS,EAAE,cAA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CAAC,YAAY,KAAK,UAAU,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,KAC5D,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,YAE1D,SAAS,CAAC,CAAC,CAAC,CACX,8BACG,MAAM,KAAK,SAAS,IAAI,CACvB,eAAM,SAAS,EAAE,MAAM,CAAC,OAAO,kBAAe,QAAQ,YACnD,MAAM,GACF,CACR,EACD,eAAM,SAAS,EAAE,MAAM,CAAC,OAAO,kBAAe,SAAS,YACpD,QAAQ,GACJ,EACN,MAAM,KAAK,SAAS,IAAI,CACvB,eAAM,SAAS,EAAE,MAAM,CAAC,OAAO,kBAAe,QAAQ,YACnD,MAAM,GACF,CACR,EACA,YAAY,KAAK,SAAS,IAAI,KAAC,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,OAAO,GAAI,IACpE,CACJ,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACO,CACX,CAAC;IACF,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,GAAG,CAAC;IACjD,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,CACL,8BACG,GAAG,EACJ,KAAC,SAAS,IAAC,UAAU,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,GAAI,IAC1E,CACJ,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- :where(.box){position:relative;box-sizing:border-box;display:var(--box-display);flex-direction:var(--box-direction);flex-wrap:var(--box-wrap);justify-content:var(--box-justify);align-items:var(--box-align);gap:var(--box-gap);min-block-size:var(--box-minimum-size);min-inline-size:var(--box-minimum-size);padding:var(--box-padding);border:var(--box-border-thickness) var(--line-style) var(--box-border-color);border-radius:var(--corner-radius);background:var(--box-background);color:var(--box-text-color);font-family:var(--font-family);line-height:var(--line-height);text-align:var(--box-text-align);text-decoration:none;--section-padding: var(--box-section-padding);--section-minimum-size: calc(var(--box-minimum-size) - 2 * var(--box-border-thickness));-webkit-backdrop-filter:var(--box-backdrop);backdrop-filter:var(--box-backdrop);transition:background-color var(--quick-duration) var(--easing),color var(--quick-duration) var(--easing),border-color var(--quick-duration) var(--easing),opacity var(--quick-duration) var(--easing)}:where(.box[data-variant],.box[data-size],.box[data-interactive]){font-size:var(--current-font-size)}:where(.box[data-interactive]){cursor:pointer;font-weight:var(--current-font-weight);user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}:where(.box[data-interactive]):active{cursor:default}:where(.box[data-interactive]):focus-visible{outline:var(--focus-thickness) solid var(--current-color);outline-offset:var(--focus-offset)}:where(.box[data-state=loading],.box[data-state=disabled]){cursor:default}:where(.box[data-state=disabled]){opacity:var(--disabled-opacity)}:where(.box[data-field]){cursor:text;font-weight:var(--current-field-font-weight)}:where(.box[data-field]):active{cursor:text}:where(.box[data-field]):focus-within{outline:var(--focus-thickness) solid var(--current-color);outline-offset:var(--focus-offset)}:where(.box[data-field])>:where([data-section=prefix]){border-inline-end:var(--box-border-thickness) var(--line-style) var(--box-border-color)}:where(.box[data-field])>:where([data-section=suffix]){border-inline-start:var(--box-border-thickness) var(--line-style) var(--box-border-color)}:where(.box[data-field][data-state=disabled]){cursor:default}:where(.content){display:flex;flex:1 1 auto;flex-direction:inherit;justify-content:inherit;align-items:inherit;gap:inherit;min-inline-size:0;padding-inline:var(--section-padding)}:where(.section){display:flex;flex:none;justify-content:center;align-items:center;min-block-size:var(--section-minimum-size);min-inline-size:var(--section-minimum-size)}:where(.box[data-square]){aspect-ratio:1}:where(.box[data-square])>:where(.content){justify-content:center;padding-inline:0}:where(.box[data-state=loading])>:where(.content,.section){opacity:0}:where(.spinner){position:absolute;inset:0;margin:auto}
1
+ :where(.box){position:relative;box-sizing:border-box;display:var(--box-display);flex-direction:var(--box-direction);flex-wrap:var(--box-wrap);justify-content:var(--box-justify);align-items:var(--box-align);gap:var(--box-gap);min-block-size:var(--box-minimum-size);min-inline-size:var(--box-minimum-size);padding:var(--box-padding);border:var(--box-border-thickness) var(--line-style) color-mix(in srgb, transparent calc(var(--box-border-gradient-weight) * var(--line-solid)), var(--box-border-color));border-radius:var(--corner-radius);background-color:var(--box-background);background-image:var(--box-text-paint),var(--box-background-image);-webkit-background-clip:var(--box-text-clip),border-box;background-clip:var(--box-text-clip),border-box;color:var(--box-text-color);-webkit-text-fill-color:var(--box-text-fill);font-family:var(--font-family);line-height:var(--line-height);text-align:var(--box-text-align);text-decoration:none;--section-padding: var(--box-section-padding);--section-minimum-size: calc(var(--box-minimum-size) - 2 * var(--box-border-thickness));-webkit-backdrop-filter:var(--box-backdrop);backdrop-filter:var(--box-backdrop);transition:background-color var(--quick-duration) var(--easing),color var(--quick-duration) var(--easing),border-color var(--quick-duration) var(--easing),opacity var(--quick-duration) var(--easing)}:where(.box)::after{content:"";display:var(--box-ring-display);position:absolute;inset:calc(-1*var(--box-border-thickness));border:var(--box-border-thickness) solid rgba(0,0,0,0);border-radius:inherit;background:var(--box-border-paint) border-box;mask:linear-gradient(#000 0 0) padding-box exclude,linear-gradient(#000 0 0);opacity:var(--line-solid);pointer-events:none}:where(.box[data-modifications]:not([data-modifications~=glass])){-webkit-backdrop-filter:none;backdrop-filter:none}:where(.box[data-modifications~=glow]){z-index:1}:where(.box[data-variant],.box[data-size],.box[data-interactive]){font-size:var(--current-font-size)}:where(.box[data-interactive]){cursor:pointer;font-weight:var(--current-font-weight);user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}:where(.box[data-interactive]):active{cursor:default}:where(.box[data-interactive]):focus-visible{outline:var(--focus-thickness) solid var(--current-color);outline-offset:var(--focus-offset)}:where(.box[data-state=active],.box[data-state=loading],.box[data-state=disabled]){cursor:default}:where(.box[data-state=disabled]){opacity:var(--disabled-opacity)}:where(.box[data-field]){cursor:text;font-weight:var(--current-field-font-weight)}:where(.box[data-field]):active{cursor:text}:where(.box[data-field]):focus-within{outline:var(--focus-thickness) solid var(--current-color);outline-offset:var(--focus-offset)}:where(.box[data-field])>:where([data-section=prefix]){border-inline-end:var(--box-border-thickness) var(--line-style) var(--box-border-color)}:where(.box[data-field])>:where([data-section=suffix]){border-inline-start:var(--box-border-thickness) var(--line-style) var(--box-border-color)}:where(.box[data-field][data-state=disabled]){cursor:default}:where(.content){display:flex;flex:1 1 auto;flex-direction:inherit;justify-content:inherit;align-items:inherit;gap:inherit;min-inline-size:0;padding-inline:var(--section-padding)}:where(.section){display:flex;flex:none;justify-content:center;align-items:center;min-block-size:var(--section-minimum-size);min-inline-size:var(--section-minimum-size)}:where(.box[data-square]){aspect-ratio:1}:where(.box[data-square])>:where(.content){justify-content:center;padding-inline:0}:where(.box[data-state=loading])>:where(.content,.section){opacity:0}:where(.spinner){position:absolute;inset:0;margin:auto}
@@ -12,10 +12,17 @@
12
12
  min-block-size: var(--box-minimum-size);
13
13
  min-inline-size: var(--box-minimum-size);
14
14
  padding: var(--box-padding);
15
- border: var(--box-border-thickness) var(--line-style) var(--box-border-color);
15
+ // A gradient color's flat border hides on whole lines, where its gradient ring is drawn instead.
16
+ border: var(--box-border-thickness) var(--line-style)
17
+ color-mix(in srgb, transparent calc(var(--box-border-gradient-weight) * var(--line-solid)), var(--box-border-color));
16
18
  border-radius: var(--corner-radius);
17
- background: var(--box-background);
19
+ // The first layer paints a gradient color's text (clipped to it), the second the background.
20
+ background-color: var(--box-background);
21
+ background-image: var(--box-text-paint), var(--box-background-image);
22
+ -webkit-background-clip: var(--box-text-clip), border-box;
23
+ background-clip: var(--box-text-clip), border-box;
18
24
  color: var(--box-text-color);
25
+ -webkit-text-fill-color: var(--box-text-fill);
19
26
  font-family: var(--font-family);
20
27
  line-height: var(--line-height);
21
28
  text-align: var(--box-text-align);
@@ -30,6 +37,32 @@
30
37
  color var(--quick-duration) var(--easing),
31
38
  border-color var(--quick-duration) var(--easing),
32
39
  opacity var(--quick-duration) var(--easing);
40
+
41
+ // A gradient color's border: a ring of its transparent gradient over the border, drawn only where one is needed.
42
+ &::after {
43
+ content: "";
44
+ display: var(--box-ring-display);
45
+ position: absolute;
46
+ inset: calc(-1 * var(--box-border-thickness));
47
+ border: var(--box-border-thickness) solid transparent;
48
+ border-radius: inherit;
49
+ background: var(--box-border-paint) border-box;
50
+ mask:
51
+ linear-gradient(#000 0 0) padding-box exclude,
52
+ linear-gradient(#000 0 0);
53
+ opacity: var(--line-solid);
54
+ pointer-events: none;
55
+ }
56
+ }
57
+
58
+ // Modifications: glass (the default) blurs what is behind a see-through box; a glowing box sits over its glow.
59
+ :where(.box[data-modifications]:not([data-modifications~="glass"])) {
60
+ -webkit-backdrop-filter: none;
61
+ backdrop-filter: none;
62
+ }
63
+
64
+ :where(.box[data-modifications~="glow"]) {
65
+ z-index: 1;
33
66
  }
34
67
 
35
68
  :where(.box[data-variant], .box[data-size], .box[data-interactive]) {
@@ -52,7 +85,8 @@
52
85
  }
53
86
  }
54
87
 
55
- :where(.box[data-state="loading"], .box[data-state="disabled"]) {
88
+ // Pressed, set to active or loading, or disabled: the default cursor (active and loading keep the pressed look).
89
+ :where(.box[data-state="active"], .box[data-state="loading"], .box[data-state="disabled"]) {
56
90
  cursor: default;
57
91
  }
58
92