@stainless-api/ui-primitives 0.1.0-beta.1 → 0.1.0-beta.11

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 (44) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +60 -0
  3. package/dist/components/Accordion.d.ts +10 -0
  4. package/dist/components/Accordion.js +19 -0
  5. package/dist/components/Accordion.js.map +1 -0
  6. package/dist/components/Button.d.ts +27 -0
  7. package/dist/components/Button.js +33 -0
  8. package/dist/components/Button.js.map +1 -0
  9. package/dist/components/Callout.d.ts +8 -0
  10. package/dist/components/Callout.js +16 -0
  11. package/dist/components/Callout.js.map +1 -0
  12. package/dist/components/DropdownButton.d.ts +21 -0
  13. package/dist/components/DropdownButton.js +37 -0
  14. package/dist/components/DropdownButton.js.map +1 -0
  15. package/dist/index.d.ts +4 -0
  16. package/dist/index.js +5 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/scripts/dropdown-button.d.ts +5 -0
  19. package/dist/scripts/dropdown-button.js +43 -0
  20. package/dist/scripts/dropdown-button.js.map +1 -0
  21. package/dist/scripts/index.d.ts +1 -0
  22. package/dist/scripts/index.js +2 -0
  23. package/dist/scripts/index.js.map +1 -0
  24. package/dist/tsconfig.tsbuildinfo +1 -0
  25. package/package.json +6 -6
  26. package/src/components/Accordion.tsx +41 -0
  27. package/src/components/Button.tsx +1 -0
  28. package/src/components/DropdownButton.tsx +66 -40
  29. package/src/components/accordion.css +145 -0
  30. package/src/components/button.css +165 -135
  31. package/src/components/callout.css +57 -59
  32. package/src/components/dropdown-button.css +33 -31
  33. package/src/index.ts +1 -1
  34. package/src/styles/layout.css +3 -1
  35. package/src/styles/scales.css +1 -1
  36. package/src/styles/starlight-compat.css +138 -107
  37. package/src/styles/swatches.css +2 -2
  38. package/src/styles/theme.css +2 -2
  39. package/src/styles/typography.css +109 -148
  40. package/src/styles.css +1 -1
  41. package/tsconfig.json +2 -6
  42. package/.env +0 -1
  43. package/src/components/DetailsGroup.tsx +0 -17
  44. package/src/components/details.css +0 -126
