@warp-ds/elements 2.2.0-next.3 → 2.2.0-next.30

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 (267) hide show
  1. package/README.md +217 -28
  2. package/dist/.storybook/utilities.d.ts +28 -0
  3. package/dist/.storybook/utilities.js +52 -0
  4. package/dist/api.js +1 -49
  5. package/dist/api.js.map +4 -4
  6. package/dist/custom-elements.json +3059 -0
  7. package/dist/index.d.ts +942 -18
  8. package/dist/packages/affix/affix.react.stories.d.ts +9 -0
  9. package/dist/packages/affix/affix.react.stories.js +10 -0
  10. package/dist/packages/affix/affix.stories.d.ts +10 -0
  11. package/dist/packages/affix/affix.stories.js +25 -0
  12. package/dist/packages/affix/affix.test.d.ts +1 -0
  13. package/dist/packages/affix/affix.test.js +9 -0
  14. package/dist/packages/affix/index.d.ts +47 -24
  15. package/dist/packages/affix/index.js +2448 -2240
  16. package/dist/packages/affix/index.js.map +4 -4
  17. package/dist/packages/affix/react.d.ts +2 -0
  18. package/dist/packages/affix/react.js +15 -0
  19. package/dist/packages/affix/styles.d.ts +1 -0
  20. package/dist/packages/affix/styles.js +2 -0
  21. package/dist/packages/alert/alert.react.stories.d.ts +13 -0
  22. package/dist/packages/alert/alert.react.stories.js +44 -0
  23. package/dist/packages/alert/alert.stories.d.ts +15 -0
  24. package/dist/packages/alert/alert.stories.js +68 -0
  25. package/dist/packages/alert/alert.test.d.ts +1 -0
  26. package/dist/packages/alert/alert.test.js +18 -0
  27. package/dist/packages/alert/index.d.ts +23 -17
  28. package/dist/packages/alert/index.js +2452 -2446
  29. package/dist/packages/alert/index.js.map +4 -4
  30. package/dist/packages/alert/react.d.ts +2 -0
  31. package/dist/packages/alert/react.js +11 -0
  32. package/dist/packages/alert/styles.d.ts +1 -0
  33. package/dist/packages/alert/styles.js +2 -0
  34. package/dist/packages/attention/attention.react.stories.d.ts +15 -0
  35. package/dist/packages/attention/attention.react.stories.js +92 -0
  36. package/dist/packages/attention/attention.stories.d.ts +16 -0
  37. package/dist/packages/attention/attention.stories.js +180 -0
  38. package/dist/packages/attention/attention.test.d.ts +1 -0
  39. package/dist/packages/attention/attention.test.js +11 -0
  40. package/dist/packages/attention/index.d.ts +61 -89
  41. package/dist/packages/attention/index.js +3530 -3924
  42. package/dist/packages/attention/index.js.map +4 -4
  43. package/dist/packages/attention/layout-styles.d.ts +1 -0
  44. package/dist/packages/attention/layout-styles.js +905 -0
  45. package/dist/packages/attention/locales/da/messages.mjs +1 -0
  46. package/dist/packages/attention/locales/en/messages.mjs +1 -0
  47. package/dist/packages/attention/locales/fi/messages.mjs +1 -0
  48. package/dist/packages/attention/locales/nb/messages.mjs +1 -0
  49. package/dist/packages/attention/locales/sv/messages.mjs +1 -0
  50. package/dist/packages/attention/react.d.ts +15 -0
  51. package/dist/packages/attention/react.js +17 -0
  52. package/dist/packages/attention/styles.d.ts +1 -0
  53. package/dist/packages/attention/styles.js +2 -0
  54. package/dist/packages/badge/badge.react.stories.d.ts +18 -0
  55. package/dist/packages/badge/badge.react.stories.js +60 -0
  56. package/dist/packages/badge/badge.stories.d.ts +17 -0
  57. package/dist/packages/badge/badge.stories.js +68 -0
  58. package/dist/packages/badge/badge.test.d.ts +1 -0
  59. package/dist/packages/badge/badge.test.js +9 -0
  60. package/dist/packages/badge/index.d.ts +12 -12
  61. package/dist/packages/badge/index.js +2441 -300
  62. package/dist/packages/badge/index.js.map +4 -4
  63. package/dist/packages/badge/react.d.ts +2 -0
  64. package/dist/packages/badge/react.js +11 -0
  65. package/dist/packages/badge/styles.d.ts +1 -0
  66. package/dist/packages/badge/styles.js +2 -0
  67. package/dist/packages/box/box.react.stories.d.ts +15 -0
  68. package/dist/packages/box/box.react.stories.js +45 -0
  69. package/dist/packages/box/box.stories.d.ts +14 -0
  70. package/dist/packages/box/box.stories.js +59 -0
  71. package/dist/packages/box/box.test.d.ts +1 -0
  72. package/dist/packages/box/box.test.js +9 -0
  73. package/dist/packages/box/index.d.ts +16 -21
  74. package/dist/packages/box/index.js +2443 -299
  75. package/dist/packages/box/index.js.map +4 -4
  76. package/dist/packages/box/react.d.ts +2 -0
  77. package/dist/packages/box/react.js +11 -0
  78. package/dist/packages/box/slot.test.d.ts +1 -0
  79. package/dist/packages/box/slot.test.js +9 -0
  80. package/dist/packages/box/styles.d.ts +1 -0
  81. package/dist/packages/box/styles.js +2 -0
  82. package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +13 -0
  83. package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +40 -0
  84. package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
  85. package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
  86. package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
  87. package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
  88. package/dist/packages/breadcrumbs/index.d.ts +19 -16
  89. package/dist/packages/breadcrumbs/index.js +2402 -2051
  90. package/dist/packages/breadcrumbs/index.js.map +4 -4
  91. package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
  92. package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
  93. package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
  94. package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
  95. package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
  96. package/dist/packages/breadcrumbs/react.d.ts +2 -0
  97. package/dist/packages/breadcrumbs/react.js +11 -0
  98. package/dist/packages/breadcrumbs/styles.d.ts +1 -0
  99. package/dist/packages/breadcrumbs/styles.js +2 -0
  100. package/dist/packages/button/button.react.stories.d.ts +22 -0
  101. package/dist/packages/button/button.react.stories.js +102 -0
  102. package/dist/packages/button/button.stories.d.ts +25 -0
  103. package/dist/packages/button/button.stories.js +151 -0
  104. package/dist/packages/button/button.test.d.ts +1 -1
  105. package/dist/packages/button/button.test.js +25 -0
  106. package/dist/packages/button/index.d.ts +83 -9
  107. package/dist/packages/button/index.js +2614 -2422
  108. package/dist/packages/button/index.js.map +4 -4
  109. package/dist/packages/button/locales/da/messages.mjs +1 -0
  110. package/dist/packages/button/locales/en/messages.mjs +1 -0
  111. package/dist/packages/button/locales/fi/messages.mjs +1 -0
  112. package/dist/packages/button/locales/nb/messages.mjs +1 -0
  113. package/dist/packages/button/locales/sv/messages.mjs +1 -0
  114. package/dist/packages/button/react.d.ts +2 -0
  115. package/dist/packages/button/react.js +11 -0
  116. package/dist/packages/button/styles.d.ts +1 -0
  117. package/dist/packages/button/styles.js +2 -0
  118. package/dist/packages/card/card.react.stories.d.ts +16 -0
  119. package/dist/packages/card/card.react.stories.js +63 -0
  120. package/dist/packages/card/card.stories.d.ts +15 -0
  121. package/dist/packages/card/card.stories.js +82 -0
  122. package/dist/packages/card/card.test.d.ts +1 -0
  123. package/dist/packages/card/card.test.js +9 -0
  124. package/dist/packages/card/index.d.ts +27 -16
  125. package/dist/packages/card/index.js +2403 -2067
  126. package/dist/packages/card/index.js.map +4 -4
  127. package/dist/packages/card/locales/da/messages.mjs +1 -0
  128. package/dist/packages/card/locales/en/messages.mjs +1 -0
  129. package/dist/packages/card/locales/fi/messages.mjs +1 -0
  130. package/dist/packages/card/locales/nb/messages.mjs +1 -0
  131. package/dist/packages/card/locales/sv/messages.mjs +1 -0
  132. package/dist/packages/card/react.d.ts +2 -0
  133. package/dist/packages/card/react.js +11 -0
  134. package/dist/packages/card/styles.d.ts +1 -0
  135. package/dist/packages/card/styles.js +2 -0
  136. package/dist/packages/expandable/expandable.react.stories.d.ts +18 -0
  137. package/dist/packages/expandable/expandable.react.stories.js +103 -0
  138. package/dist/packages/expandable/expandable.stories.d.ts +19 -0
  139. package/dist/packages/expandable/expandable.stories.js +132 -0
  140. package/dist/packages/expandable/expandable.test.d.ts +1 -0
  141. package/dist/packages/expandable/expandable.test.js +24 -0
  142. package/dist/packages/expandable/index.d.ts +52 -50
  143. package/dist/packages/expandable/index.js +2424 -2286
  144. package/dist/packages/expandable/index.js.map +4 -4
  145. package/dist/packages/expandable/react.d.ts +2 -0
  146. package/dist/packages/expandable/react.js +11 -0
  147. package/dist/packages/expandable/styles.d.ts +1 -0
  148. package/dist/packages/expandable/styles.js +2 -0
  149. package/dist/packages/i18n.js +45 -0
  150. package/dist/packages/link/index.d.ts +34 -0
  151. package/dist/packages/link/index.js +99 -0
  152. package/dist/packages/link/styles.d.ts +1 -0
  153. package/dist/packages/link/styles.js +200 -0
  154. package/dist/packages/modal/index.d.ts +5 -6
  155. package/dist/packages/modal/index.js +5 -2611
  156. package/dist/packages/modal/locales/da/messages.mjs +1 -0
  157. package/dist/packages/modal/locales/en/messages.mjs +1 -0
  158. package/dist/packages/modal/locales/fi/messages.mjs +1 -0
  159. package/dist/packages/modal/locales/nb/messages.mjs +1 -0
  160. package/dist/packages/modal/locales/sv/messages.mjs +1 -0
  161. package/dist/packages/modal/modal-footer.d.ts +12 -10
  162. package/dist/packages/modal/modal-footer.js +2460 -0
  163. package/dist/packages/modal/modal-footer.js.map +7 -0
  164. package/dist/packages/modal/modal-header.d.ts +15 -13
  165. package/dist/packages/modal/modal-header.js +2567 -0
  166. package/dist/packages/modal/modal-header.js.map +7 -0
  167. package/dist/packages/modal/modal-main.d.ts +14 -8
  168. package/dist/packages/modal/modal-main.js +2572 -0
  169. package/dist/packages/modal/modal-main.js.map +7 -0
  170. package/dist/packages/modal/modal.react.stories.d.ts +14 -0
  171. package/dist/packages/modal/modal.react.stories.js +27 -0
  172. package/dist/packages/modal/modal.stories.d.ts +19 -0
  173. package/dist/packages/modal/modal.stories.js +254 -0
  174. package/dist/packages/modal/react.d.ts +12 -0
  175. package/dist/packages/modal/react.js +31 -0
  176. package/dist/packages/modal/util.d.ts +7 -17
  177. package/dist/packages/modal/util.js +21 -0
  178. package/dist/packages/pill/index.d.ts +39 -23
  179. package/dist/packages/pill/index.js +2408 -2175
  180. package/dist/packages/pill/index.js.map +4 -4
  181. package/dist/packages/pill/locales/da/messages.mjs +1 -0
  182. package/dist/packages/pill/locales/en/messages.mjs +1 -0
  183. package/dist/packages/pill/locales/fi/messages.mjs +1 -0
  184. package/dist/packages/pill/locales/nb/messages.mjs +1 -0
  185. package/dist/packages/pill/locales/sv/messages.mjs +1 -0
  186. package/dist/packages/pill/pill.react.stories.d.ts +23 -0
  187. package/dist/packages/pill/pill.react.stories.js +22 -0
  188. package/dist/packages/pill/pill.stories.d.ts +12 -0
  189. package/dist/packages/pill/pill.stories.js +33 -0
  190. package/dist/packages/pill/pill.test.d.ts +1 -0
  191. package/dist/packages/pill/pill.test.js +25 -0
  192. package/dist/packages/pill/react.d.ts +7 -0
  193. package/dist/packages/pill/react.js +17 -0
  194. package/dist/packages/pill/styles.d.ts +1 -0
  195. package/dist/packages/pill/styles.js +2 -0
  196. package/dist/packages/select/index.d.ts +56 -60
  197. package/dist/packages/select/index.js +2428 -2533
  198. package/dist/packages/select/index.js.map +4 -4
  199. package/dist/packages/select/locales/da/messages.mjs +1 -0
  200. package/dist/packages/select/locales/en/messages.mjs +1 -0
  201. package/dist/packages/select/locales/fi/messages.mjs +1 -0
  202. package/dist/packages/select/locales/nb/messages.mjs +1 -0
  203. package/dist/packages/select/locales/sv/messages.mjs +1 -0
  204. package/dist/packages/select/react.d.ts +6 -0
  205. package/dist/packages/select/react.js +20 -0
  206. package/dist/packages/select/select.react.stories.d.ts +18 -0
  207. package/dist/packages/select/select.react.stories.js +28 -0
  208. package/dist/packages/select/select.stories.d.ts +17 -0
  209. package/dist/packages/select/select.stories.js +100 -0
  210. package/dist/packages/select/select.test.d.ts +1 -0
  211. package/dist/packages/select/select.test.js +31 -0
  212. package/dist/packages/select/styles.d.ts +1 -0
  213. package/dist/packages/select/styles.js +2 -0
  214. package/dist/packages/styles.js +2442 -0
  215. package/dist/packages/textfield/index.d.ts +78 -74
  216. package/dist/packages/textfield/index.js +2522 -707
  217. package/dist/packages/textfield/index.js.map +4 -4
  218. package/dist/packages/textfield/react.d.ts +11 -0
  219. package/dist/packages/textfield/react.js +21 -0
  220. package/dist/packages/textfield/styles/w-textfield.styles.d.ts +1 -0
  221. package/dist/packages/textfield/styles/w-textfield.styles.js +55 -0
  222. package/dist/packages/textfield/styles.d.ts +1 -0
  223. package/dist/packages/textfield/styles.js +2 -0
  224. package/dist/packages/textfield/textfield.react.stories.d.ts +37 -0
  225. package/dist/packages/textfield/textfield.react.stories.js +88 -0
  226. package/dist/packages/textfield/textfield.stories.d.ts +18 -0
  227. package/dist/packages/textfield/textfield.stories.js +105 -0
  228. package/dist/packages/textfield/textfield.test.d.ts +2 -0
  229. package/dist/packages/textfield/textfield.test.js +68 -0
  230. package/dist/packages/toast/api.d.ts +4 -45
  231. package/dist/packages/toast/api.js +41 -0
  232. package/dist/packages/toast/index.d.ts +3 -3
  233. package/dist/packages/toast/index.js +3 -2804
  234. package/dist/packages/toast/locales/da/messages.mjs +1 -0
  235. package/dist/packages/toast/locales/en/messages.mjs +1 -0
  236. package/dist/packages/toast/locales/fi/messages.mjs +1 -0
  237. package/dist/packages/toast/locales/nb/messages.mjs +1 -0
  238. package/dist/packages/toast/locales/sv/messages.mjs +1 -0
  239. package/dist/packages/toast/styles.d.ts +1 -0
  240. package/dist/packages/toast/styles.js +2 -0
  241. package/dist/packages/toast/toast-container.d.ts +13 -63
  242. package/dist/packages/toast/toast-container.js +2458 -0
  243. package/dist/packages/toast/toast-container.js.map +7 -0
  244. package/dist/packages/toast/toast.d.ts +36 -29
  245. package/dist/packages/toast/toast.js +2466 -0
  246. package/dist/packages/toast/toast.js.map +7 -0
  247. package/dist/packages/toast/toast.stories.d.ts +12 -0
  248. package/dist/packages/toast/toast.stories.js +50 -0
  249. package/dist/packages/toast/types.d.ts +15 -0
  250. package/dist/packages/toast/types.js +1 -0
  251. package/dist/packages/utils/expand-transition.d.ts +3 -3
  252. package/dist/packages/utils/expand-transition.js +59 -0
  253. package/dist/packages/utils/index.d.ts +1 -1
  254. package/dist/packages/utils/index.js +37 -0
  255. package/dist/packages/utils/unstyled-heading.d.ts +3 -4
  256. package/dist/packages/utils/unstyled-heading.js +22 -0
  257. package/dist/packages/utils/window-exists.js +1 -0
  258. package/dist/setup-tests.d.ts +1 -0
  259. package/dist/setup-tests.js +1 -0
  260. package/dist/vscode.css-custom-data.json +6 -0
  261. package/dist/vscode.html-custom-data.json +296 -0
  262. package/dist/web-types.json +661 -0
  263. package/package.json +89 -36
  264. package/dist/index.js +0 -9820
  265. package/dist/index.js.map +0 -7
  266. package/dist/packages/modal/index.js.map +0 -7
  267. package/dist/packages/toast/index.js.map +0 -7
