@warp-ds/elements 1.2.1-next.1 → 1.2.1-next.2

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 (37) hide show
  1. package/README.md +18 -4
  2. package/dist/api.js +52 -1
  3. package/dist/api.js.map +2 -2
  4. package/dist/index.js +3353 -3813
  5. package/dist/index.js.map +7 -0
  6. package/dist/packages/affix/index.js +1748 -8
  7. package/dist/packages/affix/index.js.map +4 -4
  8. package/dist/packages/alert/index.js +1881 -9
  9. package/dist/packages/alert/index.js.map +4 -4
  10. package/dist/packages/attention/index.js +2364 -17
  11. package/dist/packages/attention/index.js.map +4 -4
  12. package/dist/packages/badge/index.js +289 -2
  13. package/dist/packages/badge/index.js.map +4 -4
  14. package/dist/packages/box/index.js +279 -3
  15. package/dist/packages/box/index.js.map +4 -4
  16. package/dist/packages/breadcrumbs/index.js +1703 -10
  17. package/dist/packages/breadcrumbs/index.js.map +4 -4
  18. package/dist/packages/broadcast/index.js +93 -8
  19. package/dist/packages/broadcast/index.js.map +2 -2
  20. package/dist/packages/button/index.js +1778 -8
  21. package/dist/packages/button/index.js.map +4 -4
  22. package/dist/packages/card/index.js +318 -9
  23. package/dist/packages/card/index.js.map +4 -4
  24. package/dist/packages/expandable/index.d.ts +0 -2
  25. package/dist/packages/expandable/index.js +1822 -55
  26. package/dist/packages/expandable/index.js.map +4 -4
  27. package/dist/packages/select/index.js +1841 -19
  28. package/dist/packages/select/index.js.map +4 -4
  29. package/dist/packages/textfield/index.js +378 -17
  30. package/dist/packages/textfield/index.js.map +4 -4
  31. package/dist/packages/toast/index.js +2165 -23
  32. package/dist/packages/toast/index.js.map +4 -4
  33. package/package.json +17 -19
  34. package/dist/elements.min.js +0 -5
  35. package/dist/packages/expandable/locales/en/messages.d.mts +0 -1
  36. package/dist/packages/expandable/locales/fi/messages.d.mts +0 -1
  37. package/dist/packages/expandable/locales/nb/messages.d.mts +0 -1
