@stainless-api/ui-primitives 0.1.0-beta.10 → 0.1.0-beta.12

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/styles.js ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/ui-primitives",
3
- "version": "0.1.0-beta.10",
3
+ "version": "0.1.0-beta.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,11 +27,11 @@
27
27
  "lucide-react": "^0.544.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/react": "^19.1.13",
31
- "@types/react-dom": "^19.1.9",
32
- "react": "^19.1.1",
33
- "react-dom": "^19.1.1",
34
- "typescript": "5.9.2",
30
+ "@types/react": "^19.2.2",
31
+ "@types/react-dom": "^19.2.2",
32
+ "react": "^19.2.0",
33
+ "react-dom": "^19.2.0",
34
+ "typescript": "5.9.3",
35
35
  "@stainless/eslint-config": "0.0.0"
36
36
  }
37
37
  }
@@ -1,69 +1,73 @@
1
1
  import clsx from 'clsx';
2
2
  import { ChevronsUpDown, ExternalLink } from 'lucide-react';
3
+ import type { ComponentPropsWithoutRef } from 'react';
3
4
 
4
5
  function PrimaryActionText({ children }: { children?: React.ReactNode }) {
5
6
  return <span data-part="primary-action-text">{children}</span>;
6
7
  }
7
8
 
8
- function PrimaryAction({ children }: { children?: React.ReactNode }) {
9
+ function PrimaryAction({ className, ...props }: ComponentPropsWithoutRef<'button'>) {
9
10
  return (
10
11
  <button
11
- type="button"
12
12
  data-part="primary-action"
13
- className="stl-ui-dropdown-button__button stl-ui-dropdown-button--action"
14
- >
15
- {children}
16
- </button>
13
+ {...props}
14
+ className={clsx('stl-ui-dropdown-button__button stl-ui-dropdown-button--action', className)}
15
+ />
17
16
  );
18
17
  }
19
18
 
20
- function Trigger() {
19
+ function Trigger({ className, ...props }: ComponentPropsWithoutRef<'button'>) {
21
20
  return (
22
21
  <button
23
- className="stl-ui-dropdown-button__button stl-ui-dropdown-button__trigger"
24
22
  aria-haspopup="listbox"
25
23
  aria-expanded="false"
26
24
  data-part="trigger"
25
+ {...props}
26
+ className={clsx('stl-ui-dropdown-button__button stl-ui-dropdown-button__trigger', className)}
27
27
  >
28
28
  <ChevronsUpDown size={16} />
29
29
  </button>
30
30
  );
31
31
  }
32
32
 
33
- function Menu({ children }: { children?: React.ReactNode }) {
33
+ function Menu({ className, ...props }: ComponentPropsWithoutRef<'div'>) {
34
34
  return (
35
- <div className="stl-ui-dropdown-button__menu" data-state="closed" data-part="menu">
36
- {children}
37
- </div>
35
+ <div
36
+ data-state="closed"
37
+ data-part="menu"
38
+ {...props}
39
+ className={clsx('stl-ui-dropdown-button__menu', className)}
40
+ />
38
41
  );
39
42
  }
40
43
 
41
- function MenuItemIcon({ children }: { children?: React.ReactNode }) {
44
+ function MenuItemIcon({ className, ...props }: ComponentPropsWithoutRef<'div'>) {
42
45
  return (
43
- <div className="stl-ui-dropdown-button__menu-item-icon" data-part="item-icon">
44
- {children}
45
- </div>
46
+ <div
47
+ data-part="item-icon"
48
+ {...props}
49
+ className={clsx('stl-ui-dropdown-button__menu-item-icon', className)}
50
+ />
46
51
  );
47
52
  }
48
53
 
49
- function MenuItemText({ children, subtle }: { children?: React.ReactNode; subtle?: boolean }) {
54
+ function MenuItemText({
55
+ className,
56
+ subtle,
57
+ ...props
58
+ }: ComponentPropsWithoutRef<'span'> & { subtle?: boolean }) {
50
59
  return (
51
60
  <span
52
- className={clsx(`stl-ui-dropdown-button__menu-item-text`, {
53
- 'stl-ui-dropdown-button__menu-item-text--subtle': subtle,
54
- })}
55
61
  data-part="item-text"
56
- >
57
- {children}
58
- </span>
59
- );
60
- }
61
-
62
- function MenuItemTextSubtle({ children }: { children?: React.ReactNode }) {
63
- return (
64
- <span className="stl-ui-dropdown-button__menu-item-text-subtle" data-part="item-text-subtle">
65
- {children}
66
- </span>
62
+ className={clsx(
63
+ `stl-ui-dropdown-button__menu-item-text`,
64
+ {
65
+ 'stl-ui-dropdown-button__menu-item-text--subtle': subtle,
66
+ },
67
+ className,
68
+ )}
69
+ {...props}
70
+ />
67
71
  );
68
72
  }
69
73
 
@@ -71,13 +75,19 @@ function MenuItem({
71
75
  children,
72
76
  value,
73
77
  isExternalLink,
74
- }: {
78
+ ...props
79
+ }: ComponentPropsWithoutRef<'div'> & {
75
80
  children?: React.ReactNode;
76
81
  value: string;
77
82
  isExternalLink?: boolean;
78
83
  }) {
79
84
  return (
80
- <div className="stl-ui-dropdown-button__menu-item" data-part="item" data-value={value}>
85
+ <div
86
+ data-part="item"
87
+ data-value={value}
88
+ {...props}
89
+ className={clsx('stl-ui-dropdown-button__menu-item', props.className)}
90
+ >
81
91
  <div className="stl-ui-dropdown-button__menu-item-content">{children}</div>
82
92
  {isExternalLink && (
83
93
  <div
@@ -91,11 +101,17 @@ function MenuItem({
91
101
  );
92
102
  }
93
103
 
94
- export function DropdownButton({ id, children }: { id: string; children?: React.ReactNode }) {
104
+ export function DropdownButton({
105
+ id,
106
+ className,
107
+ ...props
108
+ }: ComponentPropsWithoutRef<'div'> & { id: string }) {
95
109
  return (
96
- <div className="stl-ui-dropdown-button stl-ui-not-prose not-content" id={id}>
97
- {children}
98
- </div>
110
+ <div
111
+ id={id}
112
+ {...props}
113
+ className={clsx('stl-ui-dropdown-button stl-ui-not-prose not-content', className)}
114
+ />
99
115
  );
100
116
  }
101
117
 
@@ -103,7 +119,6 @@ DropdownButton.Menu = Menu;
103
119
  DropdownButton.MenuItem = MenuItem;
104
120
  DropdownButton.MenuItemIcon = MenuItemIcon;
105
121
  DropdownButton.MenuItemText = MenuItemText;
106
- DropdownButton.MenuItemTextSubtle = MenuItemTextSubtle;
107
122
  DropdownButton.PrimaryAction = PrimaryAction;
108
123
  DropdownButton.PrimaryActionText = PrimaryActionText;
109
124
  DropdownButton.Trigger = Trigger;
@@ -35,7 +35,7 @@
35
35
  /* indent content to line up with left edge of summary content */
36
36
  padding-inline-start: var(--stl-ui--internal--accordion-padding-start);
37
37
 
38
- .stl-ui-accordion__summary {
38
+ & > .stl-ui-accordion__summary {
39
39
  display: block;
40
40
  list-style: none;
41
41
 
@@ -85,7 +85,7 @@
85
85
  border-color: var(--stl-ui-border-emphasis);
86
86
  padding-bottom: calc(var(--stl-ui-accordion-padding) + var(--stl-ui-accordion-content-padding-bottom));
87
87
 
88
- .stl-ui-accordion__summary {
88
+ & > .stl-ui-accordion__summary {
89
89
  /* padding-bottom shouldn’t extend beyond the row gap while open, i.e. we shouldn’t be negative-margin-placing content overlapping summary */
90
90
  --stl-ui--internal--summary-padding-bottom: min(
91
91
  var(--stl-ui-accordion-padding),
@@ -102,7 +102,7 @@
102
102
  }
103
103
  }
104
104
 
105
- &:has(.stl-ui-accordion__summary:hover) {
105
+ &:has(> .stl-ui-accordion__summary:hover) {
106
106
  background-image: linear-gradient(
107
107
  to bottom,
108
108
  var(--stl-ui-accordion-hover-film-color),
@@ -111,7 +111,7 @@
111
111
  border-color: var(--stl-ui-border-emphasis);
112
112
  }
113
113
 
114
- .stl-ui-accordion__summary + * {
114
+ & > .stl-ui-accordion__summary + * {
115
115
  margin-top: 0;
116
116
  }
117
117
  }
@@ -120,7 +120,7 @@
120
120
  & > .stl-ui-accordion:has(+ .stl-ui-accordion) {
121
121
  border-bottom-left-radius: 0;
122
122
  border-bottom-right-radius: 0;
123
- .stl-ui-accordion__summary {
123
+ & > .stl-ui-accordion__summary {
124
124
  border-bottom-left-radius: 0;
125
125
  border-bottom-right-radius: 0;
126
126
  }
@@ -132,7 +132,7 @@
132
132
  border-top-left-radius: 0;
133
133
  border-top-right-radius: 0;
134
134
 
135
- .stl-ui-accordion__summary {
135
+ & > .stl-ui-accordion__summary {
136
136
  border-top-left-radius: 0;
137
137
  border-top-right-radius: 0;
138
138
  }
@@ -7,5 +7,7 @@
7
7
  --stl-ui-layout-border-radius-med: 16px;
8
8
  --stl-ui-layout-border-radius-max: 9999px;
9
9
  --stl-ui-left-content-indent: 24px;
10
+
11
+ --stl-ui-page-padding-inline: 20px;
10
12
  }
11
13
  }
@@ -64,10 +64,6 @@
64
64
 
65
65
  /* Starlight Compatibility */
66
66
  .stl-ui-prose {
67
- :is(h1, h2, h3, h4, h5) code {
68
- font-size: 0.9em;
69
- font-weight: inherit;
70
- }
71
67
  /* TODO: Disable starlight headingLinks and replace with our own */
72
68
  /* Duplicate styles from h1–5 in typography; TODO: move to mixins after adopting preprocessor */
73
69
  .sl-heading-wrapper.level-h1 {
@@ -67,20 +67,10 @@ body {
67
67
  color: var(--stl-ui-foreground);
68
68
  }
69
69
 
70
- h1,
71
- h2,
72
- h3,
73
- h4,
74
- h5,
75
- h6 {
76
- &:not(.stl-ui-not-prose *) {
77
- &,
78
- * {
79
- color: var(--stl-ui-foreground);
80
- font-weight: 500;
81
- line-height: var(--stl-ui-typography-line-height-headings);
82
- }
83
- }
70
+ :is(h1, h2, h3, h4, h5, h6):not(.stl-ui-not-prose *) {
71
+ color: var(--stl-ui-foreground);
72
+ font-weight: 500;
73
+ line-height: var(--stl-ui-typography-line-height-headings);
84
74
  }
85
75
 
86
76
  h1:not(.stl-ui-not-prose *) {
@@ -160,13 +150,11 @@ body {
160
150
 
161
151
  /* Code/Regular */
162
152
  font-family: var(--stl-ui-typography-font-mono);
163
- font-size: var(--stl-ui-typography-text-body-sm);
164
- font-style: normal;
165
- font-weight: 400;
166
- line-height: 150%; /* 21px */
153
+ font-size: 0.9em;
154
+ font-weight: inherit;
167
155
 
168
- padding: 0 4px;
156
+ padding: 0 0.2em;
169
157
  background-color: oklch(from var(--stl-ui-foreground) l c h / 0.1);
170
- border-radius: var(--stl-ui-layout-border-radius-xs);
158
+ border-radius: 0.2em;
171
159
  }
172
160
  }
package/.env DELETED
@@ -1 +0,0 @@
1
- STAINLESS_API_KEY=stl_sk_001uwmod48VpDm2a1bvB1tUTdJ1ooZ5I