@warp-ds/elements 1.2.0 → 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.
- package/README.md +27 -4
- package/dist/api.js +52 -1
- package/dist/api.js.map +2 -2
- package/dist/index.js +3353 -3813
- package/dist/index.js.map +7 -0
- package/dist/packages/affix/index.js +1748 -8
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/alert/index.js +1881 -9
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/attention/index.js +2364 -17
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +289 -2
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/box/index.js +279 -3
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/breadcrumbs/index.js +1703 -10
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/broadcast/index.js +93 -8
- package/dist/packages/broadcast/index.js.map +2 -2
- package/dist/packages/button/index.js +1778 -8
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.js +318 -9
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/expandable/index.d.ts +0 -2
- package/dist/packages/expandable/index.js +1822 -55
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/select/index.js +1841 -19
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/textfield/index.js +378 -17
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/toast/index.js +2165 -23
- package/dist/packages/toast/index.js.map +4 -4
- package/package.json +23 -19
- package/dist/elements.min.js +0 -5
- package/dist/packages/expandable/locales/en/messages.d.mts +0 -1
- package/dist/packages/expandable/locales/fi/messages.d.mts +0 -1
- 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,36 +17,61 @@ 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
|
```
|
|
36
|
+
### Import components
|
|
37
|
+
This project builds both the whole Elements package and separate component packages that are published to EIK, making it possible for the user to choose to either import all of the components:
|
|
38
|
+
```js
|
|
39
|
+
import '@warp-ds/elements';
|
|
40
|
+
```
|
|
41
|
+
or a specific component:
|
|
42
|
+
```js
|
|
43
|
+
import '@warp-ds/elements/components/toast';
|
|
44
|
+
```
|
|
35
45
|
|
|
36
46
|
### Documentation
|
|
37
47
|
|
|
38
48
|
For information on the components available in the package and how to use them,
|
|
39
49
|
see the [Warp Design System documentation](https://warp-ds.github.io/tech-docs/).
|
|
40
50
|
|
|
41
|
-
|
|
42
51
|
## Releases
|
|
43
52
|
|
|
44
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`).
|
|
45
54
|
Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
|
|
46
55
|
|
|
47
|
-
|
|
48
56
|
## Changelog
|
|
49
57
|
|
|
50
58
|
Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
|
|
51
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.
|
|
52
75
|
|
|
53
76
|
## License
|
|
54
77
|
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
var
|
|
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": "
|
|
6
|
-
"names": ["
|
|
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
|
}
|