@graftwork/ui 1.2.0 → 1.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/CHANGELOG.md +16 -0
- package/dist/components/accordion.js +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/combobox.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/field.js +3 -1
- package/dist/components/pagination.js +3 -1
- package/dist/components/select.js +2 -2
- package/dist/components/tabs.js +1 -1
- package/dist/components/toggle.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @graftwork/ui
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#25](https://github.com/graftwork-studio/design-system/pull/25) [`33b8015`](https://github.com/graftwork-studio/design-system/commit/33b80153bfad7861453ded91710a7d8d542ae477) Thanks [@david-kenny](https://github.com/david-kenny)! - Controls now use the 14px body size by default.
|
|
8
|
+
|
|
9
|
+
- Button and Toggle text is 12px at `sm`, 14px at `md` and 16px at `lg` (was 14, 16 and 18).
|
|
10
|
+
- Input, Textarea, InputGroup and Combobox are 14px from the `md` breakpoint (768px) up, and 16px below it so iPhone Safari doesn't zoom in when they're tapped.
|
|
11
|
+
- The Select trigger, Select and Combobox options, DropdownMenu items, Accordion triggers and Tabs are 14px everywhere.
|
|
12
|
+
- Pagination links keep 14px text at the small button height.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`33b8015`](https://github.com/graftwork-studio/design-system/commit/33b80153bfad7861453ded91710a7d8d542ae477)]:
|
|
17
|
+
- @graftwork/tokens@1.3.0
|
|
18
|
+
|
|
3
19
|
## 1.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -10,7 +10,7 @@ export function AccordionItem({ className, ...props }) {
|
|
|
10
10
|
return _jsx(Disclosure, { "data-slot": "accordion-item", className: cn("group/accordion", className), ...props });
|
|
11
11
|
}
|
|
12
12
|
export function AccordionTrigger({ children, level = 3, className }) {
|
|
13
|
-
return (_jsx(Heading, { level: level, className: "flex", children: _jsxs(ButtonPrimitive, { slot: "trigger", "data-slot": "accordion-trigger", className: cn("focus-ring flex min-h-target-min flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-start text-
|
|
13
|
+
return (_jsx(Heading, { level: level, className: "flex", children: _jsxs(ButtonPrimitive, { slot: "trigger", "data-slot": "accordion-trigger", className: cn("focus-ring flex min-h-target-min flex-1 cursor-pointer items-center justify-between gap-4 py-3 text-start text-body font-medium text-text-default", "hover:underline data-disabled:cursor-not-allowed data-disabled:opacity-50", className), children: [children, _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-default transition-transform duration-(--gw-motion-duration-fast) group-data-expanded/accordion:rotate-180" })] }) }));
|
|
14
14
|
}
|
|
15
15
|
export function AccordionContent({ className, children, ...props }) {
|
|
16
16
|
return (_jsx(DisclosurePanel, { "data-slot": "accordion-content", ...props, children: _jsx("div", { className: cn("pb-4 text-body text-text-default", className), children: children }) }));
|
|
@@ -23,9 +23,9 @@ export const buttonVariants = cva([
|
|
|
23
23
|
destructive: "bg-action-destructive-bg text-text-on-destructive hover:bg-action-destructive-bg-hover data-pressed:bg-action-destructive-bg-hover",
|
|
24
24
|
},
|
|
25
25
|
size: {
|
|
26
|
-
sm: "h-8 px-3 text-
|
|
27
|
-
md: "h-10 px-4 text-
|
|
28
|
-
lg: "h-11 px-6 text-
|
|
26
|
+
sm: "h-8 px-3 text-xs [&_svg]:size-4",
|
|
27
|
+
md: "h-10 px-4 text-body [&_svg]:size-4",
|
|
28
|
+
lg: "h-11 px-6 text-md [&_svg]:size-5",
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
defaultVariants: { variant: "primary", size: "md" },
|
|
@@ -10,5 +10,5 @@ export function Combobox({ label, description, errorMessage, placeholder, emptyM
|
|
|
10
10
|
className: "min-h-target-min min-w-0 flex-1 bg-transparent outline-none placeholder:text-text-placeholder disabled:cursor-not-allowed" }), _jsx(ButtonPrimitive, { "data-slot": "combobox-trigger", className: "focus-ring flex size-target-min shrink-0 cursor-pointer items-center justify-center rounded-md hover:bg-action-ghost-bg-hover data-disabled:cursor-not-allowed", children: _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-4 text-icon-default" }) })] }), _jsx(FieldErrorText, { children: errorMessage }), _jsx(Popover, { "data-slot": "combobox-popover", offset: 4, className: cn("w-(--trigger-width) min-w-40 overflow-auto rounded-md border border-border-default bg-surface-overlay shadow-md", "transition-opacity duration-(--gw-motion-duration-fade) data-entering:opacity-0 data-exiting:opacity-0"), children: _jsx(ListBox, { "data-slot": "combobox-list", renderEmptyState: () => _jsx("p", { className: "px-3 py-2 text-sm text-text-secondary", children: emptyMessage }), className: "focus-ring max-h-72 p-1", children: children }) })] }));
|
|
11
11
|
}
|
|
12
12
|
export function ComboboxItem({ className, children, ...props }) {
|
|
13
|
-
return (_jsx(ListBoxItem, { "data-slot": "combobox-item", textValue: typeof children === "string" ? children : props.textValue, className: cn("flex min-h-target-min cursor-pointer items-center justify-between gap-2 rounded-sm px-3 text-
|
|
13
|
+
return (_jsx(ListBoxItem, { "data-slot": "combobox-item", textValue: typeof children === "string" ? children : props.textValue, className: cn("flex min-h-target-min cursor-pointer items-center justify-between gap-2 rounded-sm px-3 text-body text-text-default outline-none", "data-focused:bg-action-ghost-bg-hover data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring", "data-disabled:cursor-not-allowed data-disabled:opacity-50", className), ...props, children: composeRenderProps(children, (content, { isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: content }), isSelected ? _jsx(CheckIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-brand" }) : null] }))) }));
|
|
14
14
|
}
|
|
@@ -28,7 +28,7 @@ export function DropdownMenuContent({ placement = "bottom start", className, ...
|
|
|
28
28
|
return (_jsx(PopoverPrimitive, { "data-slot": "dropdown-menu-popover", placement: placement, offset: 4, className: cn(floatingPanel, "min-w-48"), children: _jsx(Menu, { "data-slot": "dropdown-menu", className: cn("focus-ring max-h-[inherit] overflow-auto p-1", className), ...props }) }));
|
|
29
29
|
}
|
|
30
30
|
const item = [
|
|
31
|
-
"group/item flex min-h-target-min cursor-pointer items-center gap-2 rounded-sm px-3 text-
|
|
31
|
+
"group/item flex min-h-target-min cursor-pointer items-center gap-2 rounded-sm px-3 text-body text-text-default outline-none",
|
|
32
32
|
"data-focused:bg-action-ghost-bg-hover",
|
|
33
33
|
"data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring",
|
|
34
34
|
"data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
package/dist/components/field.js
CHANGED
|
@@ -18,7 +18,9 @@ export function FieldErrorText({ children, className }) {
|
|
|
18
18
|
return (_jsx(FieldErrorPrimitive, { "data-slot": "field-error", className: cn("flex items-start gap-1 text-sm text-text-error", className), children: (validation) => (_jsxs(_Fragment, { children: [_jsx(CircleAlertIcon, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0" }), _jsx("span", { children: children ?? validation.validationErrors.join(" ") })] })) }));
|
|
19
19
|
}
|
|
20
20
|
export const fieldControl = [
|
|
21
|
-
|
|
21
|
+
// 14px like body text, but 16px below the md breakpoint: iOS Safari zooms into
|
|
22
|
+
// text fields under 16px. Select overrides this, as it isn't a text field.
|
|
23
|
+
"w-full min-w-0 rounded-md border border-border-input bg-surface-default px-3 text-md md:text-body text-text-default",
|
|
22
24
|
"min-h-target-min transition-colors duration-(--gw-motion-duration-fast)",
|
|
23
25
|
"data-invalid:border-2 data-invalid:border-border-input-invalid",
|
|
24
26
|
"data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
@@ -19,7 +19,9 @@ export function pageItems(page, pageCount, siblingCount = 1) {
|
|
|
19
19
|
return items;
|
|
20
20
|
}
|
|
21
21
|
export function Pagination({ page, pageCount, getHref, onPageChange, siblingCount = 1, "aria-label": label = "Pagination", className, }) {
|
|
22
|
-
const link = (target, content, extra = {}) => (_jsx(Link, { href: getHref?.(target), onPress: () => onPageChange?.(target), isDisabled: extra.disabled, "aria-label": extra.label, "aria-current": extra.current ? "page" : undefined, className: cn(buttonVariants({ variant: extra.current ? "primary" : "ghost", size: "sm" }),
|
|
22
|
+
const link = (target, content, extra = {}) => (_jsx(Link, { href: getHref?.(target), onPress: () => onPageChange?.(target), isDisabled: extra.disabled, "aria-label": extra.label, "aria-current": extra.current ? "page" : undefined, className: cn(buttonVariants({ variant: extra.current ? "primary" : "ghost", size: "sm" }),
|
|
23
|
+
// Small button height, but body-size text: page numbers shouldn't shrink to 12px.
|
|
24
|
+
"min-w-8 px-2 text-body no-underline", !extra.current && "text-text-default"), children: content }));
|
|
23
25
|
return (_jsx("nav", { "aria-label": label, "data-slot": "pagination", className: cn("flex", className), children: _jsxs("ul", { className: "flex flex-wrap items-center gap-1", children: [_jsx("li", { children: link(page - 1, _jsxs(_Fragment, { children: [_jsx(ChevronLeftIcon, { "aria-hidden": true }), _jsx("span", { className: "max-sm:sr-only", children: "Previous" })] }), {
|
|
24
26
|
label: "Previous page",
|
|
25
27
|
disabled: page <= 1,
|
|
@@ -5,8 +5,8 @@ import { Button as ButtonPrimitive, composeRenderProps, ListBox, ListBoxItem, Po
|
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { FieldDescription, FieldErrorText, FieldLabel, fieldControl } from "./field.js";
|
|
7
7
|
export function Select({ label, description, errorMessage, placeholder = "Choose an option", className, children, items, ...props }) {
|
|
8
|
-
return (_jsxs(SelectPrimitive, { "data-slot": "select", placeholder: placeholder, className: cn("group/select flex flex-col gap-1", className), ...props, children: [_jsxs(FieldLabel, { children: [label, props.isRequired ? _jsx("span", { className: "text-text-secondary", children: " (required)" }) : null] }), description ? _jsx(FieldDescription, { children: description }) : null, _jsxs(ButtonPrimitive, { "data-slot": "select-trigger", className: cn(fieldControl, "focus-ring flex cursor-pointer items-center justify-between gap-2 text-left", "hover:bg-action-secondary-bg-hover", "group-data-invalid/select:border-2 group-data-invalid/select:border-border-input-invalid"), children: [_jsx(SelectValue, { className: "truncate data-placeholder:text-text-placeholder" }), _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-default" })] }), _jsx(FieldErrorText, { children: errorMessage }), _jsx(Popover, { "data-slot": "select-popover", offset: 4, className: cn("w-(--trigger-width) min-w-40 overflow-auto rounded-md border border-border-default bg-surface-overlay shadow-md", "transition-opacity duration-(--gw-motion-duration-fade) data-entering:opacity-0 data-exiting:opacity-0"), children: _jsx(ListBox, { "data-slot": "select-list", items: items, className: "max-h-72 p-1 outline-none data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring", children: children }) })] }));
|
|
8
|
+
return (_jsxs(SelectPrimitive, { "data-slot": "select", placeholder: placeholder, className: cn("group/select flex flex-col gap-1", className), ...props, children: [_jsxs(FieldLabel, { children: [label, props.isRequired ? _jsx("span", { className: "text-text-secondary", children: " (required)" }) : null] }), description ? _jsx(FieldDescription, { children: description }) : null, _jsxs(ButtonPrimitive, { "data-slot": "select-trigger", className: cn(fieldControl, "focus-ring flex cursor-pointer items-center justify-between gap-2 text-left text-body", "hover:bg-action-secondary-bg-hover", "group-data-invalid/select:border-2 group-data-invalid/select:border-border-input-invalid"), children: [_jsx(SelectValue, { className: "truncate data-placeholder:text-text-placeholder" }), _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-default" })] }), _jsx(FieldErrorText, { children: errorMessage }), _jsx(Popover, { "data-slot": "select-popover", offset: 4, className: cn("w-(--trigger-width) min-w-40 overflow-auto rounded-md border border-border-default bg-surface-overlay shadow-md", "transition-opacity duration-(--gw-motion-duration-fade) data-entering:opacity-0 data-exiting:opacity-0"), children: _jsx(ListBox, { "data-slot": "select-list", items: items, className: "max-h-72 p-1 outline-none data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring", children: children }) })] }));
|
|
9
9
|
}
|
|
10
10
|
export function SelectItem({ className, children, ...props }) {
|
|
11
|
-
return (_jsx(ListBoxItem, { "data-slot": "select-item", textValue: typeof children === "string" ? children : props.textValue, className: cn("flex min-h-target-min cursor-pointer items-center justify-between gap-2 rounded-sm px-3 text-
|
|
11
|
+
return (_jsx(ListBoxItem, { "data-slot": "select-item", textValue: typeof children === "string" ? children : props.textValue, className: cn("flex min-h-target-min cursor-pointer items-center justify-between gap-2 rounded-sm px-3 text-body text-text-default outline-none", "data-focused:bg-action-ghost-bg-hover data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring", "data-disabled:cursor-not-allowed data-disabled:opacity-50", className), ...props, children: composeRenderProps(children, (content, { isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: content }), isSelected ? _jsx(CheckIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-brand" }) : null] }))) }));
|
|
12
12
|
}
|
package/dist/components/tabs.js
CHANGED
|
@@ -9,7 +9,7 @@ export function TabList({ className, ...props }) {
|
|
|
9
9
|
return (_jsx(TabListPrimitive, { "data-slot": "tab-list", className: cn("group/tablist flex data-[orientation=horizontal]:overflow-x-auto data-[orientation=horizontal]:border-b data-[orientation=horizontal]:border-border-default", "data-[orientation=vertical]:flex-col data-[orientation=vertical]:border-e data-[orientation=vertical]:border-border-default", className), ...props }));
|
|
10
10
|
}
|
|
11
11
|
export function Tab({ className, ...props }) {
|
|
12
|
-
return (_jsx(TabPrimitive, { "data-slot": "tab", className: cn("relative flex min-h-target-min cursor-pointer items-center px-4 text-
|
|
12
|
+
return (_jsx(TabPrimitive, { "data-slot": "tab", className: cn("relative flex min-h-target-min cursor-pointer items-center px-4 text-body font-medium whitespace-nowrap text-text-secondary outline-none", "hover:text-text-default data-selected:text-text-default", "data-focus-visible:outline-2 data-focus-visible:outline-solid data-focus-visible:-outline-offset-2 data-focus-visible:outline-focus-ring", "data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
13
13
|
// The selected bar: a shape cue, not only colour.
|
|
14
14
|
"after:absolute after:bg-transparent data-selected:after:bg-action-primary-bg", "group-data-[orientation=horizontal]/tablist:after:inset-x-0 group-data-[orientation=horizontal]/tablist:after:-bottom-px group-data-[orientation=horizontal]/tablist:after:h-0.5", "group-data-[orientation=vertical]/tablist:after:inset-y-0 group-data-[orientation=vertical]/tablist:after:-end-px group-data-[orientation=vertical]/tablist:after:w-0.5", className), ...props }));
|
|
15
15
|
}
|
|
@@ -25,9 +25,9 @@ export const toggleVariants = cva([
|
|
|
25
25
|
secondary: "border-border-input bg-action-secondary-bg",
|
|
26
26
|
},
|
|
27
27
|
size: {
|
|
28
|
-
sm: "h-8 min-w-8 px-2 text-
|
|
29
|
-
md: "h-10 min-w-10 px-3 text-
|
|
30
|
-
lg: "h-11 min-w-11 px-4 text-
|
|
28
|
+
sm: "h-8 min-w-8 px-2 text-xs [&_svg]:size-4",
|
|
29
|
+
md: "h-10 min-w-10 px-3 text-body [&_svg]:size-4",
|
|
30
|
+
lg: "h-11 min-w-11 px-4 text-md [&_svg]:size-5",
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
defaultVariants: { variant: "ghost", size: "md" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graftwork/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Graftwork React components, built on shadcn/ui with React Aria",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://graftwork-studio.github.io/design-system/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@fontsource-variable/geist": "5.3.0",
|
|
44
|
-
"@graftwork/tokens": "^1.
|
|
44
|
+
"@graftwork/tokens": "^1.3.0",
|
|
45
45
|
"class-variance-authority": "0.7.1",
|
|
46
46
|
"cn": "0.5.2",
|
|
47
47
|
"lucide-react": "1.74.0",
|