@crowdstrike/glide-core 0.5.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 (272) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/dist/accordion.d.ts +23 -0
  4. package/dist/accordion.js +1 -0
  5. package/dist/accordion.stories.d.ts +9 -0
  6. package/dist/accordion.styles.d.ts +2 -0
  7. package/dist/accordion.styles.js +98 -0
  8. package/dist/accordion.test.basics.d.ts +1 -0
  9. package/dist/accordion.test.events.d.ts +1 -0
  10. package/dist/button-group.button.d.ts +33 -0
  11. package/dist/button-group.button.js +1 -0
  12. package/dist/button-group.button.styles.d.ts +2 -0
  13. package/dist/button-group.button.styles.js +99 -0
  14. package/dist/button-group.button.test.basics.d.ts +1 -0
  15. package/dist/button-group.button.test.events.d.ts +1 -0
  16. package/dist/button-group.d.ts +26 -0
  17. package/dist/button-group.js +1 -0
  18. package/dist/button-group.stories.d.ts +16 -0
  19. package/dist/button-group.styles.d.ts +2 -0
  20. package/dist/button-group.styles.js +18 -0
  21. package/dist/button-group.test.basics.d.ts +1 -0
  22. package/dist/button-group.test.events.d.ts +1 -0
  23. package/dist/button.d.ts +29 -0
  24. package/dist/button.js +1 -0
  25. package/dist/button.stories.d.ts +17 -0
  26. package/dist/button.styles.d.ts +2 -0
  27. package/dist/button.styles.js +133 -0
  28. package/dist/button.test.basics.d.ts +1 -0
  29. package/dist/button.test.events.d.ts +1 -0
  30. package/dist/button.test.form.d.ts +1 -0
  31. package/dist/checkbox-group.d.ts +43 -0
  32. package/dist/checkbox-group.js +1 -0
  33. package/dist/checkbox-group.stories.d.ts +7 -0
  34. package/dist/checkbox-group.styles.d.ts +2 -0
  35. package/dist/checkbox-group.styles.js +20 -0
  36. package/dist/checkbox-group.test.basics.d.ts +1 -0
  37. package/dist/checkbox-group.test.events.d.ts +1 -0
  38. package/dist/checkbox-group.test.focus.d.ts +1 -0
  39. package/dist/checkbox-group.test.form.d.ts +1 -0
  40. package/dist/checkbox-group.test.validity.d.ts +1 -0
  41. package/dist/checkbox.d.ts +50 -0
  42. package/dist/checkbox.js +1 -0
  43. package/dist/checkbox.stories.d.ts +9 -0
  44. package/dist/checkbox.styles.d.ts +2 -0
  45. package/dist/checkbox.styles.js +116 -0
  46. package/dist/checkbox.test.basics.d.ts +1 -0
  47. package/dist/checkbox.test.events.d.ts +1 -0
  48. package/dist/checkbox.test.focus.d.ts +1 -0
  49. package/dist/checkbox.test.form.d.ts +1 -0
  50. package/dist/checkbox.test.states.d.ts +1 -0
  51. package/dist/checkbox.test.validity.d.ts +1 -0
  52. package/dist/drawer.d.ts +30 -0
  53. package/dist/drawer.js +15 -0
  54. package/dist/drawer.stories.d.ts +7 -0
  55. package/dist/drawer.styles.d.ts +2 -0
  56. package/dist/drawer.styles.js +34 -0
  57. package/dist/drawer.test.accessibility.d.ts +1 -0
  58. package/dist/drawer.test.basics.d.ts +1 -0
  59. package/dist/drawer.test.closing.d.ts +1 -0
  60. package/dist/drawer.test.events.d.ts +1 -0
  61. package/dist/drawer.test.methods.d.ts +1 -0
  62. package/dist/dropdown.d.ts +66 -0
  63. package/dist/dropdown.js +1 -0
  64. package/dist/dropdown.option.d.ts +33 -0
  65. package/dist/dropdown.option.js +1 -0
  66. package/dist/dropdown.option.styles.d.ts +2 -0
  67. package/dist/dropdown.option.styles.js +64 -0
  68. package/dist/dropdown.option.test.basics.d.ts +1 -0
  69. package/dist/dropdown.option.test.basics.multiple.d.ts +1 -0
  70. package/dist/dropdown.option.test.basics.single.d.ts +1 -0
  71. package/dist/dropdown.option.test.events.d.ts +1 -0
  72. package/dist/dropdown.option.test.focus.multiple.d.ts +1 -0
  73. package/dist/dropdown.option.test.focus.single.d.ts +1 -0
  74. package/dist/dropdown.option.test.interactions.multiple.d.ts +1 -0
  75. package/dist/dropdown.option.test.interactions.single.d.ts +1 -0
  76. package/dist/dropdown.stories.d.ts +15 -0
  77. package/dist/dropdown.styles.d.ts +2 -0
  78. package/dist/dropdown.styles.js +162 -0
  79. package/dist/dropdown.test.basics.d.ts +1 -0
  80. package/dist/dropdown.test.basics.filterable.d.ts +1 -0
  81. package/dist/dropdown.test.basics.multiple.d.ts +1 -0
  82. package/dist/dropdown.test.basics.single.d.ts +1 -0
  83. package/dist/dropdown.test.events.d.ts +1 -0
  84. package/dist/dropdown.test.focus.filterable.d.ts +1 -0
  85. package/dist/dropdown.test.focus.multiple.d.ts +1 -0
  86. package/dist/dropdown.test.focus.single.d.ts +1 -0
  87. package/dist/dropdown.test.form.d.ts +1 -0
  88. package/dist/dropdown.test.form.multiple.d.ts +1 -0
  89. package/dist/dropdown.test.form.single.d.ts +1 -0
  90. package/dist/dropdown.test.interactions.d.ts +1 -0
  91. package/dist/dropdown.test.interactions.filterable.d.ts +1 -0
  92. package/dist/dropdown.test.interactions.multiple.d.ts +1 -0
  93. package/dist/dropdown.test.interactions.single.d.ts +1 -0
  94. package/dist/dropdown.test.validity.d.ts +1 -0
  95. package/dist/icon-button.d.ts +22 -0
  96. package/dist/icon-button.js +1 -0
  97. package/dist/icon-button.stories.d.ts +8 -0
  98. package/dist/icon-button.styles.d.ts +2 -0
  99. package/dist/icon-button.styles.js +112 -0
  100. package/dist/icon-button.test.basics.d.ts +1 -0
  101. package/dist/icons/checked.d.ts +2 -0
  102. package/dist/icons/checked.js +1 -0
  103. package/dist/icons/magnifying-glass.d.ts +2 -0
  104. package/dist/icons/magnifying-glass.js +1 -0
  105. package/dist/input.d.ts +67 -0
  106. package/dist/input.js +1 -0
  107. package/dist/input.stories.d.ts +19 -0
  108. package/dist/input.styles.d.ts +2 -0
  109. package/dist/input.styles.js +109 -0
  110. package/dist/input.test.basics.d.ts +1 -0
  111. package/dist/input.test.events.d.ts +1 -0
  112. package/dist/input.test.focus.d.ts +1 -0
  113. package/dist/input.test.form.d.ts +1 -0
  114. package/dist/input.test.validity.d.ts +1 -0
  115. package/dist/label.d.ts +33 -0
  116. package/dist/label.js +1 -0
  117. package/dist/label.styles.d.ts +2 -0
  118. package/dist/label.styles.js +154 -0
  119. package/dist/label.test.basics.d.ts +1 -0
  120. package/dist/library/expect-argument-error.d.ts +1 -0
  121. package/dist/library/expect-argument-error.js +1 -0
  122. package/dist/library/ow.d.ts +16 -0
  123. package/dist/library/ow.js +1 -0
  124. package/dist/library/ow.test.d.ts +4 -0
  125. package/dist/menu.button.d.ts +21 -0
  126. package/dist/menu.button.js +1 -0
  127. package/dist/menu.button.styles.d.ts +2 -0
  128. package/dist/menu.button.styles.js +20 -0
  129. package/dist/menu.button.test.basics.d.ts +1 -0
  130. package/dist/menu.d.ts +27 -0
  131. package/dist/menu.js +1 -0
  132. package/dist/menu.link.d.ts +22 -0
  133. package/dist/menu.link.js +1 -0
  134. package/dist/menu.link.styles.d.ts +2 -0
  135. package/dist/menu.link.styles.js +22 -0
  136. package/dist/menu.link.test.basics.d.ts +1 -0
  137. package/dist/menu.stories.d.ts +9 -0
  138. package/dist/menu.styles.d.ts +2 -0
  139. package/dist/menu.styles.js +61 -0
  140. package/dist/menu.test.basics.d.ts +1 -0
  141. package/dist/menu.test.focus.d.ts +2 -0
  142. package/dist/menu.test.interactions.d.ts +2 -0
  143. package/dist/modal.d.ts +51 -0
  144. package/dist/modal.icon-button.d.ts +26 -0
  145. package/dist/modal.icon-button.js +1 -0
  146. package/dist/modal.icon-button.styles.d.ts +2 -0
  147. package/dist/modal.icon-button.styles.js +8 -0
  148. package/dist/modal.icon-button.test.basics.d.ts +1 -0
  149. package/dist/modal.js +15 -0
  150. package/dist/modal.stories.d.ts +14 -0
  151. package/dist/modal.styles.d.ts +2 -0
  152. package/dist/modal.styles.js +169 -0
  153. package/dist/modal.tertiary-icon.d.ts +21 -0
  154. package/dist/modal.tertiary-icon.js +1 -0
  155. package/dist/modal.tertiary-icon.test.basics.d.ts +1 -0
  156. package/dist/modal.test.accessibility.d.ts +1 -0
  157. package/dist/modal.test.basics.d.ts +3 -0
  158. package/dist/modal.test.close.d.ts +1 -0
  159. package/dist/modal.test.events.d.ts +1 -0
  160. package/dist/modal.test.lock-scroll.d.ts +1 -0
  161. package/dist/modal.test.methods.d.ts +1 -0
  162. package/dist/modal.test.scrollbars.d.ts +1 -0
  163. package/dist/radio-group.d.ts +48 -0
  164. package/dist/radio-group.js +1 -0
  165. package/dist/radio-group.stories.d.ts +8 -0
  166. package/dist/radio-group.styles.d.ts +2 -0
  167. package/dist/radio-group.styles.js +40 -0
  168. package/dist/radio-group.test.basics.d.ts +2 -0
  169. package/dist/radio-group.test.events.d.ts +2 -0
  170. package/dist/radio-group.test.focus.d.ts +2 -0
  171. package/dist/radio-group.test.form.d.ts +1 -0
  172. package/dist/radio-group.test.validity.d.ts +1 -0
  173. package/dist/radio.d.ts +23 -0
  174. package/dist/radio.js +1 -0
  175. package/dist/radio.styles.d.ts +2 -0
  176. package/dist/radio.styles.js +92 -0
  177. package/dist/status-indicator.d.ts +30 -0
  178. package/dist/status-indicator.js +1 -0
  179. package/dist/status-indicator.stories.d.ts +17 -0
  180. package/dist/status-indicator.styles.d.ts +2 -0
  181. package/dist/status-indicator.styles.js +58 -0
  182. package/dist/status-indicator.test.basics.d.ts +1 -0
  183. package/dist/styles/focus-outline.d.ts +2 -0
  184. package/dist/styles/focus-outline.js +4 -0
  185. package/dist/styles/fonts.css +1 -0
  186. package/dist/styles/variables.css +1 -0
  187. package/dist/styles/visually-hidden.d.ts +2 -0
  188. package/dist/styles/visually-hidden.js +11 -0
  189. package/dist/tab.d.ts +32 -0
  190. package/dist/tab.group.d.ts +35 -0
  191. package/dist/tab.group.js +1 -0
  192. package/dist/tab.group.styles.d.ts +2 -0
  193. package/dist/tab.group.styles.js +27 -0
  194. package/dist/tab.group.test.basics.d.ts +3 -0
  195. package/dist/tab.js +1 -0
  196. package/dist/tab.panel.d.ts +26 -0
  197. package/dist/tab.panel.js +1 -0
  198. package/dist/tab.panel.styles.d.ts +2 -0
  199. package/dist/tab.panel.styles.js +9 -0
  200. package/dist/tab.styles.d.ts +2 -0
  201. package/dist/tab.styles.js +83 -0
  202. package/dist/tab.test.basics.d.ts +1 -0
  203. package/dist/tabs.stories.d.ts +9 -0
  204. package/dist/tag.d.ts +25 -0
  205. package/dist/tag.js +1 -0
  206. package/dist/tag.stories.d.ts +9 -0
  207. package/dist/tag.styles.d.ts +2 -0
  208. package/dist/tag.styles.js +133 -0
  209. package/dist/tag.test.basics.d.ts +1 -0
  210. package/dist/tag.test.events.d.ts +1 -0
  211. package/dist/tag.test.focus.d.ts +1 -0
  212. package/dist/textarea.d.ts +49 -0
  213. package/dist/textarea.js +2 -0
  214. package/dist/textarea.stories.d.ts +13 -0
  215. package/dist/textarea.styles.d.ts +2 -0
  216. package/dist/textarea.styles.js +69 -0
  217. package/dist/textarea.test.basics.d.ts +1 -0
  218. package/dist/textarea.test.events.d.ts +1 -0
  219. package/dist/textarea.test.form.d.ts +1 -0
  220. package/dist/textarea.test.validity.d.ts +1 -0
  221. package/dist/toasts.d.ts +29 -0
  222. package/dist/toasts.js +1 -0
  223. package/dist/toasts.stories.d.ts +7 -0
  224. package/dist/toasts.styles.d.ts +2 -0
  225. package/dist/toasts.styles.js +15 -0
  226. package/dist/toasts.test.basics.d.ts +1 -0
  227. package/dist/toasts.toast.d.ts +28 -0
  228. package/dist/toasts.toast.js +1 -0
  229. package/dist/toasts.toast.styles.d.ts +2 -0
  230. package/dist/toasts.toast.styles.js +60 -0
  231. package/dist/toasts.toast.test.basics.d.ts +1 -0
  232. package/dist/toggle.d.ts +31 -0
  233. package/dist/toggle.js +1 -0
  234. package/dist/toggle.stories.d.ts +7 -0
  235. package/dist/toggle.styles.d.ts +2 -0
  236. package/dist/toggle.styles.js +81 -0
  237. package/dist/toggle.test.basics.d.ts +1 -0
  238. package/dist/toggle.test.events.d.ts +1 -0
  239. package/dist/toggle.test.focus.d.ts +1 -0
  240. package/dist/toggle.test.states.d.ts +1 -0
  241. package/dist/tooltip.d.ts +21 -0
  242. package/dist/tooltip.js +1 -0
  243. package/dist/tooltip.stories.d.ts +7 -0
  244. package/dist/tooltip.styles.d.ts +2 -0
  245. package/dist/tooltip.styles.js +66 -0
  246. package/dist/tooltip.test.basics.d.ts +1 -0
  247. package/dist/tooltip.test.interactions.d.ts +1 -0
  248. package/dist/tree.d.ts +26 -0
  249. package/dist/tree.item.d.ts +43 -0
  250. package/dist/tree.item.icon-button.d.ts +20 -0
  251. package/dist/tree.item.icon-button.js +1 -0
  252. package/dist/tree.item.icon-button.styles.d.ts +2 -0
  253. package/dist/tree.item.icon-button.styles.js +9 -0
  254. package/dist/tree.item.icon-button.test.basics.d.ts +1 -0
  255. package/dist/tree.item.js +1 -0
  256. package/dist/tree.item.menu.d.ts +21 -0
  257. package/dist/tree.item.menu.js +1 -0
  258. package/dist/tree.item.menu.styles.d.ts +2 -0
  259. package/dist/tree.item.menu.styles.js +17 -0
  260. package/dist/tree.item.menu.test.basics.d.ts +1 -0
  261. package/dist/tree.item.styles.d.ts +2 -0
  262. package/dist/tree.item.styles.js +130 -0
  263. package/dist/tree.item.test.basics.d.ts +1 -0
  264. package/dist/tree.js +1 -0
  265. package/dist/tree.stories.d.ts +17 -0
  266. package/dist/tree.styles.d.ts +2 -0
  267. package/dist/tree.styles.js +7 -0
  268. package/dist/tree.test.aria.d.ts +1 -0
  269. package/dist/tree.test.basics.d.ts +3 -0
  270. package/dist/tree.test.events.d.ts +2 -0
  271. package/dist/tree.test.focus.d.ts +1 -0
  272. package/package.json +129 -0
