@manakind/ui-core 0.2.1 → 0.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 +2 -0
- package/dist/badge/badge.d.ts +21 -2
- package/dist/badge/badge.d.ts.map +1 -1
- package/dist/badge/badge.js +9 -6
- package/dist/badge/badge.js.map +1 -1
- package/dist/button/button.css +7 -0
- package/dist/button/button.d.ts +51 -6
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +31 -3
- package/dist/button/button.js.map +1 -1
- package/dist/button/icon-button.d.ts +1 -1
- package/dist/button/icon-button.d.ts.map +1 -1
- package/dist/icon/icon.css +9 -1
- package/dist/icon/icon.d.ts +5 -4
- package/dist/icon/icon.d.ts.map +1 -1
- package/dist/icon/icon.js.map +1 -1
- package/dist/illustration/illustration.css +53 -0
- package/dist/illustration/illustration.css.d.ts +2 -0
- package/dist/illustration/illustration.d.ts +88 -0
- package/dist/illustration/illustration.d.ts.map +1 -0
- package/dist/illustration/illustration.js +39 -0
- package/dist/illustration/illustration.js.map +1 -0
- package/dist/illustration/index.d.ts +2 -0
- package/dist/illustration/index.d.ts.map +1 -0
- package/dist/illustration/index.js +2 -0
- package/dist/illustration/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/progress/progress.d.ts +1 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/tabs/tabs.css +66 -5
- package/dist/tabs/tabs.d.ts +9 -0
- package/dist/tabs/tabs.d.ts.map +1 -1
- package/dist/tabs/tabs.js +10 -1
- package/dist/tabs/tabs.js.map +1 -1
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -61,6 +61,7 @@ separately, so an app can load only what it renders.
|
|
|
61
61
|
| `@manakind/ui-core/button` | `Button` + `IconButton` |
|
|
62
62
|
| `@manakind/ui-core/card` | `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter` |
|
|
63
63
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
64
|
+
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
64
65
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
65
66
|
| `@manakind/ui-core/select` | `Select` |
|
|
66
67
|
| `@manakind/ui-core/tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` |
|
|
@@ -68,6 +69,7 @@ separately, so an app can load only what it renders.
|
|
|
68
69
|
| `@manakind/ui-core/css/button` | Button + IconButton structural CSS |
|
|
69
70
|
| `@manakind/ui-core/css/card` | Card structural CSS |
|
|
70
71
|
| `@manakind/ui-core/css/icon` | Icon structural CSS |
|
|
72
|
+
| `@manakind/ui-core/css/illustration` | Illustration structural CSS, including the paint roles |
|
|
71
73
|
| `@manakind/ui-core/css/progress` | Progress structural CSS |
|
|
72
74
|
| `@manakind/ui-core/css/select` | Select structural CSS |
|
|
73
75
|
| `@manakind/ui-core/css/tabs` | Tabs structural CSS |
|
package/dist/badge/badge.d.ts
CHANGED
|
@@ -46,7 +46,26 @@ type BadgeLook = {
|
|
|
46
46
|
variant?: Exclude<BadgeVariant, 'solid'>;
|
|
47
47
|
appearance: 'plain';
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* `labelClassName` lets a composition hide the label (a container query, say),
|
|
51
|
+
* so the badge must then carry its own name: without `aria-label` a hidden
|
|
52
|
+
* label leaves the badge unnamed, since the glyph is always decorative.
|
|
53
|
+
* Required here the same way `compact` requires it.
|
|
54
|
+
*/
|
|
55
|
+
type BadgeLabelClass = {
|
|
56
|
+
/**
|
|
57
|
+
* Your own class on the label wrapper, so a composition can style the
|
|
58
|
+
* label — for instance hide it from a container query when space runs
|
|
59
|
+
* out — without selecting `ui-core`'s classes. The wrapper exists only
|
|
60
|
+
* when there is an `icon`, so a label can never be hidden without a glyph
|
|
61
|
+
* left in its place: colour alone is never the signal.
|
|
62
|
+
*/
|
|
63
|
+
labelClassName: string;
|
|
64
|
+
'aria-label': string;
|
|
65
|
+
} | {
|
|
66
|
+
labelClassName?: undefined;
|
|
67
|
+
};
|
|
68
|
+
export type BadgeProps = Omit<ComponentProps<typeof ark.span>, 'asChild'> & BadgeCompact & BadgeLook & BadgeLabelClass & {
|
|
50
69
|
/**
|
|
51
70
|
* `pill` is the default. `circle` is for counts: a true circle at one or two
|
|
52
71
|
* digits, and a fixed-height lozenge beyond that.
|
|
@@ -85,6 +104,6 @@ export type BadgeAppearance = NonNullable<BadgeProps['appearance']>;
|
|
|
85
104
|
* Reads as "Completed" wide, collapses to the glyph when the container
|
|
86
105
|
* shrinks, and announces the same name at every width.
|
|
87
106
|
*/
|
|
88
|
-
export declare function Badge({ variant, shape, appearance, icon, compact, className, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
107
|
+
export declare function Badge({ variant, shape, appearance, labelClassName, icon, compact, className, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
89
108
|
export {};
|
|
90
109
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,aAAa,CAAC;AAGrB,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3C;;;;;;;GAOG;AACH,KAAK,YAAY,GACb;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,UAA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AE,YAAY,CAAC;IACvB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC;CACvB,GACD;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtE;;;;;GAKG;AACH,KAAK,eAAe,GAChB;IACE;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IAAE,cAAc,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEnC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,GACvE,YAAY,GACZ,SAAS,GACT,eAAe,GAAG;IAChB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEJ,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAoBpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAiB,EACjB,KAAc,EACd,UAAqB,EACrB,cAAc,EACd,IAAI,EACJ,OAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,2CAwCZ"}
|
package/dist/badge/badge.js
CHANGED
|
@@ -17,10 +17,8 @@ import { cx } from '../cx';
|
|
|
17
17
|
* Requires `icon` and `aria-label`, enforced by the union.
|
|
18
18
|
*
|
|
19
19
|
* For a badge that should collapse only when space runs out, leave `compact`
|
|
20
|
-
* off and hide
|
|
21
|
-
*
|
|
22
|
-
* actually have a glyph (`:has(.ds-icon)`), or a consumer who passed no icon
|
|
23
|
-
* gets the bare colour chip the union exists to prevent.
|
|
20
|
+
* off, pass a `labelClassName`, and hide that class from a container query —
|
|
21
|
+
* GoalCard's status badge is the worked example.
|
|
24
22
|
*/
|
|
25
23
|
/**
|
|
26
24
|
* Small inline label for counts, states, and categories.
|
|
@@ -45,7 +43,7 @@ import { cx } from '../cx';
|
|
|
45
43
|
* Reads as "Completed" wide, collapses to the glyph when the container
|
|
46
44
|
* shrinks, and announces the same name at every width.
|
|
47
45
|
*/
|
|
48
|
-
export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled', icon, compact = false, className, children, ...props }) {
|
|
46
|
+
export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled', labelClassName, icon, compact = false, className, children, ...props }) {
|
|
49
47
|
/*
|
|
50
48
|
* ARIA prohibits `aria-label` on a role-less `span` (it resolves to
|
|
51
49
|
* `role="generic"`), so the label is not reliably announced — axe reports
|
|
@@ -57,6 +55,11 @@ export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled'
|
|
|
57
55
|
* decorative text and should stay a plain `span`.
|
|
58
56
|
*/
|
|
59
57
|
const labelled = props['aria-label'] !== undefined || props['aria-labelledby'] !== undefined;
|
|
60
|
-
|
|
58
|
+
/*
|
|
59
|
+
* Wrapped only when there is a glyph, because the wrapper exists to be
|
|
60
|
+
* collapsed against one. A text-only badge keeps its bare-text DOM.
|
|
61
|
+
*/
|
|
62
|
+
const label = icon ? (_jsx("span", { className: cx('ds-badge__label', labelClassName), children: children })) : (children);
|
|
63
|
+
return (_jsxs(ark.span, { role: labelled ? 'img' : undefined, className: cx('ds-badge', `ds-badge--${variant}`, `ds-badge--${shape}`, appearance === 'plain' && 'ds-badge--plain', compact && 'ds-badge--compact', className), ...props, children: [icon && _jsx(Icon, { source: icon, size: "sm", decorative: true }), label] }));
|
|
61
64
|
}
|
|
62
65
|
//# sourceMappingURL=badge.js.map
|
package/dist/badge/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C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ACV,KACG,KAAK,aAER,IAAI,IAAI,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,EACnD,KAAK,IACG,CACZ,CAAC;AACJ,CAAC"}
|
package/dist/button/button.css
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
line-height: inherit;
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
border: 1px solid transparent;
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* For `asChild` on a link. A `<button>` is border-box and undecorated by
|
|
15
|
+
* default; an anchor is neither, so it came out underlined and taller.
|
|
16
|
+
*/
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
box-sizing: border-box;
|
|
12
19
|
transition:
|
|
13
20
|
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
14
21
|
border-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
package/dist/button/button.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ark } from '@ark-ui/react/factory';
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentProps, type ReactElement, type ReactNode } from 'react';
|
|
3
3
|
import { type IconSource } from '../icon/icon';
|
|
4
4
|
import './button.css';
|
|
5
5
|
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
6
6
|
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
7
|
-
|
|
7
|
+
interface ButtonOwnProps {
|
|
8
8
|
/** Visual style variant. */
|
|
9
9
|
variant?: ButtonVariant;
|
|
10
10
|
/** Size preset. */
|
|
11
11
|
size?: ButtonSize;
|
|
12
|
-
/** Show loading spinner and disable interaction. */
|
|
13
|
-
loading?: boolean;
|
|
14
12
|
/**
|
|
15
13
|
* Decorative icon rendered before the label.
|
|
16
14
|
*
|
|
@@ -22,10 +20,45 @@ export interface ButtonProps extends ComponentProps<typeof ark.button> {
|
|
|
22
20
|
leadingIcon?: IconSource;
|
|
23
21
|
/**
|
|
24
22
|
* Decorative icon rendered after the label. Same rendering contract as
|
|
25
|
-
* {@link
|
|
23
|
+
* {@link ButtonOwnProps.leadingIcon}.
|
|
26
24
|
*/
|
|
27
25
|
trailingIcon?: IconSource;
|
|
28
26
|
}
|
|
27
|
+
type ArkButtonProps = Omit<ComponentProps<typeof ark.button>, 'asChild'>;
|
|
28
|
+
interface ButtonAsButtonProps extends ButtonOwnProps, ArkButtonProps {
|
|
29
|
+
asChild?: false;
|
|
30
|
+
/** Show loading spinner and disable interaction. */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* With `asChild` the child is the control, so everything that belongs to the
|
|
35
|
+
* control goes on the child: `href`, handlers, `ref`, ARIA. Button adds its
|
|
36
|
+
* look and nothing else, which is why no other prop is accepted here.
|
|
37
|
+
*
|
|
38
|
+
* A link has no disabled state: `disabled` is not an attribute of `<a>`, and
|
|
39
|
+
* an anchor with an `href` stays reachable and clickable whatever it looks
|
|
40
|
+
* like. So neither `disabled` nor `loading` exists. Render a `Button`, or no
|
|
41
|
+
* control at all, when the destination is unavailable.
|
|
42
|
+
*/
|
|
43
|
+
interface ButtonAsChildProps extends ButtonOwnProps {
|
|
44
|
+
/**
|
|
45
|
+
* Render the single child element instead of a `<button>`, styled as this
|
|
46
|
+
* button.
|
|
47
|
+
*/
|
|
48
|
+
asChild: true;
|
|
49
|
+
/**
|
|
50
|
+
* The one element rendered as the control. Its own children become the
|
|
51
|
+
* label. A component works if it passes `className` and `children` on to
|
|
52
|
+
* the element it renders, as a router's link does.
|
|
53
|
+
*/
|
|
54
|
+
children: ReactElement<{
|
|
55
|
+
className?: string;
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
}>;
|
|
58
|
+
/** Extra class names appended after the `ds-button` modifiers. */
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
export type ButtonProps = ButtonAsButtonProps | ButtonAsChildProps;
|
|
29
62
|
/**
|
|
30
63
|
* Shared base button for the Manakind design system.
|
|
31
64
|
*
|
|
@@ -36,6 +69,18 @@ export interface ButtonProps extends ComponentProps<typeof ark.button> {
|
|
|
36
69
|
*
|
|
37
70
|
* For an icon-only button (no visible label), use `IconButton` instead —
|
|
38
71
|
* it enforces an `aria-label` at the type level.
|
|
72
|
+
*
|
|
73
|
+
* For an action that navigates, pass `asChild` and a link as the only child.
|
|
74
|
+
* The link is what renders, so it keeps what a link does: open in a new tab,
|
|
75
|
+
* copy its address, the router's prefetch. Its `href`, handlers and `ref`
|
|
76
|
+
* stay on the link.
|
|
77
|
+
*
|
|
78
|
+
* ```tsx
|
|
79
|
+
* <Button asChild leadingIcon={PlusCircle}>
|
|
80
|
+
* <a href="/goals/new">Add Goal</a>
|
|
81
|
+
* </Button>
|
|
82
|
+
* ```
|
|
39
83
|
*/
|
|
40
|
-
export declare function Button(
|
|
84
|
+
export declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
export {};
|
|
41
86
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAGtB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,UAAU,cAAc;IACtB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,mBAAmB;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;CAC3B;AAED,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AAEzE,UAAU,mBAAoB,SAAQ,cAAc,EAAE,cAAc;IAClE,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,UAAU,kBAAmB,SAAQ,cAAc;IACjD;;;OAGG;IACH,OAAO,EAAE,IAAI,CAAC;IACd;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACrE,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAkGnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAExC"}
|
package/dist/button/button.js
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ark } from '@ark-ui/react/factory';
|
|
3
|
+
import { cloneElement, Fragment, isValidElement, } from 'react';
|
|
3
4
|
import { Icon } from '../icon/icon';
|
|
4
5
|
import './button.css';
|
|
5
6
|
import { cx } from '../cx';
|
|
7
|
+
function ButtonContent({ size, loading, leadingIcon, trailingIcon, children }) {
|
|
8
|
+
return (_jsxs(_Fragment, { children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), leadingIcon && (_jsx(Icon, { source: leadingIcon, size: size, decorative: true, className: "ds-button__icon ds-button__icon--leading" })), _jsx("span", { className: "ds-button__label", children: children }), trailingIcon && (_jsx(Icon, { source: trailingIcon, size: size, decorative: true, className: "ds-button__icon ds-button__icon--trailing" }))] }));
|
|
9
|
+
}
|
|
10
|
+
function classesFor(variant, size, className) {
|
|
11
|
+
return cx('ds-button', `ds-button--${variant}`, `ds-button--${size}`, className);
|
|
12
|
+
}
|
|
13
|
+
function ButtonAsChild({ variant = 'primary', size = 'md', leadingIcon, trailingIcon, className, children, }) {
|
|
14
|
+
if (!isValidElement(children) || children.type === Fragment) {
|
|
15
|
+
throw new Error('Button asChild needs exactly one element as its child, such as <a> or a router link.');
|
|
16
|
+
}
|
|
17
|
+
const content = (_jsx(ButtonContent, { size: size, loading: false, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children.props.children }));
|
|
18
|
+
return cloneElement(children, { className: cx(classesFor(variant, size, className), children.props.className) }, content);
|
|
19
|
+
}
|
|
20
|
+
function ButtonAsButton({ variant = 'primary', size = 'md', loading = false, disabled, leadingIcon, trailingIcon, className, children, ...props }) {
|
|
21
|
+
return (_jsx(ark.button, { disabled: disabled || loading, className: cx(classesFor(variant, size, className), loading && 'ds-button--loading'), ...props, children: _jsx(ButtonContent, { size: size, loading: loading, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children }) }));
|
|
22
|
+
}
|
|
6
23
|
/**
|
|
7
24
|
* Shared base button for the Manakind design system.
|
|
8
25
|
*
|
|
@@ -13,8 +30,19 @@ import { cx } from '../cx';
|
|
|
13
30
|
*
|
|
14
31
|
* For an icon-only button (no visible label), use `IconButton` instead —
|
|
15
32
|
* it enforces an `aria-label` at the type level.
|
|
33
|
+
*
|
|
34
|
+
* For an action that navigates, pass `asChild` and a link as the only child.
|
|
35
|
+
* The link is what renders, so it keeps what a link does: open in a new tab,
|
|
36
|
+
* copy its address, the router's prefetch. Its `href`, handlers and `ref`
|
|
37
|
+
* stay on the link.
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Button asChild leadingIcon={PlusCircle}>
|
|
41
|
+
* <a href="/goals/new">Add Goal</a>
|
|
42
|
+
* </Button>
|
|
43
|
+
* ```
|
|
16
44
|
*/
|
|
17
|
-
export function Button(
|
|
18
|
-
return
|
|
45
|
+
export function Button(props) {
|
|
46
|
+
return props.asChild ? _jsx(ButtonAsChild, { ...props }) : _jsx(ButtonAsButton, { ...props });
|
|
19
47
|
}
|
|
20
48
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,cAAc,GAGf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAoE3B,SAAS,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAsB;IAC/F,OAAO,CACL,8BACG,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACrE,WAAW,IAAI,CACd,KAAC,IAAI,IACH,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,EACV,UAAU,QACV,SAAS,EAAC,0CAA0C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;IACpB,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IACT,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,IAAI,oBAAoB,CAAC,KAChF,KAAK,YAET,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,YAEzB,QAAQ,GACK,GACL,CACd,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AACtF,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { ComponentProps } from 'react';
|
|
|
3
3
|
import { type IconSource } from '../icon/icon';
|
|
4
4
|
import type { ButtonSize, ButtonVariant } from './button';
|
|
5
5
|
import './button.css';
|
|
6
|
-
export interface IconButtonProps extends Omit<ComponentProps<typeof ark.button>, 'children' | 'aria-label'> {
|
|
6
|
+
export interface IconButtonProps extends Omit<ComponentProps<typeof ark.button>, 'children' | 'aria-label' | 'asChild'> {
|
|
7
7
|
/** Decorative icon rendered inside the button. */
|
|
8
8
|
icon: IconSource;
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,CAAC;AAGtB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,CAAC;AAGtB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;IACtF,kDAAkD;IAClD,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,2CAkBjB"}
|
package/dist/icon/icon.css
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
.ds-icon {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
flex-shrink: 0;
|
|
5
|
-
fill: currentColor;
|
|
6
5
|
stroke: currentColor;
|
|
7
6
|
vertical-align: middle;
|
|
8
7
|
|
|
8
|
+
/*
|
|
9
|
+
* An outline set (Lucide, Heroicons outline) declares `fill="none"` on its
|
|
10
|
+
* root and draws with strokes. A presentation attribute loses to any CSS
|
|
11
|
+
* rule, so filling unconditionally painted those glyphs solid.
|
|
12
|
+
*/
|
|
13
|
+
&:not([fill="none"]) {
|
|
14
|
+
fill: currentColor;
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
&.ds-icon--sm {
|
|
10
18
|
width: var(--ds-icon-size-sm);
|
|
11
19
|
height: var(--ds-icon-size-sm);
|
package/dist/icon/icon.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import './icon.css';
|
|
|
3
3
|
/**
|
|
4
4
|
* Library-agnostic icon contract.
|
|
5
5
|
*
|
|
6
|
-
* An `IconSource` is a React component that renders its own `<svg>` root
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
9
|
-
*
|
|
6
|
+
* An `IconSource` is a React component that renders its own `<svg>` root.
|
|
7
|
+
* A filled glyph needs no `fill` of its own; an outline glyph declares
|
|
8
|
+
* `fill="none"` on the root, which `Icon` leaves alone. Both take the
|
|
9
|
+
* surrounding text color. The wrapper `Icon` component injects `className`,
|
|
10
|
+
* role, `aria-label`, `aria-hidden`, and `focusable` via passthrough props.
|
|
10
11
|
*
|
|
11
12
|
* Any icon library that exports React components with this shape can be
|
|
12
13
|
* passed to `<Icon>` — hand-rolled SVGs, Lucide, Heroicons, or a
|
package/dist/icon/icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,YAAY,CAAC;AAGpB
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA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":"icon.js","sourceRoot":"","sources":["../../src/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAiB,MAAM,OAAO,CAAC;AACzE,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA2B3B,MAAM,aAAa,GAA6B;IAC9C,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAeF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAa;IACzF,MAAM,OAAO,GAAG,EAAE,CAChB,SAAS,EACT,YAAY,IAAI,EAAE,EAClB,IAAI,IAAI,iBAAiB,aAAa,CAAC,IAAI,CAAC,EAAE,EAC9C,SAAS,CACV,CAAC;IAEF,OAAO,aAAa,CAAC,MAAM,EAAE;QAC3B,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;QACpC,YAAY,EAAE,KAAK;QACnB,aAAa,EAAE,UAAU,IAAI,SAAS;QACtC,SAAS,EAAE,OAAO;QAClB,SAAS,EAAE,OAAO;KACnB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-illustration {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
flex-shrink: 0;
|
|
5
|
+
color: var(--ds-illustration-line);
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
overflow: visible;
|
|
8
|
+
|
|
9
|
+
& * {
|
|
10
|
+
fill: none;
|
|
11
|
+
stroke: currentColor;
|
|
12
|
+
stroke-width: var(--ds-illustration-stroke-width);
|
|
13
|
+
stroke-linecap: round;
|
|
14
|
+
stroke-linejoin: round;
|
|
15
|
+
vector-effect: non-scaling-stroke;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
& [data-line="accent"] {
|
|
19
|
+
stroke: var(--ds-illustration-line-accent);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
& [data-line="muted"] {
|
|
23
|
+
stroke: var(--ds-illustration-line-muted);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
& [data-fill="default"] {
|
|
27
|
+
fill: var(--ds-illustration-fill);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
& [data-fill="accent"] {
|
|
31
|
+
fill: var(--ds-illustration-fill-accent);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& [data-fill="muted"] {
|
|
35
|
+
fill: var(--ds-illustration-fill-muted);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.ds-illustration--sm {
|
|
39
|
+
width: var(--ds-illustration-size-sm);
|
|
40
|
+
height: var(--ds-illustration-size-sm);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.ds-illustration--md {
|
|
44
|
+
width: var(--ds-illustration-size-md);
|
|
45
|
+
height: var(--ds-illustration-size-md);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.ds-illustration--lg {
|
|
49
|
+
width: var(--ds-illustration-size-lg);
|
|
50
|
+
height: var(--ds-illustration-size-lg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type ComponentType, type SVGProps } from 'react';
|
|
2
|
+
import './illustration.css';
|
|
3
|
+
/**
|
|
4
|
+
* Library-agnostic artwork contract, shaped like `IconSource`.
|
|
5
|
+
*
|
|
6
|
+
* An `IllustrationSource` is a React component that renders its own `<svg>`
|
|
7
|
+
* root with a `viewBox` and passes its props through to it. `Illustration`
|
|
8
|
+
* injects `className`, the ARIA attributes, `focusable`, and — when the
|
|
9
|
+
* drawing is placed inside another SVG — its position and size.
|
|
10
|
+
*
|
|
11
|
+
* Artwork paints with roles, never colours. Every shape is stroked with the
|
|
12
|
+
* line colour (`currentColor`) and left unfilled; `illustrationPaint` marks
|
|
13
|
+
* the shapes that take the accented or muted line, or one of the fills.
|
|
14
|
+
*/
|
|
15
|
+
export type IllustrationSource = ComponentType<SVGProps<SVGSVGElement>>;
|
|
16
|
+
export type IllustrationSize = 'sm' | 'md' | 'lg';
|
|
17
|
+
/**
|
|
18
|
+
* The emphasis a line or fill takes. `default` is the plain role — the line
|
|
19
|
+
* colour, or the plain fill.
|
|
20
|
+
*/
|
|
21
|
+
export type IllustrationTone = 'default' | 'accent' | 'muted';
|
|
22
|
+
/** Where a drawing sits inside a parent `<svg>`, in that SVG's user units. */
|
|
23
|
+
export interface IllustrationPlacement {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
/** Width and height. Artwork is square. */
|
|
27
|
+
size: number;
|
|
28
|
+
}
|
|
29
|
+
/** The attributes `illustrationPaint` returns, which the base CSS maps onto the colour roles. */
|
|
30
|
+
export interface IllustrationPaintAttributes {
|
|
31
|
+
'data-line'?: IllustrationTone;
|
|
32
|
+
'data-fill'?: IllustrationTone;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The paint attributes for one shape of a drawing.
|
|
36
|
+
*
|
|
37
|
+
* Omit `line` for the plain line colour; omit `fill` to leave the shape
|
|
38
|
+
* unfilled. Spread the result onto the shape:
|
|
39
|
+
* `<path {...illustrationPaint({ line: 'accent', fill: 'accent' })} d="…" />`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function illustrationPaint({ line, fill, }: {
|
|
42
|
+
line?: IllustrationTone;
|
|
43
|
+
fill?: IllustrationTone;
|
|
44
|
+
}): IllustrationPaintAttributes;
|
|
45
|
+
type IllustrationA11y = {
|
|
46
|
+
/** What the drawing depicts, for a drawing that stands alone. Renders `role="img"`. */
|
|
47
|
+
label: string;
|
|
48
|
+
decorative?: never;
|
|
49
|
+
} | {
|
|
50
|
+
/** The drawing repeats visible text beside it. Renders `aria-hidden`. */
|
|
51
|
+
decorative: true;
|
|
52
|
+
label?: never;
|
|
53
|
+
};
|
|
54
|
+
type IllustrationLayout = {
|
|
55
|
+
/** Size preset. Maps to `--ds-illustration-size-*`. Defaults to `md`. */
|
|
56
|
+
size?: IllustrationSize;
|
|
57
|
+
at?: never;
|
|
58
|
+
} | {
|
|
59
|
+
/**
|
|
60
|
+
* Places the drawing inside a parent `<svg>` instead of in the page
|
|
61
|
+
* flow, at user-space coordinates. Replaces `size`: inside a scene the
|
|
62
|
+
* drawing scales with the scene's own `viewBox`.
|
|
63
|
+
*/
|
|
64
|
+
at: IllustrationPlacement;
|
|
65
|
+
size?: never;
|
|
66
|
+
};
|
|
67
|
+
export type IllustrationProps = IllustrationA11y & IllustrationLayout & {
|
|
68
|
+
/** Artwork component supplied by the product package. */
|
|
69
|
+
source: IllustrationSource;
|
|
70
|
+
/** Extra class names appended after the `ds-illustration` classes. */
|
|
71
|
+
className?: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Renders a line drawing by delegating to a passed-in artwork component.
|
|
75
|
+
*
|
|
76
|
+
* Consumers must choose between an accessible `label` and `decorative`;
|
|
77
|
+
* TypeScript rejects neither and both. A drawing beside its own visible
|
|
78
|
+
* name is decorative. A drawing that stands alone, as in an empty state, is
|
|
79
|
+
* labelled with what it depicts.
|
|
80
|
+
*
|
|
81
|
+
* Colour comes from the `--ds-illustration-*` roles: the line is
|
|
82
|
+
* `currentColor`, which defaults to `--ds-illustration-line`, so a parent
|
|
83
|
+
* that sets `color` recolours the plain line. Strokes do not scale, so a
|
|
84
|
+
* drawing keeps `--ds-illustration-stroke-width` at every size.
|
|
85
|
+
*/
|
|
86
|
+
export declare function Illustration({ source, size, at, className, label, decorative, }: IllustrationProps): import("react").ReactElement<SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=illustration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"illustration.d.ts","sourceRoot":"","sources":["../../src/illustration/illustration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,oBAAoB,CAAC;AAG5B;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iGAAiG;AACjG,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,GAAG,2BAA2B,CAE9B;AAED,KAAK,gBAAgB,GACjB;IACE,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB,GACD;IACE,yEAAyE;IACzE,UAAU,EAAE,IAAI,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEN,KAAK,kBAAkB,GACnB;IACE,yEAAyE;IACzE,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,GACD;IACE;;;;OAIG;IACH,EAAE,EAAE,qBAAqB,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAC9C,kBAAkB,GAAG;IACnB,yDAAyD;IACzD,MAAM,EAAE,kBAAkB,CAAC;IAC3B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,IAAW,EACX,EAAE,EACF,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,iBAAiB,8GAYnB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import './illustration.css';
|
|
3
|
+
import { cx } from '../cx';
|
|
4
|
+
/**
|
|
5
|
+
* The paint attributes for one shape of a drawing.
|
|
6
|
+
*
|
|
7
|
+
* Omit `line` for the plain line colour; omit `fill` to leave the shape
|
|
8
|
+
* unfilled. Spread the result onto the shape:
|
|
9
|
+
* `<path {...illustrationPaint({ line: 'accent', fill: 'accent' })} d="…" />`.
|
|
10
|
+
*/
|
|
11
|
+
export function illustrationPaint({ line, fill, }) {
|
|
12
|
+
return { 'data-line': line, 'data-fill': fill };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders a line drawing by delegating to a passed-in artwork component.
|
|
16
|
+
*
|
|
17
|
+
* Consumers must choose between an accessible `label` and `decorative`;
|
|
18
|
+
* TypeScript rejects neither and both. A drawing beside its own visible
|
|
19
|
+
* name is decorative. A drawing that stands alone, as in an empty state, is
|
|
20
|
+
* labelled with what it depicts.
|
|
21
|
+
*
|
|
22
|
+
* Colour comes from the `--ds-illustration-*` roles: the line is
|
|
23
|
+
* `currentColor`, which defaults to `--ds-illustration-line`, so a parent
|
|
24
|
+
* that sets `color` recolours the plain line. Strokes do not scale, so a
|
|
25
|
+
* drawing keeps `--ds-illustration-stroke-width` at every size.
|
|
26
|
+
*/
|
|
27
|
+
export function Illustration({ source, size = 'md', at, className, label, decorative, }) {
|
|
28
|
+
const classes = cx('ds-illustration', !at && `ds-illustration--${size}`, className);
|
|
29
|
+
const placement = at && { x: at.x, y: at.y, width: at.size, height: at.size };
|
|
30
|
+
return createElement(source, {
|
|
31
|
+
...placement,
|
|
32
|
+
role: decorative ? undefined : 'img',
|
|
33
|
+
'aria-label': label,
|
|
34
|
+
'aria-hidden': decorative || undefined,
|
|
35
|
+
focusable: 'false',
|
|
36
|
+
className: classes,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=illustration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"illustration.js","sourceRoot":"","sources":["../../src/illustration/illustration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAiB,MAAM,OAAO,CAAC;AACzE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAsC3B;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,GAIL;IACC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC;AAsCD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,MAAM,EACN,IAAI,GAAG,IAAI,EACX,EAAE,EACF,SAAS,EACT,KAAK,EACL,UAAU,GACQ;IAClB,MAAM,OAAO,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,EAAE,IAAI,oBAAoB,IAAI,EAAE,EAAE,SAAS,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAE9E,OAAO,aAAa,CAAC,MAAM,EAAE;QAC3B,GAAG,SAAS;QACZ,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;QACpC,YAAY,EAAE,KAAK;QACnB,aAAa,EAAE,UAAU,IAAI,SAAS;QACtC,SAAS,EAAE,OAAO;QAClB,SAAS,EAAE,OAAO;KACnB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/illustration/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/illustration/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -22,7 +22,7 @@ type ProgressA11y = {
|
|
|
22
22
|
/** Accessible name when there is no visible `label`. */
|
|
23
23
|
'aria-label': string;
|
|
24
24
|
};
|
|
25
|
-
export type ProgressProps = Omit<ComponentProps<typeof ArkProgress.Root>, 'children' | 'aria-label' | 'aria-labelledby'> & ProgressA11y & {
|
|
25
|
+
export type ProgressProps = Omit<ComponentProps<typeof ArkProgress.Root>, 'children' | 'aria-label' | 'aria-labelledby' | 'asChild'> & ProgressA11y & {
|
|
26
26
|
/** Track thickness. `sm` suits inline use inside a card; `lg` stands alone. */
|
|
27
27
|
size?: ProgressSize;
|
|
28
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/progress/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AACnE,OAAO,gBAAgB,CAAC;AAGxB,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;GAOG;AACH,KAAK,YAAY,GACb;IACE;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;IACtD,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,EACvC,UAAU,GAAG,YAAY,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/progress/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AACnE,OAAO,gBAAgB,CAAC;AAGxB,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;GAOG;AACH,KAAK,YAAY,GACb;IACE;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;IACtD,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,EACvC,UAAU,GAAG,YAAY,GAAG,iBAAiB,GAAG,SAAS,CAC1D,GACC,YAAY,GAAG;IACb,+EAA+E;IAC/E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEJ;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,aAAa,2CA0Bf"}
|
package/dist/tabs/tabs.css
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
|
|
6
|
+
/*
|
|
7
|
+
* As a flex or grid item the root would otherwise refuse to be narrower
|
|
8
|
+
* than all its triggers side by side, and the list inside would never get
|
|
9
|
+
* the chance to scroll.
|
|
10
|
+
*/
|
|
11
|
+
min-inline-size: 0;
|
|
12
|
+
|
|
6
13
|
/*
|
|
7
14
|
* Derived so an inset child never curves more than its container.
|
|
8
15
|
*
|
|
@@ -13,6 +20,17 @@
|
|
|
13
20
|
*/
|
|
14
21
|
--_tabs-inner-radius: max(0px, calc(var(--ds-tabs-list-radius) - var(--ds-tabs-list-padding)));
|
|
15
22
|
|
|
23
|
+
/*
|
|
24
|
+
* The trigger's focus ring, stated once: the ring rule draws it and the
|
|
25
|
+
* scroller makes room for it, and the two must agree. It reaches past the
|
|
26
|
+
* list's edge by whatever the list's padding does not cover: 1px with
|
|
27
|
+
* Manuia's and ShipTight's tokens.
|
|
28
|
+
*/
|
|
29
|
+
--_tabs-ring-width: 2px;
|
|
30
|
+
--_tabs-ring-offset: 3px;
|
|
31
|
+
--_tabs-ring-reach: calc(var(--_tabs-ring-width) + var(--_tabs-ring-offset));
|
|
32
|
+
--_tabs-ring-overhang: max(0px, calc(var(--_tabs-ring-reach) - var(--ds-tabs-list-padding)));
|
|
33
|
+
|
|
16
34
|
/*
|
|
17
35
|
* Declared before `.ds-tabs__list` so that the higher-specificity
|
|
18
36
|
* `--fitted` override below it wins on source order as well as
|
|
@@ -38,6 +56,7 @@
|
|
|
38
56
|
font-weight: var(--ds-tabs-trigger-font-weight);
|
|
39
57
|
line-height: inherit;
|
|
40
58
|
white-space: nowrap;
|
|
59
|
+
flex-shrink: 0;
|
|
41
60
|
cursor: pointer;
|
|
42
61
|
transition:
|
|
43
62
|
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
@@ -64,8 +83,8 @@
|
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
&:focus-visible {
|
|
67
|
-
outline:
|
|
68
|
-
outline-offset:
|
|
86
|
+
outline: var(--_tabs-ring-width) solid var(--ds-tabs-focus-ring);
|
|
87
|
+
outline-offset: var(--_tabs-ring-offset);
|
|
69
88
|
}
|
|
70
89
|
|
|
71
90
|
&:disabled {
|
|
@@ -74,10 +93,50 @@
|
|
|
74
93
|
}
|
|
75
94
|
}
|
|
76
95
|
|
|
96
|
+
/*
|
|
97
|
+
* `nowrap` triggers cannot shrink below their label, so five of them used
|
|
98
|
+
* to widen the whole page on a phone. The list scrolls them instead.
|
|
99
|
+
*/
|
|
100
|
+
/*
|
|
101
|
+
* `nowrap` triggers cannot shrink below their label, so five of them used
|
|
102
|
+
* to widen the whole page on a phone. The scroller scrolls them instead.
|
|
103
|
+
*
|
|
104
|
+
* A scroll container clips whatever is drawn past its padding, and the
|
|
105
|
+
* focus ring is drawn past the list. So the scroller is larger than the
|
|
106
|
+
* list by the ring's overhang, and takes that back with a negative margin
|
|
107
|
+
* to leave the list exactly where it was.
|
|
108
|
+
*/
|
|
109
|
+
& .ds-tabs__scroller {
|
|
110
|
+
overflow-x: auto;
|
|
111
|
+
margin: calc(-1 * var(--_tabs-ring-overhang));
|
|
112
|
+
padding: var(--_tabs-ring-overhang);
|
|
113
|
+
scroll-padding-inline: var(--_tabs-ring-reach);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
* The scroller is wider than the tabs by its negative margin, which would
|
|
118
|
+
* widen a page the tabs sit flush against. Layout containment turns what
|
|
119
|
+
* overflows the frame into ink, which no ancestor scrolls to.
|
|
120
|
+
*
|
|
121
|
+
* A scrolling flex item may also shrink to nothing. Beside a panel, in the
|
|
122
|
+
* vertical orientation, that squeezed the list narrower than its triggers.
|
|
123
|
+
*/
|
|
124
|
+
& .ds-tabs__frame {
|
|
125
|
+
contain: layout;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
77
129
|
& .ds-tabs__list {
|
|
78
130
|
display: flex;
|
|
79
131
|
align-items: center;
|
|
80
132
|
gap: 0;
|
|
133
|
+
min-inline-size: max-content;
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* Without it a fitted list is its container's width plus its own
|
|
137
|
+
* padding, on any page that has not reset box-sizing itself.
|
|
138
|
+
*/
|
|
139
|
+
box-sizing: border-box;
|
|
81
140
|
padding: var(--ds-tabs-list-padding);
|
|
82
141
|
border-radius: var(--ds-tabs-list-radius);
|
|
83
142
|
background-color: var(--ds-tabs-list-bg);
|
|
@@ -85,8 +144,10 @@
|
|
|
85
144
|
&.ds-tabs__list--fitted {
|
|
86
145
|
width: 100%;
|
|
87
146
|
|
|
147
|
+
/* Equal shares of the width, and no narrower than the label. */
|
|
88
148
|
& .ds-tabs__trigger {
|
|
89
|
-
flex: 1
|
|
149
|
+
flex: 1 0 0%;
|
|
150
|
+
min-inline-size: max-content;
|
|
90
151
|
}
|
|
91
152
|
}
|
|
92
153
|
}
|
|
@@ -95,8 +156,8 @@
|
|
|
95
156
|
padding-block: var(--ds-tabs-content-padding-block);
|
|
96
157
|
|
|
97
158
|
&:focus-visible {
|
|
98
|
-
outline:
|
|
99
|
-
outline-offset:
|
|
159
|
+
outline: var(--_tabs-ring-width) solid var(--ds-tabs-focus-ring);
|
|
160
|
+
outline-offset: var(--_tabs-ring-offset);
|
|
100
161
|
}
|
|
101
162
|
}
|
|
102
163
|
|
package/dist/tabs/tabs.d.ts
CHANGED
|
@@ -40,6 +40,15 @@ export interface TabsListProps extends ComponentProps<typeof ArkTabs.List> {
|
|
|
40
40
|
* Always give this an `aria-label` (or `aria-labelledby`) when the page has
|
|
41
41
|
* more than one tablist — screen reader users otherwise get several
|
|
42
42
|
* indistinguishable "tab list" landmarks.
|
|
43
|
+
*
|
|
44
|
+
* When the triggers need more room than the list has, the list scrolls
|
|
45
|
+
* sideways inside its own box instead of widening the page. Focusing a
|
|
46
|
+
* trigger, by Tab or by arrow key, brings it into view.
|
|
47
|
+
*
|
|
48
|
+
* The two elements around the list exist for the focus ring, which reaches
|
|
49
|
+
* past the list's edge. The scroller is that much larger than the list, so
|
|
50
|
+
* scrolling does not clip the ring; the frame keeps the scroller's extra size
|
|
51
|
+
* from widening whatever the tabs sit in. `tabs.css` has the arithmetic.
|
|
43
52
|
*/
|
|
44
53
|
export declare function TabsList({ fitted, className, children, ...props }: TabsListProps): import("react/jsx-runtime").JSX.Element;
|
|
45
54
|
export type TabsTriggerProps = ComponentProps<typeof ArkTabs.Trigger>;
|
package/dist/tabs/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,YAAY,CAAC;AAGpB,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,IAAI,CAAC,E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,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAM9E"}
|
package/dist/tabs/tabs.js
CHANGED
|
@@ -35,9 +35,18 @@ export function Tabs({ className, children, ...props }) {
|
|
|
35
35
|
* Always give this an `aria-label` (or `aria-labelledby`) when the page has
|
|
36
36
|
* more than one tablist — screen reader users otherwise get several
|
|
37
37
|
* indistinguishable "tab list" landmarks.
|
|
38
|
+
*
|
|
39
|
+
* When the triggers need more room than the list has, the list scrolls
|
|
40
|
+
* sideways inside its own box instead of widening the page. Focusing a
|
|
41
|
+
* trigger, by Tab or by arrow key, brings it into view.
|
|
42
|
+
*
|
|
43
|
+
* The two elements around the list exist for the focus ring, which reaches
|
|
44
|
+
* past the list's edge. The scroller is that much larger than the list, so
|
|
45
|
+
* scrolling does not clip the ring; the frame keeps the scroller's extra size
|
|
46
|
+
* from widening whatever the tabs sit in. `tabs.css` has the arithmetic.
|
|
38
47
|
*/
|
|
39
48
|
export function TabsList({ fitted = false, className, children, ...props }) {
|
|
40
|
-
return (_jsx(ArkTabs.List, { className: cx('ds-tabs__list', fitted && 'ds-tabs__list--fitted', className), ...props, children: children }));
|
|
49
|
+
return (_jsx("div", { className: "ds-tabs__frame", children: _jsx("div", { className: "ds-tabs__scroller", children: _jsx(ArkTabs.List, { className: cx('ds-tabs__list', fitted && 'ds-tabs__list--fitted', className), ...props, children: children }) }) }));
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
43
52
|
* A single tab. `value` must match the `value` of its {@link TabsContent}.
|
package/dist/tabs/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/tabs/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B;;;;;;;;;;;;;;;;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C,OAAO,CAAC,OAAO,IAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,YACrE,QAAQ,GACO,CACnB,CAAC;AACJ,CAAC;AAID,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAC7E,OAAO,CACL,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,YACrE,QAAQ,GACO,CACnB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"types": "./dist/icon/icon.css.d.ts",
|
|
53
53
|
"default": "./dist/icon/icon.css"
|
|
54
54
|
},
|
|
55
|
+
"./css/illustration": {
|
|
56
|
+
"types": "./dist/illustration/illustration.css.d.ts",
|
|
57
|
+
"default": "./dist/illustration/illustration.css"
|
|
58
|
+
},
|
|
55
59
|
"./css/progress": {
|
|
56
60
|
"types": "./dist/progress/progress.css.d.ts",
|
|
57
61
|
"default": "./dist/progress/progress.css"
|
|
@@ -68,6 +72,10 @@
|
|
|
68
72
|
"types": "./dist/icon/index.d.ts",
|
|
69
73
|
"import": "./dist/icon/index.js"
|
|
70
74
|
},
|
|
75
|
+
"./illustration": {
|
|
76
|
+
"types": "./dist/illustration/index.d.ts",
|
|
77
|
+
"import": "./dist/illustration/index.js"
|
|
78
|
+
},
|
|
71
79
|
"./progress": {
|
|
72
80
|
"types": "./dist/progress/index.d.ts",
|
|
73
81
|
"import": "./dist/progress/index.js"
|
|
@@ -93,12 +101,12 @@
|
|
|
93
101
|
"@ark-ui/react": "^5.36.2"
|
|
94
102
|
},
|
|
95
103
|
"peerDependencies": {
|
|
96
|
-
"react": "^19.
|
|
97
|
-
"react-dom": "^19.
|
|
104
|
+
"react": "^19.0.0",
|
|
105
|
+
"react-dom": "^19.0.0"
|
|
98
106
|
},
|
|
99
107
|
"devDependencies": {
|
|
100
108
|
"@manakind/ds-config": "*",
|
|
101
|
-
"@manakind/manuia-tokens": "0.
|
|
109
|
+
"@manakind/manuia-tokens": "0.3.0",
|
|
102
110
|
"@testing-library/jest-dom": "^6.9.1",
|
|
103
111
|
"@testing-library/react": "^16.3.2",
|
|
104
112
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -112,7 +120,7 @@
|
|
|
112
120
|
"stylelint": "^17.9.1",
|
|
113
121
|
"stylelint-declaration-strict-value": "^1.11.1",
|
|
114
122
|
"typescript": "^6.0.3",
|
|
115
|
-
"vite": "^8.0.
|
|
123
|
+
"vite": "^8.0.16",
|
|
116
124
|
"vitest": "^4.1.11"
|
|
117
125
|
}
|
|
118
126
|
}
|