@stainless-api/ui-primitives 0.1.0-beta.46 → 0.1.0-beta.48

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/Badge.d.ts
5
5
  type BadgeIntent = 'none' | 'info' | 'success' | 'warning' | 'danger' | 'note' | 'tip' | 'accent';
@@ -16,7 +16,7 @@ declare function BaseBadge({
16
16
  intent?: BadgeIntent;
17
17
  size?: 'sm' | 'md' | 'lg';
18
18
  solid?: boolean;
19
- } & React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime2.JSX.Element;
19
+ } & React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime0.JSX.Element;
20
20
  type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
21
21
  declare function getHttpMethod(method?: string): HTTPMethod | null;
22
22
  declare function HTTPBadge({
@@ -26,14 +26,14 @@ declare function HTTPBadge({
26
26
  }: {
27
27
  method: HTTPMethod;
28
28
  iconOnly?: boolean;
29
- } & Omit<React.ComponentProps<typeof Badge>, 'children' | 'intent'>): react_jsx_runtime2.JSX.Element;
29
+ } & Omit<React.ComponentProps<typeof Badge>, 'children' | 'intent'>): react_jsx_runtime0.JSX.Element;
30
30
  declare const Badge: (({
31
31
  children,
32
32
  intent,
33
33
  ...props
34
34
  }: {
35
35
  children: React.ReactNode;
36
- } & React.ComponentProps<typeof BaseBadge>) => react_jsx_runtime2.JSX.Element) & {
36
+ } & React.ComponentProps<typeof BaseBadge>) => react_jsx_runtime0.JSX.Element) & {
37
37
  HTTP: typeof HTTPBadge;
38
38
  };
39
39
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime12 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import { LucideIcon } from "lucide-react";
4
4
 
5
5
  //#region src/components/Button.d.ts
@@ -21,18 +21,18 @@ type ButtonBranch = BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElemen
21
21
  href?: never;
22
22
  };
23
23
  type ButtonProps = AnchorBranch | ButtonBranch;
24
- declare function Button(props: ButtonProps): react_jsx_runtime12.JSX.Element;
24
+ declare function Button(props: ButtonProps): react_jsx_runtime0.JSX.Element;
25
25
  declare namespace Button {
26
26
  var Label: ({
27
27
  className,
28
28
  ...rest
29
- }: LabelProps) => react_jsx_runtime12.JSX.Element;
29
+ }: LabelProps) => react_jsx_runtime0.JSX.Element;
30
30
  var Icon: ({
31
31
  className,
32
32
  icon: Icon,
33
33
  size,
34
34
  ...rest
35
- }: IconProps) => react_jsx_runtime12.JSX.Element;
35
+ }: IconProps) => react_jsx_runtime0.JSX.Element;
36
36
  }
37
37
  type LabelProps = React.HTMLAttributes<HTMLSpanElement>;
38
38
  type IconProps = {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime23 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 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): react_jsx_runtime23.JSX.Element;
16
+ }: CalloutProps): react_jsx_runtime0.JSX.Element;
17
17
  //#endregion
18
18
  export { Callout, CalloutProps, CalloutVariant };
@@ -1,17 +1,17 @@
1
- import * as react_jsx_runtime24 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/Steps.d.ts
4
4
  declare function Steps({
5
5
  children
6
6
  }: {
7
7
  children: React.ReactNode;
8
- }): react_jsx_runtime24.JSX.Element;
8
+ }): react_jsx_runtime0.JSX.Element;
9
9
  declare function Step({
10
10
  children,
11
11
  title
12
12
  }: {
13
13
  children: React.ReactNode;
14
14
  title: string;
15
- }): react_jsx_runtime24.JSX.Element;
15
+ }): react_jsx_runtime0.JSX.Element;
16
16
  //#endregion
17
17
  export { Step, Steps };
@@ -1,13 +1,13 @@
1
- import { t as Menu } from "../../DropdownMenu-BdFlK_CM.js";
2
- import * as react3 from "react";
1
+ import { Menu } from "./DropdownMenu.js";
2
+ import * as react from "react";
3
3
  import { ComponentProps } from "react";
