@stainless-api/ui-primitives 0.1.0-beta.49 → 0.1.0-beta.50

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.
@@ -0,0 +1,54 @@
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
54
+ export { Menu as t };
@@ -1,7 +1,6 @@
1
- import React from "react";
1
+ import "react";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
-
5
4
  //#region src/components/Accordion.tsx
6
5
  function Accordion({ className, children, ...props }) {
7
6
  return /* @__PURE__ */ jsx("details", {
@@ -26,6 +25,5 @@ function AccordionGroup({ className, children, ...props }) {
26
25
  });
27
26
  }
28
27
  Accordion.Group = AccordionGroup;
29
-
30
28
  //#endregion
31
- export { Accordion };
29
+ export { Accordion };
@@ -1,15 +1,14 @@
1
- import React from "react";
1
+ import "react";
2
2
  import clsx from "clsx";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { ArrowDownLeftIcon, ArrowUpRightIcon, XIcon } from "lucide-react";
5
-
6
5
  //#region src/components/Badge.tsx
7
6
  function BaseBadge({ children, icon = null, intent, size = "md", solid = false, ...props }) {
8
7
  const classes = clsx("stl-ui-badge", intent && `stl-ui-badge--intent-${intent}`, `stl-ui-badge--size-${size}`, solid && "stl-ui-badge--solid", "not-content", "stl-ui-not-prose", props.className);
9
8
  return /* @__PURE__ */ jsxs("span", {
10
9
  ...props,
11
10
  className: classes,
12
- children: [icon, children && /* @__PURE__ */ jsx("span", {
11
+ children: [icon, !!children && /* @__PURE__ */ jsx("span", {
13
12
  className: "stl-ui-badge__content",
14
13
  children
15
14
  })]
@@ -60,6 +59,5 @@ function HTTPBadge({ method, iconOnly = false, ...props }) {
60
59
  });
61
60
  }
62
61
  const Badge = Object.assign(PublicBadge, { HTTP: HTTPBadge });
63
-
64
62
  //#endregion
65
- export { Badge, getHttpMethod };
63
+ export { Badge, getHttpMethod };
@@ -1,10 +1,9 @@
1
- import React from "react";
1
+ import "react";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
-
5
4
  //#region src/components/Button.tsx
6
5
  function Button(props) {
7
- const { variant, children, border, loading, ...rest } = props;
6
+ const { variant, children, border, loading, size, className, ...rest } = props;
8
7
  const classes = clsx("stl-ui-button", {
9
8
  "stl-ui-button--outline": variant === "outline",
10
9
  "stl-ui-button--ghost": variant === "ghost",
@@ -14,9 +13,9 @@ function Button(props) {
14
13
  "stl-ui-button--success": variant === "success",
15
14
  "stl-ui-button--destructive": variant === "destructive"
16
15
  }, {
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);
16
+ "stl-ui-button--size-sm": size === "sm",
17
+ "stl-ui-button--size-lg": size === "lg"
18
+ }, { "stl-ui-button--with-border": variant === "outline" || border }, { "stl-ui-button--loading": !!loading }, "not-content", "stl-ui-not-prose", className);
20
19
  if (loading) {
21
20
  rest["aria-disabled"] = "true";
22
21
  rest["aria-label"] = loading.label;
@@ -47,6 +46,5 @@ Button.Icon = function ButtonIcon({ className, icon: Icon, size = 18, ...rest })
47
46
  children: /* @__PURE__ */ jsx(Icon, { size })
48
47
  });
49
48
  };
50
-
51
49
  //#endregion
52
- export { Button };
50
+ export { Button };
@@ -1,8 +1,7 @@
1
- import React from "react";
1
+ import "react";
2
2
  import clsx from "clsx";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Check, CircleAlert, Info, Lightbulb, OctagonAlert, TriangleAlert } from "lucide-react";
5
-
6
5
  //#region src/components/Callout.tsx
7
6
  function Callout({ variant = "info", className, children, ...props }) {
8
7
  const classes = clsx("stl-ui-callout", `stl-ui-callout--${variant}`, className);
@@ -23,6 +22,5 @@ function Callout({ variant = "info", className, children, ...props }) {
23
22
  })]
24
23
  });
25
24
  }
26
-
27
25
  //#endregion
28
- export { Callout };
26
+ export { Callout };
@@ -1,5 +1,4 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
-
3
2
  //#region src/components/Steps.tsx
4
3
  function Steps({ children }) {
5
4
  return /* @__PURE__ */ jsx("ol", {
@@ -19,6 +18,5 @@ function Step({ children, title }) {
19
18
  })]
20
19
  });