@@ -1,5 +1,5 @@
1
- @layer stl-ui {
2
- /* Typography - Stainless */
1
+ /* Typography - Stainless */
2
+ @layer stl-ui.tokens {
3
3
  :root {
4
4
  --stl-ui-typography-font: 'Geist', system-ui, sans-serif;
5
5
  --stl-ui-typography-font-mono: 'Geist Mono', ui-monospace, monospace;
@@ -30,170 +30,131 @@
30
30
  --stl-ui-type-scale-text-5xl: 42px;
31
31
  --stl-ui-type-scale-text-6xl: 64px;
32
32
  }
33
+ }
33
34
 
34
- /* Prose exists in its own sub-layer for easy reverting */
35
- @layer typography {
36
- body {
37
- font-family: var(--stl-ui-typography-font);
38
- font-feature-settings:
39
- 'ss01' on,
40
- 'ss03' on,
41
- 'ss04' on,
42
- 'ss06' on,
43
- 'ss08' on;
44
- }
45
-
46
- .stl-ui-prose {
47
- color: var(--stl-ui-foreground-secondary);
48
-
49
- /* Body/Regular */
50
- font-size: var(--stl-ui-typography-text-body);
51
- font-style: normal;
52
- font-weight: 400;
53
- line-height: var(--stl-ui-typography-line-height);
54
- letter-spacing: -0.01em;
55
-
56
- * {
57
- margin: 0;
58
- }
59
-
60
- p {
61
- margin-top: 16px;
62
- }
35
+ /* Prose exists in its own sub-layer for easy reverting */
36
+ body {
37
+ font-family: var(--stl-ui-typography-font);
38
+ font-feature-settings:
39
+ 'ss01' on,
40
+ 'ss03' on,
41
+ 'ss04' on,
42
+ 'ss06' on,
43
+ 'ss08' on;
44
+ }
63
45
 
64
- p,
65
- li {
66
- color: var(--stl-ui-foreground-secondary);
67
- }
46
+ .stl-ui-prose {
47
+ :where(p):not(.stl-ui-not-prose *) {
48
+ color: var(--stl-ui-foreground-secondary);
49
+ font-weight: 400;
50
+ line-height: var(--stl-ui-typography-line-height);
51
+ letter-spacing: -0.01em;
52
+ font-size: var(--stl-ui-typography-text-body);
53
+ margin-top: 16px;
54
+ }
68
55
 
69
- strong {
70
- color: var(--stl-ui-foreground);
71
- }
56
+ :where(p, li) {
57
+ &:not(.stl-ui-not-prose *) {
58
+ color: var(--stl-ui-foreground-secondary);
59
+ }
60
+ }
72
61
 
73
- aside {
74
- p,
75
- li {
76
- color: var(--stl-ui-foreground);
77
- }
78
- }
62
+ :where(strong):not(.stl-ui-not-prose *) {
63
+ color: var(--stl-ui-foreground);
64
+ }
79
65
 
80
- a {
81
- color: var(--stl-ui-foreground-accent);
82
-
83
- /* Body/Link */
84
- font-weight: 600;
85
- text-decoration-line: underline;
86
- text-decoration-style: solid;
87
- text-decoration-skip-ink: auto;
88
- text-decoration-thickness: auto;
89
- text-underline-offset: auto;
90
- text-underline-position: from-font;
91
- }
66
+ :where(aside):not(.stl-ui-not-prose *) {
67
+ color: var(--stl-ui-foreground);
68
+ }
92
69
 
93
- h1,
94
- h2,
95
- h3,
96
- h4,
97
- h5,
98
- h6 {
99
- color: var(--stl-ui-foreground);
100
- font-weight: 500;
101
- line-height: var(--stl-ui-typography-line-height-headings);
102
- }
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);
74
+ }
103
75
 
104
- h1 {
105
- /* Heading 1/Medium */
106
- font-size: var(--stl-ui-typography-text-h1);
107
- letter-spacing: -0.03em;
76
+ h1:not(.stl-ui-not-prose *) {
77
+ /* Heading 1/Medium */
78
+ font-size: var(--stl-ui-typography-text-h1);
79
+ letter-spacing: -0.03em;
108
80
 
109
- margin-top: 64px;
110
- }
81
+ margin-top: 64px;
82
+ }
111
83
 
112
- h2 {
113
- /* Heading 2/Medium */
114
- font-size: var(--stl-ui-typography-text-h2);
115
- letter-spacing: -0.03em;
116
- margin-top: 48px;
117
- }
84
+ h2:not(.stl-ui-not-prose *) {
85
+ /* Heading 2/Medium */
86
+ font-size: var(--stl-ui-typography-text-h2);
87
+ letter-spacing: -0.03em;
118
88
 
119
- h3 {
120
- /* Heading 3/Medium */
121
- font-size: var(--stl-ui-typography-text-h3);
122
- letter-spacing: -0.02em;
123
- margin-top: 40px;
124
- }
89
+ margin-top: 48px;
90
+ }
125
91
 
126
- h4 {
127
- /* Heading 4/Medium */
128
- font-size: var(--stl-ui-typography-text-h4);
129
- letter-spacing: -0.02em;
130
- margin-top: 32px;
131
- }
92
+ h3:not(.stl-ui-not-prose *) {
93
+ /* Heading 3/Medium */
94
+ font-size: var(--stl-ui-typography-text-h3);
95
+ letter-spacing: -0.02em;
96
+ margin-top: 40px;
97
+ }
132
98
 
133
- h5 {
134
- /* Heading 5/Medium */
135
- font-size: var(--stl-ui-typography-text-h5);
136
- letter-spacing: -0.02em;
137
- margin-top: 24px;
138
- }
99
+ h4:not(.stl-ui-not-prose *) {
100
+ /* Heading 4/Medium */
101
+ font-size: var(--stl-ui-typography-text-h4);
102
+ letter-spacing: -0.02em;
103
+ margin-top: 32px;
104
+ }
139
105
 
140
- li {
141
- &:not(:last-child) {
142
- margin-bottom: 8px;
143
- }
144
-
145
- h1,
146
- h2,
147
- h3,
148
- h4,
149
- h5,
150
- p,
151
- a {
152
- &:first-child {
153
- display: inline;
154
- }
155
- }
156
- }
106
+ h5:not(.stl-ui-not-prose *) {
107
+ /* Heading 5/Medium */
108
+ font-size: var(--stl-ui-typography-text-h5);
109
+ letter-spacing: -0.02em;
110
+ margin-top: 24px;
111
+ }
157
112
 
158
- ol,
159
- ul {
160
- padding-left: 26px;
161
- }
113
+ li:not(.stl-ui-not-prose *) {
114
+ &:not(:last-child) {
115
+ margin-bottom: 8px;
116
+ }
162
117
 
163
- ol,
164
- ul,
165
- aside,
166
- img,
167
- svg,
168
- figure,
169
- details {
170
- margin-top: 16px;
118
+ h1,
119
+ h2,
120
+ h3,
121
+ h4,
122
+ h5,
123
+ p,
124
+ a {
125
+ &:first-child {
126
+ display: inline;
171
127
  }
128
+ }
129
+ }
172
130
 
173
- :not(pre) > code {
174
- color: var(--stl-ui-foreground);
175
- font-feature-settings:
176
- 'ss01' on,
177
- 'ss03' on,
178
- 'ss04' on,
179
- 'ss06' on;
180
-
181
- /* Code/Regular */
182
- font-family: var(--stl-ui-typography-font-mono);
183
- font-size: var(--stl-ui-typography-text-body-sm);
184
- font-style: normal;
185
- font-weight: 400;
186
- line-height: 150%; /* 21px */
187
-
188
- padding: 0 4px;
189
- background-color: oklch(from var(--stl-ui-foreground) l c h / 0.1);
190
- border-radius: var(--stl-ui-layout-border-radius-xs);
191
- }
131
+ :where(ol, ul) {
132
+ &:not(.stl-ui-not-prose *) {
133
+ padding-left: 26px;
134
+ }
135
+ }
192
136
 
193
- /* Escape hatch for non-prose content */
194
- .stl-ui-not-prose * {
195
- all: revert-layer;
196
- }
137
+ :where(ol, ul, aside, img, figure, details) {
138
+ &:not(.stl-ui-not-prose *) {
139
+ margin-top: 16px;
197
140
  }
198
141
  }
142
+
143
+ :where(:not(pre) > code):not(.stl-ui-not-prose *) {
144
+ color: var(--stl-ui-foreground);
145
+ font-feature-settings:
146
+ 'ss01' on,
147
+ 'ss03' on,
148
+ 'ss04' on,
149
+ 'ss06' on;
150
+
151
+ /* Code/Regular */
152
+ font-family: var(--stl-ui-typography-font-mono);
153
+ font-size: 0.9em;
154
+ font-weight: inherit;
155
+
156
+ padding: 0 0.2em;
157
+ background-color: oklch(from var(--stl-ui-foreground) l c h / 0.1);
158
+ border-radius: 0.2em;
159
+ }
199
160
  }
package/src/styles.css CHANGED
@@ -8,4 +8,4 @@
8
8
  @import './components/button.css';
9
9
  @import './components/dropdown-button.css';
10
10
  @import './components/callout.css';
11
- @import './components/details.css';
11
+ @import './components/accordion.css';
package/tsconfig.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
+ "extends": "../../tsconfig.base.json",
2
3
  "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
4
+ "noEmit": false,
5
5
  "declaration": true,
6
6
  "declarationDir": "dist",
7
7
  "outDir": "dist",
8
8
  "jsx": "react-jsx",
9
- "esModuleInterop": true,
10
- "moduleResolution": "Node",
11
- "skipLibCheck": true,
12
- "strict": true
13
9
  },
14
10
  "include": ["src"]
15
11
  }
