@stainless-api/ui-primitives 0.1.0-beta.28 → 0.1.0-beta.29
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/{Accordion-Cj5GURin.d.ts → Accordion-CvvTR8p8.d.ts} +4 -4
- package/dist/{Button-CxQtPObH.d.ts → Button-DMtVJEuK.d.ts} +4 -4
- package/dist/{Callout-DlwbfFHm.d.ts → Callout-Desqa2PM.d.ts} +2 -2
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Callout.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -8
- package/dist/scripts/index.js +5 -5
- package/dist/styles.css +19 -12
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Accordion.d.ts
|
|
5
5
|
type AccordionProps = React.ComponentProps<'details'>;
|
|
@@ -7,7 +7,7 @@ declare function Accordion({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...props
|
|
10
|
-
}: AccordionProps):
|
|
10
|
+
}: AccordionProps): react_jsx_runtime3.JSX.Element;
|
|
11
11
|
declare namespace Accordion {
|
|
12
12
|
var Summary: typeof AccordionSummary;
|
|
13
13
|
var Group: typeof AccordionGroup;
|
|
@@ -16,11 +16,11 @@ declare function AccordionSummary({
|
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
18
18
|
...props
|
|
19
|
-
}: React.ComponentProps<'summary'>):
|
|
19
|
+
}: React.ComponentProps<'summary'>): react_jsx_runtime3.JSX.Element;
|
|
20
20
|
declare function AccordionGroup({
|
|
21
21
|
className,
|
|
22
22
|
children,
|
|
23
23
|
...props
|
|
24
|
-
}: React.ComponentProps<'div'>):
|
|
24
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime3.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { AccordionProps as n, Accordion as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
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
|
|
@@ -17,17 +17,17 @@ type ButtonBranch = BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
17
17
|
href?: never;
|
|
18
18
|
};
|
|
19
19
|
type ButtonProps = AnchorBranch | ButtonBranch;
|
|
20
|
-
declare function Button(props: ButtonProps):
|
|
20
|
+
declare function Button(props: ButtonProps): react_jsx_runtime0.JSX.Element;
|
|
21
21
|
declare namespace Button {
|
|
22
22
|
var Label: ({
|
|
23
23
|
className,
|
|
24
24
|
...rest
|
|
25
|
-
}: LabelProps) =>
|
|
25
|
+
}: LabelProps) => react_jsx_runtime0.JSX.Element;
|
|
26
26
|
var Icon: ({
|
|
27
27
|
className,
|
|
28
28
|
icon: Icon,
|
|
29
29
|
size
|
|
30
|
-
}: IconProps) =>
|
|
30
|
+
}: IconProps) => react_jsx_runtime0.JSX.Element;
|
|
31
31
|
}
|
|
32
32
|
type LabelProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
33
33
|
type IconProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
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):
|
|
16
|
+
}: CalloutProps): react_jsx_runtime0.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { CalloutProps as n, CalloutVariant as r, Callout as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AccordionProps, t as Accordion } from "../Accordion-
|
|
1
|
+
import { n as AccordionProps, t as Accordion } from "../Accordion-CvvTR8p8.js";
|
|
2
2
|
export { Accordion, AccordionProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ButtonProps, r as ButtonVariant, t as Button } from "../Button-
|
|
1
|
+
import { n as ButtonProps, r as ButtonVariant, t as Button } from "../Button-DMtVJEuK.js";
|
|
2
2
|
export { Button, ButtonProps, ButtonVariant };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "../Callout-
|
|
1
|
+
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "../Callout-Desqa2PM.js";
|
|
2
2
|
export { Callout, CalloutProps, CalloutVariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as AccordionProps, t as Accordion } from "./Accordion-
|
|
2
|
-
import { n as ButtonProps, r as ButtonVariant, t as Button } from "./Button-
|
|
3
|
-
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "./Callout-
|
|
1
|
+
import { n as AccordionProps, t as Accordion } from "./Accordion-CvvTR8p8.js";
|
|
2
|
+
import { n as ButtonProps, r as ButtonVariant, t as Button } from "./Button-DMtVJEuK.js";
|
|
3
|
+
import { n as CalloutProps, r as CalloutVariant, t as Callout } from "./Callout-Desqa2PM.js";
|
|
4
4
|
import * as react3 from "react";
|
|
5
5
|
import { ComponentProps } from "react";
|
|
6
6
|
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { CheckIcon, ChevronsUpDown, ExternalLink } from "lucide-react";
|
|
|
9
9
|
function Menu({ className, ...props }) {
|
|
10
10
|
return /* @__PURE__ */ jsx("div", {
|
|
11
11
|
...props,
|
|
12
|
-
role: "
|
|
12
|
+
role: "menu",
|
|
13
13
|
"data-state": "closed",
|
|
14
14
|
"data-part": "menu",
|
|
15
15
|
className: clsx("stl-ui-dropdown-menu", className)
|
|
@@ -40,7 +40,7 @@ function MenuItem({ children, value, href, isExternalLink, isSelected, ...props
|
|
|
40
40
|
})
|
|
41
41
|
] });
|
|
42
42
|
if (href) return /* @__PURE__ */ jsx("a", {
|
|
43
|
-
role: "
|
|
43
|
+
role: "menuitem",
|
|
44
44
|
"data-part": "item",
|
|
45
45
|
"data-value": value,
|
|
46
46
|
"aria-selected": isSelected,
|
|
@@ -51,7 +51,7 @@ function MenuItem({ children, value, href, isExternalLink, isSelected, ...props
|
|
|
51
51
|
});
|
|
52
52
|
return /* @__PURE__ */ jsx("button", {
|
|
53
53
|
...props,
|
|
54
|
-
role: "
|
|
54
|
+
role: "menuitem",
|
|
55
55
|
"data-part": "item",
|
|
56
56
|
"data-value": value,
|
|
57
57
|
"aria-selected": isSelected,
|
|
@@ -81,6 +81,9 @@ Menu.ItemTemplate = MenuItemTemplate;
|
|
|
81
81
|
//#region src/components/dropdown/Dropdown.tsx
|
|
82
82
|
function Trigger$1({ className, ...props }) {
|
|
83
83
|
return /* @__PURE__ */ jsx("button", {
|
|
84
|
+
"aria-label": "Select an option",
|
|
85
|
+
"aria-haspopup": "menu",
|
|
86
|
+
"aria-expanded": "false",
|
|
84
87
|
...props,
|
|
85
88
|
"data-part": "trigger",
|
|
86
89
|
className: clsx("stl-ui-dropdown__button", className),
|
|
@@ -111,8 +114,6 @@ function Icon$1({ className, ...props }) {
|
|
|
111
114
|
function Dropdown({ className, ...props }) {
|
|
112
115
|
return /* @__PURE__ */ jsx("div", {
|
|
113
116
|
...props,
|
|
114
|
-
"aria-haspopup": "listbox",
|
|
115
|
-
"aria-expanded": "false",
|
|
116
117
|
className: clsx("stl-ui-dropdown stl-ui-not-prose not-content", className)
|
|
117
118
|
});
|
|
118
119
|
}
|
|
@@ -135,6 +136,8 @@ function PrimaryActionText({ children }) {
|
|
|
135
136
|
}
|
|
136
137
|
function PrimaryAction({ className, ...props }) {
|
|
137
138
|
return /* @__PURE__ */ jsx("button", {
|
|
139
|
+
type: "button",
|
|
140
|
+
"aria-label": "Select primary option",
|
|
138
141
|
...props,
|
|
139
142
|
"data-part": "primary-action",
|
|
140
143
|
className: clsx("stl-ui-dropdown__button stl-ui-dropdown-button--action", className)
|
|
@@ -142,8 +145,11 @@ function PrimaryAction({ className, ...props }) {
|
|
|
142
145
|
}
|
|
143
146
|
function Trigger({ className, ...props }) {
|
|
144
147
|
return /* @__PURE__ */ jsx("button", {
|
|
145
|
-
...props,
|
|
146
148
|
type: "button",
|
|
149
|
+
"aria-haspopup": "menu",
|
|
150
|
+
"aria-expanded": "false",
|
|
151
|
+
"aria-label": "Select an option",
|
|
152
|
+
...props,
|
|
147
153
|
"data-part": "trigger",
|
|
148
154
|
className: clsx("stl-ui-dropdown__button stl-ui-dropdown-button__trigger", className),
|
|
149
155
|
children: /* @__PURE__ */ jsx(ChevronsUpDown, { size: 16 })
|
|
@@ -159,8 +165,6 @@ function Icon({ className, ...props }) {
|
|
|
159
165
|
function DropdownButton({ className, ...props }) {
|
|
160
166
|
return /* @__PURE__ */ jsx("div", {
|
|
161
167
|
...props,
|
|
162
|
-
"aria-haspopup": "listbox",
|
|
163
|
-
"aria-expanded": "false",
|
|
164
168
|
className: clsx("stl-ui-dropdown stl-ui-not-prose not-content", className)
|
|
165
169
|
});
|
|
166
170
|
}
|
package/dist/scripts/index.js
CHANGED
|
@@ -18,7 +18,7 @@ function initDropdown({ root, onSelect, initialValue }) {
|
|
|
18
18
|
const items = Array.from(menu.querySelectorAll("[data-part=\"item\"]"));
|
|
19
19
|
function open() {
|
|
20
20
|
if (!trigger || !menu || !root) return;
|
|
21
|
-
|
|
21
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
22
22
|
menu.dataset.state = "open";
|
|
23
23
|
menu.removeAttribute("aria-hidden");
|
|
24
24
|
const triggerRect = trigger.getBoundingClientRect();
|
|
@@ -31,7 +31,7 @@ function initDropdown({ root, onSelect, initialValue }) {
|
|
|
31
31
|
}
|
|
32
32
|
function close() {
|
|
33
33
|
if (!trigger || !menu || !root) return;
|
|
34
|
-
|
|
34
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
35
35
|
menu.dataset.state = "closed";
|
|
36
36
|
menu.setAttribute("aria-hidden", "true");
|
|
37
37
|
}
|
|
@@ -71,8 +71,8 @@ function initDropdown({ root, onSelect, initialValue }) {
|
|
|
71
71
|
trigger.focus();
|
|
72
72
|
}
|
|
73
73
|
function handleTriggerClick() {
|
|
74
|
-
if (!
|
|
75
|
-
if (
|
|
74
|
+
if (!trigger) return false;
|
|
75
|
+
if (trigger.getAttribute("aria-expanded") === "true") {
|
|
76
76
|
close();
|
|
77
77
|
return false;
|
|
78
78
|
} else {
|
|
@@ -94,7 +94,7 @@ function initDropdown({ root, onSelect, initialValue }) {
|
|
|
94
94
|
handleItemSelection(e);
|
|
95
95
|
});
|
|
96
96
|
document.addEventListener("keydown", (e) => {
|
|
97
|
-
if (!(
|
|
97
|
+
if (!(trigger.getAttribute("aria-expanded") === "true")) return;
|
|
98
98
|
if (e.key === "Escape") {
|
|
99
99
|
close();
|
|
100
100
|
trigger.focus();
|
package/dist/styles.css
CHANGED
|
@@ -29,11 +29,10 @@
|
|
|
29
29
|
--stl-typography-scale-5xl: 42px;
|
|
30
30
|
--stl-typography-scale-6xl: 64px;
|
|
31
31
|
|
|
32
|
-
--stl-
|
|
33
|
-
--stl-
|
|
34
|
-
|
|
35
|
-
rgb(from var(--stl-
|
|
36
|
-
rgb(from var(--stl-typography-selection-base) r g b / calc(alpha * 0.35))
|
|
32
|
+
--stl-color-text-selection-foreground: /* unset by default; text colors are unchanged */;
|
|
33
|
+
--stl-color-text-selection-background: light-dark(
|
|
34
|
+
rgb(from var(--stl-color-text-selection) r g b / calc(alpha * 0.2)),
|
|
35
|
+
rgb(from var(--stl-color-text-selection) r g b / calc(alpha * 0.35))
|
|
37
36
|
);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
@@ -64,16 +63,12 @@ body {
|
|
|
64
63
|
color: initial;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
:where(p:not(.stl-ui-not-prose *), .stl-ui-not-prose .stl-ui-prose p) {
|
|
68
|
-
margin-top: 16px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
66
|
:where(strong:not(.stl-ui-not-prose *), .stl-ui-not-prose .stl-ui-prose strong) {
|
|
72
67
|
color: var(--stl-color-foreground);
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
:where(a:not(.stl-ui-not-prose *), .stl-ui-not-prose .stl-ui-prose a) {
|
|
76
|
-
color: var(--stl-color-foreground
|
|
71
|
+
color: var(--stl-color-link-foreground);
|
|
77
72
|
text-decoration-color: rgb(from currentColor r g b / calc(alpha * var(--stl-opacity-level-040)));
|
|
78
73
|
transition: text-decoration-color 0.1s ease-out;
|
|
79
74
|
&:hover {
|
|
@@ -181,6 +176,11 @@ body {
|
|
|
181
176
|
}
|
|
182
177
|
}
|
|
183
178
|
|
|
179
|
+
/* _direct_ children of stl-ui-prose should get a margin-top by default for spacing. */
|
|
180
|
+
:where(.stl-ui-prose, .stl-ui-prose > .sl-markdown-content) > :where(:not(:first-child)) {
|
|
181
|
+
margin-top: 16px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
184
|
@layer starlight.content {
|
|
185
185
|
.stl-ui-prose .sl-markdown-content {
|
|
186
186
|
a,
|
|
@@ -191,8 +191,8 @@ body {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
::selection {
|
|
194
|
-
background-color: var(--stl-
|
|
195
|
-
color: var(--stl-
|
|
194
|
+
background-color: var(--stl-color-text-selection-background);
|
|
195
|
+
color: var(--stl-color-text-selection-foreground);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
@layer stl-ui.tokens {
|
|
@@ -364,6 +364,13 @@ body {
|
|
|
364
364
|
color: var(--stl-color-foreground);
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
+
/* Semantic color roles */
|
|
368
|
+
@layer stl-ui.tokens {
|
|
369
|
+
:root {
|
|
370
|
+
--stl-color-link-foreground: var(--stl-color-foreground-accent);
|
|
371
|
+
--stl-color-text-selection: var(--stl-color-accent-background);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
367
374
|
.stl-ui-button {
|
|
368
375
|
height: 32px;
|
|
369
376
|
padding: 8px 10px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/ui-primitives",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.29",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "^19.2.0",
|
|
24
24
|
"rolldown": "1.0.0-beta.51",
|
|
25
25
|
"sass": "^1.94.2",
|
|
26
|
-
"tsdown": "^0.16.
|
|
26
|
+
"tsdown": "^0.16.7",
|
|
27
27
|
"typescript": "5.9.3",
|
|
28
28
|
"@stainless/eslint-config": "0.1.0-beta.0"
|
|
29
29
|
},
|