@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("{\"select.label.optional\":[\"(valgfrit)\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"select.label.optional\":[\"(optional)\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"select.label.optional\":[\"(vapaaehtoinen)\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"select.label.optional\":[\"(valgfritt)\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"select.label.optional\":[\"(valfritt)\"]}");
|
|
@@ -0,0 +1,20 @@
|
|
|
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 Select = createComponent({
|
|
8
|
+
tagName: 'w-select',
|
|
9
|
+
elementClass: Component,
|
|
10
|
+
react: React,
|
|
11
|
+
events: {
|
|
12
|
+
onChange: 'change',
|
|
13
|
+
onchange: 'change',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const Option = createComponent({
|
|
17
|
+
tagName: 'w-option',
|
|
18
|
+
elementClass: Component,
|
|
19
|
+
react: React,
|
|
20
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { Select } from './react';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
render(args: Omit<React.HTMLAttributes<import(".").WarpSelect>, "label" | "onchange" | "autoFocus" | "onChange" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "form" | "disabled" | "name" | "value" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "resetFormControl" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "invalid" | "always" | "hint" | "optional" | "readOnly" | "_options" | "_setValue" | "handleKeyDown"> & {
|
|
7
|
+
onChange?: (e: Event) => void;
|
|
8
|
+
onchange?: (e: Event) => void;
|
|
9
|
+
} & Partial<Omit<import(".").WarpSelect, keyof HTMLElement>> & React.RefAttributes<import(".").WarpSelect>): React.JSX.Element;
|
|
10
|
+
component: import("@lit/react").ReactWebComponent<import(".").WarpSelect, {
|
|
11
|
+
onChange: string;
|
|
12
|
+
onchange: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
16
|
+
export type Story = StoryObj<typeof Select>;
|
|
17
|
+
export declare const Default: Story;
|
|
18
|
+
export declare const ChangeEvent: (args: any) => React.JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Select, Option } from './react';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Forms/Select',
|
|
5
|
+
render(args) {
|
|
6
|
+
return (React.createElement(Select, { ...args },
|
|
7
|
+
React.createElement(Option, { value: "strawberries" }, "Strawberries"),
|
|
8
|
+
React.createElement(Option, { value: "raspberries", selected: true }, "Raspberries"),
|
|
9
|
+
React.createElement(Option, { value: "cloudberries" }, "Cloudberries")));
|
|
10
|
+
},
|
|
11
|
+
component: Select,
|
|
12
|
+
};
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
label: 'Berries',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const ChangeEvent = (args) => {
|
|
19
|
+
const [selectedValue, setSelectedValue] = useState('');
|
|
20
|
+
return (React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement("div", null,
|
|
22
|
+
"Selected Value: ",
|
|
23
|
+
selectedValue),
|
|
24
|
+
React.createElement(Select, { ...args, onChange: (e) => setSelectedValue(e.detail) },
|
|
25
|
+
React.createElement(Option, { value: "strawberries" }, "Strawberries"),
|
|
26
|
+
React.createElement(Option, { value: "raspberries", selected: true }, "Raspberries"),
|
|
27
|
+
React.createElement(Option, { value: "cloudberries" }, "Cloudberries"))));
|
|
28
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import type { WarpSelect } from './index.js';
|
|
3
|
+
import './index.js';
|
|
4
|
+
declare const args: Partial<WarpSelect> & {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
declare const meta: Meta<typeof args>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof args>;
|
|
10
|
+
export declare const Default: Story;
|
|
11
|
+
export declare const Hint: Story;
|
|
12
|
+
export declare const Invalid: Story;
|
|
13
|
+
export declare const Disabled: Story;
|
|
14
|
+
export declare const ReadOnly: Story;
|
|
15
|
+
export declare const NoLabel: Story;
|
|
16
|
+
export declare const Optional: Story;
|
|
17
|
+
export declare const Placeholder: Story;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 './index.js';
|
|
6
|
+
const { events, args, argTypes } = getStorybookHelpers('w-select');
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Forms/Select',
|
|
9
|
+
render(args) {
|
|
10
|
+
return html `
|
|
11
|
+
<w-select ${spread(prespread(args))}>
|
|
12
|
+
<option value="raspberries">Raspberries</option>
|
|
13
|
+
<option value="strawberries" selected>Strawberries</option>
|
|
14
|
+
<option value="cloudberries">Cloudberries</option>
|
|
15
|
+
</w-select>
|
|
16
|
+
`;
|
|
17
|
+
},
|
|
18
|
+
args,
|
|
19
|
+
argTypes,
|
|
20
|
+
parameters: {
|
|
21
|
+
actions: {
|
|
22
|
+
handles: events,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
export const Default = {
|
|
28
|
+
args: {
|
|
29
|
+
label: 'Berries',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export const Hint = {
|
|
33
|
+
args: {
|
|
34
|
+
label: 'Berries',
|
|
35
|
+
always: true,
|
|
36
|
+
hint: 'We assume this is your jam preference'
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const Invalid = {
|
|
40
|
+
args: {
|
|
41
|
+
label: 'Berries',
|
|
42
|
+
invalid: true,
|
|
43
|
+
hint: 'Wrong choice'
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const Disabled = {
|
|
47
|
+
args: {
|
|
48
|
+
label: 'Berries',
|
|
49
|
+
disabled: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export const ReadOnly = {
|
|
53
|
+
args: {
|
|
54
|
+
label: 'Berries',
|
|
55
|
+
'read-only': true,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const NoLabel = {
|
|
59
|
+
render(args) {
|
|
60
|
+
return html `
|
|
61
|
+
<div style="display: flex; flex-direction: column; gap: 32px;">
|
|
62
|
+
<w-select ${spread(prespread(args))} aria-label="Your selection is berry nice!">
|
|
63
|
+
<option value="raspberries">Raspberries</option>
|
|
64
|
+
<option value="strawberries" selected>Strawberries</option>
|
|
65
|
+
<option value="cloudberries">Cloudberries</option>
|
|
66
|
+
</w-select>
|
|
67
|
+
|
|
68
|
+
<label id="select-label" htmlFor="warp-aria-labelledby-example">
|
|
69
|
+
You're berry good at selecting!
|
|
70
|
+
</label>
|
|
71
|
+
<w-select ${spread(prespread(args))} id="warp-aria-labelledby-example">
|
|
72
|
+
<option value="raspberries">Raspberries</option>
|
|
73
|
+
<option value="strawberries" selected>Strawberries</option>
|
|
74
|
+
<option value="cloudberries">Cloudberries</option>
|
|
75
|
+
</w-select>
|
|
76
|
+
</div>
|
|
77
|
+
`;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const Optional = {
|
|
81
|
+
args: {
|
|
82
|
+
label: 'Berries',
|
|
83
|
+
optional: true,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export const Placeholder = {
|
|
87
|
+
args: {
|
|
88
|
+
label: 'Berries',
|
|
89
|
+
},
|
|
90
|
+
render(args) {
|
|
91
|
+
return html `
|
|
92
|
+
<w-select ${spread(prespread(args))}>
|
|
93
|
+
<option value="">Select an option</option>
|
|
94
|
+
<option value="raspberries">Raspberries</option>
|
|
95
|
+
<option value="strawberries">Strawberries</option>
|
|
96
|
+
<option value="cloudberries">Cloudberries</option>
|
|
97
|
+
</w-select>
|
|
98
|
+
`;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { userEvent } from '@vitest/browser/context';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { expect, test } from 'vitest';
|
|
4
|
+
import { render } from 'vitest-browser-lit';
|
|
5
|
+
import './index.js';
|
|
6
|
+
test('works in a form', async () => {
|
|
7
|
+
const component = html `
|
|
8
|
+
<form data-testid="flavour">
|
|
9
|
+
<w-select label="Berries" name="berry">
|
|
10
|
+
<option value="strawberries">Strawberries</option>
|
|
11
|
+
<option value="raspberries">Raspberries</option>
|
|
12
|
+
<option value="cloudberries">Cloudberries</option>
|
|
13
|
+
</w-select>
|
|
14
|
+
|
|
15
|
+
<button>Submit</button>
|
|
16
|
+
</form>
|
|
17
|
+
`;
|
|
18
|
+
const page = render(component);
|
|
19
|
+
// Confirm we have a form associated field berry
|
|
20
|
+
const form = page.getByTestId('flavour');
|
|
21
|
+
expect(form).toHaveFormValues({
|
|
22
|
+
berry: undefined,
|
|
23
|
+
});
|
|
24
|
+
// Select Raspberries
|
|
25
|
+
await expect.element(page.getByLabelText('Berries')).toBeVisible();
|
|
26
|
+
await userEvent.selectOptions(page.getByLabelText('Berries').element(), 'Raspberries');
|
|
27
|
+
// Confirm the form has a field berry with value raspberries
|
|
28
|
+
expect(form).toHaveFormValues({
|
|
29
|
+
berry: 'raspberries',
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -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}.appearance-none{-webkit-appearance:none;appearance:none}.border-0{border-width:0}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.opacity-25{opacity:.25}.block,.before\\:block:before{display:block}.before\\:hidden:before{display:none}.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}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.bottom-0{bottom:0}.right-0{right:0}.before\\:bottom-0:before{bottom:0}.before\\:right-0:before{right:0}.top-\\[30\\%\\]{top:30%}.absolute{position:absolute}.relative{position:relative}.static{position:static}.before\\:absolute:before{position:absolute}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.s-icon{color:var(--w-s-color-icon)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-disabled:hover{border-color:var(--w-s-color-border-disabled)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-active:active{border-color:var(--w-s-color-border-active)}.active\\:s-border-disabled:active{border-color:var(--w-s-color-border-disabled)}.h-full{height:100%}.w-32{width:3.2rem}.w-full{width:100%}.before\\:h-full:before{height:100%}.before\\:w-32:before{width:3.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-32{padding-right:3.2rem}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none,.before\\:pointer-events-none:before{pointer-events:none}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}`;
|