package/.env DELETED
@@ -1 +0,0 @@
1
- STAINLESS_API_KEY=stl_sk_001uwmod48VpDm2a1bvB1tUTdJ1ooZ5I
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
-
4
- export type DetailsGroupProps = React.ComponentProps<'div'>;
5
-
6
- export function DetailsGroup({ className, children, ...props }: DetailsGroupProps) {
7
- const classes = clsx('stl-ui-details-group', className);
8
-
9
- // TODO: boolean `exclusive` prop assigns a unique `name` to each of the child <details> elements
10
- // For now this can be handled by the user
11
-
12
- return (
13
- <div className={classes} {...props}>
14
- {children}
15
- </div>
16
- );
17
- }
@@ -1,126 +0,0 @@
1
- /* revert starlight details styles */
2
- @layer starlight.content {
3
- /* artificially increase specificity to outcompete selectors in the same layer whose styles we want to revert */
4
- .stl-ui-prose .sl-markdown-content.sl-markdown-content.sl-markdown-content {
5
- details,
6
- summary,
7
- summary::before,
8
- summary::marker {
9
- all: revert-layer;
10
- }
11
- }
12
- }
13
-
14
- @layer stl-ui {
15
- @layer typography {
16
- .stl-ui-prose {
17
- details {
18
- --stl-ui-details-padding: 12px;
19
- --stl-ui-details-content-padding-bottom: 4px;
20
- --stl-ui-details-marker-size: 1em;
21
- --stl-ui-details-marker-margin: calc((1lh - var(--stl-ui-details-marker-size)) / 2);
22
- --stl-ui-details-row-gap: 8px;
23
- --stl-ui-details-summary-column-gap: 8px;
24
- --stl-ui-details-border-radius: var(--stl-ui-layout-border-radius);
25
- /* left inset to make content line up with summary content (after chevron) */
26
- --stl-ui--internal--details-padding-start: calc(
27
- var(--stl-ui-details-padding)
28
- + var(--stl-ui-details-marker-size)
29
- + var(--stl-ui-details-marker-margin) * 2
30
- + var(--stl-ui-details-summary-column-gap)
31
- );
32
-
33
- background-color: var(--stl-ui-card-background);
34
- border: 1px solid var(--stl-ui-border);
35
- border-radius: var(--stl-ui-details-border-radius);
36
- font-size: var(--stl-ui-typography-text-body);
37
-
38
- padding: var(--stl-ui-details-padding);
39
- /* indent content to line up with left edge of summary content */
40
- padding-inline-start: var(--stl-ui--internal--details-padding-start);
41
-
42
- summary {
43
- display: block;
44
- list-style: none;
45
-
46
- /* summary extends to the edges of the element in order to increase click target */
47
- padding: var(--stl-ui-details-padding);
48
- padding-inline-start: var(--stl-ui--internal--details-padding-start);
49
- margin: calc(-1 * var(--stl-ui-details-padding));
50
- margin-inline-start: calc(-1 * var(--stl-ui--internal--details-padding-start));
51
-
52
- cursor: pointer;
53
- font-weight: 500;
54
-
55
- border-radius: var(--stl-ui-details-border-radius);
56
-
57
- &::before {
58
- content: '';
59
- width: var(--stl-ui-details-marker-size);
60
- height: var(--stl-ui-details-marker-size);
61
- margin: var(--stl-ui-details-marker-margin);
62
- background-color: currentColor;
63
- display: block;
64
- position: absolute;
65
- --stl-ui-details--internal--marker-width: calc(var(--stl-ui-details-marker-size) + var(--stl-ui-details-marker-margin) * 2);
66
- --stl-ui-details--internal--summary-marker-transform: translateX(calc(-1 * var(--stl-ui-details--internal--marker-width) - var(--stl-ui-details-summary-column-gap)));
67
- transform: var(--stl-ui-details--internal--summary-marker-transform);
68
-
69
- --lucide-chevron-right: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQtaWNvbiBsdWNpZGUtY2hldnJvbi1yaWdodCI+PHBhdGggZD0ibTkgMTggNi02LTYtNiIvPjwvc3ZnPg==');
70
- mask-image: var(--lucide-chevron-right);
71
- mask-size: contain;
72
- mask-repeat: no-repeat;
73
-
74
- transition: transform 0.1s ease-out;
75
- }
76
-
77
- & > :first-child {
78
- margin-top: 0;
79
- }
80
- }
81
-
82
- &[open] {
83
- padding-bottom: calc(var(--stl-ui-details-padding) + var(--stl-ui-details-content-padding-bottom));
84
-
85
- summary {
86
- /* padding-bottom shouldn’t extend beyond the row gap while open, i.e. we shouldn’t be negative-margin-placing content overlapping summary */
87
- --stl-ui--internal--summary-padding-bottom: min(var(--stl-ui-details-padding), var(--stl-ui-details-row-gap));
88
- padding-bottom: var(--stl-ui--internal--summary-padding-bottom);
89
- margin-bottom: calc(var(--stl-ui-details-row-gap) - var(--stl-ui--internal--summary-padding-bottom));
90
- border-bottom-left-radius: 0;
91
- border-bottom-right-radius: 0;
92
-
93
- &::before {
94
- transform: var(--stl-ui-details--internal--summary-marker-transform) rotate(90deg);
95
- }
96
- }
97
- }
98
-
99
- summary + * {
100
- margin-top: 0;
101
- }
102
- }
103
- }
104
-
105
- .stl-ui-details-group {
106
- & > details:has(+ details) {
107
- border-bottom-left-radius: 0;
108
- border-bottom-right-radius: 0;
109
- summary {
110
- border-bottom-left-radius: 0;
111
- border-bottom-right-radius: 0;
112
- }
113
- }
114
- & > details + details {
115
- margin-top: 0;
116
- border-top: 0;
117
- border-top-left-radius: 0;
118
- border-top-right-radius: 0;
119
- summary {
120
- border-top-left-radius: 0;
121
- border-top-right-radius: 0;
122
- }
123
- }
124
- }
125
- }
126
- }