4
- import * as react_jsx_runtime15 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/dropdown/Dropdown.d.ts
7
7
  declare function Dropdown({
8
8
  className,
9
9
  ...props
10
- }: ComponentProps<'div'>): react_jsx_runtime15.JSX.Element;
10
+ }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
11
11
  declare namespace Dropdown {
12
12
  var Menu: typeof Menu;
13
13
  var MenuItem: ({
@@ -22,42 +22,42 @@ declare namespace Dropdown {
22
22
  value: string;
23
23
  isExternalLink?: boolean;
24
24
  isSelected?: boolean;
25
- } & react3.ClassAttributes<HTMLAnchorElement> & react3.AnchorHTMLAttributes<HTMLAnchorElement> & {
25
+ } & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
26
26
  href: string;
27
27
  }) | ({
28
28
  children?: React.ReactNode;
29
29
  value: string;
30
30
  isExternalLink?: boolean;
31
31
  isSelected?: boolean;
32
- } & react3.ClassAttributes<HTMLButtonElement> & react3.ButtonHTMLAttributes<HTMLButtonElement> & {
32
+ } & react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & {
33
33
  href?: never;
34
- })) => react_jsx_runtime15.JSX.Element;
34
+ })) => react_jsx_runtime0.JSX.Element;
35
35
  var MenuItemText: ({
36
36
  className,
37
37
  subtle,
38
38
  ...props
39
39
  }: ComponentProps<"span"> & {
40
40
  subtle?: boolean;
41
- }) => react_jsx_runtime15.JSX.Element;
41
+ }) => react_jsx_runtime0.JSX.Element;
42
42
  var MenuItemTemplate: ({
43
43
  ...props
44
- }: ComponentProps<"template">) => react_jsx_runtime15.JSX.Element;
44
+ }: ComponentProps<"template">) => react_jsx_runtime0.JSX.Element;
45
45
  var Trigger: ({
46
46
  className,
47
47
  ...props
48
- }: ComponentProps<"button">) => react_jsx_runtime15.JSX.Element;
48
+ }: ComponentProps<"button">) => react_jsx_runtime0.JSX.Element;
49
49
  var TriggerSelectedItem: ({
50
50
  className,
51
51
  ...props
52
- }: ComponentProps<"div">) => react_jsx_runtime15.JSX.Element;
52
+ }: ComponentProps<"div">) => react_jsx_runtime0.JSX.Element;
53
53
  var TriggerIcon: ({
54
54
  className,
55
55
  ...props
56
- }: ComponentProps<"span">) => react_jsx_runtime15.JSX.Element;
56
+ }: ComponentProps<"span">) => react_jsx_runtime0.JSX.Element;
57
57
  var Icon: ({
58
58
  className,
59
59
  ...props
60
- }: ComponentProps<"div">) => react_jsx_runtime15.JSX.Element;
60
+ }: ComponentProps<"div">) => react_jsx_runtime0.JSX.Element;
61
61
  }
62
62
  //#endregion
63
63
  export { Dropdown };
@@ -1,4 +1,4 @@
1
- import { t as Menu } from "../../DropdownMenu-Bj6SQIH-.js";
1
+ import { Menu } from "./DropdownMenu.js";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
@@ -1,13 +1,13 @@
1
- import { t as Menu } from "../../DropdownMenu-BdFlK_CM.js";
2
- import * as react0 from "react";
1
+ import { Menu } from "./DropdownMenu.js";
2
+ import * as react from "react";
3
3
  import { ComponentProps } from "react";
4
- import * as react_jsx_runtime5 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/dropdown/DropdownButton.d.ts
7
7
  declare function DropdownButton({
8
8
  className,
9
9
  ...props
10
- }: ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
10
+ }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
11
11
  declare namespace DropdownButton {
12
12
  var Menu: typeof Menu;
13
13
  var MenuItem: ({
@@ -22,40 +22,40 @@ declare namespace DropdownButton {
22
22
  value: string;
23
23
  isExternalLink?: boolean;
24
24
  isSelected?: boolean;
25
- } & react0.ClassAttributes<HTMLAnchorElement> & react0.AnchorHTMLAttributes<HTMLAnchorElement> & {
25
+ } & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
26
26
  href: string;
27
27
  }) | ({
28
28
  children?: React.ReactNode;
29
29
  value: string;
30
30
  isExternalLink?: boolean;
31
31
  isSelected?: boolean;
32
- } & react0.ClassAttributes<HTMLButtonElement> & react0.ButtonHTMLAttributes<HTMLButtonElement> & {
32
+ } & react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & {
33
33
  href?: never;
34
- })) => react_jsx_runtime5.JSX.Element;
34
+ })) => react_jsx_runtime0.JSX.Element;
35
35
  var MenuItemText: ({
36
36
  className,
37
37
  subtle,
38
38
  ...props
39
39
  }: ComponentProps<"span"> & {
40
40
  subtle?: boolean;
41
- }) => react_jsx_runtime5.JSX.Element;
41
+ }) => react_jsx_runtime0.JSX.Element;
42
42
  var PrimaryAction: ({
43
43
  className,
44
44
  ...props
45
- }: ComponentProps<"button">) => react_jsx_runtime5.JSX.Element;
45
+ }: ComponentProps<"button">) => react_jsx_runtime0.JSX.Element;
46
46
  var PrimaryActionText: ({
47
47
  children
48
48
  }: {
49
49
  children?: React.ReactNode;
50
- }) => react_jsx_runtime5.JSX.Element;
50
+ }) => react_jsx_runtime0.JSX.Element;
51
51
  var Trigger: ({
52
52
  className,
53
53
  ...props
54
- }: ComponentProps<"button">) => react_jsx_runtime5.JSX.Element;
54
+ }: ComponentProps<"button">) => react_jsx_runtime0.JSX.Element;
55
55
  var Icon: ({
56
56
  className,
57
57
  ...props
58
- }: ComponentProps<"div">) => react_jsx_runtime5.JSX.Element;
58
+ }: ComponentProps<"div">) => react_jsx_runtime0.JSX.Element;
59
59
  }
