@carbonid1/design-system 7.2.0 → 7.3.0
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/README.md +1 -0
- package/dist/Autocomplete/Autocomplete.d.ts +22 -0
- package/dist/Autocomplete/Autocomplete.js +39 -0
- package/dist/Autocomplete/Autocomplete.types.d.ts +37 -0
- package/dist/Autocomplete/Autocomplete.types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -2
- package/skills/design-system-package/SKILL.md +11 -10
package/README.md
CHANGED
|
@@ -77,6 +77,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
77
77
|
| `Switch` | Boolean setting control with a compound `Root` / `Thumb` API |
|
|
78
78
|
| `ContextMenu` | Right-click / long-press menu (compound API) |
|
|
79
79
|
| `Select` | Base UI-backed dropdown with a convenience wrapper and compound `Root` / `Trigger` / `Popup` / `Item` parts |
|
|
80
|
+
| `Autocomplete` | Searchable single selection with compound input, trigger, clear, popup, list, and item parts |
|
|
80
81
|
| `Tooltip` | Hover/focus tooltip with a convenience wrapper and compound `Provider` / `Root` / `Trigger` / `Popup` parts |
|
|
81
82
|
| `Toaster` | Base UI-backed toast notification root (renders once in layout) |
|
|
82
83
|
| `toast` | Imperative toast trigger for default, success, error, action, persistent, and dismissible notifications |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
2
|
+
import type { AutocompleteClearProps, AutocompleteEmptyProps, AutocompleteGroupLabelProps, AutocompleteInputGroupProps, AutocompleteInputProps, AutocompleteItemProps, AutocompleteListProps, AutocompletePopupProps, AutocompletePositionerProps, AutocompleteRootProps, AutocompleteStatusProps, AutocompleteTriggerProps } from './Autocomplete.types';
|
|
3
|
+
/** Searchable single selection, built on Base UI Combobox. Input text filters; only items are selected. */
|
|
4
|
+
export declare const Autocomplete: {
|
|
5
|
+
Root: <Value>({ autoHighlight, modal, ...props }: AutocompleteRootProps<Value>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
InputGroup: ({ className, ...props }: AutocompleteInputGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Input: (props: AutocompleteInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Trigger: ({ children, className, "aria-label": ariaLabel, ...props }: AutocompleteTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Clear: ({ children, className, "aria-label": ariaLabel, keepMounted, ...props }: AutocompleteClearProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
Positioner: ({ className, sideOffset, collisionPadding, positionMethod, ...props }: AutocompletePositionerProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Popup: ({ className, ...props }: AutocompletePopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
List: ({ className, ...props }: AutocompleteListProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Item: ({ children, className, ...props }: AutocompleteItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Empty: ({ className, ...props }: AutocompleteEmptyProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Group: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
GroupLabel: ({ className, ...props }: AutocompleteGroupLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
Collection: typeof BaseCombobox.Collection;
|
|
19
|
+
Status: ({ className, ...props }: AutocompleteStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
useFilter: typeof BaseCombobox.useFilter;
|
|
21
|
+
useFilteredItems: typeof BaseCombobox.useFilteredItems;
|
|
22
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
4
|
+
import { Check, ChevronDown, X } from 'lucide-react';
|
|
5
|
+
import { InputGroup as StyledInputGroup } from '../InputGroup/InputGroup';
|
|
6
|
+
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
7
|
+
const Root = ({ autoHighlight = true, modal = false, ...props }) => (_jsx(BaseCombobox.Root, { autoHighlight: autoHighlight, modal: modal, ...props, multiple: false }));
|
|
8
|
+
const InputGroup = ({ className, ...props }) => (_jsx(BaseCombobox.InputGroup, { render: _jsx(StyledInputGroup.Root, {}), className: mergeStatefulClassName('min-h-9 gap-0 p-0.5', className), ...props }));
|
|
9
|
+
/** Compose inside InputGroup so the input and its actions share one focus ring and surface. */
|
|
10
|
+
const Input = (props) => (_jsx(BaseCombobox.Input, { render: _jsx(StyledInputGroup.Control, {}), ...props }));
|
|
11
|
+
const Trigger = ({ children, className, 'aria-label': ariaLabel = 'Show options', ...props }) => (_jsx(BaseCombobox.Trigger, { "aria-label": ariaLabel, "aria-labelledby": undefined, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('group motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight]', className), ...props, children: children ?? (_jsx(ChevronDown, { "aria-hidden": true, className: "size-4 transition-transform group-data-[popup-open]:rotate-180 motion-reduce:transition-none" })) }));
|
|
12
|
+
const Clear = ({ children, className, 'aria-label': ariaLabel = 'Clear selection', keepMounted = true, ...props }) => (_jsx(BaseCombobox.Clear, { "aria-label": ariaLabel, keepMounted: keepMounted, render: _jsx(StyledInputGroup.Action, { variant: "ghost" }), className: mergeStatefulClassName('not-data-[visible]:invisible motion-reduce:transition-none forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-[Highlight]', className), ...props, children: children ?? _jsx(X, { "aria-hidden": true, className: "size-4" }) }));
|
|
13
|
+
const Positioner = ({ className, sideOffset = 4, collisionPadding = 8, positionMethod = 'fixed', ...props }) => (_jsx(BaseCombobox.Positioner, { sideOffset: sideOffset, collisionPadding: collisionPadding, positionMethod: positionMethod, className: mergeStatefulClassName('z-50 outline-hidden', className), ...props }));
|
|
14
|
+
const Popup = ({ className, ...props }) => (_jsx(BaseCombobox.Popup, { className: mergeStatefulClassName('border-border bg-popover text-popover-foreground shadow-popover flex max-h-[var(--available-height)] w-[var(--anchor-width)] max-w-[var(--available-width)] flex-col overflow-hidden rounded-lg border outline-hidden', className), ...props }));
|
|
15
|
+
const List = ({ className, ...props }) => (_jsx(BaseCombobox.List, { className: mergeStatefulClassName('max-h-60 min-h-0 scroll-py-1 space-y-1 overflow-y-auto overscroll-contain p-1 empty:p-0', className), ...props }));
|
|
16
|
+
const Item = ({ children, className, ...props }) => (_jsxs(BaseCombobox.Item, { className: mergeStatefulClassName('data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[selected]:bg-primary/10 data-[selected]:ring-primary/20 relative flex min-h-9 cursor-default items-center gap-2 rounded-lg px-2.5 py-2 text-sm break-words outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[selected]:font-medium data-[selected]:ring-1 data-[selected]:ring-inset forced-colors:data-[highlighted]:outline-2 forced-colors:data-[highlighted]:outline-offset-[-2px] forced-colors:data-[highlighted]:outline-[Highlight]', className), ...props, children: [_jsx("span", { className: "min-w-0 flex-1", children: children }), _jsx(BaseCombobox.ItemIndicator, { keepMounted: true, className: "invisible shrink-0 data-[selected]:visible", children: _jsx(Check, { "aria-hidden": true, className: "size-4" }) })] }));
|
|
17
|
+
const Empty = ({ className, ...props }) => (_jsx(BaseCombobox.Empty, { className: mergeStatefulClassName('text-muted-foreground overflow-y-auto px-3 text-sm not-empty:py-3', className), ...props }));
|
|
18
|
+
const GroupLabel = ({ className, ...props }) => (_jsx(BaseCombobox.GroupLabel, { className: mergeStatefulClassName('text-muted-foreground px-2.5 pt-2 pb-1 text-xs font-medium', className), ...props }));
|
|
19
|
+
const Status = ({ className, ...props }) => (_jsx(BaseCombobox.Status, { className: mergeStatefulClassName('text-muted-foreground px-3 text-sm not-empty:py-2', className), ...props }));
|
|
20
|
+
/** Searchable single selection, built on Base UI Combobox. Input text filters; only items are selected. */
|
|
21
|
+
export const Autocomplete = {
|
|
22
|
+
Root,
|
|
23
|
+
InputGroup,
|
|
24
|
+
Input,
|
|
25
|
+
Trigger,
|
|
26
|
+
Clear,
|
|
27
|
+
Portal: BaseCombobox.Portal,
|
|
28
|
+
Positioner,
|
|
29
|
+
Popup,
|
|
30
|
+
List,
|
|
31
|
+
Item,
|
|
32
|
+
Empty,
|
|
33
|
+
Group: BaseCombobox.Group,
|
|
34
|
+
GroupLabel,
|
|
35
|
+
Collection: BaseCombobox.Collection,
|
|
36
|
+
Status,
|
|
37
|
+
useFilter: BaseCombobox.useFilter,
|
|
38
|
+
useFilteredItems: BaseCombobox.useFilteredItems,
|
|
39
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
2
|
+
import type { Ref } from 'react';
|
|
3
|
+
/** A searchable single-selection control. `value` is the selected item; `inputValue` is the query. */
|
|
4
|
+
export type AutocompleteRootProps<Value> = Omit<BaseCombobox.Root.Props<Value>, 'multiple'>;
|
|
5
|
+
export type AutocompleteInputGroupProps = BaseCombobox.InputGroup.Props & {
|
|
6
|
+
ref?: Ref<HTMLDivElement>;
|
|
7
|
+
};
|
|
8
|
+
export type AutocompleteInputProps = BaseCombobox.Input.Props & {
|
|
9
|
+
ref?: Ref<HTMLInputElement>;
|
|
10
|
+
};
|
|
11
|
+
export type AutocompleteTriggerProps = BaseCombobox.Trigger.Props & {
|
|
12
|
+
ref?: Ref<HTMLButtonElement>;
|
|
13
|
+
};
|
|
14
|
+
export type AutocompleteClearProps = BaseCombobox.Clear.Props & {
|
|
15
|
+
ref?: Ref<HTMLButtonElement>;
|
|
16
|
+
};
|
|
17
|
+
export type AutocompletePositionerProps = BaseCombobox.Positioner.Props & {
|
|
18
|
+
ref?: Ref<HTMLDivElement>;
|
|
19
|
+
};
|
|
20
|
+
export type AutocompletePopupProps = BaseCombobox.Popup.Props & {
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
};
|
|
23
|
+
export type AutocompleteListProps = BaseCombobox.List.Props & {
|
|
24
|
+
ref?: Ref<HTMLDivElement>;
|
|
25
|
+
};
|
|
26
|
+
export type AutocompleteItemProps = BaseCombobox.Item.Props & {
|
|
27
|
+
ref?: Ref<HTMLDivElement>;
|
|
28
|
+
};
|
|
29
|
+
export type AutocompleteEmptyProps = BaseCombobox.Empty.Props & {
|
|
30
|
+
ref?: Ref<HTMLDivElement>;
|
|
31
|
+
};
|
|
32
|
+
export type AutocompleteGroupLabelProps = BaseCombobox.GroupLabel.Props & {
|
|
33
|
+
ref?: Ref<HTMLDivElement>;
|
|
34
|
+
};
|
|
35
|
+
export type AutocompleteStatusProps = BaseCombobox.Status.Props & {
|
|
36
|
+
ref?: Ref<HTMLDivElement>;
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { buttonVariants } from './Button/Button.variants';
|
|
|
7
7
|
export type { ButtonProps } from './Button/Button.types';
|
|
8
8
|
export { Input } from './Input/Input';
|
|
9
9
|
export type { InputProps } from './Input/Input.types';
|
|
10
|
+
export { Autocomplete } from './Autocomplete/Autocomplete';
|
|
11
|
+
export type { AutocompleteClearProps, AutocompleteEmptyProps, AutocompleteGroupLabelProps, AutocompleteInputGroupProps, AutocompleteInputProps, AutocompleteItemProps, AutocompleteListProps, AutocompletePopupProps, AutocompletePositionerProps, AutocompleteRootProps, AutocompleteStatusProps, AutocompleteTriggerProps, } from './Autocomplete/Autocomplete.types';
|
|
10
12
|
export { Field } from './Field/Field';
|
|
11
13
|
export type { FieldControlProps, FieldDescriptionProps, FieldErrorProps, FieldItemProps, FieldLabelProps, FieldRootActions, FieldRootProps, FieldValidityProps, FieldValidityState, } from './Field/Field.types';
|
|
12
14
|
export { InputGroup } from './InputGroup/InputGroup';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { badgeVariants } from './Badge/Badge.variants';
|
|
|
4
4
|
export { Button } from './Button/Button';
|
|
5
5
|
export { buttonVariants } from './Button/Button.variants';
|
|
6
6
|
export { Input } from './Input/Input';
|
|
7
|
+
export { Autocomplete } from './Autocomplete/Autocomplete';
|
|
7
8
|
export { Field } from './Field/Field';
|
|
8
9
|
export { InputGroup } from './InputGroup/InputGroup';
|
|
9
10
|
export { Card, cardVariants } from './Card/Card';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonid1/design-system",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Shared React UI primitives + design tokens (themes, postcss config)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"@base-ui/react": "^1.6.0",
|
|
56
56
|
"@storybook/addon-a11y": "^10.3.5",
|
|
57
57
|
"@storybook/addon-docs": "^10.3.5",
|
|
58
|
-
"@storybook/addon-mcp": "^0.6.0",
|
|
59
58
|
"@storybook/addon-themes": "^10.3.5",
|
|
60
59
|
"@storybook/addon-vitest": "^10.3.5",
|
|
61
60
|
"@storybook/react-vite": "^10.3.5",
|
|
@@ -7,11 +7,11 @@ description: 'Building or modifying the @carbonid1/design-system package itself
|
|
|
7
7
|
|
|
8
8
|
How to **build and change `@carbonid1/design-system` itself** — the shared primitives, tokens, and variants every carbonid1 app consumes. This is the opposite end from the `design-system` skill, which is for _using_ the system in app code. Reach for this the moment a task means editing the package: adding a primitive, changing a token or variant, updating exports, or lifting an app-local component into the system.
|
|
9
9
|
|
|
10
|
-
The package lives at `packages/design-system` in the `packages` monorepo. This skill is the single source for how we build it — the rules, the Storybook
|
|
10
|
+
The package lives at `packages/design-system` in the `packages` monorepo. This skill is the single source for how we build it — the rules, the Storybook workflow, the token recipe, testing, and release; the package's `AGENTS.md` just points here.
|
|
11
11
|
|
|
12
12
|
## Before you add anything — study what exists
|
|
13
13
|
|
|
14
|
-
- **Read the real exports and types.** The barrel is `src/index.ts`; each primitive is `src/<Name>/<Name>.tsx`, with a `.types.ts` when it exports its own prop types and a `.stories.tsx` when it has visual states to show; helpers are `src/helpers/<name>/<name>.ts`, with a co-located test when there's logic worth testing.
|
|
14
|
+
- **Read the real exports and types.** The barrel is `src/index.ts`; each primitive is `src/<Name>/<Name>.tsx`, with a `.types.ts` when it exports its own prop types and a `.stories.tsx` when it has visual states to show; helpers are `src/helpers/<name>/<name>.ts`, with a co-located test when there's logic worth testing. Read types for the API and existing stories for usage examples.
|
|
15
15
|
- **Study comparable shadcn source for structure and accessibility**, then own it. shadcn is a good reference for how a primitive is composed, and we already follow its token _naming_ (~99% token-driven, as validation). But **never import a shadcn component and never add a shadcn runtime dependency** — we hand-own every value and behavior. Reference, not dependency.
|
|
16
16
|
|
|
17
17
|
## Build rules
|
|
@@ -35,19 +35,18 @@ When a consumer needs something the system doesn't have — a token, a variant,
|
|
|
35
35
|
|
|
36
36
|
Use enough sub-variants for depth — don't squeeze a semantic color into just `base + foreground` when the role needs distinct text/background/border values. Opacity modifiers are a poor substitute for dedicated tokens tuned per role.
|
|
37
37
|
|
|
38
|
-
## Storybook
|
|
38
|
+
## Storybook
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Run these commands from `packages/design-system`:
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- React-only and preview-stage upstream; `@storybook/addon-mcp` is pinned to `^0.6.0` and may churn.
|
|
42
|
+
- `pnpm storybook` starts the standalone component browser at `http://localhost:7006`.
|
|
43
|
+
- `pnpm build-storybook` builds the static component documentation.
|
|
44
|
+
- `pnpm test:run:storybook` runs story interaction and accessibility tests through Vitest.
|
|
46
45
|
|
|
47
46
|
## Verify before you ship
|
|
48
47
|
|
|
49
48
|
- **Stories for everything visual** — `Component.stories.tsx`, one story per visual state, each rendering under both palettes × both modes (the `.storybook/preview.ts` toolbar switchers prove it in isolation before shipping). Story-level `.test()` methods for interaction behavior. **Vitest** for non-visual helpers in `src/helpers/`.
|
|
50
|
-
- **Run the story tests**
|
|
49
|
+
- **Run the story tests** with `pnpm test:run:storybook` and resolve interaction and accessibility failures before shipping.
|
|
51
50
|
- **UI/UX Pro Max accessibility review** — For any visual, interactive, or token change, invoke the UI/UX Pro Max plugin review lens when available (prefer `ui-ux-pro-max:design-system` for primitives and tokens, `ui-ux-pro-max:ui-styling` for component styling, and `ui-ux-pro-max:ui-ux-pro-max` when unsure) and let it choose the relevant checks for the diff. The review must still cover keyboard navigation, visible focus states, contrast, accessible names/ARIA, screen-reader semantics, responsive behavior, interaction states, and reduced-motion behavior where they apply. In the handoff, name the lens used and summarize findings; for non-visual package housekeeping, say it does not apply. Package rules stay authoritative over broad style suggestions.
|
|
52
51
|
- **Prove it downstream.** The real proof a change works is at least one app or fixture outside the package rendering it; a primitive that type-checks can still look wrong under a palette you never opened.
|
|
53
52
|
|
|
@@ -57,4 +56,6 @@ A package change is invisible outside this repo until it's published. For releas
|
|
|
57
56
|
|
|
58
57
|
`pnpm release` is a local agent-run release step, not CI/GitHub automation. It versions packages, publishes to npm, pushes tags, and expects a clean `main`. Run it only for release-ready package work; don't run it for exploratory or unfinished changes.
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
**Publishing auth is exclusively `NPM_TOKEN`**, loaded by the packages repo's release script from its gitignored `.env.local` or an explicitly exported environment variable. Never print or commit it. Do not use `npm login`, `pnpm login`, browser/QR CLI login, OTP prompts, `~/.npmrc` session credentials, a direct publish command, or publishing CI as a fallback. If authentication fails, inspect the token's expiry and package write permissions and replace that token in `.env.local`; token rotation in npm's account settings must not become an alternate publishing session.
|
|
60
|
+
|
|
61
|
+
Stop only for real blockers: failing checks, an unexpected major or breaking release, a missing or rejected publishing token, unrelated dirty work, merge conflicts, an unexpected release prompt, or a release script failure. Otherwise publish and continue.
|