@stainless-api/ui-primitives 0.1.0-beta.21 → 0.1.0-beta.23
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/dist/{Accordion-DLQE3Td6.js → Accordion-CL3Oarbz.js} +3 -3
- package/dist/{Accordion-CJL9SWwS.d.ts → Accordion-Cj5GURin.d.ts} +4 -4
- package/dist/{Button-DwndlytB.d.ts → Button-CxQtPObH.d.ts} +4 -4
- package/dist/{Button-DBhd6kU7.js → Button-DFAg4M-E.js} +3 -3
- package/dist/{Callout-UZQRuCQ5.js → Callout-BGkXD7D2.js} +1 -1
- package/dist/{Callout-CMz3Yl_5.d.ts → Callout-DlwbfFHm.d.ts} +2 -2
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Accordion.js +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.d.ts +1 -1
- package/dist/components/Callout.js +1 -1
- package/dist/index.d.ts +170 -5
- package/dist/index.js +175 -5
- package/dist/scripts/index.d.ts +12 -1
- package/dist/scripts/index.js +150 -22
- package/dist/styles.css +210 -96
- package/dist/styles.js +0 -1
- package/package.json +21 -12
- package/.turbo/turbo-build.log +0 -35
- package/CHANGELOG.md +0 -133
- package/dist/DropdownButton-DoYDi8tB.js +0 -82
- package/dist/DropdownButton-zcvep_xH.d.ts +0 -50
- package/dist/components/DropdownButton.d.ts +0 -2
- package/dist/components/DropdownButton.js +0 -3
- package/eslint.config.js +0 -2
- package/src/components/Accordion.tsx +0 -41
- package/src/components/Button.tsx +0 -95
- package/src/components/Callout.tsx +0 -31
- package/src/components/accordion.css +0 -145
- package/src/components/button.css +0 -187
- package/src/components/callout.css +0 -93
- package/src/components/dropdown/Dropdown.tsx +0 -51
- package/src/components/dropdown/DropdownButton.tsx +0 -54
- package/src/components/dropdown/DropdownMenu.tsx +0 -113
- package/src/components/dropdown/dropdown.css +0 -232
- package/src/index.ts +0 -5
- package/src/scripts/dropdown-button.ts +0 -39
- package/src/scripts/dropdown.ts +0 -193
- package/src/scripts/index.ts +0 -2
- package/src/styles/layout.css +0 -13
- package/src/styles/scales.css +0 -129
- package/src/styles/starlight-compat.css +0 -156
- package/src/styles/swatches.css +0 -87
- package/src/styles/theme.css +0 -49
- package/src/styles/typography.css +0 -169
- package/src/styles.css +0 -11
- package/tsconfig.json +0 -11
|
@@ -3,14 +3,14 @@ import clsx from "clsx";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Accordion.tsx
|
|
6
|
-
function Accordion({ className, children
|
|
6
|
+
function Accordion({ className, children, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsx("details", {
|
|
8
8
|
className: clsx("stl-ui-accordion", className),
|
|
9
9
|
...props,
|
|
10
10
|
children
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function AccordionSummary({ children, className
|
|
13
|
+
function AccordionSummary({ children, className, ...props }) {
|
|
14
14
|
return /* @__PURE__ */ jsx("summary", {
|
|
15
15
|
className: clsx("stl-ui-accordion__summary", className),
|
|
16
16
|
...props,
|
|
@@ -18,7 +18,7 @@ function AccordionSummary({ children, className,...props }) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
Accordion.Summary = AccordionSummary;
|
|
21
|
-
function AccordionGroup({ className, children
|
|
21
|
+
function AccordionGroup({ className, children, ...props }) {
|
|
22
22
|
return /* @__PURE__ */ jsx("div", {
|
|
23
23
|
className: clsx("stl-ui-accordion-group", className),
|
|
24
24
|
...props,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Accordion.d.ts
|
|
5
5
|
type AccordionProps = React.ComponentProps<'details'>;
|
|
@@ -7,7 +7,7 @@ declare function Accordion({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...props
|
|
10
|
-
}: AccordionProps):
|
|
10
|
+
}: AccordionProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
declare namespace Accordion {
|
|
12
12
|
var Summary: typeof AccordionSummary;
|
|
13
13
|
var Group: typeof AccordionGroup;
|
|
@@ -16,11 +16,11 @@ declare function AccordionSummary({
|
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
18
18
|
...props
|
|
19
|
-
}: React.ComponentProps<'summary'>):
|
|
19
|
+
}: React.ComponentProps<'summary'>): react_jsx_runtime0.JSX.Element;
|
|
20
20
|
declare function AccordionGroup({
|
|
21
21
|
className,
|
|
22
22
|
children,
|
|
23
23
|
...props
|
|
24
|
-
}: React.ComponentProps<'div'>):
|
|
24
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { AccordionProps as n, Accordion as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
3
|
import { LucideIcon } from "lucide-react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Button.d.ts
|
|
@@ -17,17 +17,17 @@ type ButtonBranch = BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
17
17
|
href?: never;
|
|
18
18
|
};
|
|
19
19
|
type ButtonProps = AnchorBranch | ButtonBranch;
|
|
20
|
-
declare function Button(props: ButtonProps):
|
|
20
|
+
declare function Button(props: ButtonProps): react_jsx_runtime2.JSX.Element;
|
|
21
21
|
declare namespace Button {
|
|
22
22
|
var Label: ({
|
|
23
23
|
className,
|
|
24
24
|
...rest
|
|
25
|
-
}: LabelProps) =>
|
|
25
|
+
}: LabelProps) => react_jsx_runtime2.JSX.Element;
|
|
26
26
|
var Icon: ({
|
|
27
27
|
className,
|
|
28
28
|
icon: Icon,
|
|
29
29
|
size
|
|
30
|
-
}: IconProps) =>
|
|
30
|
+
}: IconProps) => react_jsx_runtime2.JSX.Element;
|
|
31
31
|
}
|
|
32
32
|
type LabelProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
33
33
|
type IconProps = {
|
|
@@ -18,7 +18,7 @@ function Button(props) {
|
|
|
18
18
|
"stl-ui-button--size-lg": props.size === "lg"
|
|
19
19
|
}, "not-content", "stl-ui-not-prose", props.className);
|
|
20
20
|
if ("href" in props) {
|
|
21
|
-
const { href
|
|
21
|
+
const { href, ...rest$1 } = props;
|
|
22
22
|
return /* @__PURE__ */ jsx("a", {
|
|
23
23
|
href,
|
|
24
24
|
...rest$1,
|
|
@@ -26,7 +26,7 @@ function Button(props) {
|
|
|
26
26
|
children
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
const { type
|
|
29
|
+
const { type, ...rest } = props;
|
|
30
30
|
return /* @__PURE__ */ jsx("button", {
|
|
31
31
|
type: type ?? "button",
|
|
32
32
|
...rest,
|
|
@@ -34,7 +34,7 @@ function Button(props) {
|
|
|
34
34
|
children
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
Button.Label = function ButtonLabel({ className
|
|
37
|
+
Button.Label = function ButtonLabel({ className, ...rest }) {
|
|
38
38
|
return /* @__PURE__ */ jsx("span", {
|
|
39
39
|
className: clsx("stl-ui-button-label leading-none", className),
|
|
40
40
|
...rest
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { Check, CircleAlert, Info, Lightbulb, OctagonAlert, TriangleAlert } from "lucide-react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Callout.tsx
|
|
7
|
-
function Callout({ variant = "info", className, children
|
|
7
|
+
function Callout({ variant = "info", className, children, ...props }) {
|
|
8
8
|
const classes = clsx("stl-ui-callout", `stl-ui-callout--${variant}`, className);
|
|
9
9
|
const Icon = {
|
|
10
10
|
info: Info,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Callout.d.ts
|
|
5
5
|
type CalloutVariant = 'info' | 'note' | 'tip' | 'success' | 'warning' | 'danger';
|
|
@@ -13,6 +13,6 @@ declare function Callout({
|
|
|
13
13
|
className,
|
|
14
14
|
children,
|
|
15
15
|
...props
|
|
16
|
-
}: CalloutProps):
|
|
16
|
+
}: CalloutProps): react_jsx_runtime5.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { CalloutProps as n, CalloutVariant as r, Callout as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AccordionProps, t as Accordion } from "../Accordion-
|
|
1
|
+
import { n as AccordionProps, t as Accordion } from "../Accordion-Cj5GURin.js";
|
|
2
2
|
export { Accordion, AccordionProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ButtonProps, r as ButtonVariant, t as Button } from "../Button-
|
|
1
|
+
import { n as ButtonProps, r as ButtonVariant, t as Button } from "../Button-CxQtPObH.js";
|
|
2
2
|
export { Button, ButtonProps, ButtonVariant };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "../Callout-
|
|
1
|
+
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "../Callout-DlwbfFHm.js";
|
|
2
2
|
export { Callout, CalloutProps, CalloutVariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,170 @@
|
|
|
1
|
-
import { n as AccordionProps, t as Accordion } from "./Accordion-
|
|
2
|
-
import { n as ButtonProps, r as ButtonVariant, t as Button } from "./Button-
|
|
3
|
-
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "./Callout-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { n as AccordionProps, t as Accordion } from "./Accordion-Cj5GURin.js";
|
|
2
|
+
import { n as ButtonProps, r as ButtonVariant, t as Button } from "./Button-CxQtPObH.js";
|
|
3
|
+
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "./Callout-DlwbfFHm.js";
|
|
4
|
+
import * as react0 from "react";
|
|
5
|
+
import { ComponentProps } from "react";
|
|
6
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/dropdown/DropdownMenu.d.ts
|
|
9
|
+
declare function Menu({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: ComponentProps<'div'>): react_jsx_runtime21.JSX.Element;
|
|
13
|
+
declare namespace Menu {
|
|
14
|
+
var Item: typeof MenuItem;
|
|
15
|
+
var ItemText: typeof MenuItemText;
|
|
16
|
+
var ItemTemplate: typeof MenuItemTemplate;
|
|
17
|
+
}
|
|
18
|
+
declare function MenuItemText({
|
|
19
|
+
className,
|
|
20
|
+
subtle,
|
|
21
|
+
...props
|
|
22
|
+
}: ComponentProps<'span'> & {
|
|
23
|
+
subtle?: boolean;
|
|
24
|
+
}): react_jsx_runtime21.JSX.Element;
|
|
25
|
+
type MenuItemBaseProps = {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
value: string;
|
|
28
|
+
isExternalLink?: boolean;
|
|
29
|
+
isSelected?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type MenuItemWithHref = MenuItemBaseProps & ComponentProps<'a'> & {
|
|
32
|
+
href: string;
|
|
33
|
+
};
|
|
34
|
+
type MenuItemWithoutHref = MenuItemBaseProps & ComponentProps<'button'> & {
|
|
35
|
+
href?: never;
|
|
36
|
+
};
|
|
37
|
+
type MenuItemProps = MenuItemWithHref | MenuItemWithoutHref;
|
|
38
|
+
declare function MenuItem({
|
|
39
|
+
children,
|
|
40
|
+
value,
|
|
41
|
+
href,
|
|
42
|
+
isExternalLink,
|
|
43
|
+
isSelected,
|
|
44
|
+
...props
|
|
45
|
+
}: MenuItemProps): react_jsx_runtime21.JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* A template component that defines the content to be displayed in the dropdown trigger
|
|
48
|
+
* when a menu item is selected. This template is used to customize the appearance of
|
|
49
|
+
* the selected item in the trigger button.
|
|
50
|
+
*
|
|
51
|
+
* @param props - Standard HTML template element props
|
|
52
|
+
* @returns A template element marked with the "selected-template" data part
|
|
53
|
+
*/
|
|
54
|
+
declare function MenuItemTemplate({
|
|
55
|
+
...props
|
|
56
|
+
}: ComponentProps<'template'>): react_jsx_runtime21.JSX.Element;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/components/dropdown/Dropdown.d.ts
|
|
59
|
+
declare function Dropdown({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: ComponentProps<'div'>): react_jsx_runtime21.JSX.Element;
|
|
63
|
+
declare namespace Dropdown {
|
|
64
|
+
var Menu: typeof Menu;
|
|
65
|
+
var MenuItem: ({
|
|
66
|
+
children,
|
|
67
|
+
value,
|
|
68
|
+
href,
|
|
69
|
+
isExternalLink,
|
|
70
|
+
isSelected,
|
|
71
|
+
...props
|
|
72
|
+
}: ({
|
|
73
|
+
children?: React.ReactNode;
|
|
74
|
+
value: string;
|
|
75
|
+
isExternalLink?: boolean;
|
|
76
|
+
isSelected?: boolean;
|
|
77
|
+
} & react0.ClassAttributes<HTMLAnchorElement> & react0.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
78
|
+
href: string;
|
|
79
|
+
}) | ({
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
value: string;
|
|
82
|
+
isExternalLink?: boolean;
|
|
83
|
+
isSelected?: boolean;
|
|
84
|
+
} & react0.ClassAttributes<HTMLButtonElement> & react0.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
85
|
+
href?: never;
|
|
86
|
+
})) => react_jsx_runtime21.JSX.Element;
|
|
87
|
+
var MenuItemText: ({
|
|
88
|
+
className,
|
|
89
|
+
subtle,
|
|
90
|
+
...props
|
|
91
|
+
}: ComponentProps<"span"> & {
|
|
92
|
+
subtle?: boolean;
|
|
93
|
+
}) => react_jsx_runtime21.JSX.Element;
|
|
94
|
+
var MenuItemTemplate: ({
|
|
95
|
+
...props
|
|
96
|
+
}: ComponentProps<"template">) => react_jsx_runtime21.JSX.Element;
|
|
97
|
+
var Trigger: ({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}: ComponentProps<"button">) => react_jsx_runtime21.JSX.Element;
|
|
101
|
+
var TriggerSelectedItem: ({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}: ComponentProps<"div">) => react_jsx_runtime21.JSX.Element;
|
|
105
|
+
var TriggerIcon: ({
|
|
106
|
+
className,
|
|
107
|
+
...props
|
|
108
|
+
}: ComponentProps<"span">) => react_jsx_runtime21.JSX.Element;
|
|
109
|
+
var Icon: ({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}: ComponentProps<"div">) => react_jsx_runtime21.JSX.Element;
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/components/dropdown/DropdownButton.d.ts
|
|
116
|
+
declare function DropdownButton({
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
119
|
+
}: ComponentProps<'div'>): react_jsx_runtime21.JSX.Element;
|
|
120
|
+
declare namespace DropdownButton {
|
|
121
|
+
var Menu: typeof Menu;
|
|
122
|
+
var MenuItem: ({
|
|
123
|
+
children,
|
|
124
|
+
value,
|
|
125
|
+
href,
|
|
126
|
+
isExternalLink,
|
|
127
|
+
isSelected,
|
|
128
|
+
...props
|
|
129
|
+
}: ({
|
|
130
|
+
children?: React.ReactNode;
|
|
131
|
+
value: string;
|
|
132
|
+
isExternalLink?: boolean;
|
|
133
|
+
isSelected?: boolean;
|
|
134
|
+
} & react0.ClassAttributes<HTMLAnchorElement> & react0.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
135
|
+
href: string;
|
|
136
|
+
}) | ({
|
|
137
|
+
children?: React.ReactNode;
|
|
138
|
+
value: string;
|
|
139
|
+
isExternalLink?: boolean;
|
|
140
|
+
isSelected?: boolean;
|
|
141
|
+
} & react0.ClassAttributes<HTMLButtonElement> & react0.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
142
|
+
href?: never;
|
|
143
|
+
})) => react_jsx_runtime21.JSX.Element;
|
|
144
|
+
var MenuItemText: ({
|
|
145
|
+
className,
|
|
146
|
+
subtle,
|
|
147
|
+
...props
|
|
148
|
+
}: ComponentProps<"span"> & {
|
|
149
|
+
subtle?: boolean;
|
|
150
|
+
}) => react_jsx_runtime21.JSX.Element;
|
|
151
|
+
var PrimaryAction: ({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}: ComponentProps<"button">) => react_jsx_runtime21.JSX.Element;
|
|
155
|
+
var PrimaryActionText: ({
|
|
156
|
+
children
|
|
157
|
+
}: {
|
|
158
|
+
children?: React.ReactNode;
|
|
159
|
+
}) => react_jsx_runtime21.JSX.Element;
|
|
160
|
+
var Trigger: ({
|
|
161
|
+
className,
|
|
162
|
+
...props
|
|
163
|
+
}: ComponentProps<"button">) => react_jsx_runtime21.JSX.Element;
|
|
164
|
+
var Icon: ({
|
|
165
|
+
className,
|
|
166
|
+
...props
|
|
167
|
+
}: ComponentProps<"div">) => react_jsx_runtime21.JSX.Element;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { Accordion, AccordionProps, Button, ButtonProps, ButtonVariant, Callout, CalloutProps, CalloutVariant, Dropdown, DropdownButton };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,176 @@
|
|
|
1
|
-
import { t as Button } from "./Button-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
1
|
+
import { t as Button } from "./Button-DFAg4M-E.js";
|
|
2
|
+
import { t as Callout } from "./Callout-BGkXD7D2.js";
|
|
3
|
+
import { t as Accordion } from "./Accordion-CL3Oarbz.js";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CheckIcon, ChevronsUpDown, ExternalLink } from "lucide-react";
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
//#region src/components/dropdown/DropdownMenu.tsx
|
|
9
|
+
function Menu({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
...props,
|
|
12
|
+
role: "listbox",
|
|
13
|
+
"data-state": "closed",
|
|
14
|
+
"data-part": "menu",
|
|
15
|
+
className: clsx("stl-ui-dropdown-menu", className)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function MenuItemText({ className, subtle, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx("span", {
|
|
20
|
+
...props,
|
|
21
|
+
"data-part": "item-text",
|
|
22
|
+
className: clsx(`stl-ui-dropdown-menu__item-text`, { "stl-ui-dropdown-menu__item-text--subtle": subtle }, className)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function MenuItem({ children, value, href, isExternalLink, isSelected, ...props }) {
|
|
26
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "stl-ui-dropdown-menu__item-content",
|
|
29
|
+
children
|
|
30
|
+
}),
|
|
31
|
+
isSelected && /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "stl-ui-dropdown-menu__item-icon",
|
|
33
|
+
"data-part": "item-selected-icon",
|
|
34
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { size: 16 })
|
|
35
|
+
}),
|
|
36
|
+
isExternalLink && /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "stl-ui-dropdown-menu__item-subtle-icon",
|
|
38
|
+
"data-part": "item-external-link-icon",
|
|
39
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { size: 16 })
|
|
40
|
+
})
|
|
41
|
+
] });
|
|
42
|
+
if (href) return /* @__PURE__ */ jsx("a", {
|
|
43
|
+
role: "option",
|
|
44
|
+
"data-part": "item",
|
|
45
|
+
"data-value": value,
|
|
46
|
+
"aria-selected": isSelected,
|
|
47
|
+
href,
|
|
48
|
+
...props,
|
|
49
|
+
className: clsx("stl-ui-dropdown-menu__item", "stl-ui-dropdown-menu__item-link", props.className),
|
|
50
|
+
children: inner
|
|
51
|
+
});
|
|
52
|
+
return /* @__PURE__ */ jsx("button", {
|
|
53
|
+
...props,
|
|
54
|
+
role: "option",
|
|
55
|
+
"data-part": "item",
|
|
56
|
+
"data-value": value,
|
|
57
|
+
"aria-selected": isSelected,
|
|
58
|
+
className: clsx("stl-ui-dropdown-menu__item", props.className),
|
|
59
|
+
children: inner
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A template component that defines the content to be displayed in the dropdown trigger
|
|
64
|
+
* when a menu item is selected. This template is used to customize the appearance of
|
|
65
|
+
* the selected item in the trigger button.
|
|
66
|
+
*
|
|
67
|
+
* @param props - Standard HTML template element props
|
|
68
|
+
* @returns A template element marked with the "selected-template" data part
|
|
69
|
+
*/
|
|
70
|
+
function MenuItemTemplate({ ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsx("template", {
|
|
72
|
+
"data-part": "selected-template",
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
Menu.Item = MenuItem;
|
|
77
|
+
Menu.ItemText = MenuItemText;
|
|
78
|
+
Menu.ItemTemplate = MenuItemTemplate;
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/components/dropdown/Dropdown.tsx
|
|
82
|
+
function Trigger$1({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx("button", {
|
|
84
|
+
...props,
|
|
85
|
+
"data-part": "trigger",
|
|
86
|
+
className: clsx("stl-ui-dropdown__button", className),
|
|
87
|
+
children: props.children
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function TriggerSelectedItem({ className, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsx("div", {
|
|
92
|
+
...props,
|
|
93
|
+
"data-part": "trigger-selected",
|
|
94
|
+
className: clsx("stl-ui-dropdown__trigger-selected", className)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function TriggerIcon({ className, ...props }) {
|
|
98
|
+
return /* @__PURE__ */ jsx("span", {
|
|
99
|
+
...props,
|
|
100
|
+
"data-part": "trigger-icon",
|
|
101
|
+
className: clsx("stl-ui-dropdown__trigger-icon", className)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function Icon$1({ className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx("div", {
|
|
106
|
+
...props,
|
|
107
|
+
"data-part": "item-icon",
|
|
108
|
+
className: clsx("stl-ui-dropdown__icon", className)
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function Dropdown({ className, ...props }) {
|
|
112
|
+
return /* @__PURE__ */ jsx("div", {
|
|
113
|
+
...props,
|
|
114
|
+
"aria-haspopup": "listbox",
|
|
115
|
+
"aria-expanded": "false",
|
|
116
|
+
className: clsx("stl-ui-dropdown stl-ui-not-prose not-content", className)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
Dropdown.Menu = Menu;
|
|
120
|
+
Dropdown.MenuItem = Menu.Item;
|
|
121
|
+
Dropdown.MenuItemText = Menu.ItemText;
|
|
122
|
+
Dropdown.MenuItemTemplate = Menu.ItemTemplate;
|
|
123
|
+
Dropdown.Trigger = Trigger$1;
|
|
124
|
+
Dropdown.TriggerSelectedItem = TriggerSelectedItem;
|
|
125
|
+
Dropdown.TriggerIcon = TriggerIcon;
|
|
126
|
+
Dropdown.Icon = Icon$1;
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/dropdown/DropdownButton.tsx
|
|
130
|
+
function PrimaryActionText({ children }) {
|
|
131
|
+
return /* @__PURE__ */ jsx("span", {
|
|
132
|
+
"data-part": "primary-action-text",
|
|
133
|
+
children
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function PrimaryAction({ className, ...props }) {
|
|
137
|
+
return /* @__PURE__ */ jsx("button", {
|
|
138
|
+
...props,
|
|
139
|
+
"data-part": "primary-action",
|
|
140
|
+
className: clsx("stl-ui-dropdown__button stl-ui-dropdown-button--action", className)
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function Trigger({ className, ...props }) {
|
|
144
|
+
return /* @__PURE__ */ jsx("button", {
|
|
145
|
+
...props,
|
|
146
|
+
type: "button",
|
|
147
|
+
"data-part": "trigger",
|
|
148
|
+
className: clsx("stl-ui-dropdown__button stl-ui-dropdown-button__trigger", className),
|
|
149
|
+
children: /* @__PURE__ */ jsx(ChevronsUpDown, { size: 16 })
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function Icon({ className, ...props }) {
|
|
153
|
+
return /* @__PURE__ */ jsx("div", {
|
|
154
|
+
"data-part": "item-icon",
|
|
155
|
+
...props,
|
|
156
|
+
className: clsx("stl-ui-dropdown__icon", className)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function DropdownButton({ className, ...props }) {
|
|
160
|
+
return /* @__PURE__ */ jsx("div", {
|
|
161
|
+
...props,
|
|
162
|
+
"aria-haspopup": "listbox",
|
|
163
|
+
"aria-expanded": "false",
|
|
164
|
+
className: clsx("stl-ui-dropdown stl-ui-not-prose not-content", className)
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
DropdownButton.Menu = Menu;
|
|
168
|
+
DropdownButton.MenuItem = Menu.Item;
|
|
169
|
+
DropdownButton.MenuItemText = Menu.ItemText;
|
|
170
|
+
DropdownButton.PrimaryAction = PrimaryAction;
|
|
171
|
+
DropdownButton.PrimaryActionText = PrimaryActionText;
|
|
172
|
+
DropdownButton.Trigger = Trigger;
|
|
173
|
+
DropdownButton.Icon = Icon;
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
export { Accordion, Button, Callout, Dropdown, DropdownButton };
|
package/dist/scripts/index.d.ts
CHANGED
|
@@ -9,4 +9,15 @@ declare function initDropdownButton({
|
|
|
9
9
|
onPrimaryAction: (primaryActionElement: Element) => void;
|
|
10
10
|
}): void;
|
|
11
11
|
//#endregion
|
|
12
|
-
|
|
12
|
+
//#region src/scripts/dropdown.d.ts
|
|
13
|
+
declare function initDropdown({
|
|
14
|
+
root,
|
|
15
|
+
onSelect,
|
|
16
|
+
initialValue
|
|
17
|
+
}: {
|
|
18
|
+
root?: Element | null;
|
|
19
|
+
onSelect?: (value: string) => void;
|
|
20
|
+
initialValue?: string;
|
|
21
|
+
}): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { initDropdown, initDropdownButton };
|