60
60
  //#endregion
61
61
  export { DropdownButton };
@@ -1,4 +1,4 @@
1
- import { t as Menu } from "../../DropdownMenu-Bj6SQIH-.js";
1
+ import { Menu } from "./DropdownMenu.js";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { ChevronsUpDown } from "lucide-react";
@@ -1,2 +1,54 @@
1
- import { t as Menu } from "../../DropdownMenu-BdFlK_CM.js";
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/components/dropdown/DropdownMenu.d.ts
5
+ declare function Menu({
6
+ className,
7
+ ...props
8
+ }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
9
+ declare namespace Menu {
10
+ var Item: typeof MenuItem;
11
+ var ItemText: typeof MenuItemText;
12
+ var ItemTemplate: typeof MenuItemTemplate;
13
+ }
14
+ declare function MenuItemText({
15
+ className,
16
+ subtle,
17
+ ...props
18
+ }: ComponentProps<'span'> & {
19
+ subtle?: boolean;
20
+ }): react_jsx_runtime0.JSX.Element;
21
+ type MenuItemBaseProps = {
22
+ children?: React.ReactNode;
23
+ value: string;
24
+ isExternalLink?: boolean;
25
+ isSelected?: boolean;
26
+ };
27
+ type MenuItemWithHref = MenuItemBaseProps & ComponentProps<'a'> & {
28
+ href: string;
29
+ };
30
+ type MenuItemWithoutHref = MenuItemBaseProps & ComponentProps<'button'> & {
31
+ href?: never;
32
+ };
33
+ type MenuItemProps = MenuItemWithHref | MenuItemWithoutHref;
34
+ declare function MenuItem({
35
+ children,
36
+ value,
37
+ href,
38
+ isExternalLink,
39
+ isSelected,
40
+ ...props
41
+ }: MenuItemProps): react_jsx_runtime0.JSX.Element;
42
+ /**
43
+ * A template component that defines the content to be displayed in the dropdown trigger
44
+ * when a menu item is selected. This template is used to customize the appearance of
45
+ * the selected item in the trigger button.
46
+ *
47
+ * @param props - Standard HTML template element props
48
+ * @returns A template element marked with the "selected-template" data part
49
+ */
50
+ declare function MenuItemTemplate({
51
+ ...props
52
+ }: ComponentProps<'template'>): react_jsx_runtime0.JSX.Element;
53
+ //#endregion
2
54
  export { Menu };
@@ -1,3 +1,78 @@
1
- import { t as Menu } from "../../DropdownMenu-Bj6SQIH-.js";
1
+ import clsx from "clsx";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { CheckIcon, ExternalLink } from "lucide-react";
2
4
 
5
+ //#region src/components/dropdown/DropdownMenu.tsx
6
+ function Menu({ className, ...props }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ ...props,
9
+ role: "menu",
10
+ "data-state": "closed",
11
+ "data-part": "menu",
12
+ className: clsx("stl-ui-dropdown-menu", className)
13
+ });
14
+ }
15
+ function MenuItemText({ className, subtle, ...props }) {
16
+ return /* @__PURE__ */ jsx("span", {
17
+ ...props,
18
+ "data-part": "item-text",
19
+ className: clsx(`stl-ui-dropdown-menu__item-text`, { "stl-ui-dropdown-menu__item-text--subtle": subtle }, className)
20
+ });
21
+ }
22
+ function MenuItem({ children, value, href, isExternalLink, isSelected, ...props }) {
23
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
24
+ /* @__PURE__ */ jsx("div", {
25
+ className: "stl-ui-dropdown-menu__item-content",
26
+ children
27
+ }),
28
+ isSelected && /* @__PURE__ */ jsx("div", {
29
+ className: "stl-ui-dropdown-menu__item-icon",
30
+ "data-part": "item-selected-icon",
31
+ children: /* @__PURE__ */ jsx(CheckIcon, { size: 16 })
32
+ }),
33
+ isExternalLink && /* @__PURE__ */ jsx("div", {
34
+ className: "stl-ui-dropdown-menu__item-subtle-icon",
35
+ "data-part": "item-external-link-icon",
36
+ children: /* @__PURE__ */ jsx(ExternalLink, { size: 16 })
37
+ })
38
+ ] });
39
+ if (href) return /* @__PURE__ */ jsx("a", {
40
+ role: "menuitem",
41
+ "data-part": "item",
42
+ "data-value": value,
43
+ "aria-selected": isSelected,
44
+ href,
45
+ ...props,
46
+ className: clsx("stl-ui-dropdown-menu__item", "stl-ui-dropdown-menu__item-link", props.className),
47
+ children: inner
48
+ });
49
+ return /* @__PURE__ */ jsx("button", {
50
+ ...props,
51
+ role: "menuitem",
52
+ "data-part": "item",
53
+ "data-value": value,
54
+ "aria-selected": isSelected,
55
+ className: clsx("stl-ui-dropdown-menu__item", props.className),
56
+ children: inner
57
+ });
58
+ }
59
+ /**
60
+ * A template component that defines the content to be displayed in the dropdown trigger
61
+ * when a menu item is selected. This template is used to customize the appearance of
62
+ * the selected item in the trigger button.
63
+ *
64
+ * @param props - Standard HTML template element props
65
+ * @returns A template element marked with the "selected-template" data part
66
+ */
67
+ function MenuItemTemplate({ ...props }) {
68
+ return /* @__PURE__ */ jsx("template", {
69
+ "data-part": "selected-template",
70
+ ...props
71
+ });
72
+ }
73
+ Menu.Item = MenuItem;
74
+ Menu.ItemText = MenuItemText;
75
+ Menu.ItemTemplate = MenuItemTemplate;
76
+
77
+ //#endregion
3
78
  export { Menu };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { Badge, BadgeIntent, HTTPMethod, getHttpMethod } from "./components/Badg
