@stainless-api/ui-primitives 0.1.0-beta.9 → 1.0.0-beta.55

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 (51) hide show
  1. package/dist/DropdownMenu-DJ2-gPoP.d.ts +54 -0
  2. package/dist/components/Accordion.d.ts +26 -0
  3. package/dist/components/Accordion.js +29 -0
  4. package/dist/components/Badge.d.ts +40 -0
  5. package/dist/components/Badge.js +63 -0
  6. package/dist/components/Button.d.ts +45 -0
  7. package/dist/components/Button.js +50 -0
  8. package/dist/components/Callout.d.ts +18 -0
  9. package/dist/components/Callout.js +26 -0
  10. package/dist/components/Steps.d.ts +17 -0
  11. package/dist/components/Steps.js +22 -0
  12. package/dist/components/dropdown/Dropdown.d.ts +63 -0
  13. package/dist/components/dropdown/Dropdown.js +52 -0
  14. package/dist/components/dropdown/DropdownButton.d.ts +61 -0
  15. package/dist/components/dropdown/DropdownButton.js +54 -0
  16. package/dist/components/dropdown/DropdownMenu.d.ts +2 -0
  17. package/dist/components/dropdown/DropdownMenu.js +76 -0
  18. package/dist/components/icons/Function.d.ts +9 -0
  19. package/dist/components/icons/Function.js +6 -0
  20. package/dist/components/icons/index.d.ts +2 -0
  21. package/dist/components/icons/index.js +2 -0
  22. package/dist/index.d.ts +8 -0
  23. package/dist/index.js +8 -0
  24. package/dist/scripts/index.d.ts +23 -0
  25. package/dist/scripts/index.js +162 -0
  26. package/dist/styles/starlight-compat.css +131 -0
  27. package/dist/styles/theme.css +183 -0
  28. package/dist/styles.css +1184 -0
  29. package/package.json +47 -24
  30. package/.env +0 -1
  31. package/CHANGELOG.md +0 -61
  32. package/eslint.config.js +0 -2
  33. package/src/components/Accordion.tsx +0 -41
  34. package/src/components/Button.tsx +0 -95
  35. package/src/components/Callout.tsx +0 -31
  36. package/src/components/DropdownButton.tsx +0 -109
  37. package/src/components/accordion.css +0 -145
  38. package/src/components/button.css +0 -187
  39. package/src/components/callout.css +0 -70
  40. package/src/components/dropdown-button.css +0 -164
  41. package/src/index.ts +0 -4
  42. package/src/scripts/dropdown-button.ts +0 -55
  43. package/src/scripts/index.ts +0 -1
  44. package/src/styles/layout.css +0 -11
  45. package/src/styles/scales.css +0 -129
  46. package/src/styles/starlight-compat.css +0 -160
  47. package/src/styles/swatches.css +0 -87
  48. package/src/styles/theme.css +0 -49
  49. package/src/styles/typography.css +0 -183
  50. package/src/styles.css +0 -11
  51. package/tsconfig.json +0 -11
package/package.json CHANGED
@@ -1,37 +1,60 @@
1
1
  {
2
2
  "name": "@stainless-api/ui-primitives",
3
- "version": "0.1.0-beta.9",
3
+ "version": "1.0.0-beta.55",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/stainless/docs-platform.git",
8
+ "directory": "packages/ui-primitives"
9
+ },
4
10
  "publishConfig": {
5
11
  "access": "public"
6
12
  },
7
- "exports": {
8
- ".": {
9
- "types": "./src/index.ts",
10
- "import": "./src/index.ts",
11
- "require": "./src/index.ts"
12
- },
13
- "./scripts": {
14
- "types": "./src/scripts/index.ts",
15
- "import": "./src/scripts/index.ts",
16
- "require": "./src/scripts/index.ts"
17
- },
18
- "./styles.css": "./src/styles.css"
19
- },
20
- "types": "./src/index.ts",
13
+ "type": "module",
14
+ "files": [
15
+ "dist"
16
+ ],
21
17
  "peerDependencies": {
22
- "react": ">=18.0.0",
23
- "react-dom": ">=18.0.0"
18
+ "react": ">=19.0.0",
19
+ "react-dom": ">=19.0.0"
24
20
  },
25
21
  "dependencies": {
26
22
  "clsx": "^2.1.1",
27
- "lucide-react": "^0.544.0"
23
+ "lucide-react": "^1.14.0"
28
24
  },
29
25
  "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",
