@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.
- package/README.md +217 -28
- package/dist/.storybook/utilities.d.ts +28 -0
- package/dist/.storybook/utilities.js +52 -0
- package/dist/api.js +1 -49
- package/dist/api.js.map +4 -4
- package/dist/custom-elements.json +3059 -0
- package/dist/index.d.ts +942 -18
- package/dist/packages/affix/affix.react.stories.d.ts +9 -0
- package/dist/packages/affix/affix.react.stories.js +10 -0
- package/dist/packages/affix/affix.stories.d.ts +10 -0
- package/dist/packages/affix/affix.stories.js +25 -0
- package/dist/packages/affix/affix.test.d.ts +1 -0
- package/dist/packages/affix/affix.test.js +9 -0
- package/dist/packages/affix/index.d.ts +47 -24
- package/dist/packages/affix/index.js +2448 -2240
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +2 -0
- package/dist/packages/affix/react.js +15 -0
- package/dist/packages/affix/styles.d.ts +1 -0
- package/dist/packages/affix/styles.js +2 -0
- package/dist/packages/alert/alert.react.stories.d.ts +13 -0
- package/dist/packages/alert/alert.react.stories.js +44 -0
- package/dist/packages/alert/alert.stories.d.ts +15 -0
- package/dist/packages/alert/alert.stories.js +68 -0
- package/dist/packages/alert/alert.test.d.ts +1 -0
- package/dist/packages/alert/alert.test.js +18 -0
- package/dist/packages/alert/index.d.ts +23 -17
- package/dist/packages/alert/index.js +2452 -2446
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/alert/react.d.ts +2 -0
- package/dist/packages/alert/react.js +11 -0
- package/dist/packages/alert/styles.d.ts +1 -0
- package/dist/packages/alert/styles.js +2 -0
- package/dist/packages/attention/attention.react.stories.d.ts +15 -0
- package/dist/packages/attention/attention.react.stories.js +92 -0
- package/dist/packages/attention/attention.stories.d.ts +16 -0
- package/dist/packages/attention/attention.stories.js +180 -0
- package/dist/packages/attention/attention.test.d.ts +1 -0
- package/dist/packages/attention/attention.test.js +11 -0
- package/dist/packages/attention/index.d.ts +61 -89
- package/dist/packages/attention/index.js +3530 -3924
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/layout-styles.d.ts +1 -0
- package/dist/packages/attention/layout-styles.js +905 -0
- package/dist/packages/attention/locales/da/messages.mjs +1 -0
- package/dist/packages/attention/locales/en/messages.mjs +1 -0
- package/dist/packages/attention/locales/fi/messages.mjs +1 -0
- package/dist/packages/attention/locales/nb/messages.mjs +1 -0
- package/dist/packages/attention/locales/sv/messages.mjs +1 -0
- package/dist/packages/attention/react.d.ts +15 -0
- package/dist/packages/attention/react.js +17 -0
- package/dist/packages/attention/styles.d.ts +1 -0
- package/dist/packages/attention/styles.js +2 -0
- package/dist/packages/badge/badge.react.stories.d.ts +18 -0
- package/dist/packages/badge/badge.react.stories.js +60 -0
- package/dist/packages/badge/badge.stories.d.ts +17 -0
- package/dist/packages/badge/badge.stories.js +68 -0
- package/dist/packages/badge/badge.test.d.ts +1 -0
- package/dist/packages/badge/badge.test.js +9 -0
- package/dist/packages/badge/index.d.ts +12 -12
- package/dist/packages/badge/index.js +2441 -300
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +2 -0
- package/dist/packages/badge/react.js +11 -0
- package/dist/packages/badge/styles.d.ts +1 -0
- package/dist/packages/badge/styles.js +2 -0
- package/dist/packages/box/box.react.stories.d.ts +15 -0
- package/dist/packages/box/box.react.stories.js +45 -0
- package/dist/packages/box/box.stories.d.ts +14 -0
- package/dist/packages/box/box.stories.js +59 -0
- package/dist/packages/box/box.test.d.ts +1 -0
- package/dist/packages/box/box.test.js +9 -0
- package/dist/packages/box/index.d.ts +16 -21
- package/dist/packages/box/index.js +2443 -299
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +2 -0
- package/dist/packages/box/react.js +11 -0
- package/dist/packages/box/slot.test.d.ts +1 -0
- package/dist/packages/box/slot.test.js +9 -0
- package/dist/packages/box/styles.d.ts +1 -0
- package/dist/packages/box/styles.js +2 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +13 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +40 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
- package/dist/packages/breadcrumbs/index.d.ts +19 -16
- package/dist/packages/breadcrumbs/index.js +2402 -2051
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/react.d.ts +2 -0
- package/dist/packages/breadcrumbs/react.js +11 -0
- package/dist/packages/breadcrumbs/styles.d.ts +1 -0
- package/dist/packages/breadcrumbs/styles.js +2 -0
- package/dist/packages/button/button.react.stories.d.ts +22 -0
- package/dist/packages/button/button.react.stories.js +102 -0
- package/dist/packages/button/button.stories.d.ts +25 -0
- package/dist/packages/button/button.stories.js +151 -0
- package/dist/packages/button/button.test.d.ts +1 -1
- package/dist/packages/button/button.test.js +25 -0
- package/dist/packages/button/index.d.ts +83 -9
- package/dist/packages/button/index.js +2614 -2422
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/locales/da/messages.mjs +1 -0
- package/dist/packages/button/locales/en/messages.mjs +1 -0
- package/dist/packages/button/locales/fi/messages.mjs +1 -0
- package/dist/packages/button/locales/nb/messages.mjs +1 -0
- package/dist/packages/button/locales/sv/messages.mjs +1 -0
- package/dist/packages/button/react.d.ts +2 -0
- package/dist/packages/button/react.js +11 -0
- package/dist/packages/button/styles.d.ts +1 -0
- package/dist/packages/button/styles.js +2 -0
- package/dist/packages/card/card.react.stories.d.ts +16 -0
- package/dist/packages/card/card.react.stories.js +63 -0
- package/dist/packages/card/card.stories.d.ts +15 -0
- package/dist/packages/card/card.stories.js +82 -0
- package/dist/packages/card/card.test.d.ts +1 -0
- package/dist/packages/card/card.test.js +9 -0
- package/dist/packages/card/index.d.ts +27 -16
- package/dist/packages/card/index.js +2403 -2067
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/locales/da/messages.mjs +1 -0
- package/dist/packages/card/locales/en/messages.mjs +1 -0
- package/dist/packages/card/locales/fi/messages.mjs +1 -0
- package/dist/packages/card/locales/nb/messages.mjs +1 -0
- package/dist/packages/card/locales/sv/messages.mjs +1 -0
- package/dist/packages/card/react.d.ts +2 -0
- package/dist/packages/card/react.js +11 -0
- package/dist/packages/card/styles.d.ts +1 -0
- package/dist/packages/card/styles.js +2 -0
- package/dist/packages/expandable/expandable.react.stories.d.ts +18 -0
- package/dist/packages/expandable/expandable.react.stories.js +103 -0
- package/dist/packages/expandable/expandable.stories.d.ts +19 -0
- package/dist/packages/expandable/expandable.stories.js +132 -0
- package/dist/packages/expandable/expandable.test.d.ts +1 -0
- package/dist/packages/expandable/expandable.test.js +24 -0
- package/dist/packages/expandable/index.d.ts +52 -50
- package/dist/packages/expandable/index.js +2424 -2286
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/expandable/react.d.ts +2 -0
- package/dist/packages/expandable/react.js +11 -0
- package/dist/packages/expandable/styles.d.ts +1 -0
- package/dist/packages/expandable/styles.js +2 -0
- package/dist/packages/i18n.js +45 -0
- package/dist/packages/link/index.d.ts +34 -0
- package/dist/packages/link/index.js +99 -0
- package/dist/packages/link/styles.d.ts +1 -0
- package/dist/packages/link/styles.js +200 -0
- package/dist/packages/modal/index.d.ts +5 -6
- package/dist/packages/modal/index.js +5 -2611
- package/dist/packages/modal/locales/da/messages.mjs +1 -0
- package/dist/packages/modal/locales/en/messages.mjs +1 -0
- package/dist/packages/modal/locales/fi/messages.mjs +1 -0
- package/dist/packages/modal/locales/nb/messages.mjs +1 -0
- package/dist/packages/modal/locales/sv/messages.mjs +1 -0
- package/dist/packages/modal/modal-footer.d.ts +12 -10
- package/dist/packages/modal/modal-footer.js +2460 -0
- package/dist/packages/modal/modal-footer.js.map +7 -0
- package/dist/packages/modal/modal-header.d.ts +15 -13
- package/dist/packages/modal/modal-header.js +2567 -0
- package/dist/packages/modal/modal-header.js.map +7 -0
- package/dist/packages/modal/modal-main.d.ts +14 -8
- package/dist/packages/modal/modal-main.js +2572 -0
- package/dist/packages/modal/modal-main.js.map +7 -0
- package/dist/packages/modal/modal.react.stories.d.ts +14 -0
- package/dist/packages/modal/modal.react.stories.js +27 -0
- package/dist/packages/modal/modal.stories.d.ts +19 -0
- package/dist/packages/modal/modal.stories.js +254 -0
- package/dist/packages/modal/react.d.ts +12 -0
- package/dist/packages/modal/react.js +31 -0
- package/dist/packages/modal/util.d.ts +7 -17
- package/dist/packages/modal/util.js +21 -0
- package/dist/packages/pill/index.d.ts +39 -23
- package/dist/packages/pill/index.js +2408 -2175
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/pill/locales/da/messages.mjs +1 -0
- package/dist/packages/pill/locales/en/messages.mjs +1 -0
- package/dist/packages/pill/locales/fi/messages.mjs +1 -0
- package/dist/packages/pill/locales/nb/messages.mjs +1 -0
- package/dist/packages/pill/locales/sv/messages.mjs +1 -0
- package/dist/packages/pill/pill.react.stories.d.ts +23 -0
- package/dist/packages/pill/pill.react.stories.js +22 -0
- package/dist/packages/pill/pill.stories.d.ts +12 -0
- package/dist/packages/pill/pill.stories.js +33 -0
- package/dist/packages/pill/pill.test.d.ts +1 -0
- package/dist/packages/pill/pill.test.js +25 -0
- package/dist/packages/pill/react.d.ts +7 -0
- package/dist/packages/pill/react.js +17 -0
- package/dist/packages/pill/styles.d.ts +1 -0
- package/dist/packages/pill/styles.js +2 -0
- package/dist/packages/select/index.d.ts +56 -60
- package/dist/packages/select/index.js +2428 -2533
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/select/locales/da/messages.mjs +1 -0
- package/dist/packages/select/locales/en/messages.mjs +1 -0
- package/dist/packages/select/locales/fi/messages.mjs +1 -0
- package/dist/packages/select/locales/nb/messages.mjs +1 -0
- package/dist/packages/select/locales/sv/messages.mjs +1 -0
- package/dist/packages/select/react.d.ts +6 -0
- package/dist/packages/select/react.js +20 -0
- package/dist/packages/select/select.react.stories.d.ts +18 -0
- package/dist/packages/select/select.react.stories.js +28 -0
- package/dist/packages/select/select.stories.d.ts +17 -0
- package/dist/packages/select/select.stories.js +100 -0
- package/dist/packages/select/select.test.d.ts +1 -0
- package/dist/packages/select/select.test.js +31 -0
- package/dist/packages/select/styles.d.ts +1 -0
- package/dist/packages/select/styles.js +2 -0
- package/dist/packages/styles.js +2442 -0
- package/dist/packages/textfield/index.d.ts +78 -74
- package/dist/packages/textfield/index.js +2522 -707
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +11 -0
- package/dist/packages/textfield/react.js +21 -0
- package/dist/packages/textfield/styles/w-textfield.styles.d.ts +1 -0
- package/dist/packages/textfield/styles/w-textfield.styles.js +55 -0
- package/dist/packages/textfield/styles.d.ts +1 -0
- package/dist/packages/textfield/styles.js +2 -0
- package/dist/packages/textfield/textfield.react.stories.d.ts +37 -0
- package/dist/packages/textfield/textfield.react.stories.js +88 -0
- package/dist/packages/textfield/textfield.stories.d.ts +18 -0
- package/dist/packages/textfield/textfield.stories.js +105 -0
- package/dist/packages/textfield/textfield.test.d.ts +2 -0
- package/dist/packages/textfield/textfield.test.js +68 -0
- package/dist/packages/toast/api.d.ts +4 -45
- package/dist/packages/toast/api.js +41 -0
- package/dist/packages/toast/index.d.ts +3 -3
- package/dist/packages/toast/index.js +3 -2804
- package/dist/packages/toast/locales/da/messages.mjs +1 -0
- package/dist/packages/toast/locales/en/messages.mjs +1 -0
- package/dist/packages/toast/locales/fi/messages.mjs +1 -0
- package/dist/packages/toast/locales/nb/messages.mjs +1 -0
- package/dist/packages/toast/locales/sv/messages.mjs +1 -0
- package/dist/packages/toast/styles.d.ts +1 -0
- package/dist/packages/toast/styles.js +2 -0
- package/dist/packages/toast/toast-container.d.ts +13 -63
- package/dist/packages/toast/toast-container.js +2458 -0
- package/dist/packages/toast/toast-container.js.map +7 -0
- package/dist/packages/toast/toast.d.ts +36 -29
- package/dist/packages/toast/toast.js +2466 -0
- package/dist/packages/toast/toast.js.map +7 -0
- package/dist/packages/toast/toast.stories.d.ts +12 -0
- package/dist/packages/toast/toast.stories.js +50 -0
- package/dist/packages/toast/types.d.ts +15 -0
- package/dist/packages/toast/types.js +1 -0
- package/dist/packages/utils/expand-transition.d.ts +3 -3
- package/dist/packages/utils/expand-transition.js +59 -0
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/index.js +37 -0
- package/dist/packages/utils/unstyled-heading.d.ts +3 -4
- package/dist/packages/utils/unstyled-heading.js +22 -0
- package/dist/packages/utils/window-exists.js +1 -0
- package/dist/setup-tests.d.ts +1 -0
- package/dist/setup-tests.js +1 -0
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +296 -0
- package/dist/web-types.json +661 -0
- package/package.json +89 -36
- package/dist/index.js +0 -9820
- package/dist/index.js.map +0 -7
- package/dist/packages/modal/index.js.map +0 -7
- package/dist/packages/toast/index.js.map +0 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createComponent } from '@lit/react';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
// We do this in order to prevent users from bundling in the CE implementation when
|
|
5
|
+
// they should be getting it from Eik.
|
|
6
|
+
class Component extends LitElement {
|
|
7
|
+
}
|
|
8
|
+
export const Affix = createComponent({
|
|
9
|
+
tagName: 'w-affix',
|
|
10
|
+
// This tricks TS into thinking the stub we created above is still the actual implementation
|
|
11
|
+
// This ensures devs can import the react wrapper and use it with the full intellisense experience
|
|
12
|
+
// yet not bundling in the CE implementation into their app bundles.
|
|
13
|
+
elementClass: Component,
|
|
14
|
+
react: React,
|
|
15
|
+
});
|
|
@@ -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}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.rounded-4{border-radius:4px}.block{display:block}.flex{display:flex}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.items-center{align-items:center}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-center{justify-content:center}.absolute{position:absolute}.relative{position:relative}.static{position:static}.s-text{color:var(--w-s-color-text)}.w-40{width:4rem}.w-max{width:max-content}.pb-0{padding-bottom:0}.pl-12{padding-left:1.2rem}.pr-12{padding-right:1.2rem}.cursor-default{cursor:default}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { Alert } from './react';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("@lit/react").ReactWebComponent<import(".").WarpAlert, {}>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export type Story = StoryObj<typeof Alert>;
|
|
9
|
+
export declare const Info: Story;
|
|
10
|
+
export declare const Warning: Story;
|
|
11
|
+
export declare const Negative: Story;
|
|
12
|
+
export declare const Positive: Story;
|
|
13
|
+
export declare const WithDescription: Story;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert } from './react';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Feedback/Alert',
|
|
5
|
+
component: Alert,
|
|
6
|
+
};
|
|
7
|
+
export const Info = {
|
|
8
|
+
args: {
|
|
9
|
+
variant: 'info',
|
|
10
|
+
show: true,
|
|
11
|
+
role: 'alert',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export const Warning = {
|
|
15
|
+
args: {
|
|
16
|
+
variant: 'warning',
|
|
17
|
+
show: true,
|
|
18
|
+
role: 'alert',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const Negative = {
|
|
22
|
+
args: {
|
|
23
|
+
variant: 'negative',
|
|
24
|
+
show: true,
|
|
25
|
+
role: 'alert',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Positive = {
|
|
29
|
+
args: {
|
|
30
|
+
variant: 'positive',
|
|
31
|
+
show: true,
|
|
32
|
+
role: 'alert',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const WithDescription = {
|
|
36
|
+
args: {
|
|
37
|
+
variant: 'info',
|
|
38
|
+
show: true,
|
|
39
|
+
role: 'alert',
|
|
40
|
+
children: (React.createElement(React.Fragment, null,
|
|
41
|
+
React.createElement("h3", null, "Alert Title"),
|
|
42
|
+
React.createElement("p", null, "This is a more detailed alert message with additional description."))),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import '../utils/expand-transition.js';
|
|
3
|
+
import type { WarpAlert } from './index.js';
|
|
4
|
+
import './index.js';
|
|
5
|
+
declare const args: Partial<WarpAlert> & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
declare const meta: Meta<typeof args>;
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof args>;
|
|
11
|
+
export declare const Info: Story;
|
|
12
|
+
export declare const Warning: Story;
|
|
13
|
+
export declare const Negative: Story;
|
|
14
|
+
export declare const Positive: Story;
|
|
15
|
+
export declare const WithDescription: Story;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 '../utils/expand-transition.js';
|
|
6
|
+
import './index.js';
|
|
7
|
+
const { events, args, argTypes } = getStorybookHelpers('w-alert');
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Feedback/Alert',
|
|
10
|
+
render(args) {
|
|
11
|
+
return html `
|
|
12
|
+
<w-alert ${spread(prespread(args))}>
|
|
13
|
+
<p>This is an alert message</p>
|
|
14
|
+
</w-alert>
|
|
15
|
+
`;
|
|
16
|
+
},
|
|
17
|
+
args,
|
|
18
|
+
argTypes,
|
|
19
|
+
parameters: {
|
|
20
|
+
actions: {
|
|
21
|
+
handles: events,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
export const Info = {
|
|
27
|
+
args: {
|
|
28
|
+
variant: 'info',
|
|
29
|
+
show: true,
|
|
30
|
+
role: 'alert',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Warning = {
|
|
34
|
+
args: {
|
|
35
|
+
variant: 'warning',
|
|
36
|
+
show: true,
|
|
37
|
+
role: 'alert',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const Negative = {
|
|
41
|
+
args: {
|
|
42
|
+
variant: 'negative',
|
|
43
|
+
show: true,
|
|
44
|
+
role: 'alert',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const Positive = {
|
|
48
|
+
args: {
|
|
49
|
+
variant: 'positive',
|
|
50
|
+
show: true,
|
|
51
|
+
role: 'alert',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const WithDescription = {
|
|
55
|
+
args: {
|
|
56
|
+
variant: 'info',
|
|
57
|
+
show: true,
|
|
58
|
+
role: 'alert',
|
|
59
|
+
},
|
|
60
|
+
render(args) {
|
|
61
|
+
return html `
|
|
62
|
+
<w-alert ${spread(prespread(args))}>
|
|
63
|
+
<h3>Alert Title</h3>
|
|
64
|
+
<p>This is a more detailed alert message with additional description.</p>
|
|
65
|
+
</w-alert>
|
|
66
|
+
`;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import { render } from 'vitest-browser-lit';
|
|
4
|
+
import './index.js';
|
|
5
|
+
test('renders an info', async () => {
|
|
6
|
+
const page = render(html `<w-alert variant="info" show data-testid="infoMessage">This is information</w-alert>`);
|
|
7
|
+
// Verify the icon correct icon is rendered
|
|
8
|
+
await expect
|
|
9
|
+
.poll(() => page.getByTestId('infoMessage').element().shadowRoot.querySelector('w-icon-info-16'))
|
|
10
|
+
.toBeVisible();
|
|
11
|
+
await expect.element(page.getByTestId('infoMessage')).toBeVisible();
|
|
12
|
+
await expect.element(page.getByText('This is information')).toBeVisible();
|
|
13
|
+
});
|
|
14
|
+
test('does not render when "show" is not set / or not true', async () => {
|
|
15
|
+
const component = html `<w-alert variant="warning" data-testid="warningMessage">This is a warning</w-alert>`;
|
|
16
|
+
const page = render(component);
|
|
17
|
+
await expect.element(page.container.querySelector('w-alert')).not.toHaveAttribute('show');
|
|
18
|
+
});
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
static styles: (import("lit").CSSResult | (import("lit").CSSResult | CSSStyleSheet | import("lit").CSSResultArray)[])[];
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '@warp-ds/icons/elements/info-16';
|
|
3
|
+
import '@warp-ds/icons/elements/warning-16';
|
|
4
|
+
import '@warp-ds/icons/elements/error-16';
|
|
5
|
+
import '@warp-ds/icons/elements/success-16';
|
|
6
|
+
type AlertVariants = 'negative' | 'positive' | 'warning' | 'info';
|
|
7
|
+
/**
|
|
8
|
+
* Alert is an inline component used for displaying different types of messages.
|
|
9
|
+
*
|
|
10
|
+
* For accessibility reasons, alert should appear close to the element that triggered it.
|
|
11
|
+
*
|
|
12
|
+
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/feedback-alert--docs)
|
|
13
|
+
*/
|
|
14
|
+
declare class WarpAlert extends LitElement {
|
|
15
|
+
variant: AlertVariants;
|
|
17
16
|
show: boolean;
|
|
17
|
+
role: string;
|
|
18
|
+
constructor();
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
/** @internal */
|
|
18
21
|
get _wrapperClasses(): string;
|
|
22
|
+
/** @internal */
|
|
19
23
|
get _iconClasses(): string;
|
|
24
|
+
static styles: import("lit").CSSResult[];
|
|
25
|
+
/** @internal */
|
|
20
26
|
get _icon(): import("lit").TemplateResult<1> | "";
|
|
21
27
|
render(): import("lit").TemplateResult<1>;
|
|
22
28
|
}
|
|
23
|
-
|
|
29
|
+
export { WarpAlert };
|