@warp-ds/elements 2.2.0-next.20 → 2.2.0-next.22
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 +26 -37
- package/dist/api.js.map +1 -1
- package/dist/custom-elements.json +1118 -977
- package/dist/index.d.ts +183 -162
- 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.js +1 -1
- package/dist/packages/affix/index.js +1 -1
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +1 -1
- package/dist/packages/affix/react.js +10 -3
- 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.js +1 -1
- package/dist/packages/alert/alert.test.js +3 -1
- package/dist/packages/alert/index.d.ts +1 -1
- package/dist/packages/alert/index.js +2 -2
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/alert/react.d.ts +1 -1
- package/dist/packages/alert/react.js +6 -3
- package/dist/packages/alert/styles.js +1 -1
- 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 +1 -0
- package/dist/packages/attention/attention.stories.js +31 -39
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/attention/index.d.ts +3 -2
- package/dist/packages/attention/index.js +238 -17
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/react.d.ts +15 -1
- package/dist/packages/attention/react.js +13 -5
- package/dist/packages/attention/styles.js +1 -1
- 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.js +1 -1
- package/dist/packages/badge/index.js +1 -1
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +1 -1
- package/dist/packages/badge/react.js +6 -3
- 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.js +1 -1
- package/dist/packages/box/index.js +3 -3
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +1 -1
- package/dist/packages/box/react.js +6 -3
- 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.js +1 -1
- package/dist/packages/breadcrumbs/index.js +6 -6
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/react.d.ts +1 -1
- package/dist/packages/breadcrumbs/react.js +6 -3
- 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.js +1 -1
- package/dist/packages/button/index.js +2 -2
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/button/react.js +6 -3
- 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.js +2 -2
- package/dist/packages/card/index.d.ts +1 -1
- package/dist/packages/card/index.js +2 -2
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/react.d.ts +1 -1
- package/dist/packages/card/react.js +6 -3
- package/dist/packages/combobox/combobox.react.stories.d.ts +28 -0
- package/dist/packages/combobox/combobox.react.stories.js +90 -0
- package/dist/packages/combobox/combobox.stories.d.ts +5 -1
- package/dist/packages/combobox/combobox.stories.js +47 -25
- package/dist/packages/combobox/index.d.ts +1 -1
- package/dist/packages/combobox/index.js +4 -4
- package/dist/packages/combobox/index.js.map +4 -4
- package/dist/packages/combobox/react.d.ts +7 -0
- package/dist/packages/combobox/react.js +17 -0
- package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
- package/dist/packages/datepicker/DatePicker.test.js +3 -2
- package/dist/packages/datepicker/datepicker.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.js +105 -105
- package/dist/packages/datepicker/datepicker.js.map +4 -4
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +18 -0
- package/dist/packages/datepicker/datepicker.react.stories.js +26 -0
- package/dist/packages/datepicker/datepicker.stories.js +1 -1
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- package/dist/packages/datepicker/index.js +105 -105
- package/dist/packages/datepicker/index.js.map +4 -4
- package/dist/packages/datepicker/react.d.ts +5 -2
- package/dist/packages/datepicker/react.js +10 -3
- package/dist/packages/dead-toggle/dead-toggle.react.stories.d.ts +15 -0
- package/dist/packages/dead-toggle/dead-toggle.react.stories.js +34 -0
- package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +5 -1
- package/dist/packages/dead-toggle/dead-toggle.stories.js +25 -3
- package/dist/packages/dead-toggle/index.js +1 -1
- package/dist/packages/dead-toggle/index.js.map +2 -2
- package/dist/packages/dead-toggle/react.d.ts +1 -1
- package/dist/packages/dead-toggle/react.js +6 -3
- 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.js +1 -1
- package/dist/packages/expandable/index.js +2 -2
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/expandable/react.d.ts +1 -1
- package/dist/packages/expandable/react.js +6 -3
- package/dist/packages/i18n.js +2 -1
- package/dist/packages/link/index.js +1 -1
- package/dist/packages/link/index.js.map +4 -4
- package/dist/packages/link/link.react.stories.d.ts +21 -0
- package/dist/packages/link/link.react.stories.js +96 -0
- package/dist/packages/link/link.stories.js +1 -12
- package/dist/packages/link/link.test.js +1 -1
- package/dist/packages/link/react.d.ts +1 -1
- package/dist/packages/link/react.js +6 -3
- package/dist/packages/modal/index.js +8 -8
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/modal/modal-footer.js +3 -3
- package/dist/packages/modal/modal-footer.js.map +3 -3
- package/dist/packages/modal/modal-header.js +4 -4
- package/dist/packages/modal/modal-header.js.map +4 -4
- package/dist/packages/modal/modal-main.js.map +1 -1
- 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 +1 -1
- package/dist/packages/modal/modal.stories.js +1 -1
- package/dist/packages/modal/react.d.ts +11 -3
- package/dist/packages/modal/react.js +19 -6
- package/dist/packages/pageindicator/pageindicator.react.stories.d.ts +19 -0
- package/dist/packages/pageindicator/pageindicator.react.stories.js +20 -0
- package/dist/packages/pageindicator/pageindicator.stories.d.ts +1 -1
- package/dist/packages/pageindicator/pageindicator.stories.js +1 -1
- package/dist/packages/pageindicator/react.d.ts +1 -1
- package/dist/packages/pageindicator/react.js +6 -3
- package/dist/packages/pagination/index.js +9 -3
- package/dist/packages/pagination/index.js.map +3 -3
- package/dist/packages/pagination/pagination.react.stories.d.ts +21 -0
- package/dist/packages/pagination/pagination.react.stories.js +45 -0
- package/dist/packages/pagination/pagination.stories.js +6 -6
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pagination/react.d.ts +5 -2
- package/dist/packages/pagination/react.js +10 -3
- package/dist/packages/pill/index.js +1 -1
- package/dist/packages/pill/index.js.map +2 -2
- 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.js +1 -1
- package/dist/packages/pill/pill.test.js +3 -1
- package/dist/packages/pill/react.d.ts +7 -0
- package/dist/packages/pill/react.js +17 -0
- package/dist/packages/pill/styles.js +1 -1
- package/dist/packages/rip-and-tear-checkbox/checkbox.js +5 -5
- package/dist/packages/rip-and-tear-checkbox/checkbox.js.map +3 -3
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.d.ts +8 -0
- package/dist/packages/rip-and-tear-checkbox/checkbox.stories.js +11 -0
- package/dist/packages/rip-and-tear-checkbox/index.js +5 -5
- package/dist/packages/rip-and-tear-checkbox/index.js.map +3 -3
- package/dist/packages/rip-and-tear-checkbox/react.d.ts +5 -0
- package/dist/packages/rip-and-tear-checkbox/react.js +15 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.d.ts +12 -0
- package/dist/packages/rip-and-tear-checkbox/rip-and-tear-checkbox.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-radio/index.js +8 -8
- package/dist/packages/rip-and-tear-radio/index.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/radio-group.js +8 -8
- package/dist/packages/rip-and-tear-radio/radio-group.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/radio.js.map +2 -2
- package/dist/packages/rip-and-tear-radio/radio.stories.js +9 -9
- package/dist/packages/rip-and-tear-radio/radio.stories.js.map +3 -3
- package/dist/packages/rip-and-tear-radio/react.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/react.js +22 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.d.ts +9 -0
- package/dist/packages/rip-and-tear-radio/rip-and-tear-radio.react.stories.js +10 -0
- package/dist/packages/rip-and-tear-radio/slot.js +3 -3
- package/dist/packages/select/index.d.ts +4 -4
- package/dist/packages/select/index.js +12 -12
- package/dist/packages/select/index.js.map +3 -3
- package/dist/packages/select/react.d.ts +6 -2
- package/dist/packages/select/react.js +15 -3
- 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.js +2 -2
- package/dist/packages/select/select.test.js +1 -1
- package/dist/packages/select/styles.js +1 -1
- package/dist/packages/slider/Slider.js +1 -1
- package/dist/packages/slider/SliderThumb.js +1 -1
- package/dist/packages/slider/index.js +6 -6
- package/dist/packages/slider/index.js.map +4 -4
- package/dist/packages/slider/react.d.ts +8 -0
- package/dist/packages/slider/react.js +20 -0
- package/dist/packages/slider/slider-thumb.js +3 -3
- package/dist/packages/slider/slider-thumb.js.map +4 -4
- package/dist/packages/slider/slider.js +2 -2
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.react.stories.d.ts +18 -0
- package/dist/packages/slider/slider.react.stories.js +119 -0
- package/dist/packages/slider/slider.stories.js +2 -2
- package/dist/packages/slider/slider.test.js +1 -1
- package/dist/packages/slider/styles.js +1 -1
- package/dist/packages/steps/index.js +2 -2
- package/dist/packages/steps/index.js.map +4 -4
- package/dist/packages/steps/react.d.ts +1 -1
- package/dist/packages/steps/react.js +7 -4
- package/dist/packages/steps/steps.react.stories.d.ts +15 -0
- package/dist/packages/steps/steps.react.stories.js +112 -0
- package/dist/packages/switch/index.js +1 -1
- package/dist/packages/switch/index.js.map +4 -4
- package/dist/packages/switch/react.d.ts +5 -2
- package/dist/packages/switch/react.js +10 -3
- package/dist/packages/switch/switch.react.stories.d.ts +15 -0
- package/dist/packages/switch/switch.react.stories.js +29 -0
- package/dist/packages/tabs/index.d.ts +1 -1
- package/dist/packages/tabs/index.js +12 -12
- package/dist/packages/tabs/index.js.map +4 -4
- package/dist/packages/tabs/react.d.ts +11 -3
- package/dist/packages/tabs/react.js +18 -5
- package/dist/packages/tabs/tab-panel.js.map +2 -2
- package/dist/packages/tabs/tab.js +1 -1
- package/dist/packages/tabs/tab.js.map +4 -4
- package/dist/packages/tabs/tabs.d.ts +2 -0
- package/dist/packages/tabs/tabs.js +4 -4
- package/dist/packages/tabs/tabs.js.map +4 -4
- package/dist/packages/tabs/tabs.react.stories.d.ts +15 -0
- package/dist/packages/tabs/tabs.react.stories.js +51 -0
- package/dist/packages/tabs/tabs.stories.js +12 -12
- package/dist/packages/tabs/tabs.stories.js.map +4 -4
- package/dist/packages/textfield/index.js +2 -2
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +11 -2
- package/dist/packages/textfield/react.js +16 -3
- package/dist/packages/textfield/styles.js +1 -1
- 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.js +1 -1
- package/dist/packages/textfield/textfield.test.js +1 -1
- package/dist/packages/toast/api.d.ts +1 -1
- package/dist/packages/toast/index.d.ts +1 -1
- package/dist/packages/toast/index.js +14 -14
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/toast-container.d.ts +1 -1
- package/dist/packages/toast/toast-container.js +2454 -149
- package/dist/packages/toast/toast-container.js.map +7 -0
- package/dist/packages/toast/toast.js +2459 -193
- package/dist/packages/toast/toast.js.map +7 -0
- package/dist/packages/toast/toast.stories.js +1 -1
- package/dist/packages/utils/expand-transition.js +1 -1
- package/dist/vscode.html-custom-data.json +83 -78
- package/dist/web-types.json +135 -127
- package/package.json +22 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WarpAlert } from '
|
|
1
|
+
import { WarpAlert } from '.';
|
|
2
2
|
export declare const Alert: import("@lit/react").ReactWebComponent<WarpAlert, {}>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
2
|
import { createComponent } from '@lit/react';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
|
+
// decouple from CDN by providing a dummy class
|
|
5
|
+
class Component extends LitElement {
|
|
6
|
+
}
|
|
4
7
|
export const Alert = createComponent({
|
|
5
8
|
tagName: 'w-alert',
|
|
6
|
-
elementClass:
|
|
9
|
+
elementClass: Component,
|
|
7
10
|
react: React,
|
|
8
11
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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}.will-change-height{will-change:height}.border{border-width:1px}.border-l-4{border-left-width:4px}.rounded-4{border-radius:4px}.block{display:block}.flex{display:flex}.static{position:static}.s-bg-info-subtle{background-color:var(--w-s-color-background-info-subtle)}.s-bg-negative-subtle{background-color:var(--w-s-color-background-negative-subtle)}.s-bg-positive-subtle{background-color:var(--w-s-color-background-positive-subtle)}.s-bg-warning-subtle{background-color:var(--w-s-color-background-warning-subtle)}.s-text{color:var(--w-s-color-text)}.s-icon-info{color:var(--w-s-color-icon-info)}.s-icon-negative{color:var(--w-s-color-icon-negative)}.s-icon-positive{color:var(--w-s-color-icon-positive)}.s-icon-warning{color:var(--w-s-color-icon-warning)}.s-border-info-subtle{border-color:var(--w-s-color-border-info-subtle)}.s-border-l-info{border-left-color:var(--w-s-color-border-info)}.s-border-l-negative{border-left-color:var(--w-s-color-border-negative)}.s-border-l-positive{border-left-color:var(--w-s-color-border-positive)}.s-border-l-warning{border-left-color:var(--w-s-color-border-warning)}.s-border-negative-subtle{border-color:var(--w-s-color-border-negative-subtle)}.s-border-positive-subtle{border-color:var(--w-s-color-border-positive-subtle)}.s-border-warning-subtle{border-color:var(--w-s-color-border-warning-subtle)}.min-w-16{min-width:1.6rem}.w-16{width:1.6rem}.last-child\\:mb-0>:last-child{margin-bottom:0}.mr-8{margin-right:.8rem}.p-16{padding:1.6rem}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}`;
|
|
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}.will-change-height{will-change:height}.border{border-width:1px}.border-l-4{border-left-width:4px}.rounded-4{border-radius:4px}.block{display:block}.inline{display:inline}.flex{display:flex}.static{position:static}.s-bg-info-subtle{background-color:var(--w-s-color-background-info-subtle)}.s-bg-negative-subtle{background-color:var(--w-s-color-background-negative-subtle)}.s-bg-positive-subtle{background-color:var(--w-s-color-background-positive-subtle)}.s-bg-warning-subtle{background-color:var(--w-s-color-background-warning-subtle)}.s-text{color:var(--w-s-color-text)}.s-icon-info{color:var(--w-s-color-icon-info)}.s-icon-negative{color:var(--w-s-color-icon-negative)}.s-icon-positive{color:var(--w-s-color-icon-positive)}.s-icon-warning{color:var(--w-s-color-icon-warning)}.s-border-info-subtle{border-color:var(--w-s-color-border-info-subtle)}.s-border-l-info{border-left-color:var(--w-s-color-border-info)}.s-border-l-negative{border-left-color:var(--w-s-color-border-negative)}.s-border-l-positive{border-left-color:var(--w-s-color-border-positive)}.s-border-l-warning{border-left-color:var(--w-s-color-border-warning)}.s-border-negative-subtle{border-color:var(--w-s-color-border-negative-subtle)}.s-border-positive-subtle{border-color:var(--w-s-color-border-positive-subtle)}.s-border-warning-subtle{border-color:var(--w-s-color-border-warning-subtle)}.min-w-16{min-width:1.6rem}.w-16{width:1.6rem}.last-child\\:mb-0>:last-child{margin-bottom:0}.mr-8{margin-right:.8rem}.p-16{padding:1.6rem}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { Attention } from './react';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: React.FC<import("./react").AttentionProps>;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export type Story = StoryObj<typeof Attention>;
|
|
10
|
+
export declare const Default: Story;
|
|
11
|
+
export declare const ToolTip: Story;
|
|
12
|
+
export declare const Callout: Story;
|
|
13
|
+
export declare const Highlight: Story;
|
|
14
|
+
export declare const DismissibleHighlight: Story;
|
|
15
|
+
export declare const AccessibleTooltip: Story;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button } from '../button/react';
|
|
3
|
+
import { Attention } from './react';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Overlays/Attention',
|
|
6
|
+
component: Attention,
|
|
7
|
+
};
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
placement: 'bottom',
|
|
11
|
+
popover: true,
|
|
12
|
+
flip: true,
|
|
13
|
+
},
|
|
14
|
+
render: (args) => {
|
|
15
|
+
const [show, setShow] = useState(false);
|
|
16
|
+
return (React.createElement(Attention, { ...args, show: show },
|
|
17
|
+
React.createElement(Button, { onClick: () => setShow(!show), slot: "target" }, "Click to toggle a popover"),
|
|
18
|
+
React.createElement("span", { slot: "message" }, "I'm a popover")));
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const ToolTip = {
|
|
22
|
+
args: {
|
|
23
|
+
placement: 'right',
|
|
24
|
+
id: 'tooltip-element',
|
|
25
|
+
tooltip: true,
|
|
26
|
+
flip: true,
|
|
27
|
+
},
|
|
28
|
+
render: (args) => {
|
|
29
|
+
const [show, setShow] = useState(false);
|
|
30
|
+
return (React.createElement(Attention, { ...args, show: show },
|
|
31
|
+
React.createElement(Button, { slot: "target", onMouseEnter: () => {
|
|
32
|
+
setShow(true);
|
|
33
|
+
}, onMouseLeave: () => setShow(false), onFocus: () => setShow(true), onBlur: () => setShow(false) }, "hover me"),
|
|
34
|
+
React.createElement("span", { slot: "message" }, "Tooltip content")));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const Callout = {
|
|
38
|
+
args: {
|
|
39
|
+
placement: 'right',
|
|
40
|
+
callout: false,
|
|
41
|
+
show: true,
|
|
42
|
+
className: 'flex items-center gap-8',
|
|
43
|
+
},
|
|
44
|
+
render: (args) => {
|
|
45
|
+
return (React.createElement(Attention, { ...args },
|
|
46
|
+
React.createElement(Button, { slot: "target" }, "I need a callout"),
|
|
47
|
+
React.createElement("span", { slot: "message" }, "Callout")));
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const Highlight = {
|
|
51
|
+
args: {
|
|
52
|
+
placement: 'right',
|
|
53
|
+
highlight: true,
|
|
54
|
+
flip: true,
|
|
55
|
+
},
|
|
56
|
+
render: (args) => {
|
|
57
|
+
const [show, setShow] = useState(false);
|
|
58
|
+
return (React.createElement(Attention, { ...args, show: show },
|
|
59
|
+
React.createElement(Button, { onClick: () => setShow(!show), slot: "target" }, "I'm highlighted"),
|
|
60
|
+
React.createElement("span", { slot: "message" }, "Highlighted content")));
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const DismissibleHighlight = {
|
|
64
|
+
args: {
|
|
65
|
+
className: 'flex items-center gap-8',
|
|
66
|
+
placement: 'right',
|
|
67
|
+
canClose: true,
|
|
68
|
+
crossAxis: true,
|
|
69
|
+
highlight: true,
|
|
70
|
+
flip: true,
|
|
71
|
+
},
|
|
72
|
+
render: (args) => {
|
|
73
|
+
const [show, setShow] = useState(false);
|
|
74
|
+
return (React.createElement(Attention, { ...args, show: show, onClose: () => setShow(false) },
|
|
75
|
+
React.createElement(Button, { onClick: () => setShow(!show), slot: "target" }, "click me"),
|
|
76
|
+
React.createElement("span", { slot: "message" }, "Dismissible highlight content")));
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const AccessibleTooltip = {
|
|
80
|
+
args: {
|
|
81
|
+
placement: 'right',
|
|
82
|
+
popover: true,
|
|
83
|
+
},
|
|
84
|
+
render: (args) => {
|
|
85
|
+
const [show, setShow] = useState(false);
|
|
86
|
+
return (React.createElement(Attention, { ...args, show: show },
|
|
87
|
+
React.createElement("div", { slot: "message" },
|
|
88
|
+
React.createElement("p", { id: "aria-content", role: "tooltip" }, "I'm a popover with ARIA \"tooltip\" role"),
|
|
89
|
+
React.createElement("p", null, "(this text is less relevant)")),
|
|
90
|
+
React.createElement("button", { onClick: () => setShow(!show), "aria-details": "aria-content", id: "accessible-target", className: "group block relative break-words last-child:mb-0 p-16 rounded-8 s-bg-subtle", slot: "target" }, "Click to toggle a popover")));
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
1
|
import { spread } from '@open-wc/lit-helpers';
|
|
3
2
|
import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
|
|
3
|
+
import { html } from 'lit';
|
|
4
4
|
import { prespread } from '../../.storybook/utilities.js';
|
|
5
5
|
import './index.js';
|
|
6
|
+
import '../button/index.js';
|
|
6
7
|
const { events, args, argTypes } = getStorybookHelpers('w-attention');
|
|
7
8
|
const meta = {
|
|
8
9
|
title: 'Overlays/Attention',
|
|
9
10
|
render(args) {
|
|
10
11
|
return html `
|
|
11
12
|
<w-attention ${spread(prespread(args))}>
|
|
12
|
-
<button
|
|
13
|
+
<w-button
|
|
13
14
|
${spread({ id: args.buttonId })}
|
|
14
|
-
|
|
15
|
+
variant="secondary"
|
|
15
16
|
slot="target">
|
|
16
17
|
${args.buttonText}
|
|
17
|
-
</button>
|
|
18
|
+
</w-button>
|
|
18
19
|
<span slot="message">I'm a message</span>
|
|
19
20
|
</w-attention>
|
|
20
21
|
`;
|
|
@@ -37,42 +38,27 @@ export const Default = {
|
|
|
37
38
|
render(args) {
|
|
38
39
|
return html `
|
|
39
40
|
<w-attention ${spread(prespread(args))}>
|
|
40
|
-
<w-button
|
|
41
|
+
<w-button
|
|
42
|
+
id="popoverTarget"
|
|
43
|
+
slot="target"
|
|
44
|
+
variant="secondary"
|
|
45
|
+
@click=${(e) => { const attention = e.currentTarget.closest('w-attention'); attention.show = !attention.show; }}>
|
|
46
|
+
Click to toggle a popover
|
|
47
|
+
</w-button>
|
|
41
48
|
<span slot="message">I'm a popover</span>
|
|
42
49
|
</w-attention>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
const popoverTarget = document.querySelector('#popoverTarget');
|
|
46
|
-
const popoverEl = document.querySelector('[popover]');
|
|
47
|
-
|
|
48
|
-
popoverTarget.addEventListener('click', () => {
|
|
49
|
-
if (popoverEl.show) {
|
|
50
|
-
popoverEl.removeAttribute('show');
|
|
51
|
-
} else {
|
|
52
|
-
popoverEl.setAttribute('show', 'true');
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
</script>
|
|
56
50
|
`;
|
|
57
51
|
},
|
|
58
|
-
decorators: [
|
|
59
|
-
(story) => html `
|
|
60
|
-
${story()}
|
|
61
|
-
<script>
|
|
62
|
-
// use IIFE to create local scope
|
|
63
|
-
(() => {
|
|
64
|
-
const popoverIconEl = document.getElementById('attention-element');
|
|
65
|
-
const popoverIconTarget = document.getElementById('icon-button-target');
|
|
66
|
-
popoverIconTarget.addEventListener('click', () => {
|
|
67
|
-
popoverIconEl.show = !popoverIconEl.show;
|
|
68
|
-
});
|
|
69
|
-
})();
|
|
70
|
-
</script>
|
|
71
|
-
`,
|
|
72
|
-
],
|
|
73
52
|
};
|
|
74
53
|
export const ToolTip = {
|
|
75
|
-
args: {
|
|
54
|
+
args: {
|
|
55
|
+
placement: 'right',
|
|
56
|
+
buttonText: 'hover me',
|
|
57
|
+
id: 'tooltip-element',
|
|
58
|
+
tooltip: true,
|
|
59
|
+
flip: true,
|
|
60
|
+
buttonId: 'tooltip-target',
|
|
61
|
+
},
|
|
76
62
|
decorators: [
|
|
77
63
|
(story) => html `
|
|
78
64
|
${story()}
|
|
@@ -98,7 +84,13 @@ export const ToolTip = {
|
|
|
98
84
|
],
|
|
99
85
|
};
|
|
100
86
|
export const Callout = {
|
|
101
|
-
args: {
|
|
87
|
+
args: {
|
|
88
|
+
buttonText: 'i need a callout',
|
|
89
|
+
class: 'flex items-center gap-8',
|
|
90
|
+
placement: 'right',
|
|
91
|
+
callout: true,
|
|
92
|
+
show: true,
|
|
93
|
+
},
|
|
102
94
|
};
|
|
103
95
|
export const Highlight = {
|
|
104
96
|
args: {
|
|
@@ -163,13 +155,13 @@ export const AccessibleTooltip = {
|
|
|
163
155
|
<p id="aria-content" role="tooltip">I'm a popover with ARIA "tooltip" role</p>
|
|
164
156
|
<p>(this text is less relevant)</p>
|
|
165
157
|
</div>
|
|
166
|
-
<button
|
|
158
|
+
<w-button
|
|
167
159
|
aria-details="aria-content"
|
|
168
160
|
id="accessible-target"
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
slot="target"
|
|
162
|
+
variant="secondary">
|
|
171
163
|
Click to toggle a popover
|
|
172
|
-
</button>
|
|
164
|
+
</w-button>
|
|
173
165
|
</w-attention>
|
|
174
166
|
`;
|
|
175
167
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import { Directions } from '@warp-ds/core/attention';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
3
|
import '@warp-ds/icons/elements/close-16';
|
|
4
|
+
import '../button/index';
|
|
4
5
|
export declare const ccAttention: {
|
|
5
6
|
base: string;
|
|
6
7
|
tooltip: string;
|
|
@@ -62,7 +63,7 @@ declare class WarpAttention extends LitElement {
|
|
|
62
63
|
/** @internal */
|
|
63
64
|
get _arrowClasses(): string;
|
|
64
65
|
/** @internal */
|
|
65
|
-
get _arrowHtml():
|
|
66
|
+
get _arrowHtml(): import("lit").TemplateResult<1> | "";
|
|
66
67
|
/** @internal */
|
|
67
68
|
get _activeVariantClasses(): {
|
|
68
69
|
wrapper: any;
|