3
3
  import { Button, ButtonProps, ButtonVariant } from "./components/Button.js";
4
4
  import { Callout, CalloutProps, CalloutVariant } from "./components/Callout.js";
5
5
  import { Step, Steps } from "./components/Steps.js";
6
- import "./DropdownMenu-BdFlK_CM.js";
7
6
  import { Dropdown } from "./components/dropdown/Dropdown.js";
8
7
  import { DropdownButton } from "./components/dropdown/DropdownButton.js";
9
8
  export { Accordion, AccordionProps, Badge, BadgeIntent, Button, ButtonProps, ButtonVariant, Callout, CalloutProps, CalloutVariant, Dropdown, DropdownButton, HTTPMethod, Step, Steps, getHttpMethod };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Button } from "./components/Button.js";
2
- import "./DropdownMenu-Bj6SQIH-.js";
3
2
  import { Dropdown } from "./components/dropdown/Dropdown.js";
4
3
  import { DropdownButton } from "./components/dropdown/DropdownButton.js";
5
4
  import { Callout } from "./components/Callout.js";
@@ -119,7 +119,7 @@
119
119
 
120
120
  /* TODO: remove these */
121
121
  .stl-ui-prose starlight-tabs {
122
- a {
122
+ a[role='tab'] {
123
123
  text-decoration: none;
124
124
  line-height: unset;
125
125
  color: var(--stl-color-foreground);
@@ -130,17 +130,14 @@
130
130
  }
131
131
  }
132
132
 
133
- ol,
134
- ul {
135
- &:not(.stl-ui-not-prose *) {
136
- padding-left: 0;
137
- }
133
+ [role='tablist']:is(ol, ul) {
134
+ padding-left: 0;
138
135
  }
139
136
 
140
- li:not(.stl-ui-not-prose *) {
137
+ li.tab:not(.stl-ui-not-prose *) {
141
138
  margin-bottom: 0;
142
139
 
143
- a:first-child {
140
+ & > a:first-child {
144
141
  display: flex;
145
142
  }
146
143
  }
package/dist/styles.css CHANGED
@@ -41,12 +41,6 @@
41
41
  /* Prose exists in its own sub-layer for easy reverting */
42
42
  body {
43
43
  font-family: var(--stl-typography-font);
44
- font-feature-settings:
45
- 'ss01' on,
46
- 'ss03' on,
47
- 'ss04' on,
48
- 'ss06' on,
49
- 'ss08' on;
50
44
  }
51
45
 
52
46
  .stl-ui-prose {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/ui-primitives",
3
- "version": "0.1.0-beta.46",
3
+ "version": "0.1.0-beta.48",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,13 +17,13 @@
17
17
  "lucide-react": "^0.562.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/react": "19.2.7",
20
+ "@types/react": "19.2.10",
21
21
  "@types/react-dom": "^19.2.3",
22
- "react": "^19.2.3",
23
- "react-dom": "^19.2.3",
22
+ "react": "^19.2.4",
23
+ "react-dom": "^19.2.4",
24
24
  "rolldown": "1.0.0-rc.1",
25
25
  "sass": "^1.97.2",
26
- "tsdown": "^0.20.0",
26
+ "tsdown": "^0.20.3",
27
27
  "typescript": "5.9.3",
28
28
  "@stainless/eslint-config": "0.1.0-beta.1"
29
29
  },
@@ -1,54 +0,0 @@
1
- import { ComponentProps } from "react";
2
- import * as react_jsx_runtime26 from "react/jsx-runtime";
3
-
4
- //#region src/components/dropdown/DropdownMenu.d.ts
5
- declare function Menu({
6
- className,
7
- ...props
8
- }: ComponentProps<'div'>): react_jsx_runtime26.JSX.Element;
9
- declare namespace Menu {
10
- var Item: typeof MenuItem;
11
- var ItemText: typeof MenuItemText;
12
- var ItemTemplate: typeof MenuItemTemplate;
13
- }
14
- declare function MenuItemText({
15
- className,
16
- subtle,
17
- ...props
18
- }: ComponentProps<'span'> & {
19
- subtle?: boolean;
20
- }): react_jsx_runtime26.JSX.Element;
21
- type MenuItemBaseProps = {
22
- children?: React.ReactNode;
23
- value: string;
24
- isExternalLink?: boolean;
25
- isSelected?: boolean;
26
- };
27
- type MenuItemWithHref = MenuItemBaseProps & ComponentProps<'a'> & {
28
- href: string;
29
- };
30
- type MenuItemWithoutHref = MenuItemBaseProps & ComponentProps<'button'> & {
31
- href?: never;
32
- };
33
- type MenuItemProps = MenuItemWithHref | MenuItemWithoutHref;
34
- declare function MenuItem({
35
- children,
36
- value,
37
- href,
38
- isExternalLink,
39
- isSelected,
40
- ...props
41
- }: MenuItemProps): react_jsx_runtime26.JSX.Element;
42
- /**
43
- * A template component that defines the content to be displayed in the dropdown trigger
44
- * when a menu item is selected. This template is used to customize the appearance of
45
- * the selected item in the trigger button.
46
- *
47
- * @param props - Standard HTML template element props
48
- * @returns A template element marked with the "selected-template" data part
49
- */
50
- declare function MenuItemTemplate({
51
- ...props
52
- }: ComponentProps<'template'>): react_jsx_runtime26.JSX.Element;
53
- //#endregion
54
- export { Menu as t };
@@ -1,78 +0,0 @@
1
- import clsx from "clsx";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { CheckIcon, ExternalLink } from "lucide-react";
4
-
5
- //#region src/components/dropdown/DropdownMenu.tsx
6
- function Menu({ className, ...props }) {
7
- return /* @__PURE__ */ jsx("div", {
8
- ...props,
9
- role: "menu",
10
- "data-state": "closed",
11
- "data-part": "menu",
12
- className: clsx("stl-ui-dropdown-menu", className)
13
- });
14
- }
15
- function MenuItemText({ className, subtle, ...props }) {
16
- return /* @__PURE__ */ jsx("span", {
17
- ...props,
18
- "data-part": "item-text",
19
- className: clsx(`stl-ui-dropdown-menu__item-text`, { "stl-ui-dropdown-menu__item-text--subtle": subtle }, className)
20
- });
21
- }
22
- function MenuItem({ children, value, href, isExternalLink, isSelected, ...props }) {
23
- const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
24
- /* @__PURE__ */ jsx("div", {
25
- className: "stl-ui-dropdown-menu__item-content",
26
- children
27
- }),
28
- isSelected && /* @__PURE__ */ jsx("div", {
29
- className: "stl-ui-dropdown-menu__item-icon",
30
- "data-part": "item-selected-icon",
31
- children: /* @__PURE__ */ jsx(CheckIcon, { size: 16 })
32
- }),
33
- isExternalLink && /* @__PURE__ */ jsx("div", {
34
- className: "stl-ui-dropdown-menu__item-subtle-icon",
35
- "data-part": "item-external-link-icon",
36
- children: /* @__PURE__ */ jsx(ExternalLink, { size: 16 })
37
- })
38
- ] });
39
- if (href) return /* @__PURE__ */ jsx("a", {
40
- role: "menuitem",
41
- "data-part": "item",
42
- "data-value": value,
43
- "aria-selected": isSelected,
44
- href,
45
- ...props,
46
- className: clsx("stl-ui-dropdown-menu__item", "stl-ui-dropdown-menu__item-link", props.className),
47
- children: inner
48
- });
49
- return /* @__PURE__ */ jsx("button", {
50
- ...props,
51
- role: "menuitem",
52
- "data-part": "item",
53
- "data-value": value,
54
- "aria-selected": isSelected,
55
- className: clsx("stl-ui-dropdown-menu__item", props.className),
56
- children: inner
57
- });
58
- }
59
- /**
60
- * A template component that defines the content to be displayed in the dropdown trigger
61
- * when a menu item is selected. This template is used to customize the appearance of
62
- * the selected item in the trigger button.
63
- *
64
- * @param props - Standard HTML template element props
65
- * @returns A template element marked with the "selected-template" data part
66
- */
67
- function MenuItemTemplate({ ...props }) {
68
- return /* @__PURE__ */ jsx("template", {
69
- "data-part": "selected-template",
70
- ...props
71
- });
72
- }
73
- Menu.Item = MenuItem;
74
- Menu.ItemText = MenuItemText;
75
- Menu.ItemTemplate = MenuItemTemplate;
76
-
77
- //#endregion
78
- export { Menu as t };
@@ -1,54 +0,0 @@
1
- import { ComponentProps } from "react";
2
- import * as react_jsx_runtime23 from "react/jsx-runtime";
3
-
4
- //#region src/components/dropdown/DropdownMenu.d.ts
5
- declare function Menu({
6
- className,
7
- ...props
8
- }: ComponentProps<'div'>): react_jsx_runtime23.JSX.Element;
9
- declare namespace Menu {
10
- var Item: typeof MenuItem;
11
- var ItemText: typeof MenuItemText;
12
- var ItemTemplate: typeof MenuItemTemplate;
13
- }
14
- declare function MenuItemText({
15
- className,
16
- subtle,
17
- ...props
18
- }: ComponentProps<'span'> & {
19
- subtle?: boolean;
20
- }): react_jsx_runtime23.JSX.Element;
21
- type MenuItemBaseProps = {
22
- children?: React.ReactNode;
23
- value: string;
24
- isExternalLink?: boolean;
25
- isSelected?: boolean;
26
- };
27
- type MenuItemWithHref = MenuItemBaseProps & ComponentProps<'a'> & {
28
- href: string;
29
- };
30
- type MenuItemWithoutHref = MenuItemBaseProps & ComponentProps<'button'> & {
31
- href?: never;
32
- };
33
- type MenuItemProps = MenuItemWithHref | MenuItemWithoutHref;
34
- declare function MenuItem({
35
- children,
36
- value,
37
- href,
38
- isExternalLink,
39
- isSelected,
40
- ...props
41
- }: MenuItemProps): react_jsx_runtime23.JSX.Element;
42
- /**
43
- * A template component that defines the content to be displayed in the dropdown trigger
44
- * when a menu item is selected. This template is used to customize the appearance of
45
- * the selected item in the trigger button.
46
- *
47
- * @param props - Standard HTML template element props
48
- * @returns A template element marked with the "selected-template" data part
49
- */
50
- declare function MenuItemTemplate({
51
- ...props
52
- }: ComponentProps<'template'>): react_jsx_runtime23.JSX.Element;
53
- //#endregion
54
- export { Menu as t };