@stainless-api/ui-primitives 0.1.0-beta.4 → 0.1.0-beta.40

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