@@ -0,0 +1,9 @@
1
+ import './icons/storybook.js';
2
+ import './menu.button.js';
3
+ import './menu.js';
4
+ import './menu.link.js';
5
+ import type { Meta, StoryObj } from '@storybook/web-components';
6
+ declare const meta: Meta;
7
+ export default meta;
8
+ export declare const Menu: StoryObj;
9
+ export declare const MenuWithIcon: StoryObj;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,61 @@
1
+ "use strict";import{css as i}from"lit";export default[i`
2
+ :host {
3
+ /* Contains elements with "padding", "margin", and "width". Inline by default. */
4
+ display: inline-block;
5
+ }
6
+
7
+ .component {
8
+ color: var(--glide-core-text-body-1);
9
+ display: flex;
10
+ }
11
+
12
+ .target-container {
13
+ display: flex;
14
+ position: relative;
15
+ }
16
+
17
+ .options {
18
+ background-color: var(--glide-core-surface-base-lighter);
19
+ border: 1px solid var(--glide-core-border-base-lighter);
20
+ border-radius: var(--glide-core-spacing-xs);
21
+ box-shadow: var(--glide-core-shadow-lg);
22
+ box-sizing: border-box;
23
+ inline-size: max-content;
24
+ inset-block-start: 0;
25
+ inset-inline-start: 0;
26
+ margin-block: 0;
27
+ min-inline-size: 9.375rem;
28
+ padding: var(--glide-core-spacing-xxxs);
29
+ position: absolute;
30
+ visibility: hidden;
31
+
32
+ &.visible {
33
+ visibility: visible;
34
+ }
35
+
36
+ &.large {
37
+ --gap: var(--glide-core-spacing-sm);
38
+ --padding-inline: var(--glide-core-spacing-sm);
39
+ --padding-block: var(--glide-core-spacing-xxs);
40
+
41
+ font-family: var(--glide-core-body-sm-font-family);
42
+ font-size: var(--glide-core-body-sm-font-size);
43
+ font-style: var(--glide-core-body-sm-font-style);
44
+ font-weight: var(--glide-core-body-sm-font-weight);
45
+ line-height: var(--glide-core-body-sm-line-height);
46
+ }
47
+
48
+ &.small {
49
+ --gap: var(--glide-core-spacing-xs);
50
+ --padding-inline: var(--glide-core-spacing-xs);
51
+ --padding-block: var(--glide-core-spacing-xxxs);
52
+ --size: 0.75rem;
53
+
54
+ font-family: var(--glide-core-body-xs-font-family);
55
+ font-size: var(--glide-core-body-xs-font-size);
56
+ font-style: var(--glide-core-body-xs-font-style);
57
+ font-weight: var(--glide-core-body-xs-font-weight);
58
+ line-height: var(--glide-core-body-xs-line-height);
59
+ }
60
+ }
61
+ `];
@@ -0,0 +1 @@
1
+ import './menu.button.js';
@@ -0,0 +1,2 @@
1
+ import './menu.js';
2
+ import './menu.link.js';
@@ -0,0 +1,2 @@
1
+ import './menu.js';
2
+ import './menu.link.js';
@@ -0,0 +1,51 @@
1
+ import './modal.icon-button.js';
2
+ import { LitElement } from 'lit';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'glide-core-modal': GlideCoreModal;
6
+ }
7
+ }
8
+ /**
9
+ * @description A Modal dialog component which interrupts interaction with the rest of the page.
10
+ *
11
+ * @event close - Emitted when the Modal closes.
12
+ *
13
+ * @function showModal - A method on the `glide-core-modal` component to open the Modal programmatically.
14
+ *
15
+ * @function close - A method on the `glide-core-modal` component to close the Modal programmatically.
16
+ *
17
+ * @slot - The content of the modal.
18
+ *
19
+ * @slot header-actions - A slot for placing additional header actions. These are co-located with the close button.
20
+ * Use the `glide-core-modal-icon-button` component only.
21
+ *
22
+ * @slot primary - A slot for rendering a primary action button. Normally a "Continue", "Next", or "Submit" action.
23
+ *
24
+ * @slot secondary - A slot for rendering a secondary action button. Normally a "Cancel" action.
25
+ *
26
+ * @slot tertiary - A slot for rendering an icon+tooltip for additional information,
27
+ * or a tertiary action button.
28
+ */
29
+ export default class GlideCoreModal extends LitElement {
30
+ #private;
31
+ static shadowRootOptions: ShadowRootInit;
32
+ static styles: import("lit").CSSResult[];
33
+ /** The title text for the Modal. */
34
+ label: string;
35
+ /** Adds a back/dismiss button in the Modal header. */
36
+ showBackButton: boolean;
37
+ /** Fixed-size options for the Modal. */
38
+ size?: 'small' | 'medium' | 'large' | 'xlarge';
39
+ /**
40
+ * Event called by consumers to programmatically close the Modal.
41
+ */
42
+ close(): void;
43
+ connectedCallback(): void;
44
+ disconnectedCallback(): void;
45
+ firstUpdated(): void;
46
+ render(): import("lit").TemplateResult<1>;
47
+ /**
48
+ * Method called by consumers to open the Modal.
49
+ */
50
+ showModal(): void;
51
+ }
@@ -0,0 +1,26 @@
1
+ import './icon-button.js';
2
+ import { LitElement } from 'lit';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'glide-core-modal-icon-button': GlideCoreModalIconButton;
6
+ }
7
+ }
8
+ /**
9
+ * @description A Modal Icon Button. Should be used only in the "header-actions" slot of a Modal.
10
+ *
11
+ * @slot - The content of the button. Should only be an icon. The icon should also leverage the
12
+ * "label" attribute for accessibility so that it is read to screenreaders.
13
+ *
14
+ * @example
15
+ * <glide-core-modal-icon-button slot="header-actions">
16
+ * <!-- icon here -->
17
+ * </glide-core-modal-icon-button>
18
+ */
19
+ export default class GlideCoreModalIconButton extends LitElement {
20
+ #private;
21
+ static shadowRootOptions: ShadowRootInit;
22
+ static styles: import("lit").CSSResult[];
23
+ label?: string | undefined;
24
+ firstUpdated(): void;
25
+ render(): import("lit").TemplateResult<1>;
26
+ }
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var p=(t,e,o,a)=>{for(var i=a>1?void 0:a?E(e,o):e,f=t.length-1,n;f>=0;f--)(n=t[f])&&(i=(a?n(e,o,i):n(i))||i);return a&&i&&u(e,o,i),i};var c=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)};var m=(t,e,o)=>(c(t,e,"read from private field"),o?o.call(t):e.get(t)),d=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)};var h=(t,e,o)=>(c(t,e,"access private method"),o);var l,s,v;import"./icon-button.js";import{LitElement as b,html as R}from"lit";import{createRef as S,ref as w}from"lit/directives/ref.js";import{customElement as y,property as L}from"lit/decorators.js";import{ifDefined as T}from"lit/directives/if-defined.js";import{owSlot as g}from"./library/ow.js";import $ from"./modal.icon-button.styles.js";let r=class extends b{constructor(){super(...arguments);d(this,s);this.label="";d(this,l,S())}firstUpdated(){g(m(this,l).value)}render(){return R`<glide-core-icon-button label="${T(this.label)}" variant="tertiary"><slot @slotchange="${h(this,s,v)}" ${w(m(this,l))}></slot></glide-core-icon-button>`}};l=new WeakMap,s=new WeakSet,v=function(){g(m(this,l).value)},r.shadowRootOptions={...b.shadowRootOptions,mode:"closed"},r.styles=$,p([L()],r.prototype,"label",2),r=p([y("glide-core-modal-icon-button")],r);export{r as default};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";import{css as e}from"lit";export default[e`
2
+ ::slotted(*) {
3
+ --size: 1.25rem;
4
+
5
+ block-size: 1.25rem;
6
+ inline-size: 1.25rem;
7
+ }
8
+ `];
@@ -0,0 +1 @@
1
+ export {};
package/dist/modal.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";var Y=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var b=(l,o,t,n)=>{for(var c=n>1?void 0:n?N(o,t):o,R=l.length-1,B;R>=0;R--)(B=l[R])&&(c=(n?B(o,t,c):B(c))||c);return n&&c&&Y(o,t,c),c};var z=(l,o,t)=>{if(!o.has(l))throw TypeError("Cannot "+t)};var e=(l,o,t)=>(z(l,o,"read from private field"),t?t.call(l):o.get(l)),i=(l,o,t)=>{if(o.has(l))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(l):o.set(l,t)};var r=(l,o,t)=>(z(l,o,"access private method"),t);var s,p,g,v,f,S,w,x,E,j,y,F,C,P,M,K,$,O,L,W,H,X;import"./modal.icon-button.js";import{LitElement as V,html as D}from"lit";import{classMap as U}from"lit/directives/class-map.js";import{createRef as m,ref as u}from"lit/directives/ref.js";import{customElement as q,property as T}from"lit/decorators.js";import{owSlot as I,owSlotType as d}from"./library/ow.js";import{when as J}from"lit/directives/when.js";import h from"./button.js";import Z from"./modal.icon-button.js";import A from"./modal.tertiary-icon.js";import Q from"./modal.styles.js";const k=new CSSStyleSheet;k.insertRule(`
2
+ @supports (scrollbar-gutter: stable) {
3
+ .private-glide-core-modal-lock-scroll {
4
+ scrollbar-gutter: stable !important;
5
+ overflow: hidden !important;
6
+ }
7
+ }
8
+ `),k.insertRule(`
9
+ @supports not (scrollbar-gutter: stable) {
10
+ .private-glide-core-modal-lock-scroll {
11
+ padding-right: var(--glide-scroll-size, 0.9375rem) !important;
12
+ overflow: hidden !important;
13
+ }
14
+ }
15
+ `);let a=class extends V{constructor(){super(...arguments);i(this,w);i(this,E);i(this,y);i(this,C);i(this,M);i(this,$);i(this,L);i(this,H);this.label="";this.showBackButton=!1;this.size="medium";i(this,s,m());i(this,p,m());i(this,g,m());i(this,v,m());i(this,f,m());i(this,S,m())}close(){e(this,s).value?.open&&(document.documentElement.classList.remove("private-glide-core-modal-lock-scroll"),this.dispatchEvent(new Event("close")),e(this,s).value?.close())}connectedCallback(){super.connectedCallback(),document.adoptedStyleSheets.includes(k)||document.adoptedStyleSheets.push(k)}disconnectedCallback(){super.disconnectedCallback(),document.documentElement.classList.remove("private-glide-core-modal-lock-scroll"),document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==k)}firstUpdated(){I(e(this,p).value),d(e(this,S).value,[Z]),d(e(this,g).value,[h]),d(e(this,v).value,[h]),d(e(this,f).value,[A,h])}render(){return D`<dialog class="${U({component:!0,small:this.size==="small",medium:this.size==="medium",large:this.size==="large",xlarge:this.size==="xlarge"})}" tabindex="-1" @keydown="${r(this,L,W)}" @mousedown="${r(this,H,X)}" ${u(e(this,s))}><header class="header"><h2 class="label" data-test="heading" id="heading">${J(this.showBackButton,()=>D`<glide-core-modal-icon-button data-test="back-button" @click="${r(this,w,x)}"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><title>Dismiss</title><path d="M12 18C11.4477 18 11 18.4477 11 19C11 19.5523 11.4477 20 12 20V18ZM20 14.5C20 16.433 18.433 18 16.5 18V20C19.5376 20 22 17.5376 22 14.5H20ZM16.5 11C18.433 11 20 12.567 20 14.5H22C22 11.4624 19.5376 9 16.5 9V11ZM16.5 18H12V20H16.5V18ZM16.5 9H3V11H16.5V9Z" fill="currentColor"/><path d="M7 6L3 10L7 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></glide-core-modal-icon-button>`)} ${this.label}</h2><div class="header-actions" role="toolbar"><slot name="header-actions" @slotchange="${r(this,$,O)}" ${u(e(this,S))}></slot><glide-core-modal-icon-button data-test="close-button" @click="${r(this,w,x)}"><svg width="24" height="24" viewBox="0 0 24 24" fill="none"><title>Close</title><path d="M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M18 6L6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></glide-core-modal-icon-button></div></header><article aria-labelledby="heading" class="body" role="region" tabindex="0"><slot @slotchange="${r(this,E,j)}" ${u(e(this,p))}></slot></article><footer class="footer"><menu class="menu"><li class="flex align-center"><slot name="tertiary" @slotchange="${r(this,M,K)}" ${u(e(this,f))}></slot></li><li><menu class="actions"><li><slot name="secondary" @slotchange="${r(this,C,P)}" ${u(e(this,v))}></slot></li><li><slot name="primary" @slotchange="${r(this,y,F)}" ${u(e(this,g))}></slot></li></menu></li></menu></footer></dialog>`}showModal(){if(!e(this,s).value?.open){if(document.documentElement.classList.add("private-glide-core-modal-lock-scroll"),!window.CSS.supports("scrollbar-gutter","stable")){const t=Math.abs(window.innerWidth-document.documentElement.clientWidth);document.documentElement.style.setProperty("--glide-scroll-size",`${t}px`)}e(this,s).value?.showModal(),e(this,s).value?.focus()}}};s=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap,f=new WeakMap,S=new WeakMap,w=new WeakSet,x=function(){document.documentElement.classList.remove("private-glide-core-modal-lock-scroll"),this.dispatchEvent(new Event("close")),e(this,s).value?.close()},E=new WeakSet,j=function(){I(e(this,p).value)},y=new WeakSet,F=function(){d(e(this,g).value,[h])},C=new WeakSet,P=function(){d(e(this,v).value,[h])},M=new WeakSet,K=function(){d(e(this,f).value,[A,h])},$=new WeakSet,O=function(){d(e(this,S).value,[Z])},L=new WeakSet,W=function(t){t.key==="Escape"&&(document.documentElement.classList.remove("private-glide-core-modal-lock-scroll"),this.dispatchEvent(new Event("close")),e(this,s).value?.close())},H=new WeakSet,X=function(t){if(t.target!==e(this,s).value)return;const n=e(this,s).value?.getBoundingClientRect();n&&(n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width||(document.documentElement.classList.remove("private-glide-core-modal-lock-scroll"),this.dispatchEvent(new Event("close")),e(this,s).value?.close()))},a.shadowRootOptions={...V.shadowRootOptions,mode:"closed"},a.styles=Q,b([T({reflect:!0})],a.prototype,"label",2),b([T({attribute:"show-back-button",type:Boolean,reflect:!0})],a.prototype,"showBackButton",2),b([T({reflect:!0})],a.prototype,"size",2),a=b([q("glide-core-modal")],a);export{a as default};
@@ -0,0 +1,14 @@
1
+ import './button.js';
2
+ import './icons/storybook.js';
3
+ import './modal.js';
4
+ import './modal.tertiary-icon.js';
5
+ import './tooltip.js';
6
+ import type { Meta, StoryObj } from '@storybook/web-components';
7
+ declare const meta: Meta;
8
+ export default meta;
9
+ export declare const Modal: StoryObj;
10
+ export declare const WithBackButton: StoryObj;
11
+ export declare const HeaderActions: StoryObj;
12
+ export declare const HeaderActionsWithBackButton: StoryObj;
13
+ export declare const TertiaryButton: StoryObj;
14
+ export declare const TertiaryIcon: StoryObj;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,169 @@
1
+ "use strict";import{css as i}from"lit";import e from"./styles/focus-outline.js";export default[i`
2
+ /* When browser support improves, we can have nicer animations with https://caniuse.com/mdn-css_at-rules_starting-style */
3
+ @keyframes backdrop-fade-in {
4
+ from {
5
+ opacity: 0;
6
+ }
7
+
8
+ to {
9
+ opacity: 1;
10
+ }
11
+ }
12
+
13
+ @keyframes modal-open {
14
+ from {
15
+ opacity: 0;
16
+ transform: scale(0.9);
17
+ }
18
+
19
+ to {
20
+ opacity: 1;
21
+ transform: scale(1);
22
+ }
23
+ }
24
+
25
+ .component {
26
+ background-color: var(--glide-core-surface-base-lighter);
27
+ border: none;
28
+ border-radius: 0.5rem;
29
+ box-shadow: var(--glide-core-shadow-lg);
30
+ font-family: var(--glide-core-body-xs-font-family);
31
+ inline-size: 35rem;
32
+ max-block-size: 75vh;
33
+ opacity: 0;
34
+ padding: 1.25rem;
35
+
36
+ &[open] {
37
+ animation: modal-open 250ms;
38
+ opacity: 1;
39
+ }
40
+
41
+ &:focus {
42
+ outline: none;
43
+ }
44
+
45
+ &:focus-visible {
46
+ ${e};
47
+ }
48
+
49
+ &::backdrop {
50
+ animation: backdrop-fade-in 250ms;
51
+
52
+ /* prefix required for Safari */
53
+ /* stylelint-disable-next-line property-no-vendor-prefix */
54
+ -webkit-backdrop-filter: blur(3px);
55
+ backdrop-filter: blur(3px);
56
+ background-color: rgba(0 0 0 / 40%);
57
+ }
58
+
59
+ ::slotted([slot='tertiary']) {
60
+ --size: 1rem;
61
+
62
+ size: 1rem;
63
+ }
64
+ }
65
+
66
+ @media (prefers-reduced-motion) {
67
+ dialog {
68
+ &[open] {
69
+ animation: none;
70
+ }
71
+
72
+ &::backdrop {
73
+ animation: none;
74
+ }
75
+ }
76
+ }
77
+
78
+ .small {
79
+ inline-size: 22.5rem;
80
+ }
81
+
82
+ .medium {
83
+ inline-size: 35rem;
84
+ }
85
+
86
+ .large {
87
+ inline-size: 53.75rem;
88
+ }
89
+
90
+ .xlarge {
91
+ inline-size: 69.375rem;
92
+ }
93
+
94
+ .header {
95
+ align-items: center;
96
+ display: flex;
97
+ justify-content: space-between;
98
+ }
99
+
100
+ .label {
101
+ align-items: center;
102
+ color: var(--glide-core-text-body);
103
+ display: flex;
104
+ font-size: 1.5rem;
105
+ font-weight: 600;
106
+ gap: var(--glide-core-spacing-xs);
107
+ inline-size: 100%;
108
+ line-height: 1.875rem;
109
+ margin: 0;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ }
114
+
115
+ .header-actions {
116
+ align-items: center;
117
+ display: flex;
118
+ gap: 0.625rem;
119
+ line-height: 1;
120
+ }
121
+
122
+ .body {
123
+ line-height: 1;
124
+ overflow: auto;
125
+ padding-block: 1rem;
126
+ padding-block-end: 0.625rem;
127
+
128
+ &:focus {
129
+ outline: none;
130
+ }
131
+
132
+ &:focus-visible {
133
+ ${e};
134
+ }
135
+ }
136
+
137
+ .footer {
138
+ align-items: center;
139
+ display: flex;
140
+ }
141
+
142
+ .actions {
143
+ display: flex;
144
+ gap: var(--glide-core-spacing-xs);
145
+
146
+ /* Reset the default menu styles */
147
+ list-style-type: none;
148
+ margin: 0;
149
+ margin-inline-start: auto;
150
+ padding: 0;
151
+ }
152
+
153
+ .menu {
154
+ display: flex;
155
+ inline-size: 100%;
156
+ justify-content: space-between;
157
+ list-style-type: none;
158
+ margin: 0;
159
+ padding: 0;
160
+ }
161
+
162
+ .flex {
163
+ display: flex;
164
+ }
165
+
166
+ .align-center {
167
+ align-items: center;
168
+ }
169
+ `];
@@ -0,0 +1,21 @@
1
+ import './tooltip.js';
2
+ import { LitElement } from 'lit';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'glide-core-modal-tertiary-icon': GlideCoreModalTertiaryIcon;
6
+ }
7
+ }
8
+ /**
9
+ * @description A Modal tertiary icon wrapper. Provides opinionated styling and accessibility for icons in Modals.
10
+ * Should be used only in the "tertiary" slot of a Modal.
11
+ *
12
+ * @slot - The icon to be rendered.
13
+ */
14
+ export default class GlideCoreModalTertiaryIcon extends LitElement {
15
+ #private;
16
+ static shadowRootOptions: ShadowRootInit;
17
+ label?: string;
18
+ tooltipPlacement: 'bottom' | 'left' | 'right' | 'top';
19
+ firstUpdated(): void;
20
+ render(): import("lit").TemplateResult<1>;
21
+ }
@@ -0,0 +1 @@
1
+ "use strict";var E=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var r=(e,t,o,m)=>{for(var i=m>1?void 0:m?R(t,o):t,n=e.length-1,f;n>=0;n--)(f=e[n])&&(i=(m?f(t,o,i):f(i))||i);return m&&i&&E(t,o,i),i};var c=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var s=(e,t,o)=>(c(e,t,"read from private field"),o?o.call(e):t.get(e)),h=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)};var d=(e,t,o)=>(c(e,t,"access private method"),o);var a,p,v;import"./tooltip.js";import{LitElement as g,html as S}from"lit";import{createRef as $,ref as w}from"lit/directives/ref.js";import{customElement as x,property as b}from"lit/decorators.js";import{ifDefined as L}from"lit/directives/if-defined.js";import{owSlot as u}from"./library/ow.js";let l=class extends g{constructor(){super(...arguments);h(this,p);this.tooltipPlacement="bottom";h(this,a,$())}firstUpdated(){u(s(this,a).value)}render(){return S`<glide-core-tooltip placement="${this.tooltipPlacement}">${this.label} <span tabindex="0" aria-label="${L(this.label)}" slot="target"><slot @slotchange="${d(this,p,v)}" ${w(s(this,a))}></slot></span></glide-core-tooltip>`}};a=new WeakMap,p=new WeakSet,v=function(){u(s(this,a).value)},l.shadowRootOptions={...g.shadowRootOptions,mode:"closed"},r([b()],l.prototype,"label",2),r([b({attribute:"tooltip-placement"})],l.prototype,"tooltipPlacement",2),l=r([x("glide-core-modal-tertiary-icon")],l);export{l as default};
@@ -0,0 +1 @@
1
+ import './button.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import './button.js';
2
+ import './modal.icon-button.js';
3
+ import './modal.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import './modal.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import './modal.js';
@@ -0,0 +1,48 @@
1
+ import './label.js';
2
+ import './tooltip.js';
3
+ import { LitElement, type PropertyValueMap } from 'lit';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'glide-core-radio-group': GlideCoreRadioGroup;
7
+ }
8
+ }
9
+ /**
10
+ /**
11
+ * @description A radio group with a label, and optional tooltip and description. Participates in forms and validation via `FormData` and various methods.
12
+ *
13
+ * @event change - Dispatched when a radio is clicked or checked by key press.
14
+ * @event input - Dispatched when a radio is clicked or checked by key press.
15
+ *
16
+ * @slot - One or more of `<glide-core-radio>`.
17
+ * @slot description - Additional information or context.
18
+ * @slot tooltip - Content for the tooltip.
19
+ */
20
+ export default class GlideCoreRadioGroup extends LitElement {
21
+ #private;
22
+ static formAssociated: boolean;
23
+ static shadowRootOptions: ShadowRootInit;
24
+ static styles: import("lit").CSSResult[];
25
+ description: string;
26
+ disabled: boolean;
27
+ label: string;
28
+ hideLabel: boolean;
29
+ name: string;
30
+ required: boolean;
31
+ value: string;
32
+ checkValidity(): boolean;
33
+ disconnectedCallback(): void;
34
+ firstUpdated(): void;
35
+ focus(options?: FocusOptions): void;
36
+ get form(): HTMLFormElement | null;
37
+ get validity(): ValidityState;
38
+ get willValidate(): boolean;
39
+ formAssociatedCallback(): void;
40
+ formResetCallback(): void;
41
+ render(): import("lit").TemplateResult<1>;
42
+ reportValidity(): boolean;
43
+ updated(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
44
+ willUpdate(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
45
+ constructor();
46
+ private isCheckingValidity;
47
+ private isReportValidityOrSubmit;
48
+ }
@@ -0,0 +1 @@
1
+ "use strict";var tt=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var m=(n,d,t,e)=>{for(var i=e>1?void 0:e?et(d,t):d,b=n.length-1,A;b>=0;b--)(A=n[b])&&(i=(e?A(d,t,i):A(i))||i);return e&&i&&tt(d,t,i),i};var O=(n,d,t)=>{if(!d.has(n))throw TypeError("Cannot "+t)};var s=(n,d,t)=>(O(n,d,"read from private field"),t?t.call(n):d.get(n)),o=(n,d,t)=>{if(d.has(n))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(n):d.set(n,t)},E=(n,d,t,e)=>(O(n,d,"write to private field"),e?e.call(n,t):d.set(n,t),t);var a=(n,d,t)=>(O(n,d,"access private method"),t);var R,g,p,c,y,I,V,F,S,B,$,X,x,Y,C,Z,D,_,U,G,l,r,u,v,w,T,q,H,L,z,M,K;import"./label.js";import"./tooltip.js";import{LitElement as N,html as it}from"lit";import{classMap as st}from"lit/directives/class-map.js";import{createRef as j,ref as J}from"lit/directives/ref.js";import{customElement as at,property as k,state as P}from"lit/decorators.js";import{owSlot as Q,owSlotType as W}from"./library/ow.js";import f from"./radio.js";import lt from"./radio-group.styles.js";let h=class extends N{constructor(){super();o(this,V);o(this,S);o(this,$);o(this,x);o(this,C);o(this,D);o(this,U);o(this,l);o(this,u);o(this,w);o(this,q);o(this,L);o(this,M);this.description="";this.disabled=!1;this.label="";this.hideLabel=!1;this.name="";this.required=!1;this.value="";this.isCheckingValidity=!1;this.isReportValidityOrSubmit=!1;o(this,R,j());o(this,g,j());o(this,p,void 0);o(this,c,void 0);o(this,y,void 0);o(this,I,({formData:t})=>{this.name&&this.value.length>0&&!this.disabled&&t.append(this.name,this.value)});E(this,c,this.attachInternals()),this.addEventListener("invalid",a(this,C,Z))}checkValidity(){return this.isCheckingValidity=!0,s(this,c).checkValidity()}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",s(this,I)),E(this,p,void 0)}firstUpdated(){Q(s(this,g).value),W(s(this,g).value,[f]),E(this,p,s(this,l,r).find(t=>t.checked)),a(this,V,F).call(this)}focus(t){let e=s(this,l,r).find(i=>i.checked);e||(e=s(this,l,r).find(i=>i.tabIndex===0)),e?.focus(t)}get form(){return s(this,c).form}get validity(){return s(this,c).validity}get willValidate(){return s(this,c).willValidate}formAssociatedCallback(){this.form?.addEventListener("formdata",s(this,I))}formResetCallback(){if(s(this,p)&&this.contains(s(this,p)))for(const t of s(this,l,r))a(this,u,v).call(this,t===s(this,p),t)}render(){return it`<div class="component" @click="${a(this,$,X)}" @keydown="${a(this,D,_)}" ${J(s(this,R))}><glide-core-label orientation="horizontal" ?error="${s(this,S,B)}" ?hide="${this.hideLabel}" ?required="${this.required}"><label id="label" data-test="label">${this.label}</label><div class="${st({"radio-container":!0,vertical:!0,invalid:s(this,S,B)})}" role="radiogroup" slot="control" aria-labelledby="label description"><slot ${J(s(this,g))} @slotchange="${a(this,x,Y)}"></slot></div><slot name="tooltip" slot="tooltip"></slot><slot id="description" name="description" slot="description"></slot></glide-core-label></div>`}reportValidity(){return s(this,c).reportValidity()}updated(t){this.hasUpdated&&(t.has("value")||t.has("required"))&&(a(this,U,G).call(this),a(this,q,H).call(this,!s(this,c).validity.valid),this.requestUpdate())}willUpdate(t){if(this.hasUpdated){if(t.has("required")&&a(this,M,K).call(this),t.has("disabled")){for(const e of s(this,l,r))a(this,w,T).call(this,this.disabled,e);!this.disabled&&a(this,L,z).call(this)}if(t.has("value"))for(const e of s(this,l,r))e.checked=e.value===this.value}}};R=new WeakMap,g=new WeakMap,p=new WeakMap,c=new WeakMap,y=new WeakMap,I=new WeakMap,V=new WeakSet,F=function(){const t=s(this,l,r).find(e=>e.checked);this.value=t?.value??s(this,p)?.value??"",E(this,y,t??s(this,p)),this.required&&a(this,M,K).call(this);for(const e of s(this,l,r))this.disabled?a(this,w,T).call(this,this.disabled,e):a(this,w,T).call(this,e.disabled,e);!this.disabled&&a(this,L,z).call(this)},S=new WeakSet,B=function(){const t=!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit;return a(this,q,H).call(this,t),t},$=new WeakSet,X=function(t){if(this.disabled)return;if(t.target instanceof f&&t.target.disabled&&s(this,y)&&!s(this,y).disabled){s(this,y)?.focus();return}const e=t.target;if(e instanceof f&&e&&!e.disabled){a(this,u,v).call(this,!0,e);for(const i of s(this,l,r))i!==e&&a(this,u,v).call(this,!1,i)}},x=new WeakSet,Y=function(){Q(s(this,g).value),W(s(this,g).value,[f]),a(this,V,F).call(this)},C=new WeakSet,Z=function(t){t.preventDefault(),this.isCheckingValidity||(this.isReportValidityOrSubmit=!0,this.focus())},D=new WeakSet,_=function(t){if(!(this.disabled||t.target instanceof f&&t.target?.disabled)&&t.target instanceof f){const e=t.target;switch(t.key){case"ArrowUp":case"ArrowLeft":{t.preventDefault();let i=e.previousElementSibling;for(;(!i||i instanceof f&&i.disabled||!(i instanceof f))&&i!==e;)if(i===null){const b=s(this,l,r).at(-1);b&&(i=b)}else i=i.previousElementSibling;i&&i instanceof f&&!i.disabled&&i!==e&&(a(this,u,v).call(this,!1,e),a(this,u,v).call(this,!0,i));break}case"ArrowDown":case"ArrowRight":{t.preventDefault();let i=e.nextElementSibling;for(;(!i||i instanceof f&&i.disabled||!(i instanceof f))&&i!==e;)if(i===null){const b=s(this,l,r).at(0);b&&(i=b)}else i=i.nextElementSibling;i&&i instanceof f&&!i.disabled&&i!==e&&(a(this,u,v).call(this,!1,e),a(this,u,v).call(this,!0,i));break}case" ":{if(t.preventDefault(),!e.disabled&&!e.checked){a(this,u,v).call(this,!0,e);for(const i of s(this,l,r))i!==e&&a(this,u,v).call(this,!1,i)}break}}}},U=new WeakSet,G=function(){const t=s(this,l,r).find(e=>e.checked);this.required&&!t?s(this,c).setValidity({valueMissing:!0}," ",s(this,R).value):s(this,c).setValidity({})},l=new WeakSet,r=function(){return s(this,g).value?.assignedElements().filter(t=>t instanceof f)??[]},u=new WeakSet,v=function(t,e){e.checked=t,e.tabIndex=t?0:-1,t&&(E(this,y,e),this.value=e.value,e.focus(),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new Event("input",{bubbles:!0})))},w=new WeakSet,T=function(t,e){e.disabled=t,t&&(e.tabIndex=-1)},q=new WeakSet,H=function(t){for(const e of s(this,l,r))e.invalid=t},L=new WeakSet,z=function(){if(this.disabled||s(this,l,r).every(i=>i.disabled))return;let t=null;const e=s(this,l,r).find(i=>!i.disabled&&i.checked);if(e)t=e;else{const i=s(this,l,r).find(b=>!b.disabled);i&&(t=i)}if(t)for(const i of s(this,l,r))i.tabIndex=i===t?0:-1},M=new WeakSet,K=function(){for(const t of s(this,l,r))t.required=this.required},h.formAssociated=!0,h.shadowRootOptions={...N.shadowRootOptions,mode:"closed"},h.styles=lt,m([k()],h.prototype,"description",2),m([k({type:Boolean,reflect:!0})],h.prototype,"disabled",2),m([k()],h.prototype,"label",2),m([k({attribute:"hide-label",type:Boolean})],h.prototype,"hideLabel",2),m([k()],h.prototype,"name",2),m([k({type:Boolean,reflect:!0})],h.prototype,"required",2),m([k({reflect:!0})],h.prototype,"value",2),m([P()],h.prototype,"isCheckingValidity",2),m([P()],h.prototype,"isReportValidityOrSubmit",2),h=m([at("glide-core-radio-group")],h);export{h as default};
@@ -0,0 +1,8 @@
1
+ import './radio-group.js';
2
+ import './radio.js';
3
+ import type { Meta, StoryObj } from '@storybook/web-components';
4
+ declare const meta: Meta;
5
+ export default meta;
6
+ export declare const Vertical: StoryObj;
7
+ export declare const VerticalWithToolip: StoryObj;
8
+ export declare const VerticalWithError: StoryObj;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,40 @@
1
+ "use strict";import{css as e}from"lit";export default[e`
2
+ .component {
3
+ color: var(--glide-core-text-body-1);
4
+ display: inline-flex;
5
+ font-family: var(--glide-core-heading-xxxs-font-family);
6
+ font-size: var(--glide-core-heading-xxxs-font-size);
7
+ font-style: var(--glide-core-heading-xxxs-font-style);
8
+ font-variant: var(--glide-core-heading-xxxs-font-variant);
9
+ font-weight: var(--glide-core-heading-xxxs-font-weight);
10
+ line-height: 1;
11
+
12
+ & .vertical {
13
+ appearance: none;
14
+ border: none;
15
+ display: flex;
16
+ flex-direction: column;
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ & .radio-container {
22
+ display: flex;
23
+ gap: var(--glide-core-spacing-xs);
24
+ inline-size: min-content;
25
+
26
+ &.invalid {
27
+ border: 1px solid var(--glide-core-status-error);
28
+ border-radius: 0.5rem;
29
+ color: var(--glide-core-status-error);
30
+ margin-block-end: -0.0625rem;
31
+ margin-inline-start: -0.0625rem;
32
+ padding: var(--glide-core-spacing-xxs) 0.375rem;
33
+ }
34
+ }
35
+
36
+ glide-core-label::part(tooltip-and-label-container) {
37
+ align-items: flex-start;
38
+ }
39
+ }
40
+ `];
@@ -0,0 +1,2 @@
1
+ import './radio-group.js';
2
+ import './radio.js';
@@ -0,0 +1,2 @@
1
+ import './radio-group.js';
2
+ import './radio.js';
@@ -0,0 +1,2 @@
1
+ import './radio-group.js';
2
+ import './radio.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { LitElement, type PropertyValueMap } from 'lit';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'glide-core-radio': GlideCoreRadio;
5
+ }
6
+ }
7
+ /**
8
+ * @description A radio element for use with `<glide-core-radio-group>`.
9
+ *
10
+ */
11
+ export default class GlideCoreRadio extends LitElement {
12
+ static shadowRootOptions: ShadowRootInit;
13
+ static styles: import("lit").CSSResult[];
14
+ checked: boolean;
15
+ disabled: boolean;
16
+ invalid: boolean;
17
+ required: boolean;
18
+ value: string;
19
+ label: string;
20
+ firstUpdated(): void;
21
+ render(): import("lit").TemplateResult<1>;
22
+ willUpdate(changedProperties: PropertyValueMap<GlideCoreRadio>): void;
23
+ }
package/dist/radio.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var i=(d,r,e,l)=>{for(var a=l>1?void 0:l?f(r,e):r,h=d.length-1,o;h>=0;h--)(o=d[h])&&(a=(l?o(r,e,a):o(a))||a);return l&&a&&p(r,e,a),a};import{LitElement as n,html as u}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{customElement as b,property as s}from"lit/decorators.js";import m from"./radio.styles.js";let t=class extends n{constructor(){super(...arguments);this.checked=!1;this.disabled=!1;this.invalid=!1;this.required=!1;this.value="";this.label=""}firstUpdated(){this.role="radio",this.ariaChecked=this.checked.toString(),this.ariaDisabled=this.disabled.toString(),this.ariaInvalid=this.invalid.toString(),this.ariaRequired=this.required.toString(),this.ariaLabel=this.label}render(){return u`<span class="${c({component:!0,disabled:this.disabled})}"><span id="radio" class="${c({"radio-circle":!0,checked:this.checked})}" data-test="radio" data-test-error="${this.invalid}"></span> ${this.label}</span>`}willUpdate(e){this.hasUpdated&&(e.has("checked")&&(this.ariaChecked=this.checked.toString()),e.has("disabled")&&(this.ariaDisabled=this.disabled.toString()),e.has("required")&&(this.ariaRequired=this.required.toString()),e.has("invalid")&&(this.ariaInvalid=this.invalid.toString()),e.has("label")&&(this.ariaLabel=this.label))}};t.shadowRootOptions={...n.shadowRootOptions,mode:"closed"},t.styles=m,i([s({type:Boolean,reflect:!0})],t.prototype,"checked",2),i([s({type:Boolean,reflect:!0})],t.prototype,"disabled",2),i([s({type:Boolean})],t.prototype,"invalid",2),i([s({type:Boolean,reflect:!0})],t.prototype,"required",2),i([s()],t.prototype,"value",2),i([s({reflect:!0})],t.prototype,"label",2),t=i([b("glide-core-radio")],t);export{t as default};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;