21
20
  }
22
-
23
21
  //#endregion
24
- export { Step, Steps };
22
+ export { Step, Steps };
@@ -1,4 +1,4 @@
1
- import { Menu } from "./DropdownMenu.js";
1
+ import { t as Menu } from "../../DropdownMenu-H_J8MxM7.js";
2
2
  import * as react from "react";
3
3
  import { ComponentProps } from "react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -1,7 +1,6 @@
1
1
  import { Menu } from "./DropdownMenu.js";
2
2
  import clsx from "clsx";
3
3
  import { jsx } from "react/jsx-runtime";
4
-
5
4
  //#region src/components/dropdown/Dropdown.tsx
6
5
  function Trigger({ className, ...props }) {
7
6
  return /* @__PURE__ */ jsx("button", {
@@ -49,6 +48,5 @@ Dropdown.Trigger = Trigger;
49
48
  Dropdown.TriggerSelectedItem = TriggerSelectedItem;
50
49
  Dropdown.TriggerIcon = TriggerIcon;
51
50
  Dropdown.Icon = Icon;
52
-
53
51
  //#endregion
54
- export { Dropdown };
52
+ export { Dropdown };
@@ -1,4 +1,4 @@
1
- import { Menu } from "./DropdownMenu.js";
1
+ import { t as Menu } from "../../DropdownMenu-H_J8MxM7.js";
2
2
  import * as react from "react";
3
3
  import { ComponentProps } from "react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -2,7 +2,6 @@ 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";
5
-
6
5
  //#region src/components/dropdown/DropdownButton.tsx
7
6
  function PrimaryActionText({ children }) {
8
7
  return /* @__PURE__ */ jsx("span", {
@@ -51,6 +50,5 @@ DropdownButton.PrimaryAction = PrimaryAction;
51
50
  DropdownButton.PrimaryActionText = PrimaryActionText;
52
51
  DropdownButton.Trigger = Trigger;
53
52
  DropdownButton.Icon = Icon;
54
-
55
53
  //#endregion
56
- export { DropdownButton };
54
+ export { DropdownButton };
@@ -1,54 +1,2 @@
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
1
+ import { t as Menu } from "../../DropdownMenu-H_J8MxM7.js";
54
2
  export { Menu };
@@ -1,7 +1,6 @@
1
1
  import clsx from "clsx";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CheckIcon, ExternalLink } from "lucide-react";
4
-
5
4
  //#region src/components/dropdown/DropdownMenu.tsx
6
5
  function Menu({ className, ...props }) {
7
6
  return /* @__PURE__ */ jsx("div", {
@@ -73,6 +72,5 @@ function MenuItemTemplate({ ...props }) {
73
72
  Menu.Item = MenuItem;
74
73
  Menu.ItemText = MenuItemText;
75
74
  Menu.ItemTemplate = MenuItemTemplate;
76
-
77
75
  //#endregion
78
- export { Menu };
76
+ export { Menu };
@@ -1,7 +1,9 @@
1
+ import * as react from "react";
2
+ import * as lucide_react0 from "lucide-react";
1
3
  import { IconNode } from "lucide-react";
2
4
 
3
5
  //#region src/components/icons/Function.d.ts
4
6
  declare const __iconNode: IconNode;
5
- declare const FunctionIcon: react.ForwardRefExoticComponent<any>;
7
+ declare const FunctionIcon: react.ForwardRefExoticComponent<Omit<lucide_react0.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
6
8
  //#endregion
7
9
  export { FunctionIcon, __iconNode };
@@ -1,8 +1,6 @@
1
1
  import { createLucideIcon } from "lucide-react";
2
-
3
2
  //#region src/components/icons/Function.tsx
4
3
  const __iconNode = [["path", { d: "m 7.5982756,10.85526 h 8.3632754 m -8.3632756,8.509999 c 2.9344826,0 4.1082756,-1.467241 4.1082756,-4.108276 V 9.0945701 c 0,-2.9344826 1.467243,-4.8418966 4.695174,-4.4017241" }]];
5
4
  const FunctionIcon = createLucideIcon("function", __iconNode);
6
-
7
5
  //#endregion
8
- export { FunctionIcon, __iconNode };
6
+ export { FunctionIcon, __iconNode };
@@ -1,3 +1,2 @@
1
1
  import { FunctionIcon } from "./Function.js";
2
-
3
- export { FunctionIcon };
2
+ export { FunctionIcon };
package/dist/index.js CHANGED
@@ -5,5 +5,4 @@ import { Callout } from "./components/Callout.js";
5
5
  import { Accordion } from "./components/Accordion.js";
6
6
  import { Step, Steps } from "./components/Steps.js";
7
7
  import { Badge, getHttpMethod } from "./components/Badge.js";
8
-
9
- export { Accordion, Badge, Button, Callout, Dropdown, DropdownButton, Step, Steps, getHttpMethod };
8
+ export { Accordion, Badge, Button, Callout, Dropdown, DropdownButton, Step, Steps, getHttpMethod };
@@ -132,7 +132,6 @@ function initDropdown({ root, onSelect, initialValue }) {
132
132
  });
133
133
  initialized.add(root);
134
134
  }
135
-
136
135
  //#endregion
137
136
  //#region src/scripts/dropdown-button.ts
138
137
  function initDropdownButton({ dropdown, onSelect, onPrimaryAction }) {
@@ -159,6 +158,5 @@ function initDropdownButton({ dropdown, onSelect, onPrimaryAction }) {
159
158
  onSelect
160
159
  });
161
160
  }
162
-
163
161
  //#endregion
164
- export { initDropdown, initDropdownButton };
162
+ export { initDropdown, initDropdownButton };
@@ -1,10 +1,7 @@
1
1
  :root {
2
- /* Layout and Typography */
3
2
  --sl-font: var(--stl-typography-font);
4
3
  --sl-font-mono: var(--stl-typography-font-mono);
5
4
  --sl-line-height: var(--stl-typography-line-height);
6
-
7
- /* Font sizes */
8
5
  --sl-text-h1: var(--stl-typography-text-h1);
9
6
  --sl-text-h2: var(--stl-typography-text-h2);
10
7
  --sl-text-h3: var(--stl-typography-text-h3);
@@ -15,15 +12,12 @@
15
12
  --sl-text-body-sm: var(--stl-typography-scale-sm);
16
13
  --sl-text-code: var(--stl-typography-scale-sm);
17
14
  --sl-text-code-sm: var(--stl-typography-scale-xs);
18
-
19
- /* Colors */
20
15
  --sl-color-bg: var(--stl-color-background);
21
16
  --sl-color-bg-sidebar: var(--stl-color-background);
22
17
  --sl-color-bg-ui: var(--stl-color-ui-background);
23
18
  --sl-color-bg-nav: var(--stl-color-background);
24
19
  --sl-color-bg-inline-code: var(--stl-color-muted-background);
25
20
  --sl-color-bg-accent: var(--stl-color-accent-inverse-background);
26
-
27
21
  --sl-color-text: var(--stl-color-foreground);
28
22
  --sl-color-text-secondary: var(--stl-color-foreground-reduced);
29
23
  --sl-color-text-tertiary: var(--stl-color-foreground-muted);
@@ -32,109 +26,98 @@
32
26
  --sl-color-hairline-light: var(--stl-color-border-faint);
33
27
  --sl-color-hairline-shade: var(--stl-color-border-strong);
34
28
  --sl-color-text-invert: var(--stl-color-inverse-foreground);
35
-
36
- /* Accent colors */
37
-
38
29
  --sl-color-accent-low: var(--stl-color-accent-muted-background);
39
30
  --sl-color-accent: var(--stl-color-accent);
40
31
  --sl-color-accent-high: var(--stl-color-accent);
41
-
42
- /* Primary colors */
43
32
  --sl-color-red-low: var(--stl-color-red-muted-background);
44
33
  --sl-color-red: var(--stl-color-red);
45
34
  --sl-color-red-high: var(--stl-color-red);
46
-
47
35
  --sl-color-green-low: var(--stl-color-green-muted-background);
48
36
  --sl-color-green: var(--stl-color-green);
49
37
  --sl-color-green-high: var(--stl-color-green);
50
-
51
38
  --sl-color-blue-low: var(--stl-color-blue-muted-background);
52
39
  --sl-color-blue: var(--stl-color-blue);
53
40
  --sl-color-blue-high: var(--stl-color-blue);
54
-
55
41
  --sl-color-orange-low: var(--stl-color-orange-muted-background);
56
42
  --sl-color-orange: var(--stl-color-orange);
57
43
  --sl-color-orange-high: var(--stl-color-orange);
58
-
59
44
  --sl-color-purple-low: var(--stl-color-purple-muted-background);
60
45
  --sl-color-purple: var(--stl-color-purple);
61
46
  --sl-color-purple-high: var(--stl-color-purple);
62
-
63
47
  --sl-color-teal-low: var(--stl-color-cyan-muted-background);
64
48
  --sl-color-teal: var(--stl-color-cyan);
65
49
  --sl-color-teal-high: var(--stl-color-cyan);
66
-
67
50
  --sl-color-magenta-low: var(--stl-color-pink-muted-background);
68
51
  --sl-color-magenta: var(--stl-color-pink);
69
52
  --sl-color-magenta-high: var(--stl-color-pink);
70
-
71
53
  --sl-color-yellow-low: var(--stl-color-yellow-muted-background);
72
54
  --sl-color-yellow: var(--stl-color-yellow);
73
55
  --sl-color-yellow-high: var(--stl-color-yellow);
74
56
  }
75
57
 
76
- /* Starlight Compatibility */
77
58
  .stl-ui-prose {
78
- /* TODO: Disable starlight headingLinks and replace with our own */
79
- /* Duplicate styles from h1–5 in typography; TODO: move to mixins after adopting preprocessor */
80
- .sl-heading-wrapper {
59
+ & .sl-heading-wrapper {
81
60
  line-height: var(--stl-typography-line-height-heading);
82
61
  font-family: var(--stl-typography-font-heading);
83
- --sl-anchor-icon-size: 0.8em;
84
- :is(h1, h2, h3, h4, h5) {
62
+ --sl-anchor-icon-size: .8em;
63
+
64
+ & :is(h1, h2, h3, h4, h5) {
85
65
  font-size: inherit;
86
66
  }
87
67
  }
88
- .sl-heading-wrapper.level-h1 {
68
+
69
+ & .sl-heading-wrapper.level-h1 {
89
70
  font-size: var(--stl-typography-text-h1);
90
- letter-spacing: -0.03em;
71
+ letter-spacing: -.03em;
91
72
  margin-top: 64px;
92
73
  }
93
- .sl-heading-wrapper.level-h2 {
74
+
75
+ & .sl-heading-wrapper.level-h2 {
94
76
  font-size: var(--stl-typography-text-h2);
95
- letter-spacing: -0.03em;
77
+ letter-spacing: -.03em;
96
78
  margin-top: 48px;
97
79
  }
98
80
 
99
- .sl-heading-wrapper.level-h3 {
81
+ & .sl-heading-wrapper.level-h3 {
100
82
  font-size: var(--stl-typography-text-h3);
101
- letter-spacing: -0.02em;
83
+ letter-spacing: -.02em;
102
84
  margin-top: 40px;
103
85
  }
104
- .sl-heading-wrapper.level-h4 {
86
+
87
+ & .sl-heading-wrapper.level-h4 {
105
88
  font-size: var(--stl-typography-text-h4);
106
- letter-spacing: -0.02em;
89
+ letter-spacing: -.02em;
107
90
  margin-top: 32px;
108
91
  }
109
- .sl-heading-wrapper.level-h5 {
92
+
93
+ & .sl-heading-wrapper.level-h5 {
110
94
  font-size: var(--stl-typography-text-h5);
111
- letter-spacing: -0.02em;
95
+ letter-spacing: -.02em;
112
96
  margin-top: 24px;
113
97
  }
114
- /* TODO: replace with an icon that matches Stainless branding */
115
- .sl-anchor-link svg {
98
+
99
+ & .sl-anchor-link svg {
116
100
  margin-top: 0;
117
101
  }
118
102
  }
119
103
 
120
- /* TODO: remove these */
121
104
  .stl-ui-prose starlight-tabs {
122
- a[role='tab'] {
123
- text-decoration: none;
105
+ & a[role="tab"] {
124
106
  line-height: unset;
125
107
  color: var(--stl-color-foreground);
108
+ text-decoration: none;
126
109
 
127
- &[aria-selected='true'] {
110
+ &[aria-selected="true"] {
128
111
  color: var(--stl-color-accent-foreground);
129
112
  font-weight: normal;
130
113
  }
131
114
  }
132
115
 
133
- [role='tablist']:is(ol, ul) {
116
+ & [role="tablist"]:is(ol, ul) {
134
117
  padding-left: 0;
135
118
  }
136
119
 
137
- li.tab:not(.stl-ui-not-prose *) {
120
+ & li.tab:not(.stl-ui-not-prose *) {
138
121
  margin-bottom: 0;
139
122
 
140
123
  & > a:first-child {
@@ -143,8 +126,6 @@
143
126
  }
144
127
  }
145
128
 
146
- /* Steps Compatibility */
147
129
  ol.sl-steps {
148
130
  padding-left: 0;
149
131
  }
150
-