package/README.md CHANGED
@@ -5,13 +5,11 @@ a collection of Web Components built with Lit to be used to build interfaces bas
5
5
  This repository is maintained by the [Warp Core Team](https://github.com/orgs/warp-ds/teams/warp-core-team)
6
6
  and is home to the [@warp-ds/vue](https://www.npmjs.com/package/@warp-ds/elements) library.
7
7
 
8
-
9
8
  ## How to contribute
10
9
 
11
10
  If you'd like to contribute to `@warp-ds/elements`,
12
11
  start by reviewing the [contributing guidelines](CONTRIBUTING.md).
13
12
 
14
-
15
13
  ## How to use
16
14
 
17
15
  ### Installation
@@ -19,16 +17,19 @@ start by reviewing the [contributing guidelines](CONTRIBUTING.md).
19
17
  Install by using npm/pnpm or by adding a script link:
20
18
 
21
19
  #### Install using npm
20
+
22
21
  ```sh
23
22
  npm install @warp-ds/elements
24
23
  ```
25
24
 
26
25
  #### Install using pnpm
26
+
27
27
  ```sh
28
28
  pnpm add @warp-ds/elements
29
29
  ```
30
30
 
31
31
  #### Using a direct link to Eik
32
+
32
33
  ```html
33
34
  <script src="https://assets.finn.no/pkg/@warp-ds/elements/v1"></script>
34
35
  ```
@@ -47,17 +48,30 @@ import '@warp-ds/elements/components/toast';
47
48
  For information on the components available in the package and how to use them,
48
49
  see the [Warp Design System documentation](https://warp-ds.github.io/tech-docs/).
49
50
 
50
-
51
51
  ## Releases
52
52
 
53
53
  This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/elements) and [Eik](https://assets.finn.no/pkg/@warp-ds/elements) using a `next` tag (e.g. `1.1.0-next.1`).
54
54
  Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
55
55
 
56
-
57
56
  ## Changelog
58
57
 
59
58
  Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
60
59
 
60
+ ## How to test component-classes locally
61
+
62
+ It is possible to test changes that have been made to component-classes from the [@warp-ds/css](https://github.com/warp-ds/css) package but that has not yet been published to Eik. You simply need to link the `@warp-ds/css` package in this repository and add `@unocss-placeholder` inside the static styles of the component that you want to test:
63
+
64
+ ```js
65
+ static styles = [
66
+ css`
67
+ @unocss-placeholder
68
+ `,
69
+ ]
70
+ ```
71
+
72
+ Run `pnpm dev` to see the linked styles in action.
73
+
74
+ Once you have tested it locally, make sure to remove the `@unocss-placeholder` from the static styles before pushing any changes to the repository.
61
75
 
62
76
  ## License
63
77
 
package/dist/api.js CHANGED
@@ -1,2 +1,53 @@
1
- var c=Object.defineProperty;var r=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var a=(n,o,t)=>o in n?c(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,e=(n,o)=>{for(var t in o||(o={}))u.call(o,t)&&a(n,t,o[t]);if(r)for(var t of r(o))d.call(o,t)&&a(n,t,o[t]);return n};var s=typeof window!="undefined";function p(n,o){if(!s)return;let t=customElements.get("w-toast-container").init(),i=e({id:Date.now().toString(36)+Math.random().toString(36).slice(2,5),text:n,duration:5e3,type:"success"},o);return t.set(i),i}function g(n){return s?customElements.get("w-toast-container").init().del(n):void 0}function x(n,o){if(!s)return;let t=customElements.get("w-toast-container").init();return t.set(e(e({},t.get(n)),o)),t.get(n)}export{g as removeToast,p as toast,x as updateToast};
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+
18
+ // packages/utils/window-exists.js
19
+ var windowExists = typeof window !== "undefined";
20
+
21
+ // packages/toast/api.js
22
+ function toast(message, options) {
23
+ if (!windowExists)
24
+ return;
25
+ const toast2 = customElements.get("w-toast-container").init();
26
+ const data = __spreadValues({
27
+ id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),
28
+ text: message,
29
+ duration: 5e3,
30
+ type: "success"
31
+ }, options);
32
+ toast2.set(data);
33
+ return data;
34
+ }
35
+ function removeToast(id) {
36
+ if (!windowExists)
37
+ return;
38
+ const toast2 = customElements.get("w-toast-container").init();
39
+ return toast2.del(id);
40
+ }
41
+ function updateToast(id, options) {
42
+ if (!windowExists)
43
+ return;
44
+ const toast2 = customElements.get("w-toast-container").init();
45
+ toast2.set(__spreadValues(__spreadValues({}, toast2.get(id)), options));
46
+ return toast2.get(id);
47
+ }
48
+ export {
49
+ removeToast,
50
+ toast,
51
+ updateToast
52
+ };
2
53
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../packages/utils/window-exists.js", "../packages/toast/api.js"],
4
4
  "sourcesContent": ["export const windowExists = typeof window !== 'undefined';\n", "import { windowExists } from '../utils/window-exists';\n\n/**\n * Toast helper function options\n * @typedef {Object} ToastOptions\n * @property {(number|string)} [id] Custom identifier\n * @property {('success'|'error'|'warning'|'info')} [type] Type of alert\n * @property {String} [text] The toast message. Only needed when updating text on existing toast\n * @property {(number|string)} [duration] Duration of toast in milliseconds. Defaults to 5000. For accessibility reasons, toasts should never be interactive and therefore need to auto remove. If you must disable auto remove, set duration to Number.POSITIVE_INFINITY.\n * @property {Boolean} [canclose] Whether the toast can be dismissed. Defaults to false. WARNING! For accessibility reasons, toasts should not be interactive and canclose should always be false. If the toast absolutely must be dismissble, set this to true.\n */\n\n/**\n * Creates a new toast\n * @param {String} message Message\n * @param {ToastOptions?} options Toast options\n * @returns {ToastOptions} Toast details\n */\nexport function toast(message, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n\n const data = {\n id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),\n text: message,\n duration: 5000,\n type: 'success',\n ...options,\n };\n\n toast.set(data);\n return data;\n}\n\n/**\n * Remove an existing toast\n * @param {String|Number} id Toast identifier\n * @return {Promise<Boolean>} Resolves to true if deleted, false if not found\n */\nexport function removeToast(id) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n return toast.del(id);\n}\n\n/**\n * Update an existing toast\n * @param {String|Number} id Toast identifier\n * @param {ToastOptions?} options Toast options\n * @returns {WarpToastContainer} Toast details\n */\nexport function updateToast(id, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n toast.set({ ...toast.get(id), ...options });\n return toast.get(id);\n}\n"],
5
- "mappings": "yVAAO,IAAMA,EAAe,OAAO,QAAW,YCkBvC,SAASC,EAAMC,EAASC,EAAS,CACtC,GAAI,CAACC,EAAc,OACnB,IAAMH,EAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK,EAErDI,EAAOC,EAAA,CACX,GAAI,KAAK,IAAI,EAAE,SAAS,EAAE,EAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,EACnE,KAAMJ,EACN,SAAU,IACV,KAAM,WACHC,GAGL,OAAAF,EAAM,IAAII,CAAI,EACPA,CACT,CAOO,SAASE,EAAYC,EAAI,CAC9B,OAAKJ,EACS,eAAe,IAAI,mBAAmB,EAAE,KAAK,EAC9C,IAAII,CAAE,EAFA,MAGrB,CAQO,SAASC,EAAYD,EAAIL,EAAS,CACvC,GAAI,CAACC,EAAc,OACnB,IAAMH,EAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK,EAC3D,OAAAA,EAAM,IAAIK,IAAA,GAAKL,EAAM,IAAIO,CAAE,GAAML,EAAS,EACnCF,EAAM,IAAIO,CAAE,CACrB",
6
- "names": ["windowExists", "toast", "message", "options", "windowExists", "data", "__spreadValues", "removeToast", "id", "updateToast"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAO,IAAM,eAAe,OAAO,WAAW;;;ACkBvC,SAAS,MAAM,SAAS,SAAS;AACtC,MAAI,CAAC;AAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAE3D,QAAM,OAAO;AAAA,IACX,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC;AAAA,IACnE,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,KACH;AAGL,EAAAA,OAAM,IAAI,IAAI;AACd,SAAO;AACT;AAOO,SAAS,YAAY,IAAI;AAC9B,MAAI,CAAC;AAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,SAAOA,OAAM,IAAI,EAAE;AACrB;AAQO,SAAS,YAAY,IAAI,SAAS;AACvC,MAAI,CAAC;AAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,EAAAA,OAAM,IAAI,kCAAKA,OAAM,IAAI,EAAE,IAAM,QAAS;AAC1C,SAAOA,OAAM,IAAI,EAAE;AACrB;",
6
+ "names": ["toast"]
7
7
  }