35
- "@stainless/eslint-config": "0.0.0"
26
+ "@tsdown/css": "^0.22.0",
27
+ "@types/react": "19.2.14",
28
+ "react": "^19.2.6",
29
+ "sass": "^1.99.0",
30
+ "tsdown": "^0.22.0",
31
+ "typescript": "6.0.3",
32
+ "@stainless/eslint-config": "0.1.0-beta.2"
33
+ },
34
+ "exports": {
35
+ ".": {
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./scripts": {
39
+ "default": "./dist/scripts/index.js"
40
+ },
41
+ "./styles.css": {
42
+ "default": "./dist/styles.css"
43
+ },
44
+ "./starlight-compat.css": {
45
+ "default": "./dist/styles/starlight-compat.css"
46
+ },
47
+ "./*": {
48
+ "default": "./dist/*"
49
+ },
50
+ "./icons": {
51
+ "default": "./dist/components/icons/index.js"
52
+ }
53
+ },
54
+ "scripts": {
55
+ "lint": "eslint --flag unstable_native_nodejs_ts_config .",
56
+ "check:types": "tsc --noEmit",
57
+ "build": "tsdown",
58
+ "clean": "rm -rf dist"
36
59
  }
37
60
  }
package/.env DELETED
@@ -1 +0,0 @@
1
- STAINLESS_API_KEY=stl_sk_001uwmod48VpDm2a1bvB1tUTdJ1ooZ5I
package/CHANGELOG.md DELETED
@@ -1,61 +0,0 @@
1
- # @stainless-api/ui-primitives
2
-
3
- ## 0.1.0-beta.9
4
-
5
- ### Patch Changes
6
-
7
- - c96f895: Remove css layers, update sidebar styles, add new prose elements
8
-
9
- ## 0.1.0-beta.8
10
-
11
- ### Patch Changes
12
-
13
- - d15a520: fix initialization of dropdown buttons
14
-
15
- ## 0.1.0-beta.7
16
-
17
- ### Patch Changes
18
-
19
- - 34e7c61: verify dependents update
20
-
21
- ## 0.1.0-beta.6
22
-
23
- ### Minor Changes
24
-
25
- - f664b4d: Creating design system css variables, markdown styles, and typography improvements
26
-
27
- ### Patch Changes
28
-
29
- - 34cbd12: verify publishing
30
-
31
- ## 0.1.0-beta.5
32
-
33
- ### Patch Changes
34
-
35
- - e7a2a96: verifying dependent packages update
36
-
37
- ## 0.1.0-beta.4
38
-
39
- ### Patch Changes
40
-
41
- - 2853ae8: fixing dependency structure
42
-
43
- ## 0.1.0-beta.3
44
-
45
- ### Patch Changes
46
-
47
- - 870af8d: verify dependent packages update
48
-
49
- ## 0.1.0-beta.2
50
-
51
- ## 0.1.0-beta.1
52
-
53
- ### Patch Changes
54
-
55
- - 5537225: verify publishing of dependent package works
56
-
57
- ## 0.1.0-beta.0
58
-
59
- ### Minor Changes
60
-
61
- - ed77b46: prep packages for beta release
package/eslint.config.js DELETED
@@ -1,2 +0,0 @@
1
- import { config } from '@stainless/eslint-config/astro';
2
- export default config;
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
-
4
- export type AccordionProps = React.ComponentProps<'details'>;
5
-
6
- export function Accordion({ className, children, ...props }: AccordionProps) {
7
- const classes = clsx('stl-ui-accordion', className);
8
-
9
- return (
10
- <details className={classes} {...props}>
11
- {children}
12
- </details>
13
- );
14
- }
15
-
16
- function AccordionSummary({ children, className, ...props }: React.ComponentProps<'summary'>) {
17
- const classes = clsx('stl-ui-accordion__summary', className);
18
-
19
- return (
20
- <summary className={classes} {...props}>
21
- {children}
22
- </summary>
23
- );
24
- }
25
-
26
- Accordion.Summary = AccordionSummary;
27
-
28
- function AccordionGroup({ className, children, ...props }: React.ComponentProps<'div'>) {
29
- const classes = clsx('stl-ui-accordion-group', className);
30
-
31
- // TODO: boolean `exclusive` prop assigns a unique `name` to each of the child <details> elements
32
- // For now this can be handled by the user
33
-
34
- return (
35
- <div className={classes} {...props}>
36
- {children}
37
- </div>
38
- );
39
- }
40
-
41
- Accordion.Group = AccordionGroup;
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- import { LucideIcon } from 'lucide-react';
4
-
5
- export type ButtonVariant =
6
- | 'outline'
7
- | 'ghost'
8
- | 'accent'
9
- | 'accent-muted'
10
- | 'muted'
11
- | 'success'
12
- | 'destructive'
13
- | 'default';
14
-
15
- type BaseProps = {
16
- variant?: ButtonVariant;
17
- className?: string;
18
- children?: React.ReactNode;
19
- size?: 'sm' | 'lg' | 'default';
20
- };
21
-
22
- type AnchorBranch = BaseProps &
23
- Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'className' | 'children'> & {
24
- href: string;
25
- };
26
-
27
- type ButtonBranch = BaseProps &
28
- Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'children'> & {
29
- href?: never;
30
- };
31
-
32
- export type ButtonProps = AnchorBranch | ButtonBranch;
33
-
34
- // Because this code needs to run inside .astro files, we can’t use React.cloneElement
35
- // (or radix-ui/react-slot). In .astro, children are passed as static HTML elements
36
- // rather than React elements, so they can’t be cloned or modified to add class names.
37
-
38
- export function Button(props: ButtonProps) {
39
- const { variant, children } = props;
40
-
41
- const classes = clsx(
42
- 'stl-ui-button',
43
- {
44
- 'stl-ui-button--outline': variant === 'outline',
45
- 'stl-ui-button--ghost': variant === 'ghost',
46
- 'stl-ui-button--accent': variant === 'accent',
47
- 'stl-ui-button--accent-muted': variant === 'accent-muted',
48
- 'stl-ui-button--muted': variant === 'muted',
49
- 'stl-ui-button--success': variant === 'success',
50
- 'stl-ui-button--destructive': variant === 'destructive',
51
- },
52
- {
53
- 'stl-ui-button--size-sm': props.size === 'sm',
54
- 'stl-ui-button--size-lg': props.size === 'lg',
55
- },
56
- 'not-content',
57
- 'stl-ui-not-prose',
58
- props.className,
59
- );
60
-
61
- if ('href' in props) {
62
- const { href, ...rest } = props as AnchorBranch;
63
- return (
64
- <a href={href} {...rest} className={classes}>
65
- {children}
66
- </a>
67
- );
68
- }
69
-
70
- const { type, ...rest } = props as ButtonBranch;
71
- return (
72
- <button type={type ?? 'button'} {...rest} className={classes}>
73
- {children}
74
- </button>
75
- );
76
- }
77
-
78
- type LabelProps = React.HTMLAttributes<HTMLSpanElement>;
79
-
80
- Button.Label = function ButtonLabel({ className, ...rest }: LabelProps) {
81
- return <span className={clsx('stl-ui-button-label leading-none', className)} {...rest} />;
82
- };
83
-
84
- type IconProps = {
85
- icon: LucideIcon;
86
- size?: number;
87
- } & React.HTMLAttributes<HTMLSpanElement>;
88
-
89
- Button.Icon = function ButtonIcon({ className, icon: Icon, size = 18 }: IconProps) {
90
- return (
91
- <span className={clsx('stl-ui-button__icon', className)}>
92
- <Icon size={size} />
93
- </span>
94
- );
95
- };
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- import { Info, CircleAlert, Lightbulb, Check, TriangleAlert, OctagonAlert } from 'lucide-react';
4
-
5
- export type CalloutVariant = 'info' | 'note' | 'tip' | 'success' | 'warning' | 'danger';
6
-
7
- export type CalloutProps = {
8
- variant?: CalloutVariant;
9
- className?: string;
10
- children?: React.ReactNode;
11
- } & Omit<React.ComponentProps<'aside'>, 'className' | 'children'>;
12
-
13
- export function Callout({ variant = 'info', className, children, ...props }: CalloutProps) {
14
- const classes = clsx('stl-ui-callout', `stl-ui-callout--${variant}`, className);
15
-
16
- const Icon = {
17
- info: Info,
18
- note: CircleAlert,
19
- tip: Lightbulb,
20
- success: Check,
21
- warning: TriangleAlert,
22
- danger: OctagonAlert,
23
- }[variant];
24
-
25
- return (
26
- <aside className={classes} {...props}>
27
- <Icon className="stl-ui-callout__icon" />
28
- <div className="stl-ui-callout__content">{children}</div>
29
- </aside>
30
- );
31
- }
@@ -1,109 +0,0 @@
1
- import clsx from 'clsx';
2
- import { ChevronsUpDown, ExternalLink } from 'lucide-react';
3
-
4
- function PrimaryActionText({ children }: { children?: React.ReactNode }) {
5
- return <span data-part="primary-action-text">{children}</span>;
6
- }
7
-
8
- function PrimaryAction({ children }: { children?: React.ReactNode }) {
9
- return (
10
- <button
11
- type="button"
12
- data-part="primary-action"
13
- className="stl-ui-dropdown-button__button stl-ui-dropdown-button--action"
14
- >
15
- {children}
16
- </button>
17
- );
18
- }
19
-
20
- function Trigger() {
21
- return (
22
- <button
23
- className="stl-ui-dropdown-button__button stl-ui-dropdown-button__trigger"
24
- aria-haspopup="listbox"
25
- aria-expanded="false"
26
- data-part="trigger"
27
- >
28
- <ChevronsUpDown size={16} />
29
- </button>
30
- );
31
- }
32
-
33
- function Menu({ children }: { children?: React.ReactNode }) {
34
- return (
35
- <div className="stl-ui-dropdown-button__menu" data-state="closed" data-part="menu">
36
- {children}
37
- </div>
38
- );
39
- }
40
-
41
- function MenuItemIcon({ children }: { children?: React.ReactNode }) {
42
- return (
43
- <div className="stl-ui-dropdown-button__menu-item-icon" data-part="item-icon">
44
- {children}
45
- </div>
46
- );
47
- }
48
-
49
- function MenuItemText({ children, subtle }: { children?: React.ReactNode; subtle?: boolean }) {
50
- return (
51
- <span
52
- className={clsx(`stl-ui-dropdown-button__menu-item-text`, {
53
- 'stl-ui-dropdown-button__menu-item-text--subtle': subtle,
54
- })}
55
- 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>
67
- );
68
- }
69
-
70
- function MenuItem({
71
- children,
72
- value,
73
- isExternalLink,
74
- }: {
75
- children?: React.ReactNode;
76
- value: string;
77
- isExternalLink?: boolean;
78
- }) {
79
- return (
80
- <div className="stl-ui-dropdown-button__menu-item" data-part="item" data-value={value}>
81
- <div className="stl-ui-dropdown-button__menu-item-content">{children}</div>
82
- {isExternalLink && (
83
- <div
84
- className="stl-ui-dropdown-button__menu-item-external-link-icon"
85
- data-part="item-external-link-icon"
86
- >
87
- <ExternalLink size={16} />
88
- </div>
89
- )}
90
- </div>
91
- );
92
- }
93
-
94
- export function DropdownButton({ id, children }: { id: string; children?: React.ReactNode }) {
95
- return (
96
- <div className="stl-ui-dropdown-button stl-ui-not-prose not-content" id={id}>
97
- {children}
98
- </div>
99
- );
100
- }
101
-
102
- DropdownButton.Menu = Menu;
103
- DropdownButton.MenuItem = MenuItem;
104
- DropdownButton.MenuItemIcon = MenuItemIcon;
105
- DropdownButton.MenuItemText = MenuItemText;
106
- DropdownButton.MenuItemTextSubtle = MenuItemTextSubtle;
107
- DropdownButton.PrimaryAction = PrimaryAction;
108
- DropdownButton.PrimaryActionText = PrimaryActionText;
109
- DropdownButton.Trigger = Trigger;
@@ -1,145 +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
- .stl-ui-accordion {
15
- --stl-ui-accordion-padding: 12px;
16
- --stl-ui-accordion-content-padding-bottom: 4px;
17
- --stl-ui-accordion-marker-size: 1em;
18
- --stl-ui-accordion-marker-margin: calc((1lh - var(--stl-ui-accordion-marker-size)) / 2);
19
- --stl-ui-accordion-row-gap: 8px;
20
- --stl-ui-accordion-summary-column-gap: 8px;
21
- --stl-ui-accordion-border-radius: var(--stl-ui-layout-border-radius);
22
- --stl-ui-accordion-hover-film-color: oklch(from var(--stl-ui-foreground) l c h / 0.03);
23
- /* left inset to make content line up with summary content (after chevron) */
24
- --stl-ui--internal--accordion-padding-start: calc(
25
- var(--stl-ui-accordion-padding) + var(--stl-ui-accordion-marker-size) +
26
- var(--stl-ui-accordion-marker-margin) * 2 + var(--stl-ui-accordion-summary-column-gap)
27
- );
28
-
29
- background-color: var(--stl-ui-card-background);
30
- border: 1px solid var(--stl-ui-border);
31
- border-radius: var(--stl-ui-accordion-border-radius);
32
- font-size: var(--stl-ui-typography-text-body);
33
-
34
- padding: var(--stl-ui-accordion-padding);
35
- /* indent content to line up with left edge of summary content */
36
- padding-inline-start: var(--stl-ui--internal--accordion-padding-start);
37
-
38
- .stl-ui-accordion__summary {
39
- display: block;
40
- list-style: none;
41
-
42
- /* summary extends to the edges of the element in order to increase click target */
43
- padding: var(--stl-ui-accordion-padding);
44
- padding-inline-start: var(--stl-ui--internal--accordion-padding-start);
45
- margin: calc(-1 * var(--stl-ui-accordion-padding));
46
- margin-inline-start: calc(-1 * var(--stl-ui--internal--accordion-padding-start));
47
-
48
- cursor: pointer;
49
- font-weight: 500;
50
-
51
- border-radius: var(--stl-ui-accordion-border-radius);
52
-
53
- &::before {
54
- content: '';
55
- width: var(--stl-ui-accordion-marker-size);
56
- height: var(--stl-ui-accordion-marker-size);
57
- margin: var(--stl-ui-accordion-marker-margin);
58
- background-color: currentColor;
59
- display: block;
60
- position: absolute;
61
- --stl-ui-accordion--internal--marker-width: calc(
62
- var(--stl-ui-accordion-marker-size) + var(--stl-ui-accordion-marker-margin) * 2
63
- );
64
- --stl-ui-accordion--internal--summary-marker-transform: translateX(
65
- calc(
66
- -1 * var(--stl-ui-accordion--internal--marker-width) - var(--stl-ui-accordion-summary-column-gap)
67
- )
68
- );
69
- transform: var(--stl-ui-accordion--internal--summary-marker-transform);
70
-
71
- --lucide-chevron-right: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQtaWNvbiBsdWNpZGUtY2hldnJvbi1yaWdodCI+PHBhdGggZD0ibTkgMTggNi02LTYtNiIvPjwvc3ZnPg==');
72
- mask-image: var(--lucide-chevron-right);
73
- mask-size: contain;
74
- mask-repeat: no-repeat;
75
-
76
- transition: transform 0.1s ease-out;
77
- }
78
-
79
- & > :first-child {
80
- margin-top: 0;
81
- }
82
- }
83
-
84
- &[open] {
85
- border-color: var(--stl-ui-border-emphasis);
86
- padding-bottom: calc(var(--stl-ui-accordion-padding) + var(--stl-ui-accordion-content-padding-bottom));
87
-
88
- .stl-ui-accordion__summary {
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
- --stl-ui--internal--summary-padding-bottom: min(
91
- var(--stl-ui-accordion-padding),
92
- var(--stl-ui-accordion-row-gap)
93
- );
94
- padding-bottom: var(--stl-ui--internal--summary-padding-bottom);
95
- margin-bottom: calc(var(--stl-ui-accordion-row-gap) - var(--stl-ui--internal--summary-padding-bottom));
96
- border-bottom-left-radius: 0;
97
- border-bottom-right-radius: 0;
98
-
99
- &::before {
100
- transform: var(--stl-ui-accordion--internal--summary-marker-transform) rotate(90deg);
101
- }
102
- }
103
- }
104
-
105
- &:has(.stl-ui-accordion__summary:hover) {
106
- background-image: linear-gradient(
107
- to bottom,
108
- var(--stl-ui-accordion-hover-film-color),
109
- var(--stl-ui-accordion-hover-film-color)
110
- );
111
- border-color: var(--stl-ui-border-emphasis);
112
- }
113
-
114
- .stl-ui-accordion__summary + * {
115
- margin-top: 0;
116
- }
117
- }
118
-
119
- .stl-ui-accordion-group {
120
- & > .stl-ui-accordion:has(+ .stl-ui-accordion) {
121
- border-bottom-left-radius: 0;
122
- border-bottom-right-radius: 0;
123
- .stl-ui-accordion__summary {
124
- border-bottom-left-radius: 0;
125
- border-bottom-right-radius: 0;
126
- }
127
- }
128
-
129
- & > .stl-ui-accordion + .stl-ui-accordion {
130
- margin-top: 0;
131
- border-top-width: 0;
132
- border-top-left-radius: 0;
133
- border-top-right-radius: 0;
134
-
135
- .stl-ui-accordion__summary {
136
- border-top-left-radius: 0;
137
- border-top-right-radius: 0;
138
- }
139
- }
140
-
141
- .stl-ui-accordion:not(:is([open], :hover)) + .stl-ui-accordion:is([open], :hover) {
142
- border-top-width: 1px;
143
- margin-top: -1px;
144
- }
145
- }