@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 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"card.button.text\":[\"Vælg\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"card.button.text\":[\"Select\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"card.button.text\":[\"Valitse\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"card.button.text\":[\"Velg\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"card.button.text\":[\"Välj\"]}");
|
|
@@ -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 Card = createComponent({
|
|
8
|
+
tagName: 'w-card',
|
|
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}.border-2{border-width:2px}.border-transparent{border-color:#0000}.rounded-4{border-radius:4px}.rounded-8{border-radius:8px}.block{display:block}.overflow-hidden{overflow:hidden}.outline{outline-style:solid}.inset-0{top:0;bottom:0;left:0;right:0}.absolute{position:absolute}.relative{position:relative}.static{position:static}.\\!s-bg-selected{background-color:var(--w-s-color-background-selected)!important}.s-bg{background-color:var(--w-s-color-background)}.s-bg-selected{background-color:var(--w-s-color-background-selected)}.\\!hover\\:s-bg-selected-hover:hover{background-color:var(--w-s-color-background-selected-hover)!important}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-selected-hover:hover{background-color:var(--w-s-color-background-selected-hover)}.\\!active\\:s-bg-selected-active:active{background-color:var(--w-s-color-background-selected-active)!important}.active\\:s-bg-active:active{background-color:var(--w-s-color-background-active)}.active\\:s-bg-selected-active:active{background-color:var(--w-s-color-background-selected-active)}.s-border{border-color:var(--w-s-color-border)}.s-border-selected{border-color:var(--w-s-color-border-selected)}.group:hover .group-hover\\:s-border-selected-hover{border-color:var(--w-s-color-border-selected-hover)}.hover\\:s-border-hover:hover{border-color:var(--w-s-color-border-hover)}.hover\\:s-border-selected-hover:hover{border-color:var(--w-s-color-border-selected-hover)}.active\\:s-border-active:active{border-color:var(--w-s-color-border-active)}.active\\:s-border-selected-active:active{border-color:var(--w-s-color-border-selected-active)}.group:active .group-active\\:s-border-active{border-color:var(--w-s-color-border-active)}.group:active .group-active\\:s-border-selected-active{border-color:var(--w-s-color-border-selected-active)}.s-surface-elevated-200{background-color:var(--w-s-color-surface-elevated-200);box-shadow:var(--w-s-shadow-surface-elevated-200)}.hover\\:s-surface-elevated-200-hover:hover{background-color:var(--w-s-color-surface-elevated-200-hover);box-shadow:var(--w-s-shadow-surface-elevated-200-hover)}.active\\:s-surface-elevated-200-active:active{background-color:var(--w-s-color-surface-elevated-200-active);box-shadow:var(--w-s-shadow-surface-elevated-200-active)}.cursor-pointer{cursor:pointer}.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}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { Expandable } from './react';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
render(args: Omit<React.HTMLAttributes<import(".").WarpExpandable>, "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "buttonClass" | "updated" | "firstUpdated" | "bleed" | "expanded" | "box" | "contentClass" | "noChevron" | "animated" | "headingLevel" | "_hasTitle" | "_showChevronUp" | "_expandableSlot"> & {} & Partial<Omit<import(".").WarpExpandable, keyof HTMLElement>> & React.RefAttributes<import(".").WarpExpandable>): React.JSX.Element;
|
|
7
|
+
component: import("@lit/react").ReactWebComponent<import(".").WarpExpandable, {}>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export type Story = StoryObj<typeof Expandable>;
|
|
11
|
+
export declare const Default: Story;
|
|
12
|
+
export declare const Expanded: Story;
|
|
13
|
+
export declare const Box: Story;
|
|
14
|
+
export declare const Animated: Story;
|
|
15
|
+
export declare const WithHeading: Story;
|
|
16
|
+
export declare const NoChevron: Story;
|
|
17
|
+
export declare const CustomTitle: Story;
|
|
18
|
+
export declare const NoTitle: Story;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button } from '../button/react';
|
|
3
|
+
import { Expandable } from './react';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Layout/Expandable',
|
|
6
|
+
render(args) {
|
|
7
|
+
return (React.createElement(Expandable, { ...args },
|
|
8
|
+
React.createElement("p", null, "This is the expandable content that can be shown or hidden."),
|
|
9
|
+
React.createElement("p", null, "It can contain multiple paragraphs and other elements.")));
|
|
10
|
+
},
|
|
11
|
+
component: Expandable,
|
|
12
|
+
};
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
title: "I'm expandable",
|
|
16
|
+
expanded: false,
|
|
17
|
+
box: false,
|
|
18
|
+
bleed: false,
|
|
19
|
+
animated: false,
|
|
20
|
+
noChevron: false,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const Expanded = {
|
|
24
|
+
args: {
|
|
25
|
+
title: "I'm expanded by default",
|
|
26
|
+
expanded: true,
|
|
27
|
+
box: false,
|
|
28
|
+
bleed: false,
|
|
29
|
+
animated: false,
|
|
30
|
+
noChevron: false,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Box = {
|
|
34
|
+
args: {
|
|
35
|
+
title: "I'm a box expandable",
|
|
36
|
+
expanded: false,
|
|
37
|
+
box: true,
|
|
38
|
+
bleed: false,
|
|
39
|
+
animated: false,
|
|
40
|
+
noChevron: false,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export const Animated = {
|
|
44
|
+
args: {
|
|
45
|
+
title: "I'm animated",
|
|
46
|
+
expanded: false,
|
|
47
|
+
box: true,
|
|
48
|
+
bleed: false,
|
|
49
|
+
animated: true,
|
|
50
|
+
noChevron: false,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export const WithHeading = {
|
|
54
|
+
args: {
|
|
55
|
+
title: "I'm wrapped in h2",
|
|
56
|
+
expanded: false,
|
|
57
|
+
box: true,
|
|
58
|
+
bleed: false,
|
|
59
|
+
animated: false,
|
|
60
|
+
noChevron: false,
|
|
61
|
+
headingLevel: 2,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const NoChevron = {
|
|
65
|
+
args: {
|
|
66
|
+
title: 'I have no chevron',
|
|
67
|
+
expanded: false,
|
|
68
|
+
box: false,
|
|
69
|
+
bleed: false,
|
|
70
|
+
animated: false,
|
|
71
|
+
noChevron: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const CustomTitle = {
|
|
75
|
+
args: {
|
|
76
|
+
expanded: false,
|
|
77
|
+
box: true,
|
|
78
|
+
bleed: false,
|
|
79
|
+
animated: false,
|
|
80
|
+
noChevron: false,
|
|
81
|
+
},
|
|
82
|
+
render(args) {
|
|
83
|
+
return (React.createElement(Expandable, { ...args },
|
|
84
|
+
React.createElement("div", { slot: "title", style: { display: 'flex', alignItems: 'center' } },
|
|
85
|
+
React.createElement("span", { style: { marginRight: '8px' } }, "\uD83C\uDFAF"),
|
|
86
|
+
React.createElement("span", null, "Custom title with icon")),
|
|
87
|
+
React.createElement("p", null, "This expandable has a custom title slot with an icon.")));
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export const NoTitle = {
|
|
91
|
+
args: {
|
|
92
|
+
expanded: true,
|
|
93
|
+
box: true,
|
|
94
|
+
animated: true,
|
|
95
|
+
},
|
|
96
|
+
render(args) {
|
|
97
|
+
const [expanded, setExpanded] = useState(false);
|
|
98
|
+
return (React.createElement(React.Fragment, null,
|
|
99
|
+
React.createElement(Button, { onClick: () => setExpanded(!expanded), "aria-label": "Toggle expandable content without title", "aria-controls": "expandableWithoutTitle" }, "Toggle"),
|
|
100
|
+
React.createElement(Expandable, { ...args, id: "expandableWithoutTitle", expanded: expanded },
|
|
101
|
+
React.createElement("p", null, "with expanded content"))));
|
|
102
|
+
},
|
|
103
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import '../utils/expand-transition.js';
|
|
3
|
+
import '../utils/unstyled-heading.js';
|
|
4
|
+
import type { WarpExpandable } from './index.js';
|
|
5
|
+
import './index.js';
|
|
6
|
+
declare const args: Partial<WarpExpandable> & {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
declare const meta: Meta<typeof args>;
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof args>;
|
|
12
|
+
export declare const Default: Story;
|
|
13
|
+
export declare const Expanded: Story;
|
|
14
|
+
export declare const Box: Story;
|
|
15
|
+
export declare const Animated: Story;
|
|
16
|
+
export declare const WithHeading: Story;
|
|
17
|
+
export declare const NoChevron: Story;
|
|
18
|
+
export declare const CustomTitle: Story;
|
|
19
|
+
export declare const NoTitle: Story;
|
|
@@ -0,0 +1,132 @@
|
|
|
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 '../utils/unstyled-heading.js';
|
|
7
|
+
import './index.js';
|
|
8
|
+
const { events, args, argTypes } = getStorybookHelpers('w-expandable');
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Layout/Expandable',
|
|
11
|
+
render(args) {
|
|
12
|
+
return html `
|
|
13
|
+
<w-expandable ${spread(prespread(args))}>
|
|
14
|
+
<p>This is the expandable content that can be shown or hidden.</p>
|
|
15
|
+
<p>It can contain multiple paragraphs and other elements.</p>
|
|
16
|
+
</w-expandable>
|
|
17
|
+
`;
|
|
18
|
+
},
|
|
19
|
+
args,
|
|
20
|
+
argTypes,
|
|
21
|
+
parameters: {
|
|
22
|
+
actions: {
|
|
23
|
+
handles: events,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
export const Default = {
|
|
29
|
+
args: {
|
|
30
|
+
title: "I'm expandable",
|
|
31
|
+
expanded: false,
|
|
32
|
+
box: false,
|
|
33
|
+
bleed: false,
|
|
34
|
+
animated: false,
|
|
35
|
+
'no-chevron': false,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export const Expanded = {
|
|
39
|
+
args: {
|
|
40
|
+
title: "I'm expanded by default",
|
|
41
|
+
expanded: true,
|
|
42
|
+
box: false,
|
|
43
|
+
bleed: false,
|
|
44
|
+
animated: false,
|
|
45
|
+
'no-chevron': false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const Box = {
|
|
49
|
+
args: {
|
|
50
|
+
title: "I'm a box expandable",
|
|
51
|
+
expanded: false,
|
|
52
|
+
box: true,
|
|
53
|
+
bleed: false,
|
|
54
|
+
animated: false,
|
|
55
|
+
'no-chevron': false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const Animated = {
|
|
59
|
+
args: {
|
|
60
|
+
title: "I'm animated",
|
|
61
|
+
expanded: false,
|
|
62
|
+
box: true,
|
|
63
|
+
bleed: false,
|
|
64
|
+
animated: true,
|
|
65
|
+
'no-chevron': false,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export const WithHeading = {
|
|
69
|
+
args: {
|
|
70
|
+
title: "I'm wrapped in h2",
|
|
71
|
+
expanded: false,
|
|
72
|
+
box: true,
|
|
73
|
+
bleed: false,
|
|
74
|
+
animated: false,
|
|
75
|
+
'no-chevron': false,
|
|
76
|
+
'heading-level': 2,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const NoChevron = {
|
|
80
|
+
args: {
|
|
81
|
+
title: 'I have no chevron',
|
|
82
|
+
expanded: false,
|
|
83
|
+
box: false,
|
|
84
|
+
bleed: false,
|
|
85
|
+
animated: false,
|
|
86
|
+
'no-chevron': true,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export const CustomTitle = {
|
|
90
|
+
args: {
|
|
91
|
+
expanded: false,
|
|
92
|
+
box: true,
|
|
93
|
+
bleed: false,
|
|
94
|
+
animated: false,
|
|
95
|
+
'no-chevron': false,
|
|
96
|
+
},
|
|
97
|
+
render(args) {
|
|
98
|
+
return html `
|
|
99
|
+
<w-expandable ${spread(prespread(args))}>
|
|
100
|
+
<div slot="title" style="display: flex; align-items: center;">
|
|
101
|
+
<span>Custom title with icon</span>
|
|
102
|
+
</div>
|
|
103
|
+
<p>This expandable has a custom title slot with an icon.</p>
|
|
104
|
+
</w-expandable>
|
|
105
|
+
`;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
export const NoTitle = {
|
|
109
|
+
args: {
|
|
110
|
+
expanded: true,
|
|
111
|
+
box: true,
|
|
112
|
+
animated: true,
|
|
113
|
+
},
|
|
114
|
+
render(args) {
|
|
115
|
+
return html `
|
|
116
|
+
<w-button aria-label="Toggle expandable content without title" aria-controls="expandableWithoutTitle">Toggle</w-button>
|
|
117
|
+
<w-expandable ${spread(prespread(args))} id="expandableWithoutTitle">
|
|
118
|
+
<p>with expanded content</p>
|
|
119
|
+
</w-expandable>
|
|
120
|
+
<script>
|
|
121
|
+
document.querySelector('[aria-controls="expandableWithoutTitle"]').addEventListener('click', () => {
|
|
122
|
+
const expand = document.getElementById('expandableWithoutTitle');
|
|
123
|
+
if (expand.expanded) {
|
|
124
|
+
expand.removeAttribute('expanded');
|
|
125
|
+
} else {
|
|
126
|
+
expand.setAttribute('expanded', 'true');
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
</script>
|
|
130
|
+
`;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
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 the given title prop and hides the slotted content', async () => {
|
|
6
|
+
const component = html `
|
|
7
|
+
<w-expandable title="I'm expandable">
|
|
8
|
+
<p>with expanded content</p>
|
|
9
|
+
</w-expandable>
|
|
10
|
+
`;
|
|
11
|
+
const page = render(component);
|
|
12
|
+
await expect.element(page.getByText("I'm expandable")).toBeVisible();
|
|
13
|
+
await expect.element(page.getByText('with expanded content')).not.toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
test('clicking the expandable shows the slotted content', async () => {
|
|
16
|
+
const component = html `
|
|
17
|
+
<w-expandable title="I'm expandable">
|
|
18
|
+
<p>with expanded content</p>
|
|
19
|
+
</w-expandable>
|
|
20
|
+
`;
|
|
21
|
+
const page = render(component);
|
|
22
|
+
await page.getByRole('button').click();
|
|
23
|
+
await expect.element(page.getByText('with expanded content')).toBeVisible();
|
|
24
|
+
});
|
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import '@warp-ds/icons/elements/chevron-down-16';
|
|
3
|
+
import '@warp-ds/icons/elements/chevron-up-16';
|
|
4
|
+
import '../utils/expand-transition';
|
|
5
|
+
import '../utils/unstyled-heading';
|
|
6
|
+
export declare const ccBox: {
|
|
7
|
+
base: string;
|
|
8
|
+
bleed: string;
|
|
9
|
+
info: string;
|
|
10
|
+
neutral: string;
|
|
11
|
+
bordered: string;
|
|
7
12
|
};
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_hasTitle: {
|
|
39
|
-
type: BooleanConstructor;
|
|
40
|
-
state: boolean;
|
|
41
|
-
};
|
|
42
|
-
_showChevronUp: {
|
|
43
|
-
type: BooleanConstructor;
|
|
44
|
-
state: boolean;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
static styles: (import("lit").CSSResult | (import("lit").CSSResult | CSSStyleSheet | import("lit").CSSResultArray)[])[];
|
|
13
|
+
export declare const ccExpandable: {
|
|
14
|
+
wrapper: string;
|
|
15
|
+
box: string;
|
|
16
|
+
bleed: string;
|
|
17
|
+
chevron: string;
|
|
18
|
+
chevronNonBox: string;
|
|
19
|
+
chevronTransform: string;
|
|
20
|
+
chevronExpand: string;
|
|
21
|
+
chevronCollapse: string;
|
|
22
|
+
elementsChevronDownTransform: string;
|
|
23
|
+
elementsChevronUpTransform: string;
|
|
24
|
+
elementsChevronExpand: string;
|
|
25
|
+
elementsChevronCollapse: string;
|
|
26
|
+
expansion: string;
|
|
27
|
+
expansionNotExpanded: string;
|
|
28
|
+
button: string;
|
|
29
|
+
buttonBox: string;
|
|
30
|
+
contentWithTitle: string;
|
|
31
|
+
title: string;
|
|
32
|
+
titleType: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Expandable is a layout component used for creating expandable content areas on a page.
|
|
36
|
+
*
|
|
37
|
+
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/layout-expandable--docs)
|
|
38
|
+
*
|
|
39
|
+
* @slot title - Alternative to the `title` attribute should you need to provide some additional markup.
|
|
40
|
+
*/
|
|
41
|
+
declare class WarpExpandable extends LitElement {
|
|
42
|
+
#private;
|
|
48
43
|
expanded: boolean;
|
|
49
|
-
|
|
44
|
+
title: string;
|
|
50
45
|
box: boolean;
|
|
51
46
|
bleed: boolean;
|
|
47
|
+
buttonClass: string;
|
|
48
|
+
contentClass: string;
|
|
52
49
|
noChevron: boolean;
|
|
50
|
+
animated: boolean;
|
|
51
|
+
headingLevel: number;
|
|
52
|
+
/** @internal */
|
|
53
53
|
_hasTitle: boolean;
|
|
54
|
+
/** @internal */
|
|
54
55
|
_showChevronUp: boolean;
|
|
55
|
-
|
|
56
|
+
static styles: import("lit").CSSResult[];
|
|
57
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
56
58
|
firstUpdated(): void;
|
|
59
|
+
/** @internal */
|
|
57
60
|
get _expandableSlot(): import("lit").TemplateResult<1>;
|
|
58
61
|
render(): import("lit").TemplateResult<1>;
|
|
59
|
-
#private;
|
|
60
62
|
}
|
|
61
|
-
export {};
|
|
63
|
+
export { WarpExpandable };
|