@@ -0,0 +1 @@
1
+ /*eslint-disable*/ export const messages = JSON.parse("{\"breadcrumbs.ariaLabel\":[\"Du er her\"]}");
@@ -0,0 +1 @@
1
+ /*eslint-disable*/ export const messages = JSON.parse("{\"breadcrumbs.ariaLabel\":[\"You are here\"]}");
@@ -0,0 +1 @@
1
+ /*eslint-disable*/ export const messages = JSON.parse("{\"breadcrumbs.ariaLabel\":[\"Olet tässä\"]}");
@@ -0,0 +1 @@
1
+ /*eslint-disable*/ export const messages = JSON.parse("{\"breadcrumbs.ariaLabel\":[\"Her er du\"]}");
@@ -0,0 +1 @@
1
+ /*eslint-disable*/ export const messages = JSON.parse("{\"breadcrumbs.ariaLabel\":[\"Du är här\"]}");
@@ -0,0 +1,2 @@
1
+ import { WarpBreadcrumbs } from '.';
2
+ export declare const Breadcrumbs: import("@lit/react").ReactWebComponent<WarpBreadcrumbs, {}>;
@@ -0,0 +1,11 @@
1
+ import { LitElement } from 'lit';
2
+ import { createComponent } from '@lit/react';
3
+ import React from 'react';
4
+ // decouple from CDN by providing a dummy class
5
+ class Component extends LitElement {
6
+ }
7
+ export const Breadcrumbs = createComponent({
8
+ tagName: 'w-breadcrumbs',
9
+ elementClass: Component,
10
+ react: React,
11
+ });
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,2 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.flex{display:flex}.static{position:static}.s-text{color:var(--w-s-color-text)}.s-text-link{color:var(--w-s-color-text-link)}.s-icon{color:var(--w-s-color-icon)}.space-x-8>:not([hidden])~:not([hidden]){--w-space-x-reverse:0;margin-left:calc(.8rem*calc(1 - var(--w-space-x-reverse)));margin-right:calc(.8rem*var(--w-space-x-reverse))}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.select-none{-webkit-user-select:none;user-select:none}`;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { StoryObj } from '@storybook/react';
3
+ import { Button } from './react';
4
+ declare const _default: {
5
+ title: string;
6
+ render(args: Omit<React.HTMLAttributes<import(".").WarpButton>, "rel" | "_classes" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "variant" | "form" | "small" | "quiet" | "href" | "target" | "fullWidth" | "buttonClass" | "name" | "type" | "loading" | "value" | "ariaValueTextLoading" | "updated" | "firstUpdated" | "_primaryClasses" | "_secondaryClasses" | "_utilityClasses" | "_negativeClasses" | "_pillClasses" | "_linkClasses" | "_handleButtonClick" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "resetFormControl" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate"> & {} & Partial<Omit<import(".").WarpButton, keyof HTMLElement>> & React.RefAttributes<import(".").WarpButton>): React.JSX.Element;
7
+ component: import("@lit/react").ReactWebComponent<import(".").WarpButton, {}>;
8
+ };
9
+ export default _default;
10
+ export type Story = StoryObj<typeof Button>;
11
+ export declare const Primary: Story;
12
+ export declare const Secondary: Story;
13
+ export declare const Negative: Story;
14
+ export declare const Utility: Story;
15
+ export declare const Link: Story;
16
+ export declare const Pill: Story;
17
+ export declare const Small: Story;
18
+ export declare const Quiet: Story;
19
+ export declare const Loading: Story;
20
+ export declare const FullWidth: Story;
21
+ export declare const AsLink: Story;
22
+ export declare const FormControl: Story;
@@ -0,0 +1,102 @@
1
+ import React from 'react';
2
+ import { Button } from './react';
3
+ export default {
4
+ title: 'Buttons/Button',
5
+ render(args) {
6
+ return React.createElement(Button, { ...args }, "Button Text");
7
+ },
8
+ component: Button,
9
+ };
10
+ export const Primary = {
11
+ args: {
12
+ variant: 'primary',
13
+ type: 'button',
14
+ },
15
+ };
16
+ export const Secondary = {
17
+ args: {
18
+ variant: 'secondary',
19
+ type: 'button',
20
+ },
21
+ };
22
+ export const Negative = {
23
+ args: {
24
+ variant: 'negative',
25
+ type: 'button',
26
+ },
27
+ };
28
+ export const Utility = {
29
+ args: {
30
+ variant: 'utility',
31
+ type: 'button',
32
+ },
33
+ };
34
+ export const Link = {
35
+ args: {
36
+ variant: 'link',
37
+ type: 'button',
38
+ href: 'https://developer.mozilla.org/en-US/docs/Web/API/Web_components',
39
+ target: '_new',
40
+ },
41
+ };
42
+ export const Pill = {
43
+ args: {
44
+ variant: 'pill',
45
+ type: 'button',
46
+ },
47
+ render(args) {
48
+ return React.createElement(Button, { ...args }, "\uD83D\uDC99");
49
+ },
50
+ };
51
+ export const Small = {
52
+ args: {
53
+ variant: 'primary',
54
+ small: true,
55
+ type: 'button',
56
+ },
57
+ };
58
+ export const Quiet = {
59
+ args: {
60
+ variant: 'secondary',
61
+ quiet: true,
62
+ type: 'button',
63
+ },
64
+ };
65
+ export const Loading = {
66
+ args: {
67
+ variant: 'primary',
68
+ loading: true,
69
+ type: 'button',
70
+ },
71
+ };
72
+ export const FullWidth = {
73
+ args: {
74
+ variant: 'primary',
75
+ fullWidth: true,
76
+ type: 'button',
77
+ },
78
+ render(args) {
79
+ return (React.createElement("div", { className: "w-full flex flex-col gap-8" },
80
+ React.createElement(Button, { ...args }, "Full width")));
81
+ },
82
+ };
83
+ export const AsLink = {
84
+ args: {
85
+ variant: 'primary',
86
+ href: 'https://example.com',
87
+ target: '_blank',
88
+ type: 'button',
89
+ },
90
+ render(args) {
91
+ return React.createElement(Button, { ...args }, "Visit Example");
92
+ },
93
+ };
94
+ export const FormControl = {
95
+ args: {},
96
+ render() {
97
+ return (React.createElement("form", { name: "form-control" },
98
+ React.createElement("input", { type: "text", defaultValue: "I am an input field", name: "demoValue", style: { border: '1px solid lime' } }),
99
+ React.createElement(Button, { type: "reset", name: "resetButton", value: "fooyoo" }, "Reset"),
100
+ React.createElement(Button, { type: "submit", name: "submuitButtton", value: "fooyoo" }, "Send thing")));
101
+ },
102
+ };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import type { WarpButton } from './index.js';
3
+ import './index.js';
4
+ declare const args: Partial<WarpButton> & {
5
+ [key: string]: any;
6
+ };
7
+ import "@warp-ds/icons/elements/close-16";
8
+ import "@warp-ds/icons/elements/heart-16";
9
+ import "@warp-ds/icons/elements/chevron-right-16";
10
+ import "@warp-ds/icons/elements/chevron-left-16";
11
+ declare const meta: Meta<typeof args>;
12
+ export default meta;
13
+ type Story = StoryObj<typeof args>;
14
+ export declare const Primary: Story;
15
+ export declare const Secondary: Story;
16
+ export declare const Negative: Story;
17
+ export declare const Utility: Story;
18
+ export declare const Link: Story;
19
+ export declare const Pill: Story;
20
+ export declare const Small: Story;
21
+ export declare const Quiet: Story;
22
+ export declare const Loading: Story;
23
+ export declare const FullWidth: Story;
24
+ export declare const AsLink: Story;
25
+ export declare const FormControl: Story;
@@ -0,0 +1,151 @@
1
+ import { spread } from '@open-wc/lit-helpers';
2
+ import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
3
+ import { html } from 'lit';
4
+ import { prespread } from '../../.storybook/utilities.js';
5
+ import './index.js';
6
+ const { events, args, argTypes } = getStorybookHelpers('w-button');
7
+ import "@warp-ds/icons/elements/close-16";
8
+ import "@warp-ds/icons/elements/heart-16";
9
+ import "@warp-ds/icons/elements/chevron-right-16";
10
+ import "@warp-ds/icons/elements/chevron-left-16";
11
+ const meta = {
12
+ title: 'Buttons/Button',
13
+ render(args) {
14
+ return html `<w-button ${spread(prespread(args))}>Button Text</w-button>`;
15
+ },
16
+ args,
17
+ argTypes,
18
+ parameters: {
19
+ actions: {
20
+ handles: events,
21
+ },
22
+ },
23
+ };
24
+ export default meta;
25
+ export const Primary = {
26
+ args: {
27
+ variant: 'primary',
28
+ type: 'button',
29
+ },
30
+ };
31
+ export const Secondary = {
32
+ args: {
33
+ variant: 'secondary',
34
+ type: 'button',
35
+ },
36
+ };
37
+ export const Negative = {
38
+ args: {
39
+ variant: 'negative',
40
+ type: 'button',
41
+ },
42
+ };
43
+ export const Utility = {
44
+ args: {
45
+ variant: 'utility',
46
+ type: 'button',
47
+ },
48
+ };
49
+ export const Link = {
50
+ args: {
51
+ variant: 'link',
52
+ type: 'button',
53
+ href: 'https://developer.mozilla.org/en-US/docs/Web/API/Web_components',
54
+ target: '_new',
55
+ },
56
+ };
57
+ export const Pill = {
58
+ args: {
59
+ variant: 'pill',
60
+ type: 'button',
61
+ },
62
+ render(args) {
63
+ return html `<w-button ${spread(prespread(args))}>
64
+ <w-icon-chevron-left-16 style="height: 16px;"></w-icon-chevron-left-16>
65
+ </w-button>
66
+ <w-button ${spread(prespread(args))}>
67
+ <w-icon-close-16 style="height: 16px;"></w-icon-close-16>
68
+ </w-button>
69
+ <w-button ${spread(prespread(args))}>
70
+ <w-icon-heart-16 style="height: 16px;"></w-icon-heart-16>
71
+ </w-button>
72
+ <w-button ${spread(prespread(args))}>
73
+ <w-icon-chevron-right-16
74
+ style="height: 16px;"
75
+ ></w-icon-chevron-right-16>
76
+ </w-button>
77
+ <br />
78
+ <w-button ${spread(prespread(args))} small="">
79
+ <w-icon-chevron-left-16 style="height: 16px;"></w-icon-chevron-left-16>
80
+ </w-button>
81
+ <w-button ${spread(prespread(args))} small="">
82
+ <w-icon-close-16 style="height: 16px;"></w-icon-close-16>
83
+ </w-button>
84
+ <w-button ${spread(prespread(args))} small="">
85
+ <w-icon-heart-16 style="height: 16px;"></w-icon-heart-16>
86
+ </w-button>
87
+ <w-button ${spread(prespread(args))} small="">
88
+ <w-icon-chevron-right-16
89
+ style="height: 16px;"
90
+ ></w-icon-chevron-right-16>
91
+ </w-button>`;
92
+ },
93
+ };
94
+ export const Small = {
95
+ args: {
96
+ variant: 'primary',
97
+ small: true,
98
+ type: 'button',
99
+ },
100
+ };
101
+ export const Quiet = {
102
+ args: {
103
+ variant: 'secondary',
104
+ quiet: true,
105
+ type: 'button',
106
+ },
107
+ };
108
+ export const Loading = {
109
+ args: {
110
+ variant: 'primary',
111
+ loading: true,
112
+ type: 'button',
113
+ },
114
+ };
115
+ export const FullWidth = {
116
+ args: {
117
+ variant: 'primary',
118
+ 'full-width': true,
119
+ type: 'button',
120
+ },
121
+ render(args) {
122
+ return html `
123
+ <div class="w-full flex flex-col gap-8">
124
+ <w-button ${spread(prespread(args))}>Full width</w-button>
125
+ </div>
126
+ `;
127
+ },
128
+ };
129
+ export const AsLink = {
130
+ args: {
131
+ variant: 'primary',
132
+ href: 'https://example.com',
133
+ target: '_blank',
134
+ type: 'button',
135
+ },
136
+ render(args) {
137
+ return html `<w-button ${spread(prespread(args))}>Visit Example</w-button>`;
138
+ },
139
+ };
140
+ export const FormControl = {
141
+ args: {},
142
+ render() {
143
+ return html `
144
+ <form name="form-control">
145
+ <input type="text" value="I am an input field" name="demoValue" style="border: 1px solid lime" />
146
+ <w-button type="reset" name="resetButton" value="fooyoo">Reset</w-button>
147
+ <w-button type="submit" name="submuitButtton" value="fooyoo">Send thing</w-button>
148
+ </form>
149
+ `;
150
+ },
151
+ };
@@ -1 +1 @@
1
- import "./index.js";
1
+ import './index.js';
@@ -0,0 +1,25 @@
1
+ import { html } from 'lit';
2
+ import { expect, test, vi } from 'vitest';
3
+ import { render } from 'vitest-browser-lit';
4
+ import './index.js';
5
+ test('renders the slotted label', async () => {
6
+ const component = html `<w-button>This is a button</w-button>`;
7
+ const page = render(component);
8
+ await expect.element(page.getByText('This is a button')).toBeVisible();
9
+ await expect.element(page.getByRole('button')).toBeVisible();
10
+ });
11
+ test('by default button type is button', async () => {
12
+ const component = html `<w-button>This is a button</w-button>`;
13
+ const page = render(component);
14
+ await expect.element(page.getByRole('button')).toHaveAttribute('type', 'button');
15
+ });
16
+ test.todo('works in a form as type submit');
17
+ test.todo('works in a form as type reset');
18
+ test('calling focus on w-button focuses the button inside the shadow root', async () => {
19
+ const component = html `<w-button>This is a button</w-button>`;
20
+ const page = render(component);
21
+ await expect.element(page.getByRole('button')).toBeVisible();
22
+ // @ts-expect-error if we import and type using WarpButton, the test fails which is nonsense so I've opted to simply ignore this error.
23
+ page.container.querySelector('w-button').focus();
24
+ await vi.waitFor(() => page.container.querySelector(':focus').tagName === 'BUTTON');
25
+ });
@@ -1,13 +1,74 @@
1
- import { PropertyValues } from "lit";
2
- type ButtonVariant = "primary" | "secondary" | "negative" | "utility" | "pill" | "link";
3
- type ButtonType = "button" | "submit" | "reset";
4
- declare const WarpButton_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & {
5
- new (): {
6
- [x: string]: any;
7
- };
8
- [x: string]: any;
9
- createProperty(name: any, options: any): void;
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import '../link';
3
+ type ButtonVariant = 'primary' | 'secondary' | 'negative' | 'utility' | 'pill' | 'link';
4
+ type ButtonType = 'button' | 'submit' | 'reset';
5
+ export declare const ccButton: {
6
+ secondary: string;
7
+ secondaryHref: string;
8
+ secondaryDisabled: string;
9
+ secondarySmall: string;
10
+ secondarySmallDisabled: string;
11
+ secondaryQuiet: string;
12
+ secondaryQuietDisabled: string;
13
+ secondarySmallQuiet: string;
14
+ secondarySmallQuietDisabled: string;
15
+ secondaryLoading: string;
16
+ secondarySmallLoading: string;
17
+ secondarySmallQuietLoading: string;
18
+ secondaryQuietLoading: string;
19
+ primary: string;
20
+ primaryDisabled: string;
21
+ primarySmall: string;
22
+ primarySmallDisabled: string;
23
+ primaryQuiet: string;
24
+ primaryQuietDisabled: string;
25
+ primarySmallQuiet: string;
26
+ primarySmallQuietDisabled: string;
27
+ primaryLoading: string;
28
+ primarySmallLoading: string;
29
+ primarySmallQuietLoading: string;
30
+ primaryQuietLoading: string;
31
+ utility: string;
32
+ utilityDisabled: string;
33
+ utilityQuiet: string;
34
+ utilityQuietDisabled: string;
35
+ utilitySmall: string;
36
+ utilitySmallDisabled: string;
37
+ utilitySmallQuiet: string;
38
+ utilitySmallQuietDisabled: string;
39
+ utilityLoading: string;
40
+ utilitySmallLoading: string;
41
+ utilityQuietLoading: string;
42
+ utilitySmallQuietLoading: string;
43
+ negative: string;
44
+ negativeDisabled: string;
45
+ negativeQuiet: string;
46
+ negativeQuietDisabled: string;
47
+ negativeSmall: string;
48
+ negativeSmallDisabled: string;
49
+ negativeSmallQuiet: string;
50
+ negativeSmallQuietDisabled: string;
51
+ negativeLoading: string;
52
+ negativeSmallLoading: string;
53
+ negativeQuietLoading: string;
54
+ negativeSmallQuietLoading: string;
55
+ pill: string;
56
+ pillSmall: string;
57
+ pillLoading: string;
58
+ pillSmallLoading: string;
59
+ link: string;
60
+ linkSmall: string;
61
+ linkAsButton: string;
62
+ a11y: string;
63
+ fullWidth: string;
64
+ contentWidth: string;
10
65
  };
66
+ declare const WarpButton_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
67
+ /**
68
+ * Buttons are used to perform actions, widh different visuals for different needs.
69
+ *
70
+ * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/buttons-button--docs)
71
+ */
11
72
  declare class WarpButton extends WarpButton_base {
12
73
  static shadowRootOptions: {
13
74
  delegatesFocus: boolean;
@@ -18,6 +79,9 @@ declare class WarpButton extends WarpButton_base {
18
79
  type: ButtonType;
19
80
  autofocus: boolean;
20
81
  variant: ButtonVariant;
82
+ /**
83
+ * @type {boolean}
84
+ */
21
85
  quiet: boolean;
22
86
  small: boolean;
23
87
  loading: boolean;
@@ -28,18 +92,28 @@ declare class WarpButton extends WarpButton_base {
28
92
  buttonClass: string;
29
93
  name: string;
30
94
  value: string;
95
+ /** @internal */
96
+ ariaValueTextLoading: string;
31
97
  static styles: import("lit").CSSResult[];
32
98
  updated(changedProperties: PropertyValues<this>): void;
33
99
  constructor();
34
100
  connectedCallback(): void;
35
101
  firstUpdated(): void;
102
+ /** @internal */
36
103
  get _primaryClasses(): string[];
104
+ /** @internal */
37
105
  get _secondaryClasses(): string[];
106
+ /** @internal */
38
107
  get _utilityClasses(): string[];
108
+ /** @internal */
39
109
  get _negativeClasses(): string[];
110
+ /** @internal */
40
111
  get _pillClasses(): string[];
112
+ /** @internal */
41
113
  get _linkClasses(): string[];
114
+ /** @internal */
42
115
  get _classes(): string;
116
+ /** @internal */
43
117
  _handleButtonClick(): void;
44
118
  render(): import("lit").TemplateResult<1>;
45
119
  }