@swell/swell-ui 0.0.0-stage → 0.1.1
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/CHANGELOG.md +22 -0
- package/README.md +165 -2
- package/custom-elements.json +8274 -0
- package/dist/chunks/badge-Dt6q8Cqa.js +11 -0
- package/dist/chunks/button-C7nCiu-t.js +123 -0
- package/dist/chunks/card-CvSQEug8.js +10 -0
- package/dist/chunks/checkbox-BRI_A1TP.js +99 -0
- package/dist/chunks/chip-BtnufSMG.js +48 -0
- package/dist/chunks/config-C-FYxOaJ.js +588 -0
- package/dist/chunks/define-BlQTa1g4.js +19 -0
- package/dist/chunks/description-BHfQ8meK.js +19 -0
- package/dist/chunks/disclosure-CET8-H6f.js +56 -0
- package/dist/chunks/divider-BfkO0c1j.js +27 -0
- package/dist/chunks/element-B4-_7TLZ.js +138 -0
- package/dist/chunks/input-Uun-ls2_.js +53 -0
- package/dist/chunks/link-8qHFEKQE.js +53 -0
- package/dist/chunks/link-D4NC86oc.js +24 -0
- package/dist/chunks/lookup-5icr_T6o.js +205 -0
- package/dist/chunks/lookup-list-Bw6OJoDS.js +19 -0
- package/dist/chunks/lookup-option-Mn3k8W2M.js +26 -0
- package/dist/chunks/popover-D3Ob6slA.js +92 -0
- package/dist/chunks/popup-Dbh2fchP.js +21 -0
- package/dist/chunks/quantity-h3wqn8tC.js +140 -0
- package/dist/chunks/radio-BhFDL3pO.js +192 -0
- package/dist/chunks/radio-option-hT29S8Zl.js +88 -0
- package/dist/chunks/select-DS1n_htj.js +331 -0
- package/dist/chunks/select-option-DoM9GAe0.js +66 -0
- package/dist/chunks/skeleton-DfPjhls9.js +13 -0
- package/dist/chunks/status-B23JZ5RQ.js +71 -0
- package/dist/chunks/tab-BpjFUbFO.js +107 -0
- package/dist/chunks/tabs-aWKq1Iaz.js +122 -0
- package/dist/chunks/text-ZWPy-iB3.js +26 -0
- package/dist/chunks/text-field-BB_MRt5h.js +158 -0
- package/dist/chunks/textarea-L6_OJ2IN.js +18 -0
- package/dist/chunks/thumbnail-CLe9AsFg.js +21 -0
- package/dist/chunks/toggle-C7-oPgWR.js +22 -0
- package/dist/chunks/ui-HcyMKwzs.js +11 -0
- package/dist/editors/vscode.css-custom-data.json +824 -0
- package/dist/editors/vscode.html-custom-data.json +1156 -0
- package/dist/editors/web-types.json +1706 -0
- package/dist/elements/badge.d.ts +1 -0
- package/dist/elements/badge.js +1 -0
- package/dist/elements/button.d.ts +1 -0
- package/dist/elements/button.js +1 -0
- package/dist/elements/card.d.ts +1 -0
- package/dist/elements/card.js +1 -0
- package/dist/elements/checkbox.d.ts +1 -0
- package/dist/elements/checkbox.js +1 -0
- package/dist/elements/chip.d.ts +1 -0
- package/dist/elements/chip.js +1 -0
- package/dist/elements/disclosure.d.ts +1 -0
- package/dist/elements/disclosure.js +1 -0
- package/dist/elements/divider.d.ts +1 -0
- package/dist/elements/divider.js +1 -0
- package/dist/elements/input.d.ts +1 -0
- package/dist/elements/input.js +1 -0
- package/dist/elements/link.d.ts +1 -0
- package/dist/elements/link.js +1 -0
- package/dist/elements/lookup-list.d.ts +1 -0
- package/dist/elements/lookup-list.js +1 -0
- package/dist/elements/lookup-option.d.ts +1 -0
- package/dist/elements/lookup-option.js +1 -0
- package/dist/elements/lookup.d.ts +1 -0
- package/dist/elements/lookup.js +1 -0
- package/dist/elements/popover.d.ts +1 -0
- package/dist/elements/popover.js +1 -0
- package/dist/elements/quantity.d.ts +1 -0
- package/dist/elements/quantity.js +1 -0
- package/dist/elements/radio-option.d.ts +1 -0
- package/dist/elements/radio-option.js +1 -0
- package/dist/elements/radio.d.ts +1 -0
- package/dist/elements/radio.js +1 -0
- package/dist/elements/select-option.d.ts +1 -0
- package/dist/elements/select-option.js +1 -0
- package/dist/elements/select.d.ts +1 -0
- package/dist/elements/select.js +1 -0
- package/dist/elements/skeleton.d.ts +1 -0
- package/dist/elements/skeleton.js +1 -0
- package/dist/elements/status.d.ts +1 -0
- package/dist/elements/status.js +1 -0
- package/dist/elements/tab.d.ts +1 -0
- package/dist/elements/tab.js +1 -0
- package/dist/elements/tabs.d.ts +1 -0
- package/dist/elements/tabs.js +1 -0
- package/dist/elements/text.d.ts +1 -0
- package/dist/elements/text.js +1 -0
- package/dist/elements/textarea.d.ts +1 -0
- package/dist/elements/textarea.js +1 -0
- package/dist/elements/thumbnail.d.ts +1 -0
- package/dist/elements/thumbnail.js +1 -0
- package/dist/elements/ui.d.ts +1 -0
- package/dist/elements/ui.js +1 -0
- package/dist/frameworks/jsx.d.ts +3589 -0
- package/dist/frameworks/preact.d.ts +9 -0
- package/dist/frameworks/solid.d.ts +7 -0
- package/dist/frameworks/svelte.d.ts +1676 -0
- package/dist/frameworks/vue.d.ts +827 -0
- package/dist/index.js +80 -0
- package/dist/react/badge.d.ts +12 -0
- package/dist/react/badge.js +4 -0
- package/dist/react/button.d.ts +16 -0
- package/dist/react/button.js +4 -0
- package/dist/react/card.d.ts +11 -0
- package/dist/react/card.js +4 -0
- package/dist/react/checkbox.d.ts +14 -0
- package/dist/react/checkbox.js +4 -0
- package/dist/react/chip.d.ts +12 -0
- package/dist/react/chip.js +4 -0
- package/dist/react/create.js +49 -0
- package/dist/react/disclosure.d.ts +11 -0
- package/dist/react/disclosure.js +4 -0
- package/dist/react/divider.d.ts +9 -0
- package/dist/react/divider.js +4 -0
- package/dist/react/index.d.ts +26 -0
- package/dist/react/index.js +26 -0
- package/dist/react/input.d.ts +28 -0
- package/dist/react/input.js +4 -0
- package/dist/react/link.d.ts +15 -0
- package/dist/react/link.js +4 -0
- package/dist/react/lookup-list.d.ts +9 -0
- package/dist/react/lookup-list.js +4 -0
- package/dist/react/lookup-option.d.ts +11 -0
- package/dist/react/lookup-option.js +4 -0
- package/dist/react/lookup.d.ts +28 -0
- package/dist/react/lookup.js +4 -0
- package/dist/react/popover.d.ts +11 -0
- package/dist/react/popover.js +4 -0
- package/dist/react/quantity.d.ts +15 -0
- package/dist/react/quantity.js +4 -0
- package/dist/react/radio-option.d.ts +11 -0
- package/dist/react/radio-option.js +4 -0
- package/dist/react/radio.d.ts +18 -0
- package/dist/react/radio.js +4 -0
- package/dist/react/select-option.d.ts +11 -0
- package/dist/react/select-option.js +4 -0
- package/dist/react/select.d.ts +20 -0
- package/dist/react/select.js +4 -0
- package/dist/react/skeleton.d.ts +11 -0
- package/dist/react/skeleton.js +4 -0
- package/dist/react/status.d.ts +12 -0
- package/dist/react/status.js +4 -0
- package/dist/react/tab.d.ts +10 -0
- package/dist/react/tab.js +4 -0
- package/dist/react/tabs.d.ts +17 -0
- package/dist/react/tabs.js +4 -0
- package/dist/react/text.d.ts +12 -0
- package/dist/react/text.js +4 -0
- package/dist/react/textarea.d.ts +23 -0
- package/dist/react/textarea.js +4 -0
- package/dist/react/thumbnail.d.ts +13 -0
- package/dist/react/thumbnail.js +4 -0
- package/dist/react/ui.d.ts +10 -0
- package/dist/react/ui.js +4 -0
- package/dist/types/components/core/badge/badge.d.ts +25 -0
- package/dist/types/components/core/button/button.d.ts +60 -0
- package/dist/types/components/core/card/card.d.ts +21 -0
- package/dist/types/components/core/checkbox/checkbox.d.ts +46 -0
- package/dist/types/components/core/chip/chip.d.ts +36 -0
- package/dist/types/components/core/disclosure/disclosure.d.ts +37 -0
- package/dist/types/components/core/divider/divider.d.ts +21 -0
- package/dist/types/components/core/index.d.ts +21 -0
- package/dist/types/components/core/input/input.d.ts +57 -0
- package/dist/types/components/core/link/link.d.ts +42 -0
- package/dist/types/components/core/lookup/lookup-list.d.ts +21 -0
- package/dist/types/components/core/lookup/lookup-option.d.ts +27 -0
- package/dist/types/components/core/lookup/lookup.d.ts +32 -0
- package/dist/types/components/core/popover/popover.d.ts +33 -0
- package/dist/types/components/core/quantity/quantity.d.ts +47 -0
- package/dist/types/components/core/radio/radio-option.d.ts +82 -0
- package/dist/types/components/core/radio/radio.d.ts +65 -0
- package/dist/types/components/core/select/select-option.d.ts +69 -0
- package/dist/types/components/core/select/select.d.ts +70 -0
- package/dist/types/components/core/skeleton/skeleton.d.ts +23 -0
- package/dist/types/components/core/status/status.d.ts +38 -0
- package/dist/types/components/core/tabs/tab.d.ts +76 -0
- package/dist/types/components/core/tabs/tabs.d.ts +46 -0
- package/dist/types/components/core/text/text.d.ts +23 -0
- package/dist/types/components/core/textarea/textarea.d.ts +45 -0
- package/dist/types/components/core/thumbnail/thumbnail.d.ts +27 -0
- package/dist/types/components/core/ui/ui.d.ts +16 -0
- package/dist/types/components/elements.d.ts +1 -0
- package/dist/types/react/create.d.ts +8 -0
- package/dist/types/runtime/config.d.ts +25 -0
- package/dist/types/runtime/css.d.ts +12 -0
- package/dist/types/runtime/define.d.ts +4 -0
- package/dist/types/runtime/description.d.ts +12 -0
- package/dist/types/runtime/element.d.ts +61 -0
- package/dist/types/runtime/focus.d.ts +5 -0
- package/dist/types/runtime/form.d.ts +5 -0
- package/dist/types/runtime/index.d.ts +2 -0
- package/dist/types/runtime/link.d.ts +17 -0
- package/dist/types/runtime/loader.d.ts +21 -0
- package/dist/types/runtime/popup.d.ts +8 -0
- package/dist/types/runtime/sheet.d.ts +31 -0
- package/dist/types/runtime/text-field.d.ts +47 -0
- package/dist/types/runtime/toggle.d.ts +8 -0
- package/dist/types/runtime/tokens.generated.d.ts +492 -0
- package/dist/types/runtime/values.d.ts +6 -0
- package/dist/types/runtime/variants.d.ts +4 -0
- package/package.json +136 -4
- package/resolver.json +111 -0
- package/src/components/core/badge/tokens.json +152 -0
- package/src/components/core/button/tokens.dark.json +16 -0
- package/src/components/core/button/tokens.json +232 -0
- package/src/components/core/card/tokens.json +35 -0
- package/src/components/core/checkbox/tokens.json +15 -0
- package/src/components/core/chip/tokens.json +144 -0
- package/src/components/core/link/tokens.json +24 -0
- package/src/components/core/radio/tokens.dark.json +17 -0
- package/src/components/core/radio/tokens.json +114 -0
- package/src/components/core/status/tokens.dark.json +71 -0
- package/src/components/core/status/tokens.json +135 -0
- package/src/components/core/tabs/tokens.json +80 -0
- package/src/components/core/text/tokens.json +222 -0
- package/src/components/core/thumbnail/tokens.json +46 -0
- package/tokens/border.json +38 -0
- package/tokens/color.dark.json +88 -0
- package/tokens/color.json +115 -0
- package/tokens/control.json +115 -0
- package/tokens/field.dark.json +65 -0
- package/tokens/field.json +158 -0
- package/tokens/focus.json +26 -0
- package/tokens/font.json +117 -0
- package/tokens/motion.json +49 -0
- package/tokens/overlay.json +81 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellTab as SwellTabElement } from "../types/components/core/tabs/tab.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellTab: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellTabElement>, "value" | "label" | "done" | "disabled"> &
|
|
6
|
+
Partial<Pick<SwellTabElement, "value" | "label" | "done" | "disabled">> & {
|
|
7
|
+
"hidden"?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
} & RefAttributes<SwellTabElement>
|
|
10
|
+
>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellTabs as SwellTabsElement } from "../types/components/core/tabs/tabs.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellTabs: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellTabsElement>, "onChange" | "onRequest" | "value"> &
|
|
6
|
+
Partial<Pick<SwellTabsElement, "value">> & {
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
"orientation"?: "horizontal" | "vertical";
|
|
9
|
+
"level"?: number;
|
|
10
|
+
"done-label"?: string;
|
|
11
|
+
"appearance"?: "underline" | "segmented" | "steps";
|
|
12
|
+
"size"?: "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
13
|
+
onChange?: (event: Event & { currentTarget: SwellTabsElement }) => void;
|
|
14
|
+
onRequest?: (event: CustomEvent<{ value: string }> & { currentTarget: SwellTabsElement }) => void;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
} & RefAttributes<SwellTabsElement>
|
|
17
|
+
>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellText as SwellTextElement } from "../types/components/core/text/text.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellText: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellTextElement>, never> &
|
|
6
|
+
{
|
|
7
|
+
"level"?: number;
|
|
8
|
+
"variant"?: string;
|
|
9
|
+
"type"?: "title" | "heading" | "subheading" | "strong" | "body" | "caption" | "footnote" | "eyebrow";
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
} & RefAttributes<SwellTextElement>
|
|
12
|
+
>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellTextarea as SwellTextareaElement } from "../types/components/core/textarea/textarea.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellTextarea: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellTextareaElement>, "onInput" | "onChange" | "value" | "disabled" | "required" | "readOnly" | "invalid" | "name"> &
|
|
6
|
+
Partial<Pick<SwellTextareaElement, "value" | "disabled" | "required" | "readOnly" | "invalid" | "name">> & {
|
|
7
|
+
"label"?: string;
|
|
8
|
+
"optional"?: string;
|
|
9
|
+
"hint"?: string;
|
|
10
|
+
"error"?: string;
|
|
11
|
+
"appearance"?: "outline" | "filled" | "underline";
|
|
12
|
+
"size"?: "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
13
|
+
"readonly"?: boolean;
|
|
14
|
+
"placeholder"?: string;
|
|
15
|
+
"autocomplete"?: string;
|
|
16
|
+
"minlength"?: number;
|
|
17
|
+
"maxlength"?: number;
|
|
18
|
+
"rows"?: number;
|
|
19
|
+
onInput?: (event: Event & { currentTarget: SwellTextareaElement }) => void;
|
|
20
|
+
onChange?: (event: Event & { currentTarget: SwellTextareaElement }) => void;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
} & RefAttributes<SwellTextareaElement>
|
|
23
|
+
>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellThumbnail as SwellThumbnailElement } from "../types/components/core/thumbnail/thumbnail.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellThumbnail: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellThumbnailElement>, never> &
|
|
6
|
+
{
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
"variant"?: string;
|
|
9
|
+
"size"?: "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
10
|
+
"shape"?: "circle";
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
} & RefAttributes<SwellThumbnailElement>
|
|
13
|
+
>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import type { SwellUi as SwellUiElement } from "../types/components/core/ui/ui.js";
|
|
3
|
+
|
|
4
|
+
export declare const SwellUi: ForwardRefExoticComponent<
|
|
5
|
+
Omit<HTMLAttributes<SwellUiElement>, never> &
|
|
6
|
+
{
|
|
7
|
+
"config"?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
} & RefAttributes<SwellUiElement>
|
|
10
|
+
>;
|
package/dist/react/ui.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A badge: a short label or a count, such as a subscription's interval, a discount or a quantity.
|
|
4
|
+
* It is text only: screen readers read it in place, so a count needs its context in the host's markup, such as hidden text next to it.
|
|
5
|
+
*
|
|
6
|
+
* @tag swell-badge
|
|
7
|
+
* @slot - The label.
|
|
8
|
+
* @slot start - An icon before the label, drawn 1px larger than the text.
|
|
9
|
+
* @attr {string} variant - Which palette of `color` the badge takes its colors from: `secondary`, quiet, or a variant of the host's own; without it, the badge's own.
|
|
10
|
+
* @attr {"filled" | "outline"} appearance - How the badge is drawn; the configured setting by default.
|
|
11
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the badge is; `medium` by default. A small one fits a count, an extra small one a count on an icon.
|
|
12
|
+
* @cssstate filled - The badge is filled.
|
|
13
|
+
* @cssstate outline - The badge has an outline.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SwellBadge extends SwellShadowElement {
|
|
16
|
+
static group: string;
|
|
17
|
+
static appearance: string;
|
|
18
|
+
static styles: string;
|
|
19
|
+
static template: string;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
"swell-badge": SwellBadge;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
type ButtonType = "submit" | "reset" | "button";
|
|
3
|
+
/**
|
|
4
|
+
* A button. It submits or resets the form it belongs to, like a native button.
|
|
5
|
+
* With `href` it is a link that looks like the button: an anchor in its shadow root fills it inside the border, takes the focus and follows the link, named by the element's own `aria-label`, or else by its content; `type`, `disabled`, `loading` and `success` belong to the button without `href`.
|
|
6
|
+
* `role="button"` and `tabindex="0"` count as the kit's and leave when `href` comes; any other role or tabindex is the host's and stays.
|
|
7
|
+
*
|
|
8
|
+
* While `loading`, the button shows a spinner in place of its `start` content, hides its `end` content and ignores clicks; it keeps its focus.
|
|
9
|
+
* With `success`, it is filled with the success color and shows a check in place of its icons and its spinner. It is inactive, as after a payment, but keeps its focus and doesn't fade.
|
|
10
|
+
*
|
|
11
|
+
* @tag swell-button
|
|
12
|
+
* @slot - The label of the button.
|
|
13
|
+
* @slot start - An icon before the label, drawn 4px larger than the text.
|
|
14
|
+
* @slot end - An icon after the label, drawn 4px larger than the text; it moves toward the end on hover.
|
|
15
|
+
* @attr {string} variant - Which palette of `color` the button takes its colors from: `secondary`, or a variant of the host's own; without it, the button's own.
|
|
16
|
+
* @attr {"filled" | "outline" | "plain"} appearance - How the button is drawn; the variant's setting by default.
|
|
17
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the button is; `medium` by default. `xsmall` fits an action inside a status message.
|
|
18
|
+
* @attr {"pill"} shape - Rounds the corners fully, in every variant, appearance and size, whatever the corner radius of the host's buttons.
|
|
19
|
+
* @attr {string} href - Where the button leads; with it the element is a link, named by its own `aria-label`, or else by its content.
|
|
20
|
+
* @attr {string} target - Where to open the link.
|
|
21
|
+
* @attr {string} rel - How the link's target relates to the page.
|
|
22
|
+
* @attr {"submit" | "reset" | "button"} type - What the button does in a form; `submit` by default.
|
|
23
|
+
* @attr {boolean} disabled - Removes the button from the tab order and ignores clicks.
|
|
24
|
+
* @attr {boolean} loading - Shows a spinner, marks the button busy and ignores clicks; the button stays in the tab order.
|
|
25
|
+
* @attr {boolean} success - Fills the button with the success color, draws a check and makes the button inactive; it keeps its tab stop and isn't busy.
|
|
26
|
+
* @cssstate filled - The button is filled.
|
|
27
|
+
* @cssstate outline - The button has an outline.
|
|
28
|
+
* @cssstate plain - The button has neither a fill nor a border at rest; under the pointer it takes the quiet fill.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SwellButton extends SwellShadowElement {
|
|
31
|
+
#private;
|
|
32
|
+
static group: string;
|
|
33
|
+
static appearance: string;
|
|
34
|
+
static styles: string;
|
|
35
|
+
static template: string;
|
|
36
|
+
static formAssociated: boolean;
|
|
37
|
+
static observedAttributes: string[];
|
|
38
|
+
constructor();
|
|
39
|
+
get disabled(): boolean;
|
|
40
|
+
set disabled(value: boolean);
|
|
41
|
+
get loading(): boolean;
|
|
42
|
+
set loading(value: boolean);
|
|
43
|
+
get success(): boolean;
|
|
44
|
+
set success(value: boolean);
|
|
45
|
+
get type(): ButtonType;
|
|
46
|
+
set type(value: ButtonType);
|
|
47
|
+
/** Shakes the button, as after a failed attempt to submit; each call starts the shake again. */
|
|
48
|
+
shake(): void;
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
formDisabledCallback(disabled: boolean): void;
|
|
51
|
+
/** Focuses the anchor with `href`, and the button itself without it. */
|
|
52
|
+
focus(options?: FocusOptions): void;
|
|
53
|
+
protected update(name: string): void;
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
"swell-button": SwellButton;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A card: a box that groups content, such as the details of an order or a note under a choice.
|
|
4
|
+
*
|
|
5
|
+
* @tag swell-card
|
|
6
|
+
* @slot - The content.
|
|
7
|
+
* @attr {"outline" | "filled"} appearance - How the card is drawn: with a border, or filled with the quiet background; the configured setting by default.
|
|
8
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the padding is: it follows the text of the size; `medium` by default.
|
|
9
|
+
* @cssstate outline - The card has a border.
|
|
10
|
+
* @cssstate filled - The card is filled.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SwellCard extends SwellShadowElement {
|
|
13
|
+
static group: string;
|
|
14
|
+
static appearance: string;
|
|
15
|
+
static styles: string;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"swell-card": SwellCard;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SwellFieldElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A checkbox: a native checkbox with its label, hint and error, rendered into light DOM.
|
|
4
|
+
*
|
|
5
|
+
* @tag swell-checkbox
|
|
6
|
+
* @attr {string} label - The label beside the box.
|
|
7
|
+
* @attr {string} hint - Help text under the checkbox.
|
|
8
|
+
* @attr {string} error - The error shown while the checkbox is invalid.
|
|
9
|
+
* @attr {boolean} invalid - Marks the checkbox invalid and shows the error.
|
|
10
|
+
* @attr {boolean} checked - The default state.
|
|
11
|
+
* @attr {string} value - The value sent with the form; `on` by default.
|
|
12
|
+
* @attr {boolean} disabled - Disables the checkbox.
|
|
13
|
+
* @attr {boolean} required - Makes the checkbox required.
|
|
14
|
+
* @attr {string} name - The name sent with the form.
|
|
15
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the checkbox is: the label takes the text of the size and the box grows with it; `medium` by default. The target stays at least 24px.
|
|
16
|
+
* @fires change - The user checks or unchecks the box; it bubbles from the native input.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SwellCheckbox extends SwellFieldElement {
|
|
19
|
+
#private;
|
|
20
|
+
static labelPosition: boolean;
|
|
21
|
+
static styles: string;
|
|
22
|
+
static observedAttributes: string[];
|
|
23
|
+
/** Whether the box is checked now. */
|
|
24
|
+
get checked(): boolean;
|
|
25
|
+
set checked(value: boolean);
|
|
26
|
+
/** The value sent with the form. */
|
|
27
|
+
get value(): string;
|
|
28
|
+
set value(value: string);
|
|
29
|
+
get disabled(): boolean;
|
|
30
|
+
set disabled(value: boolean);
|
|
31
|
+
get required(): boolean;
|
|
32
|
+
set required(value: boolean);
|
|
33
|
+
get invalid(): boolean;
|
|
34
|
+
set invalid(value: boolean);
|
|
35
|
+
get name(): string;
|
|
36
|
+
set name(value: string);
|
|
37
|
+
focus(options?: FocusOptions): void;
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
protected render(): void;
|
|
40
|
+
protected update(name: string): void;
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
"swell-checkbox": SwellCheckbox;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A chip: a short value the shopper can remove, such as an applied discount code or gift card.
|
|
4
|
+
* Its remove button fires `remove`; the host removes the chip and moves the focus, for example to the code field.
|
|
5
|
+
* A disabled chip, by its own attribute or a disabled fieldset around it, keeps its value legible and fades its remove button, which takes neither the focus nor presses, so a host can lock a form while it is sent.
|
|
6
|
+
*
|
|
7
|
+
* @tag swell-chip
|
|
8
|
+
* @slot - The value.
|
|
9
|
+
* @slot start - An icon before the value, drawn 2px larger than the text.
|
|
10
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the chip is; `medium` by default. Its remove button is as high as the chip, at least 24px.
|
|
11
|
+
* @attr {boolean} disabled - Disables the remove button.
|
|
12
|
+
* @attr {string} remove-label - The name of the remove button in the host's language, such as `Remove WELCOME10`; every chip needs one.
|
|
13
|
+
* @fires remove - The shopper pressed the remove button; it bubbles, and the chip stays in the page. A disabled chip fires none.
|
|
14
|
+
* @csspart remove - The remove button.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SwellChip extends SwellShadowElement {
|
|
17
|
+
#private;
|
|
18
|
+
static styles: string;
|
|
19
|
+
static template: string;
|
|
20
|
+
/** Form-associated, as a button is, so a disabled fieldset disables it. */
|
|
21
|
+
static formAssociated: boolean;
|
|
22
|
+
static observedAttributes: string[];
|
|
23
|
+
constructor();
|
|
24
|
+
get disabled(): boolean;
|
|
25
|
+
set disabled(value: boolean);
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
formDisabledCallback(): void;
|
|
28
|
+
/** Focuses the remove button, the chip's only stop, so a host can hand the focus to a chip; a click on the text leaves the focus alone. */
|
|
29
|
+
focus(options?: FocusOptions): void;
|
|
30
|
+
protected update(name: string): void;
|
|
31
|
+
}
|
|
32
|
+
declare global {
|
|
33
|
+
interface HTMLElementTagNameMap {
|
|
34
|
+
"swell-chip": SwellChip;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A disclosure: content that stays hidden until the shopper presses its trigger, such as "Add apartment, suite, etc." and the field it reveals.
|
|
4
|
+
* The trigger opens it and leaves; the focus moves to the first control of the content.
|
|
5
|
+
* With `toggle`, such as a collapsible order summary, the trigger stays, closes the content too and tells whether it is open with `aria-expanded`; the focus stays on it.
|
|
6
|
+
* The host can also set `open` itself, for example from a checkbox, and remove it to close the content and bring the trigger back; without a trigger, the host moves the focus out first.
|
|
7
|
+
* Closed content stays in the page and in the form: render it only while open, or disable its fields, so a required field doesn't block the submit.
|
|
8
|
+
*
|
|
9
|
+
* @tag swell-disclosure
|
|
10
|
+
* @slot trigger - The host's button that opens the content, such as `<swell-link appearance="plain">`; a button, not a link with `href`. Inside a form a `<button>` or a `<swell-button>` needs `type="button"`. A listener that cancels the press, also a framework's handler on the page, keeps the content closed.
|
|
11
|
+
* @slot - The content.
|
|
12
|
+
* @attr {boolean} open - Shows the content and hides the trigger. Set on connect, the content shows at once.
|
|
13
|
+
* @attr {boolean} toggle - Keeps the trigger while the content is open: it closes the content too and carries `aria-expanded`.
|
|
14
|
+
* @fires {ToggleEvent} toggle - The content opened or closed: by the trigger or by script, also as it starts open. A `ToggleEvent` with `oldState` and `newState`, fired once the script that changed `open` has run; it doesn't bubble and can't be cancelled.
|
|
15
|
+
* @csspart content - The box that expands to show the content.
|
|
16
|
+
* @cssstate closing - The content collapses; the trigger is back, out of the flow and invisible until it ends.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SwellDisclosure extends SwellShadowElement {
|
|
19
|
+
#private;
|
|
20
|
+
static styles: string;
|
|
21
|
+
static template: string;
|
|
22
|
+
static observedAttributes: string[];
|
|
23
|
+
constructor();
|
|
24
|
+
get open(): boolean;
|
|
25
|
+
set open(value: boolean);
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Closed content is inert, so Tab skips it while it collapses; closing with the focus inside gives the focus back to the trigger first.
|
|
29
|
+
* While the content collapses, the element is in the `closing` state.
|
|
30
|
+
*/
|
|
31
|
+
protected update(name: string): void;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"swell-disclosure": SwellDisclosure;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A divider: a line across its width, or two lines with a label between them, such as "or pay another way".
|
|
4
|
+
* Without a label it is a separator for screen readers; with one, they read the label and skip the lines.
|
|
5
|
+
* The host sets the space around it.
|
|
6
|
+
*
|
|
7
|
+
* @tag swell-divider
|
|
8
|
+
* @slot - An optional label, such as text or an icon, drawn in the caption font and the secondary text color; whitespace and hidden content aren't one.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SwellDivider extends SwellShadowElement {
|
|
11
|
+
#private;
|
|
12
|
+
static styles: string;
|
|
13
|
+
static template: string;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"swell-divider": SwellDivider;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { configure, getConfig, onChange, setTheme } from "../../runtime/index.js";
|
|
2
|
+
import { version } from "../../runtime/config.js";
|
|
3
|
+
/** Loads the elements of a root (a document, a shadow root or an element), and those added to it later, or the elements of a list of tags; resolves when they are defined. */
|
|
4
|
+
export declare const load: (target: import("./index.js").Root | readonly string[]) => Promise<void>;
|
|
5
|
+
/** Resolves when the tags, or the kit's tags undefined in the document now, are defined. */
|
|
6
|
+
export declare const ready: (tags?: readonly string[]) => Promise<void>;
|
|
7
|
+
export { configure, getConfig, onChange, setTheme, version };
|
|
8
|
+
export type { Color, Config, Theme } from "../../runtime/index.js";
|
|
9
|
+
export type { Root } from "../../runtime/loader.js";
|
|
10
|
+
declare global {
|
|
11
|
+
/** The kit's functions for inline scripts and pages without a bundler. */
|
|
12
|
+
var SwellUI: {
|
|
13
|
+
configure: typeof configure;
|
|
14
|
+
setTheme: typeof setTheme;
|
|
15
|
+
getConfig: typeof getConfig;
|
|
16
|
+
onChange: typeof onChange;
|
|
17
|
+
version: string;
|
|
18
|
+
load: typeof load;
|
|
19
|
+
ready: typeof ready;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SwellTextFieldElement } from "../../../runtime/text-field.js";
|
|
2
|
+
/**
|
|
3
|
+
* A text field: a native input with its label, hint and error, rendered into light DOM.
|
|
4
|
+
*
|
|
5
|
+
* @tag swell-input
|
|
6
|
+
* @attr {string} label - The label of the field.
|
|
7
|
+
* @attr {string} optional - A marker after the label, such as `(optional)`, in the host's language; it joins the field's name.
|
|
8
|
+
* @attr {string} hint - Help text under the field.
|
|
9
|
+
* @attr {string} error - The error shown while the field is invalid.
|
|
10
|
+
* @attr {boolean} invalid - Marks the field invalid and shows the error.
|
|
11
|
+
* @attr {string} value - The default value.
|
|
12
|
+
* @attr {"text" | "email" | "tel" | "password" | "number" | "search" | "url"} type - The kind of value; `text` by default.
|
|
13
|
+
* @attr {"outline" | "filled" | "underline"} appearance - How the field is drawn; the configured setting by default.
|
|
14
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large the field is; `medium` by default. At `xsmall` the label sits above the field.
|
|
15
|
+
* @attr {boolean} disabled - Disables the field.
|
|
16
|
+
* @attr {boolean} readonly - Makes the field read-only.
|
|
17
|
+
* @attr {boolean} required - Makes the field required.
|
|
18
|
+
* @attr {string} name - The name sent with the form.
|
|
19
|
+
* @attr {string} placeholder - Text shown while the field is empty.
|
|
20
|
+
* @attr {string} autocomplete - The autofill hint of the native input.
|
|
21
|
+
* @attr {string} inputmode - The virtual keyboard to show.
|
|
22
|
+
* @attr {number} minlength - The shortest allowed value.
|
|
23
|
+
* @attr {number} maxlength - The longest allowed value.
|
|
24
|
+
* @attr {string} pattern - The pattern the value matches.
|
|
25
|
+
* @attr {string} min - The smallest allowed value.
|
|
26
|
+
* @attr {string} max - The largest allowed value.
|
|
27
|
+
* @attr {string} step - The step between allowed values.
|
|
28
|
+
* @slot hint - Help content under the field in place of the `hint` text, such as "Did you mean <swell-link>gmail.com</swell-link>?"; it describes the input, and hiding it with `hidden` brings the `hint` text back.
|
|
29
|
+
* @slot start - Content before the text, such as an icon; an svg is drawn 4px larger than the text, in the quiet color.
|
|
30
|
+
* @slot end - Content after the text, such as a card logo, a check or a button; hide it with `hidden`, and disable a button in it along with the field.
|
|
31
|
+
* @csspart frame - The box that draws the field around the native input, its start and its end.
|
|
32
|
+
* @csspart start - The box of the start content.
|
|
33
|
+
* @csspart end - The box of the end content.
|
|
34
|
+
* @fires input - The value changes as the user types; it bubbles from the native input.
|
|
35
|
+
* @fires change - The user commits a new value; it bubbles from the native input.
|
|
36
|
+
* @cssstate outline - The field has a border on all sides.
|
|
37
|
+
* @cssstate filled - The field has a fill and a bottom border.
|
|
38
|
+
* @cssstate underline - The field has a bottom border.
|
|
39
|
+
* @cssstate above - The label sits above the field.
|
|
40
|
+
* @cssstate floating - The label floats inside the field.
|
|
41
|
+
*/
|
|
42
|
+
export declare class SwellInput extends SwellTextFieldElement {
|
|
43
|
+
static styles: string;
|
|
44
|
+
static control: "input";
|
|
45
|
+
static prefix: string;
|
|
46
|
+
static template: string;
|
|
47
|
+
static passed: string[];
|
|
48
|
+
static own: string[];
|
|
49
|
+
static observedAttributes: string[];
|
|
50
|
+
protected setUpControl(control: HTMLInputElement): void;
|
|
51
|
+
protected syncControl(name: string, control: HTMLInputElement): void;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
"swell-input": SwellInput;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A link. With `href`, its anchor lives in the shadow root and takes the focus for the element.
|
|
4
|
+
*
|
|
5
|
+
* Without `href` the element itself is a button that looks like the link: it takes the button role and the tab stop, fires `click` on Enter and Space, and never submits a form.
|
|
6
|
+
* Its own `aria-label`, `aria-expanded` and `aria-controls` name and describe that button, so it can open a popover or a disclosure.
|
|
7
|
+
* `role="button"` and `tabindex="0"` count as the kit's and leave when `href` comes; any other role or tabindex is the host's and stays.
|
|
8
|
+
*
|
|
9
|
+
* @tag swell-link
|
|
10
|
+
* @slot - The text of the link.
|
|
11
|
+
* @slot start - An icon before the text, 2px larger than it.
|
|
12
|
+
* @slot end - An icon after the text, 2px larger than it.
|
|
13
|
+
* @attr {string} href - Where the link goes; without it the element is a button. With it, the anchor is named by the element's own `aria-label`, as a link of an icon alone needs, or else by its content.
|
|
14
|
+
* @attr {string} target - Where to open the link.
|
|
15
|
+
* @attr {string} rel - How the target relates to the page.
|
|
16
|
+
* @attr {string} variant - Which palette of `color` the link takes its color from: `secondary`, quiet text, or a variant of the host's own; without it, the link color.
|
|
17
|
+
* @attr {"underline" | "plain"} appearance - How the link is drawn: `underline`, the default, in the font of the text around it; `plain`, for a link on its own, without an underline, in the text of a field hint, at least 24px high. Only the attribute sets it.
|
|
18
|
+
* @attr {"xsmall" | "small" | "medium" | "large" | "xlarge"} size - How large a plain link is: its text is one step smaller than the text of the size, at least 12px; `medium` by default. A link in text takes the font around it.
|
|
19
|
+
* @csspart link - The anchor, or the content of the button without `href`.
|
|
20
|
+
* @cssstate plain - The link is plain.
|
|
21
|
+
* @cssstate start-content - The link has content in its `start` slot.
|
|
22
|
+
* @cssstate end-content - The link has content in its `end` slot.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SwellLink extends SwellShadowElement {
|
|
25
|
+
#private;
|
|
26
|
+
static group: string;
|
|
27
|
+
static appearance: string;
|
|
28
|
+
static appearances: string[];
|
|
29
|
+
static styles: string;
|
|
30
|
+
static template: string;
|
|
31
|
+
static observedAttributes: string[];
|
|
32
|
+
constructor();
|
|
33
|
+
connectedCallback(): void;
|
|
34
|
+
/** Focuses the anchor with `href`, and the element itself without it. */
|
|
35
|
+
focus(options?: FocusOptions): void;
|
|
36
|
+
protected update(name: string): void;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"swell-link": SwellLink;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* Gives an element an id of its own, unless the host gave it one.
|
|
4
|
+
* A deep clone copies the id it was given, so a copied id is replaced with a new one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ownId(element: Element, prefix: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* The list of a lookup's suggestions. It lives only as a child of `<swell-lookup>`, which shows it under the field while it opens.
|
|
9
|
+
*
|
|
10
|
+
* @tag swell-lookup-list
|
|
11
|
+
* @slot - The suggestions, `<swell-lookup-option>` elements.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SwellLookupList extends SwellShadowElement {
|
|
14
|
+
static styles: string;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"swell-lookup-list": SwellLookupList;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SwellOptionElement } from "../select/select-option.js";
|
|
2
|
+
/** Marks `option` as the one the field's keyboard points at, or clears the mark. */
|
|
3
|
+
export declare function activate(option: SwellLookupOption, on: boolean): void;
|
|
4
|
+
/**
|
|
5
|
+
* One suggestion of a lookup. It lives only as a child of `<swell-lookup-list>`.
|
|
6
|
+
* Choosing it clicks it: the host reads the option from the `click`. A click on a disabled suggestion reaches the host's handlers too, and the field ignores it.
|
|
7
|
+
*
|
|
8
|
+
* @tag swell-lookup-option
|
|
9
|
+
* @slot - The label of the suggestion; the field writes its text into the input when it is chosen.
|
|
10
|
+
* @slot start - Content before the label, such as an icon.
|
|
11
|
+
* @attr {string} value - The value of the suggestion, such as the id of a place; the label by default.
|
|
12
|
+
* @attr {string} hint - A second line under the label.
|
|
13
|
+
* @attr {boolean} disabled - Disables the suggestion.
|
|
14
|
+
* @cssstate focused - The field's keyboard points at the suggestion.
|
|
15
|
+
* @cssstate disabled - The suggestion is disabled.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SwellLookupOption extends SwellOptionElement {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: string;
|
|
20
|
+
static focusable: boolean;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
"swell-lookup-option": SwellLookupOption;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SwellInput } from "../input/input.js";
|
|
2
|
+
/**
|
|
3
|
+
* A text field with suggestions: a combobox in ARIA terms. The host loads the suggestions, such as addresses,
|
|
4
|
+
* and puts them into a `<swell-lookup-list>` child as `<swell-lookup-option>` elements; the field shows them under itself.
|
|
5
|
+
* It is a `<swell-input>` in everything else: its native input stays in light DOM, so autofill works as in any field.
|
|
6
|
+
*
|
|
7
|
+
* The list opens while the user types and it has something to show, and closes on a choice, on Escape and when the focus leaves the field.
|
|
8
|
+
* Choosing a suggestion clicks it. After the click, unless a handler prevented its default, the field writes the suggestion's label
|
|
9
|
+
* into the input and fires `input`, with `inputType` `insertReplacementText`, and `change`; the list stays closed until the user types again.
|
|
10
|
+
*
|
|
11
|
+
* @tag swell-lookup
|
|
12
|
+
* @slot - The list of suggestions, a `<swell-lookup-list>`. While it is there, the input is a combobox and the list can open: keep it in the field, even empty, for as long as the field takes suggestions.
|
|
13
|
+
* @slot hint - Help content under the field in place of the `hint` text, as on an input.
|
|
14
|
+
* @slot action - A row at the end of the list, such as a `<button type="button">` that opens a manual form; it shows with at least one suggestion, so it stays in the field, and a click on it closes the list.
|
|
15
|
+
* @csspart list - The popup that holds the list and the action.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SwellLookup extends SwellInput {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: string;
|
|
20
|
+
static prefix: string;
|
|
21
|
+
static template: string;
|
|
22
|
+
constructor();
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
protected setUpControl(control: HTMLInputElement): void;
|
|
25
|
+
protected render(): void;
|
|
26
|
+
protected update(name: string): void;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"swell-lookup": SwellLookup;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SwellShadowElement } from "../../../runtime/element.js";
|
|
2
|
+
/**
|
|
3
|
+
* A popover: a small dialog that floats at the host's trigger, such as the language and currency picker of a checkout.
|
|
4
|
+
* The trigger opens and closes it; opened by the trigger, it moves the focus to its first control. Escape closes it and gives the focus back to the trigger;
|
|
5
|
+
* a press outside it and the focus leaving it close it too. A choice inside keeps it open.
|
|
6
|
+
* The panel sits under the trigger, or above it when there is more room there, at the trigger's start edge, or at its end edge when it would leave the window there.
|
|
7
|
+
* Its content sets its width, at least the trigger's and at most the window's less 16px.
|
|
8
|
+
* Name it with `aria-label`, such as `Language and currency`.
|
|
9
|
+
*
|
|
10
|
+
* @tag swell-popover
|
|
11
|
+
* @slot trigger - The host's button that opens and closes the panel: a `<button>` or a `<swell-button>`, with `type="button"` inside a form, or a `<swell-link>` without `href`. The popover sets its `aria-expanded`. A listener that cancels the press, also a framework's handler on the page, keeps the panel closed.
|
|
12
|
+
* @slot - The content of the panel.
|
|
13
|
+
* @attr {boolean} open - The panel is open. Set it to open the panel without moving the focus; remove it to close the panel, which gives the focus back to the trigger when the focus is inside.
|
|
14
|
+
* @fires {ToggleEvent} toggle - The panel opened or closed: by the trigger, Escape, a press outside, the focus leaving it or script, also as it starts open or leaves the page open. A `ToggleEvent` with `oldState` and `newState`, fired once the script that changed `open` has run; it doesn't bubble and can't be cancelled.
|
|
15
|
+
* @csspart panel - The floating panel.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SwellPopover extends SwellShadowElement {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: string;
|
|
20
|
+
static template: string;
|
|
21
|
+
static observedAttributes: string[];
|
|
22
|
+
constructor();
|
|
23
|
+
get open(): boolean;
|
|
24
|
+
set open(value: boolean);
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
protected update(name: string): void;
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
"swell-popover": SwellPopover;
|
|
32
|
+
}
|
|
33
|
+
}
|