@syware/jlib 0.0.0-stage → 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 (331) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +116 -2
  3. package/dist/all.d.ts +1 -0
  4. package/dist/all.js +75 -0
  5. package/dist/atoms/jl-avatar.css_raw.js +3 -0
  6. package/dist/atoms/jl-avatar.d.ts +52 -0
  7. package/dist/atoms/jl-avatar.js +167 -0
  8. package/dist/atoms/jl-badge.css_raw.js +3 -0
  9. package/dist/atoms/jl-badge.d.ts +32 -0
  10. package/dist/atoms/jl-badge.js +60 -0
  11. package/dist/atoms/jl-button.css_raw.js +3 -0
  12. package/dist/atoms/jl-button.d.ts +70 -0
  13. package/dist/atoms/jl-button.js +146 -0
  14. package/dist/atoms/jl-checkbox.css_raw.js +3 -0
  15. package/dist/atoms/jl-checkbox.d.ts +61 -0
  16. package/dist/atoms/jl-checkbox.js +149 -0
  17. package/dist/atoms/jl-chip.css_raw.js +3 -0
  18. package/dist/atoms/jl-chip.d.ts +59 -0
  19. package/dist/atoms/jl-chip.js +164 -0
  20. package/dist/atoms/jl-divider.css_raw.js +3 -0
  21. package/dist/atoms/jl-divider.d.ts +26 -0
  22. package/dist/atoms/jl-divider.js +59 -0
  23. package/dist/atoms/jl-icon.css_raw.js +3 -0
  24. package/dist/atoms/jl-icon.d.ts +25 -0
  25. package/dist/atoms/jl-icon.js +41 -0
  26. package/dist/atoms/jl-input.css_raw.js +3 -0
  27. package/dist/atoms/jl-input.d.ts +112 -0
  28. package/dist/atoms/jl-input.js +202 -0
  29. package/dist/atoms/jl-kbd.css_raw.js +3 -0
  30. package/dist/atoms/jl-kbd.d.ts +17 -0
  31. package/dist/atoms/jl-kbd.js +62 -0
  32. package/dist/atoms/jl-link.css_raw.js +3 -0
  33. package/dist/atoms/jl-link.d.ts +37 -0
  34. package/dist/atoms/jl-link.js +86 -0
  35. package/dist/atoms/jl-progress-ring.css_raw.js +3 -0
  36. package/dist/atoms/jl-progress-ring.d.ts +49 -0
  37. package/dist/atoms/jl-progress-ring.js +132 -0
  38. package/dist/atoms/jl-progress.css_raw.js +3 -0
  39. package/dist/atoms/jl-progress.d.ts +43 -0
  40. package/dist/atoms/jl-progress.js +109 -0
  41. package/dist/atoms/jl-rating.css_raw.js +3 -0
  42. package/dist/atoms/jl-rating.d.ts +73 -0
  43. package/dist/atoms/jl-rating.js +184 -0
  44. package/dist/atoms/jl-select.css_raw.js +3 -0
  45. package/dist/atoms/jl-select.d.ts +70 -0
  46. package/dist/atoms/jl-select.js +146 -0
  47. package/dist/atoms/jl-skeleton.css_raw.js +3 -0
  48. package/dist/atoms/jl-skeleton.d.ts +34 -0
  49. package/dist/atoms/jl-skeleton.js +63 -0
  50. package/dist/atoms/jl-slider.css_raw.js +3 -0
  51. package/dist/atoms/jl-slider.d.ts +65 -0
  52. package/dist/atoms/jl-slider.js +143 -0
  53. package/dist/atoms/jl-spinner.css_raw.js +3 -0
  54. package/dist/atoms/jl-spinner.d.ts +16 -0
  55. package/dist/atoms/jl-spinner.js +26 -0
  56. package/dist/atoms/jl-switch.css_raw.js +3 -0
  57. package/dist/atoms/jl-switch.d.ts +57 -0
  58. package/dist/atoms/jl-switch.js +125 -0
  59. package/dist/atoms/jl-textarea.css_raw.js +3 -0
  60. package/dist/atoms/jl-textarea.d.ts +81 -0
  61. package/dist/atoms/jl-textarea.js +148 -0
  62. package/dist/base/jl-element.d.ts +16 -0
  63. package/dist/base/jl-element.js +35 -0
  64. package/dist/base/jl-form-control.d.ts +29 -0
  65. package/dist/base/jl-form-control.js +44 -0
  66. package/dist/index.d.ts +119 -0
  67. package/dist/index.js +72 -0
  68. package/dist/lib/arrow.d.ts +6 -0
  69. package/dist/lib/arrow.js +15 -0
  70. package/dist/lib/attributes.d.ts +9 -0
  71. package/dist/lib/attributes.js +22 -0
  72. package/dist/lib/avatar.d.ts +11 -0
  73. package/dist/lib/avatar.js +37 -0
  74. package/dist/lib/calendar.d.ts +48 -0
  75. package/dist/lib/calendar.js +166 -0
  76. package/dist/lib/css-length.d.ts +2 -0
  77. package/dist/lib/css-length.js +8 -0
  78. package/dist/lib/define.d.ts +9 -0
  79. package/dist/lib/define.js +9 -0
  80. package/dist/lib/dom.d.ts +4 -0
  81. package/dist/lib/dom.js +16 -0
  82. package/dist/lib/files.d.ts +18 -0
  83. package/dist/lib/files.js +89 -0
  84. package/dist/lib/floating.d.ts +13 -0
  85. package/dist/lib/floating.js +127 -0
  86. package/dist/lib/fuzzy.d.ts +26 -0
  87. package/dist/lib/fuzzy.js +149 -0
  88. package/dist/lib/highlight.d.ts +5 -0
  89. package/dist/lib/highlight.js +267 -0
  90. package/dist/lib/hotkey.d.ts +9 -0
  91. package/dist/lib/hotkey.js +101 -0
  92. package/dist/lib/icon-set.d.ts +95 -0
  93. package/dist/lib/icon-set.js +97 -0
  94. package/dist/lib/icons.d.ts +12 -0
  95. package/dist/lib/icons.js +39 -0
  96. package/dist/lib/indicator.d.ts +6 -0
  97. package/dist/lib/indicator.js +18 -0
  98. package/dist/lib/keep-in-view.d.ts +5 -0
  99. package/dist/lib/keep-in-view.js +15 -0
  100. package/dist/lib/key-shortcut.d.ts +20 -0
  101. package/dist/lib/key-shortcut.js +100 -0
  102. package/dist/lib/keycaps.d.ts +8 -0
  103. package/dist/lib/keycaps.js +162 -0
  104. package/dist/lib/locale.d.ts +4 -0
  105. package/dist/lib/locale.js +13 -0
  106. package/dist/lib/nav-tree.d.ts +9 -0
  107. package/dist/lib/nav-tree.js +30 -0
  108. package/dist/lib/numeric.d.ts +20 -0
  109. package/dist/lib/numeric.js +50 -0
  110. package/dist/lib/option-filter.d.ts +29 -0
  111. package/dist/lib/option-filter.js +108 -0
  112. package/dist/lib/option-groups.d.ts +6 -0
  113. package/dist/lib/option-groups.js +26 -0
  114. package/dist/lib/options.d.ts +5 -0
  115. package/dist/lib/options.js +24 -0
  116. package/dist/lib/pagination.d.ts +9 -0
  117. package/dist/lib/pagination.js +52 -0
  118. package/dist/lib/palette.d.ts +8 -0
  119. package/dist/lib/palette.js +46 -0
  120. package/dist/lib/progress.d.ts +20 -0
  121. package/dist/lib/progress.js +33 -0
  122. package/dist/lib/rating.d.ts +7 -0
  123. package/dist/lib/rating.js +26 -0
  124. package/dist/lib/roving-index.d.ts +10 -0
  125. package/dist/lib/roving-index.js +32 -0
  126. package/dist/lib/roving.d.ts +11 -0
  127. package/dist/lib/roving.js +21 -0
  128. package/dist/lib/slots.d.ts +2 -0
  129. package/dist/lib/slots.js +6 -0
  130. package/dist/lib/sparkline.d.ts +11 -0
  131. package/dist/lib/sparkline.js +42 -0
  132. package/dist/lib/split.d.ts +12 -0
  133. package/dist/lib/split.js +37 -0
  134. package/dist/lib/surface.d.ts +7 -0
  135. package/dist/lib/surface.js +28 -0
  136. package/dist/lib/table.d.ts +30 -0
  137. package/dist/lib/table.js +110 -0
  138. package/dist/lib/tags.d.ts +14 -0
  139. package/dist/lib/tags.js +29 -0
  140. package/dist/lib/text.d.ts +5 -0
  141. package/dist/lib/text.js +13 -0
  142. package/dist/lib/tokens.d.ts +5 -0
  143. package/dist/lib/tokens.js +15 -0
  144. package/dist/lib/tree.d.ts +16 -0
  145. package/dist/lib/tree.js +89 -0
  146. package/dist/lib/trend.d.ts +3 -0
  147. package/dist/lib/trend.js +15 -0
  148. package/dist/lib/trigger.d.ts +11 -0
  149. package/dist/lib/trigger.js +34 -0
  150. package/dist/molecules/jl-accordion-item.css_raw.js +3 -0
  151. package/dist/molecules/jl-accordion-item.d.ts +34 -0
  152. package/dist/molecules/jl-accordion-item.js +82 -0
  153. package/dist/molecules/jl-accordion.css_raw.js +3 -0
  154. package/dist/molecules/jl-accordion.d.ts +27 -0
  155. package/dist/molecules/jl-accordion.js +61 -0
  156. package/dist/molecules/jl-alert.css_raw.js +3 -0
  157. package/dist/molecules/jl-alert.d.ts +38 -0
  158. package/dist/molecules/jl-alert.js +131 -0
  159. package/dist/molecules/jl-avatar-group.css_raw.js +3 -0
  160. package/dist/molecules/jl-avatar-group.d.ts +28 -0
  161. package/dist/molecules/jl-avatar-group.js +69 -0
  162. package/dist/molecules/jl-breadcrumb.css_raw.js +3 -0
  163. package/dist/molecules/jl-breadcrumb.d.ts +35 -0
  164. package/dist/molecules/jl-breadcrumb.js +126 -0
  165. package/dist/molecules/jl-calendar.css_raw.js +3 -0
  166. package/dist/molecules/jl-calendar.d.ts +101 -0
  167. package/dist/molecules/jl-calendar.js +314 -0
  168. package/dist/molecules/jl-card.css_raw.js +3 -0
  169. package/dist/molecules/jl-card.d.ts +46 -0
  170. package/dist/molecules/jl-card.js +172 -0
  171. package/dist/molecules/jl-code-block.css_raw.js +3 -0
  172. package/dist/molecules/jl-code-block.d.ts +44 -0
  173. package/dist/molecules/jl-code-block.js +106 -0
  174. package/dist/molecules/jl-combobox.css_raw.js +3 -0
  175. package/dist/molecules/jl-combobox.d.ts +120 -0
  176. package/dist/molecules/jl-combobox.js +450 -0
  177. package/dist/molecules/jl-copy-button.css_raw.js +3 -0
  178. package/dist/molecules/jl-copy-button.d.ts +31 -0
  179. package/dist/molecules/jl-copy-button.js +69 -0
  180. package/dist/molecules/jl-date-picker.css_raw.js +3 -0
  181. package/dist/molecules/jl-date-picker.d.ts +109 -0
  182. package/dist/molecules/jl-date-picker.js +322 -0
  183. package/dist/molecules/jl-empty.css_raw.js +3 -0
  184. package/dist/molecules/jl-empty.d.ts +32 -0
  185. package/dist/molecules/jl-empty.js +94 -0
  186. package/dist/molecules/jl-field.css_raw.js +3 -0
  187. package/dist/molecules/jl-field.d.ts +49 -0
  188. package/dist/molecules/jl-field.js +147 -0
  189. package/dist/molecules/jl-file-drop.css_raw.js +3 -0
  190. package/dist/molecules/jl-file-drop.d.ts +93 -0
  191. package/dist/molecules/jl-file-drop.js +366 -0
  192. package/dist/molecules/jl-list-item.css_raw.js +3 -0
  193. package/dist/molecules/jl-list-item.d.ts +56 -0
  194. package/dist/molecules/jl-list-item.js +176 -0
  195. package/dist/molecules/jl-menu.css_raw.js +3 -0
  196. package/dist/molecules/jl-menu.d.ts +62 -0
  197. package/dist/molecules/jl-menu.js +288 -0
  198. package/dist/molecules/jl-number-input.css_raw.js +3 -0
  199. package/dist/molecules/jl-number-input.d.ts +81 -0
  200. package/dist/molecules/jl-number-input.js +220 -0
  201. package/dist/molecules/jl-pagination.css_raw.js +3 -0
  202. package/dist/molecules/jl-pagination.d.ts +59 -0
  203. package/dist/molecules/jl-pagination.js +172 -0
  204. package/dist/molecules/jl-popover.css_raw.js +3 -0
  205. package/dist/molecules/jl-popover.d.ts +49 -0
  206. package/dist/molecules/jl-popover.js +152 -0
  207. package/dist/molecules/jl-radio-group.css_raw.js +3 -0
  208. package/dist/molecules/jl-radio-group.d.ts +71 -0
  209. package/dist/molecules/jl-radio-group.js +202 -0
  210. package/dist/molecules/jl-search.css_raw.js +3 -0
  211. package/dist/molecules/jl-search.d.ts +71 -0
  212. package/dist/molecules/jl-search.js +210 -0
  213. package/dist/molecules/jl-segmented.css_raw.js +3 -0
  214. package/dist/molecules/jl-segmented.d.ts +65 -0
  215. package/dist/molecules/jl-segmented.js +187 -0
  216. package/dist/molecules/jl-stat.css_raw.js +3 -0
  217. package/dist/molecules/jl-stat.d.ts +55 -0
  218. package/dist/molecules/jl-stat.js +169 -0
  219. package/dist/molecules/jl-steps.css_raw.js +3 -0
  220. package/dist/molecules/jl-steps.d.ts +44 -0
  221. package/dist/molecules/jl-steps.js +118 -0
  222. package/dist/molecules/jl-tab-panel.css_raw.js +3 -0
  223. package/dist/molecules/jl-tab-panel.d.ts +35 -0
  224. package/dist/molecules/jl-tab-panel.js +35 -0
  225. package/dist/molecules/jl-tabs.css_raw.js +3 -0
  226. package/dist/molecules/jl-tabs.d.ts +51 -0
  227. package/dist/molecules/jl-tabs.js +198 -0
  228. package/dist/molecules/jl-tag-input.css_raw.js +3 -0
  229. package/dist/molecules/jl-tag-input.d.ts +103 -0
  230. package/dist/molecules/jl-tag-input.js +429 -0
  231. package/dist/molecules/jl-timeline.css_raw.js +3 -0
  232. package/dist/molecules/jl-timeline.d.ts +28 -0
  233. package/dist/molecules/jl-timeline.js +81 -0
  234. package/dist/molecules/jl-toast.css_raw.js +3 -0
  235. package/dist/molecules/jl-toast.d.ts +75 -0
  236. package/dist/molecules/jl-toast.js +274 -0
  237. package/dist/molecules/jl-tooltip.css_raw.js +3 -0
  238. package/dist/molecules/jl-tooltip.d.ts +44 -0
  239. package/dist/molecules/jl-tooltip.js +160 -0
  240. package/dist/organisms/jl-command-palette.css_raw.js +3 -0
  241. package/dist/organisms/jl-command-palette.d.ts +60 -0
  242. package/dist/organisms/jl-command-palette.js +285 -0
  243. package/dist/organisms/jl-confirm.css_raw.js +3 -0
  244. package/dist/organisms/jl-confirm.d.ts +56 -0
  245. package/dist/organisms/jl-confirm.js +132 -0
  246. package/dist/organisms/jl-dialog.css_raw.js +3 -0
  247. package/dist/organisms/jl-dialog.d.ts +43 -0
  248. package/dist/organisms/jl-dialog.js +120 -0
  249. package/dist/organisms/jl-drawer.css_raw.js +3 -0
  250. package/dist/organisms/jl-drawer.d.ts +50 -0
  251. package/dist/organisms/jl-drawer.js +141 -0
  252. package/dist/organisms/jl-navbar.css_raw.js +3 -0
  253. package/dist/organisms/jl-navbar.d.ts +32 -0
  254. package/dist/organisms/jl-navbar.js +121 -0
  255. package/dist/organisms/jl-page-header.css_raw.js +3 -0
  256. package/dist/organisms/jl-page-header.d.ts +26 -0
  257. package/dist/organisms/jl-page-header.js +85 -0
  258. package/dist/organisms/jl-side-nav.css_raw.js +3 -0
  259. package/dist/organisms/jl-side-nav.d.ts +60 -0
  260. package/dist/organisms/jl-side-nav.js +269 -0
  261. package/dist/organisms/jl-table.css_raw.js +3 -0
  262. package/dist/organisms/jl-table.d.ts +109 -0
  263. package/dist/organisms/jl-table.js +318 -0
  264. package/dist/organisms/jl-toaster.css_raw.js +3 -0
  265. package/dist/organisms/jl-toaster.d.ts +48 -0
  266. package/dist/organisms/jl-toaster.js +142 -0
  267. package/dist/organisms/jl-tree.css_raw.js +3 -0
  268. package/dist/organisms/jl-tree.d.ts +59 -0
  269. package/dist/organisms/jl-tree.js +198 -0
  270. package/dist/styles/base.css_raw.js +3 -0
  271. package/dist/styles/control.css_raw.js +3 -0
  272. package/dist/styles/floating.css_raw.js +3 -0
  273. package/dist/styles/shared.d.ts +8 -0
  274. package/dist/styles/shared.js +14 -0
  275. package/dist/styles/tokens.css_raw.js +3 -0
  276. package/dist/templates/jl-app-shell.css_raw.js +3 -0
  277. package/dist/templates/jl-app-shell.d.ts +37 -0
  278. package/dist/templates/jl-app-shell.js +150 -0
  279. package/dist/templates/jl-split-view.css_raw.js +3 -0
  280. package/dist/templates/jl-split-view.d.ts +49 -0
  281. package/dist/templates/jl-split-view.js +149 -0
  282. package/dist/tokens.css +188 -0
  283. package/dist/types/calendar.types.d.ts +11 -0
  284. package/dist/types/files.types.d.ts +23 -0
  285. package/dist/types/floating.types.d.ts +13 -0
  286. package/dist/types/fuzzy.types.d.ts +10 -0
  287. package/dist/types/highlight.types.d.ts +6 -0
  288. package/dist/types/hotkey.types.d.ts +19 -0
  289. package/dist/types/jl-accordion.types.d.ts +2 -0
  290. package/dist/types/jl-avatar.types.d.ts +10 -0
  291. package/dist/types/jl-breadcrumb.types.d.ts +6 -0
  292. package/dist/types/jl-button.types.d.ts +3 -0
  293. package/dist/types/jl-card.types.d.ts +2 -0
  294. package/dist/types/jl-chip.types.d.ts +1 -0
  295. package/dist/types/jl-combobox.types.d.ts +8 -0
  296. package/dist/types/jl-command-palette.types.d.ts +22 -0
  297. package/dist/types/jl-confirm.types.d.ts +10 -0
  298. package/dist/types/jl-dialog.types.d.ts +1 -0
  299. package/dist/types/jl-divider.types.d.ts +2 -0
  300. package/dist/types/jl-drawer.types.d.ts +4 -0
  301. package/dist/types/jl-empty.types.d.ts +2 -0
  302. package/dist/types/jl-field.types.d.ts +2 -0
  303. package/dist/types/jl-input.types.d.ts +1 -0
  304. package/dist/types/jl-link.types.d.ts +2 -0
  305. package/dist/types/jl-menu.types.d.ts +22 -0
  306. package/dist/types/jl-navbar.types.d.ts +6 -0
  307. package/dist/types/jl-progress.types.d.ts +3 -0
  308. package/dist/types/jl-radio-group.types.d.ts +10 -0
  309. package/dist/types/jl-segmented.types.d.ts +7 -0
  310. package/dist/types/jl-select.types.d.ts +12 -0
  311. package/dist/types/jl-side-nav.types.d.ts +17 -0
  312. package/dist/types/jl-skeleton.types.d.ts +2 -0
  313. package/dist/types/jl-slider.types.d.ts +5 -0
  314. package/dist/types/jl-split-view.types.d.ts +2 -0
  315. package/dist/types/jl-stat.types.d.ts +2 -0
  316. package/dist/types/jl-steps.types.d.ts +8 -0
  317. package/dist/types/jl-switch.types.d.ts +1 -0
  318. package/dist/types/jl-table.types.d.ts +30 -0
  319. package/dist/types/jl-tabs.types.d.ts +2 -0
  320. package/dist/types/jl-timeline.types.d.ts +10 -0
  321. package/dist/types/jl-toast.types.d.ts +2 -0
  322. package/dist/types/jl-toaster.types.d.ts +23 -0
  323. package/dist/types/jl-tree.types.d.ts +26 -0
  324. package/dist/types/key-shortcut.types.d.ts +9 -0
  325. package/dist/types/keycaps.types.d.ts +7 -0
  326. package/dist/types/option-filter.types.d.ts +10 -0
  327. package/dist/types/options.types.d.ts +4 -0
  328. package/dist/types/pagination.types.d.ts +8 -0
  329. package/dist/types/roving-index.types.d.ts +2 -0
  330. package/dist/types/sparkline.types.d.ts +11 -0
  331. package/package.json +96 -4
@@ -0,0 +1,146 @@
1
+ import { BASE_STYLES } from "../styles/shared.js";
2
+ import { JlElement } from "../base/jl-element.js";
3
+ import { oneOf } from "../lib/attributes.js";
4
+ import { CONTROL_SIZES } from "../lib/options.js";
5
+ import { JlIcon } from "./jl-icon.js";
6
+ import jl_button_default from "./jl-button.css_raw.js";
7
+ import { JlSpinner } from "./jl-spinner.js";
8
+ import { css } from "@jadis/core";
9
+ import { jsx, jsxs } from "@jadis/core/jsx-runtime";
10
+ // src/atoms/jl-button.tsx
11
+ var BUTTON_VARIANTS = [
12
+ "secondary",
13
+ "primary",
14
+ "ghost",
15
+ "danger"
16
+ ];
17
+ var BUTTON_TYPES = [
18
+ "button",
19
+ "submit",
20
+ "reset"
21
+ ];
22
+ var ICON_SIZES = {
23
+ lg: 18,
24
+ md: 16,
25
+ sm: 14
26
+ };
27
+ /**
28
+ * A button. Its text is the `label` (or the slotted content); with only an `icon`, its `hint` names it.
29
+ * Listen to `press`: it fires only while the button can be pressed. `type="submit"` submits the surrounding form.
30
+ */
31
+ var JlButton = class extends JlElement {
32
+ static selector = "jl-button";
33
+ static formAssociated = true;
34
+ events = this.useEvents();
35
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
36
+ icon = this.useChange("", (name) => this.renderIcon(this._refs.start, name), { attribute: "icon" });
37
+ iconEnd = this.useChange("", (name) => this.renderIcon(this._refs.end, name), { attribute: "icon-end" });
38
+ variant = this.useChange("secondary", (value) => this.reflect("variant", value), {
39
+ attribute: "variant",
40
+ parse: oneOf(BUTTON_VARIANTS, "secondary")
41
+ });
42
+ size = this.useChange("md", (value) => this.renderSize(value), {
43
+ attribute: "size",
44
+ parse: oneOf(CONTROL_SIZES, "md")
45
+ });
46
+ type = this.useChange("button", () => void 0, {
47
+ attribute: "type",
48
+ parse: oneOf(BUTTON_TYPES, "button")
49
+ });
50
+ disabled = this.useChange(false, (value) => {
51
+ this._refs.button.disabled = value;
52
+ this.reflect("disabled", value);
53
+ }, { attribute: "disabled" });
54
+ /** Shows a spinner in place of the icon and ignores presses, while the work it started runs. */
55
+ loading = this.useChange(false, (value) => {
56
+ this._refs.spinner.hidden = !value;
57
+ this._refs.start.hidden = value || this.icon.get() === "";
58
+ this._refs.button.toggleAttribute("aria-busy", value);
59
+ this.reflect("loading", value);
60
+ }, { attribute: "loading" });
61
+ /** The tooltip; also the button's name for screen readers when it only has an icon. */
62
+ hint = this.useChange("", () => this.renderLabel(), { attribute: "hint" });
63
+ /** Takes the whole width of its container. */
64
+ block = this.useChange(false, (value) => this.reflect("block", value), { attribute: "block" });
65
+ _internals = this.attachInternals();
66
+ _refs = this.useRefs((ref) => ({
67
+ button: ref("button"),
68
+ end: ref(".end"),
69
+ label: ref(".text"),
70
+ slot: ref("slot"),
71
+ spinner: ref("jl-spinner"),
72
+ start: ref(".start")
73
+ }));
74
+ focus(options) {
75
+ this._refs.button.focus(options);
76
+ }
77
+ templateHtml() {
78
+ return /* @__PURE__ */ jsxs("button", {
79
+ type: "button",
80
+ attrs: { part: "base" },
81
+ children: [
82
+ /* @__PURE__ */ jsx(JlSpinner, { hidden: true }),
83
+ /* @__PURE__ */ jsx(JlIcon, {
84
+ class: "start",
85
+ hidden: true
86
+ }),
87
+ /* @__PURE__ */ jsx("span", { class: "text" }),
88
+ /* @__PURE__ */ jsx("slot", {}),
89
+ /* @__PURE__ */ jsx(JlIcon, {
90
+ class: "end",
91
+ hidden: true
92
+ })
93
+ ]
94
+ });
95
+ }
96
+ templateCss() {
97
+ return css`${BASE_STYLES}${jl_button_default}`;
98
+ }
99
+ onConnect() {
100
+ this.on(this._refs.slot, "slotchange", () => this.renderLabel());
101
+ this.on(this._refs.button, "click", () => {
102
+ if (this.disabled.get() || this.loading.get()) return;
103
+ this.events.emit("press");
104
+ this.actOnForm();
105
+ });
106
+ }
107
+ actOnForm() {
108
+ const form = this._internals.form;
109
+ if (form === null) return;
110
+ ({
111
+ button: () => void 0,
112
+ reset: () => form.reset(),
113
+ submit: () => form.requestSubmit()
114
+ })[this.type.get()]();
115
+ }
116
+ renderIcon(icon, name) {
117
+ icon.name.set(name);
118
+ icon.hidden = name === "" || icon === this._refs.start && this.loading.get();
119
+ this.renderLabel();
120
+ }
121
+ renderSize(size) {
122
+ this.reflect("size", size);
123
+ this._refs.start.size.set(ICON_SIZES[size]);
124
+ this._refs.end.size.set(ICON_SIZES[size]);
125
+ this._refs.spinner.size.set(ICON_SIZES[size]);
126
+ }
127
+ hasSlottedContent() {
128
+ return this._refs.slot.assignedNodes().some((node) => node.textContent?.trim() !== "" || node instanceof Element);
129
+ }
130
+ renderLabel() {
131
+ const label = this.label.get();
132
+ const hint = this.hint.get();
133
+ const iconOnly = label === "" && !this.hasSlottedContent();
134
+ this._refs.label.textContent = label;
135
+ this._refs.label.hidden = label === "";
136
+ this._refs.button.title = hint;
137
+ this.reflect("icon-only", iconOnly);
138
+ if (iconOnly && hint !== "") {
139
+ this._refs.button.setAttribute("aria-label", hint);
140
+ return;
141
+ }
142
+ this._refs.button.removeAttribute("aria-label");
143
+ }
144
+ };
145
+ JlButton.register();
146
+ export { BUTTON_TYPES, BUTTON_VARIANTS, JlButton };
@@ -0,0 +1,3 @@
1
+ // src/atoms/jl-checkbox.css?raw
2
+ var jl_checkbox_default = ":host {\n display: inline-flex;\n vertical-align: middle;\n --box: 18px;\n}\n\n.wrap {\n display: inline-flex;\n align-items: flex-start;\n gap: 10px;\n color: var(--jl-text);\n font-size: var(--jl-font-md);\n line-height: 20px;\n cursor: pointer;\n}\n\n/* The native box keeps the semantics and the keyboard; its look is drawn here, the marks on top of it. */\n.box {\n position: relative;\n display: inline-flex;\n flex: none;\n width: var(--box);\n height: var(--box);\n margin-top: 1px;\n}\n\n.native {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n border: 1px solid var(--jl-line-strong);\n border-radius: var(--jl-radius-xs);\n background: var(--jl-surface);\n cursor: inherit;\n appearance: none;\n transition:\n background var(--jl-fast) var(--jl-ease),\n border-color var(--jl-fast) var(--jl-ease),\n box-shadow var(--jl-fast) var(--jl-ease);\n}\n\n.wrap:hover .native:not(:disabled) {\n border-color: color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%);\n}\n\n.native:checked,\n.native:indeterminate {\n border-color: var(--jl-accent);\n background: var(--jl-accent);\n}\n\n.wrap:hover .native:checked:not(:disabled),\n.wrap:hover .native:indeterminate:not(:disabled) {\n border-color: var(--jl-accent-strong);\n background: var(--jl-accent-strong);\n}\n\n.mark {\n position: absolute;\n inset: 0;\n display: none;\n align-items: center;\n justify-content: center;\n color: var(--jl-on-accent);\n pointer-events: none;\n}\n\n.native:checked:not(:indeterminate) ~ .check,\n.native:indeterminate ~ .dash {\n display: flex;\n}\n\n/* Its baseline is the element's, so a label beside it (a horizontal field) lines up with the text. */\n.text {\n display: grid;\n align-self: baseline;\n gap: 2px;\n}\n\n.description {\n color: var(--jl-muted);\n font-size: var(--jl-font-sm);\n line-height: 18px;\n}\n\n:host([disabled]) .wrap,\n:host(:disabled) .wrap {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n:host([disabled]) .native:not(:checked, :indeterminate),\n:host(:disabled) .native:not(:checked, :indeterminate) {\n background: var(--jl-surface-2);\n}\n";
3
+ export { jl_checkbox_default as default };
@@ -0,0 +1,61 @@
1
+ import { JlFormControl } from '../base/jl-form-control';
2
+ /**
3
+ * A box to tick, with its label beside it: clicking the label toggles it too. `checked` is the state; the form
4
+ * gets `value` while it is checked. `indeterminate` draws a dash for a parent whose children are partly checked.
5
+ */
6
+ export declare class JlCheckbox extends JlFormControl {
7
+ static readonly selector = "jl-checkbox";
8
+ readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
9
+ change: boolean;
10
+ }>>;
11
+ readonly checked: Readonly<Readonly<{
12
+ get(): boolean;
13
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
14
+ }>>;
15
+ /** Neither checked nor unchecked: a dash, until the next click decides. */
16
+ readonly indeterminate: Readonly<Readonly<{
17
+ get(): boolean;
18
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
19
+ }>>;
20
+ /** The text beside the box; the default slot takes a richer label. */
21
+ readonly label: Readonly<Readonly<{
22
+ get(): string;
23
+ set(setter: string | ((prevState: string) => string)): void;
24
+ }>>;
25
+ /** A smaller line under the label. */
26
+ readonly description: Readonly<Readonly<{
27
+ get(): string;
28
+ set(setter: string | ((prevState: string) => string)): void;
29
+ }>>;
30
+ /** What the form gets while the box is checked. */
31
+ readonly value: Readonly<Readonly<{
32
+ get(): string;
33
+ set(setter: string | ((prevState: string) => string)): void;
34
+ }>>;
35
+ readonly required: Readonly<Readonly<{
36
+ get(): boolean;
37
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
38
+ }>>;
39
+ readonly disabled: Readonly<Readonly<{
40
+ get(): boolean;
41
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
42
+ }>>;
43
+ private readonly _form;
44
+ private readonly _refs;
45
+ focus(options?: FocusOptions): void;
46
+ /** Flips the state, as a click would, and fires `change`. */
47
+ toggle(): void;
48
+ templateHtml(): Node;
49
+ templateCss(): string;
50
+ onConnect(): void;
51
+ protected resetValue(): void;
52
+ /** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
53
+ protected setDisabledByForm(disabled: boolean): void;
54
+ private renderDisabled;
55
+ private commit;
56
+ private renderChecked;
57
+ /** Hides the text column when there is nothing to show, so a lone box has no gap beside it. */
58
+ private renderText;
59
+ private renderIndeterminate;
60
+ private renderFormValue;
61
+ }
@@ -0,0 +1,149 @@
1
+ import { BASE_STYLES } from "../styles/shared.js";
2
+ import { JlFormControl } from "../base/jl-form-control.js";
3
+ import { registerIcons } from "../lib/icons.js";
4
+ import { JlIcon } from "./jl-icon.js";
5
+ import jl_checkbox_default from "./jl-checkbox.css_raw.js";
6
+ import { css } from "@jadis/core";
7
+ import { Check, Minus } from "lucide";
8
+ import { jsx, jsxs } from "@jadis/core/jsx-runtime";
9
+ // src/atoms/jl-checkbox.tsx
10
+ registerIcons({
11
+ check: Check,
12
+ minus: Minus
13
+ });
14
+ var ICON_SIZE = 12;
15
+ var DEFAULT_VALUE = "on";
16
+ /**
17
+ * A box to tick, with its label beside it: clicking the label toggles it too. `checked` is the state; the form
18
+ * gets `value` while it is checked. `indeterminate` draws a dash for a parent whose children are partly checked.
19
+ */
20
+ var JlCheckbox = class extends JlFormControl {
21
+ static selector = "jl-checkbox";
22
+ events = this.useEvents();
23
+ checked = this.useChange(false, (value) => this.renderChecked(value), { attribute: "checked" });
24
+ /** Neither checked nor unchecked: a dash, until the next click decides. */
25
+ indeterminate = this.useChange(false, (value) => this.renderIndeterminate(value), { attribute: "indeterminate" });
26
+ /** The text beside the box; the default slot takes a richer label. */
27
+ label = this.useChange("", (value) => {
28
+ this._refs.label.textContent = value;
29
+ this._refs.label.hidden = value === "";
30
+ this.renderText();
31
+ }, { attribute: "label" });
32
+ /** A smaller line under the label. */
33
+ description = this.useChange("", (value) => {
34
+ this._refs.description.textContent = value;
35
+ this._refs.description.hidden = value === "";
36
+ this.renderText();
37
+ }, { attribute: "description" });
38
+ /** What the form gets while the box is checked. */
39
+ value = this.useChange(DEFAULT_VALUE, () => this.renderFormValue(), { attribute: "value" });
40
+ required = this.useChange(false, (value) => {
41
+ this._refs.native.required = value;
42
+ this.reflect("required", value);
43
+ this.mirrorValidity(this._refs.native);
44
+ }, { attribute: "required" });
45
+ disabled = this.useChange(false, (value) => {
46
+ this.reflect("disabled", value);
47
+ this.renderDisabled();
48
+ }, { attribute: "disabled" });
49
+ _form = { disabled: false };
50
+ _refs = this.useRefs((ref) => ({
51
+ description: ref(".description"),
52
+ label: ref(".label"),
53
+ native: ref("input"),
54
+ slot: ref("slot"),
55
+ text: ref(".text")
56
+ }));
57
+ focus(options) {
58
+ this._refs.native.focus(options);
59
+ }
60
+ /** Flips the state, as a click would, and fires `change`. */
61
+ toggle() {
62
+ this.commit(!this.checked.get());
63
+ }
64
+ templateHtml() {
65
+ return /* @__PURE__ */ jsxs("label", {
66
+ class: "wrap",
67
+ attrs: { part: "base" },
68
+ children: [/* @__PURE__ */ jsxs("span", {
69
+ class: "box",
70
+ children: [
71
+ /* @__PURE__ */ jsx("input", {
72
+ type: "checkbox",
73
+ class: "native",
74
+ "aria-describedby": "description"
75
+ }),
76
+ /* @__PURE__ */ jsx(JlIcon, {
77
+ class: "mark check",
78
+ name: "check",
79
+ size: ICON_SIZE
80
+ }),
81
+ /* @__PURE__ */ jsx(JlIcon, {
82
+ class: "mark dash",
83
+ name: "minus",
84
+ size: ICON_SIZE
85
+ })
86
+ ]
87
+ }), /* @__PURE__ */ jsxs("span", {
88
+ class: "text",
89
+ hidden: true,
90
+ children: [/* @__PURE__ */ jsxs("span", {
91
+ class: "title",
92
+ children: [/* @__PURE__ */ jsx("span", {
93
+ class: "label",
94
+ hidden: true
95
+ }), /* @__PURE__ */ jsx("slot", {})]
96
+ }), /* @__PURE__ */ jsx("span", {
97
+ id: "description",
98
+ class: "description",
99
+ hidden: true
100
+ })]
101
+ })]
102
+ });
103
+ }
104
+ templateCss() {
105
+ return css`${BASE_STYLES}${jl_checkbox_default}`;
106
+ }
107
+ onConnect() {
108
+ const native = this._refs.native;
109
+ this.on(native, "change", () => this.commit(native.checked));
110
+ this.renderText();
111
+ this.on(this._refs.slot, "slotchange", () => this.renderText());
112
+ }
113
+ resetValue() {
114
+ this.checked.set(this.hasAttribute("checked"));
115
+ this.indeterminate.set(this.hasAttribute("indeterminate"));
116
+ }
117
+ /** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
118
+ setDisabledByForm(disabled) {
119
+ this._form.disabled = disabled;
120
+ this.whenRendered(() => this.renderDisabled());
121
+ }
122
+ renderDisabled() {
123
+ this._refs.native.disabled = this.disabled.get() || this._form.disabled;
124
+ }
125
+ commit(checked) {
126
+ this.indeterminate.set(false);
127
+ this.checked.set(checked);
128
+ this.events.emit("change", checked);
129
+ }
130
+ renderChecked(checked) {
131
+ const native = this._refs.native;
132
+ if (native.checked !== checked) native.checked = checked;
133
+ this.renderFormValue();
134
+ }
135
+ /** Hides the text column when there is nothing to show, so a lone box has no gap beside it. */
136
+ renderText() {
137
+ const slotted = this._refs.slot.assignedNodes().some((node) => node instanceof Element || node.textContent?.trim() !== "");
138
+ this._refs.text.hidden = this.label.get() === "" && this.description.get() === "" && !slotted;
139
+ }
140
+ renderIndeterminate(indeterminate) {
141
+ this._refs.native.indeterminate = indeterminate;
142
+ }
143
+ renderFormValue() {
144
+ this.internals.setFormValue(this.checked.get() ? this.value.get() : null);
145
+ this.mirrorValidity(this._refs.native);
146
+ }
147
+ };
148
+ JlCheckbox.register();
149
+ export { JlCheckbox };
@@ -0,0 +1,3 @@
1
+ // src/atoms/jl-chip.css?raw
2
+ var jl_chip_default = ":host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: middle;\n --height: 28px;\n --pad: 10px;\n --font-size: var(--jl-font-sm);\n --dismiss: 20px;\n}\n\n:host([size=\"sm\"]) {\n --height: 24px;\n --pad: 8px;\n --font-size: var(--jl-font-xs);\n --dismiss: 18px;\n}\n\n.chip {\n display: inline-flex;\n align-items: center;\n min-width: 0;\n height: var(--height);\n border: 1px solid var(--jl-line-strong);\n border-radius: var(--jl-radius-pill);\n background: var(--jl-surface);\n color: var(--jl-text-2);\n font-size: var(--font-size);\n font-weight: 600;\n line-height: 1;\n white-space: nowrap;\n transition:\n background var(--jl-fast) var(--jl-ease),\n border-color var(--jl-fast) var(--jl-ease),\n color var(--jl-fast) var(--jl-ease);\n}\n\n.main {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n height: 100%;\n padding: 0 var(--pad);\n border-radius: inherit;\n}\n\n.label {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.label:empty {\n display: none;\n}\n\n:host([removable]) .main {\n padding-right: 4px;\n}\n\n:host([selectable]) .main {\n cursor: pointer;\n}\n\n:host([selectable]:not([disabled])) .chip:hover {\n background: var(--jl-surface-2);\n}\n\n:host([selected]) .chip,\n:host([selected][selectable]:not([disabled])) .chip:hover {\n border-color: var(--jl-accent-line);\n background: var(--jl-accent-soft);\n color: var(--jl-accent);\n}\n\n/* The ring goes around the whole chip, which the main part fills. */\n.main:focus-visible {\n box-shadow: none;\n}\n\n.chip:has(.main:focus-visible) {\n box-shadow: var(--jl-focus-ring);\n}\n\n.dismiss {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: var(--dismiss);\n height: var(--dismiss);\n margin-right: 3px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--jl-muted);\n cursor: pointer;\n}\n\n.dismiss:hover {\n background: var(--jl-surface-3);\n color: var(--jl-text);\n}\n\n:host([selected]) .dismiss {\n color: var(--jl-accent);\n}\n\n:host([selected]) .dismiss:hover {\n background: color-mix(in srgb, var(--jl-accent) 14%, transparent);\n color: var(--jl-accent-strong);\n}\n\n:host([disabled]) .chip {\n opacity: 0.5;\n}\n\n:host([disabled]) .main,\n:host([disabled]) .dismiss {\n cursor: not-allowed;\n}\n\n:host([disabled]) .dismiss:hover {\n background: transparent;\n}\n";
3
+ export { jl_chip_default as default };
@@ -0,0 +1,59 @@
1
+ import { JlElement } from '../base/jl-element';
2
+ import type { ChipSize } from '../types/jl-chip.types';
3
+ export declare const CHIP_SIZES: readonly ChipSize[];
4
+ /**
5
+ * A compact token: a filter people turn on and off (`selectable`), a tag they can take away (`removable`), or a
6
+ * plain label. Fires `change` with the new state when pressed, and `dismiss` when its × is.
7
+ */
8
+ export declare class JlChip extends JlElement {
9
+ static readonly selector = "jl-chip";
10
+ readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
11
+ change: boolean;
12
+ dismiss: undefined;
13
+ }>>;
14
+ readonly label: Readonly<Readonly<{
15
+ get(): string;
16
+ set(setter: string | ((prevState: string) => string)): void;
17
+ }>>;
18
+ readonly icon: Readonly<Readonly<{
19
+ get(): string;
20
+ set(setter: string | ((prevState: string) => string)): void;
21
+ }>>;
22
+ /** Turns on and off when pressed, like a toggle button. */
23
+ readonly selectable: Readonly<Readonly<{
24
+ get(): boolean;
25
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
26
+ }>>;
27
+ readonly selected: Readonly<Readonly<{
28
+ get(): boolean;
29
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
30
+ }>>;
31
+ /** Shows an × that fires `dismiss`; the page takes the chip away. */
32
+ readonly removable: Readonly<Readonly<{
33
+ get(): boolean;
34
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
35
+ }>>;
36
+ readonly disabled: Readonly<Readonly<{
37
+ get(): boolean;
38
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
39
+ }>>;
40
+ readonly size: Readonly<Readonly<{
41
+ get(): ChipSize;
42
+ set(setter: ((prevState: ChipSize) => ChipSize) | ChipSize): void;
43
+ }>>;
44
+ private readonly _refs;
45
+ focus(options?: FocusOptions): void;
46
+ /** Turns the chip on or off as a press would, and fires `change`. */
47
+ toggle(): void;
48
+ templateHtml(): Node;
49
+ templateCss(): string;
50
+ onConnect(): void;
51
+ private onMainKey;
52
+ private dismiss;
53
+ /** A selectable chip is a toggle button; a plain one is only text. */
54
+ private renderInteraction;
55
+ /** The chip's icon; a selected filter without one shows a check. */
56
+ private renderIcon;
57
+ private renderLabel;
58
+ private renderSize;
59
+ }
@@ -0,0 +1,164 @@
1
+ import { BASE_STYLES } from "../styles/shared.js";
2
+ import { JlElement } from "../base/jl-element.js";
3
+ import { oneOf } from "../lib/attributes.js";
4
+ import { registerIcons } from "../lib/icons.js";
5
+ import { JlIcon } from "./jl-icon.js";
6
+ import { isActivationKey } from "../lib/surface.js";
7
+ import jl_chip_default from "./jl-chip.css_raw.js";
8
+ import { css } from "@jadis/core";
9
+ import { Check, X } from "lucide";
10
+ import { jsx, jsxs } from "@jadis/core/jsx-runtime";
11
+ // src/atoms/jl-chip.tsx
12
+ registerIcons({
13
+ check: Check,
14
+ x: X
15
+ });
16
+ var CHIP_SIZES = ["md", "sm"];
17
+ var ICON_SIZES = {
18
+ md: 14,
19
+ sm: 12
20
+ };
21
+ var DISMISS_ICON_SIZES = {
22
+ md: 13,
23
+ sm: 12
24
+ };
25
+ var DISMISS_KEYS = ["Backspace", "Delete"];
26
+ var SELECTED_ICON = "check";
27
+ /**
28
+ * A compact token: a filter people turn on and off (`selectable`), a tag they can take away (`removable`), or a
29
+ * plain label. Fires `change` with the new state when pressed, and `dismiss` when its × is.
30
+ */
31
+ var JlChip = class extends JlElement {
32
+ static selector = "jl-chip";
33
+ events = this.useEvents();
34
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
35
+ icon = this.useChange("", () => this.renderIcon(), { attribute: "icon" });
36
+ /** Turns on and off when pressed, like a toggle button. */
37
+ selectable = this.useChange(false, (value) => {
38
+ this.reflect("selectable", value);
39
+ this.renderInteraction();
40
+ this.renderIcon();
41
+ }, { attribute: "selectable" });
42
+ selected = this.useChange(false, (value) => {
43
+ this.reflect("selected", value);
44
+ this.renderInteraction();
45
+ this.renderIcon();
46
+ }, { attribute: "selected" });
47
+ /** Shows an × that fires `dismiss`; the page takes the chip away. */
48
+ removable = this.useChange(false, (value) => {
49
+ this._refs.dismiss.hidden = !value;
50
+ this.reflect("removable", value);
51
+ }, { attribute: "removable" });
52
+ disabled = this.useChange(false, (value) => {
53
+ this._refs.dismiss.disabled = value;
54
+ this.reflect("disabled", value);
55
+ this.renderInteraction();
56
+ }, { attribute: "disabled" });
57
+ size = this.useChange("md", (value) => this.renderSize(value), {
58
+ attribute: "size",
59
+ parse: oneOf(CHIP_SIZES, "md")
60
+ });
61
+ _refs = this.useRefs((ref) => ({
62
+ dismiss: ref(".dismiss"),
63
+ dismissIcon: ref(".dismiss jl-icon"),
64
+ icon: ref(".icon"),
65
+ label: ref(".label"),
66
+ main: ref(".main")
67
+ }));
68
+ focus(options) {
69
+ (this.selectable.get() ? this._refs.main : this._refs.dismiss).focus(options);
70
+ }
71
+ /** Turns the chip on or off as a press would, and fires `change`. */
72
+ toggle() {
73
+ if (!this.selectable.get() || this.disabled.get()) return;
74
+ this.selected.set(!this.selected.get());
75
+ this.events.emit("change", this.selected.get());
76
+ }
77
+ templateHtml() {
78
+ return /* @__PURE__ */ jsxs("span", {
79
+ class: "chip",
80
+ attrs: { part: "base" },
81
+ children: [/* @__PURE__ */ jsxs("span", {
82
+ class: "main",
83
+ children: [
84
+ /* @__PURE__ */ jsx(JlIcon, {
85
+ class: "icon",
86
+ hidden: true
87
+ }),
88
+ /* @__PURE__ */ jsx("span", { class: "label" }),
89
+ /* @__PURE__ */ jsx("slot", {})
90
+ ]
91
+ }), /* @__PURE__ */ jsx("button", {
92
+ class: "dismiss",
93
+ type: "button",
94
+ "aria-label": "Remove",
95
+ hidden: true,
96
+ children: /* @__PURE__ */ jsx(JlIcon, { name: "x" })
97
+ })]
98
+ });
99
+ }
100
+ templateCss() {
101
+ return css`${BASE_STYLES}${jl_chip_default}`;
102
+ }
103
+ onConnect() {
104
+ const main = this._refs.main;
105
+ this.on(main, "click", () => this.toggle());
106
+ this.on(main, "keydown", (event) => this.onMainKey(event));
107
+ this.on(this._refs.dismiss, "click", () => this.dismiss());
108
+ }
109
+ onMainKey(event) {
110
+ if (isActivationKey(event)) {
111
+ event.preventDefault();
112
+ this.toggle();
113
+ return;
114
+ }
115
+ if (DISMISS_KEYS.includes(event.key) && this.removable.get()) {
116
+ event.preventDefault();
117
+ this.dismiss();
118
+ }
119
+ }
120
+ dismiss() {
121
+ if (this.disabled.get()) return;
122
+ this.events.emit("dismiss");
123
+ }
124
+ /** A selectable chip is a toggle button; a plain one is only text. */
125
+ renderInteraction() {
126
+ const main = this._refs.main;
127
+ const selectable = this.selectable.get();
128
+ const disabled = this.disabled.get();
129
+ if (!selectable) {
130
+ main.removeAttribute("role");
131
+ main.removeAttribute("tabindex");
132
+ main.removeAttribute("aria-pressed");
133
+ main.removeAttribute("aria-disabled");
134
+ return;
135
+ }
136
+ main.setAttribute("role", "button");
137
+ main.setAttribute("aria-pressed", String(this.selected.get()));
138
+ main.toggleAttribute("aria-disabled", disabled);
139
+ if (disabled) {
140
+ main.removeAttribute("tabindex");
141
+ return;
142
+ }
143
+ main.tabIndex = 0;
144
+ }
145
+ /** The chip's icon; a selected filter without one shows a check. */
146
+ renderIcon() {
147
+ const icon = this.icon.get();
148
+ const name = icon === "" && this.selectable.get() && this.selected.get() ? SELECTED_ICON : icon;
149
+ this._refs.icon.name.set(name);
150
+ this._refs.icon.hidden = name === "";
151
+ }
152
+ renderLabel() {
153
+ const label = this.label.get();
154
+ this._refs.label.textContent = label;
155
+ this._refs.dismiss.setAttribute("aria-label", label === "" ? "Remove" : `Remove ${label}`);
156
+ }
157
+ renderSize(size) {
158
+ this.reflect("size", size);
159
+ this._refs.icon.size.set(ICON_SIZES[size]);
160
+ this._refs.dismissIcon.size.set(DISMISS_ICON_SIZES[size]);
161
+ }
162
+ };
163
+ JlChip.register();
164
+ export { CHIP_SIZES, JlChip };
@@ -0,0 +1,3 @@
1
+ // src/atoms/jl-divider.css?raw
2
+ var jl_divider_default = ":host {\n display: block;\n --color: var(--jl-line);\n --thickness: 1px;\n --gap: 12px;\n}\n\n:host([vertical]) {\n display: inline-flex;\n align-self: stretch;\n min-height: 1em;\n vertical-align: middle;\n}\n\n.divider {\n display: flex;\n align-items: center;\n gap: var(--gap);\n width: 100%;\n}\n\n:host([vertical]) .divider {\n flex-direction: column;\n width: auto;\n height: auto;\n}\n\n.line {\n flex: 1;\n height: var(--thickness);\n background: var(--color);\n}\n\n:host([vertical]) .line {\n width: var(--thickness);\n height: auto;\n min-height: 4px;\n}\n\n/* Without a label, one line runs through: two would leave the gap between them. */\n:host(:not([labelled])) .after {\n display: none;\n}\n\n/* A label at the start or the end sits flush with that edge, as a section heading. */\n:host([labelled][align=\"start\"]) .before,\n:host([labelled][align=\"end\"]) .after {\n display: none;\n}\n\n.label {\n flex: none;\n max-width: 80%;\n color: var(--jl-muted);\n font-size: var(--jl-font-xs);\n font-weight: 600;\n line-height: 1.4;\n text-align: center;\n}\n\n:host([vertical]) .label {\n max-width: none;\n writing-mode: horizontal-tb;\n}\n";
3
+ export { jl_divider_default as default };
@@ -0,0 +1,26 @@
1
+ import { JlElement } from '../base/jl-element';
2
+ import type { DividerAlign } from '../types/jl-divider.types';
3
+ export declare const DIVIDER_ALIGNS: readonly DividerAlign[];
4
+ /**
5
+ * A line between groups of content, across or (`vertical`) up and down. A `label` sits on the line: "or",
6
+ * "Today", "Advanced".
7
+ */
8
+ export declare class JlDivider extends JlElement {
9
+ static readonly selector = "jl-divider";
10
+ readonly label: Readonly<Readonly<{
11
+ get(): string;
12
+ set(setter: string | ((prevState: string) => string)): void;
13
+ }>>;
14
+ readonly vertical: Readonly<Readonly<{
15
+ get(): boolean;
16
+ set(setter: boolean | ((prevState: boolean) => boolean)): void;
17
+ }>>;
18
+ /** Where the label sits along the line. */
19
+ readonly align: Readonly<Readonly<{
20
+ get(): DividerAlign;
21
+ set(setter: ((prevState: DividerAlign) => DividerAlign) | DividerAlign): void;
22
+ }>>;
23
+ private readonly _refs;
24
+ templateHtml(): Node;
25
+ templateCss(): string;
26
+ }