@nswds/ui 1.3.0 → 1.5.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/dist/components/badge.d.ts +16 -7
- package/dist/components/badge.js +10 -9
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +40 -8
- package/dist/components/button.js +41 -13
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +14 -0
- package/dist/components/card.js +94 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/field.d.ts +29 -0
- package/dist/components/field.js +219 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +50 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +21 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/link.d.ts +48 -3
- package/dist/components/link.js +120 -5
- package/dist/components/link.js.map +1 -1
- package/dist/components/login-form.d.ts +6 -0
- package/dist/components/login-form.js +57 -0
- package/dist/components/login-form.js.map +1 -0
- package/dist/components/separator.d.ts +15 -0
- package/dist/components/separator.js +44 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/spinner.d.ts +7 -1
- package/dist/components/spinner.js +13 -2
- package/dist/components/spinner.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +4 -3
package/dist/components/link.js
CHANGED
|
@@ -1,8 +1,71 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
4
|
import React, { createContext, forwardRef, useContext } from 'react';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
5
6
|
|
|
7
|
+
const styledBase = [
|
|
8
|
+
// Typography + transition
|
|
9
|
+
"font-medium underline decoration-current underline-offset-4 transition-colors",
|
|
10
|
+
// Text colour derives from --link-color; --link-halo and --link-halo-active
|
|
11
|
+
// derive from --link-color via color-mix so each variant only sets the one
|
|
12
|
+
// token and the hover/active halos follow automatically.
|
|
13
|
+
"text-(--link-color)",
|
|
14
|
+
"[--link-halo:color-mix(in_oklch,var(--link-color)_10%,transparent)]",
|
|
15
|
+
"[--link-halo-active:color-mix(in_oklch,var(--link-color)_18%,transparent)]",
|
|
16
|
+
// Hover / active halos use box-shadow + background-color rather than
|
|
17
|
+
// padding, so inline links sit flush against surrounding text. The
|
|
18
|
+
// shadows extend the halo 2px above and 4px below the line box, matching
|
|
19
|
+
// the GOV.UK Design System focus pattern.
|
|
20
|
+
"hover:bg-(--link-halo) hover:decoration-2",
|
|
21
|
+
"hover:shadow-[0_-2px_0_var(--link-halo),0_4px_0_var(--link-halo)]",
|
|
22
|
+
// Wrapped lines each get their own halo
|
|
23
|
+
"[box-decoration-break:clone] [-webkit-box-decoration-break:clone]",
|
|
24
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--link-color)",
|
|
25
|
+
// Default sizing for icon children — without this, an unsized SVG inside
|
|
26
|
+
// a Link collapses to 0×0 in flex layouts. `vertical-align: -0.15em`
|
|
27
|
+
// aligns the icon's box to the text's x-height for inline-flow usage;
|
|
28
|
+
// flex contexts ignore vertical-align and should set `items-baseline` (or
|
|
29
|
+
// similar) on the Link itself. Consumers can override per-icon by passing
|
|
30
|
+
// a `size-*` or `align-*` class on the icon itself.
|
|
31
|
+
"*:data-[slot=icon]:inline-block *:data-[slot=icon]:size-[1em] *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:align-[-0.15em]"
|
|
32
|
+
];
|
|
33
|
+
const linkVariants = cva("", {
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
primary: [
|
|
37
|
+
...styledBase,
|
|
38
|
+
// Link
|
|
39
|
+
"[--link-color:var(--color-primary-800)] dark:[--link-color:var(--color-primary-200)]",
|
|
40
|
+
// Visited — set the text colour directly. `:visited` is restricted by
|
|
41
|
+
// browsers to a small set of paint-only properties (color, *-color,
|
|
42
|
+
// fill, stroke) and ignores custom properties, so we can't shift
|
|
43
|
+
// --link-color here. Setting `text-*` works, and the underline follows
|
|
44
|
+
// because the base uses `decoration-current` (currentColor).
|
|
45
|
+
"visited:text-primary-600 dark:visited:text-primary-300",
|
|
46
|
+
// Active — deeper halo via --link-halo-active
|
|
47
|
+
"active:bg-(--link-halo-active) active:decoration-2",
|
|
48
|
+
"active:shadow-[0_-2px_0_var(--link-halo-active),0_4px_0_var(--link-halo-active)]"
|
|
49
|
+
],
|
|
50
|
+
secondary: [
|
|
51
|
+
...styledBase,
|
|
52
|
+
"[--link-color:var(--color-primary-200)] dark:[--link-color:var(--color-primary-800)]"
|
|
53
|
+
],
|
|
54
|
+
white: [
|
|
55
|
+
...styledBase,
|
|
56
|
+
"[--link-color:var(--color-white)] dark:[--link-color:var(--color-grey-800)]"
|
|
57
|
+
],
|
|
58
|
+
// Zero classes — the consumer (typically Button / BadgeButton) is
|
|
59
|
+
// supplying its own complete visual treatment and doesn't want any
|
|
60
|
+
// Link styling to compose on top. Intentionally omits the icon defaults
|
|
61
|
+
// too, so the wrapping component has full control of icon sizing.
|
|
62
|
+
unstyled: []
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
variant: "primary"
|
|
67
|
+
}
|
|
68
|
+
});
|
|
6
69
|
const LinkComponentContext = createContext(null);
|
|
7
70
|
function LinkProvider({
|
|
8
71
|
children,
|
|
@@ -10,12 +73,64 @@ function LinkProvider({
|
|
|
10
73
|
}) {
|
|
11
74
|
return /* @__PURE__ */ jsx(LinkComponentContext.Provider, { value: component, children });
|
|
12
75
|
}
|
|
13
|
-
const
|
|
76
|
+
const ANCHOR_ONLY_PROPS = [
|
|
77
|
+
"href",
|
|
78
|
+
"target",
|
|
79
|
+
"rel",
|
|
80
|
+
"download",
|
|
81
|
+
"ping",
|
|
82
|
+
"referrerPolicy",
|
|
83
|
+
"hrefLang",
|
|
84
|
+
"type"
|
|
85
|
+
];
|
|
86
|
+
const Link = forwardRef(function Link2({ as, variant, className, ...props }, ref) {
|
|
14
87
|
const ContextLink = useContext(LinkComponentContext);
|
|
15
88
|
const component = as ?? ContextLink ?? "a";
|
|
16
|
-
|
|
89
|
+
const isNonAnchorIntrinsic = typeof component === "string" && component !== "a";
|
|
90
|
+
const elementProps = { ...props };
|
|
91
|
+
if (isNonAnchorIntrinsic) {
|
|
92
|
+
for (const prop of ANCHOR_ONLY_PROPS) {
|
|
93
|
+
delete elementProps[prop];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return React.createElement(component, {
|
|
97
|
+
...elementProps,
|
|
98
|
+
className: cn(linkVariants({ variant }), className),
|
|
99
|
+
ref
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
function OpenInNewIcon(props) {
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
"svg",
|
|
105
|
+
{
|
|
106
|
+
"data-slot": "icon",
|
|
107
|
+
fill: "currentColor",
|
|
108
|
+
viewBox: "0 -960 960 960",
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
...props,
|
|
111
|
+
children: /* @__PURE__ */ jsx("path", { d: "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h240q17 0 28.5 11.5T480-800q0 17-11.5 28.5T440-760H200v560h560v-240q0-17 11.5-28.5T800-480q17 0 28.5 11.5T840-440v240q0 33-23.5 56.5T760-120H200Zm560-584L416-360q-11 11-28 11t-28-11q-11-11-11-28t11-28l344-344H600q-17 0-28.5-11.5T560-800q0-17 11.5-28.5T600-840h200q17 0 28.5 11.5T840-800v200q0 17-11.5 28.5T800-560q-17 0-28.5-11.5T760-600v-104Z" })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const ExternalLink = forwardRef(function ExternalLink2({
|
|
116
|
+
children,
|
|
117
|
+
icon,
|
|
118
|
+
newTabLabel = "(opens in a new tab)",
|
|
119
|
+
target = "_blank",
|
|
120
|
+
rel = "noopener noreferrer",
|
|
121
|
+
...props
|
|
122
|
+
}, ref) {
|
|
123
|
+
const trailingIcon = icon === null ? null : icon ?? /* @__PURE__ */ jsx(OpenInNewIcon, { className: "ml-0.5" });
|
|
124
|
+
return /* @__PURE__ */ jsxs(Link, { ...props, target, rel, ref, children: [
|
|
125
|
+
children,
|
|
126
|
+
trailingIcon,
|
|
127
|
+
newTabLabel ? /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
128
|
+
" ",
|
|
129
|
+
newTabLabel
|
|
130
|
+
] }) : null
|
|
131
|
+
] });
|
|
17
132
|
});
|
|
18
133
|
|
|
19
|
-
export { Link, LinkProvider };
|
|
134
|
+
export { ExternalLink, Link, LinkProvider, linkVariants };
|
|
20
135
|
//# sourceMappingURL=link.js.map
|
|
21
136
|
//# sourceMappingURL=link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/link.tsx"],"names":["Link"],"mappings":";;;;AAYA,MAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AAErE,SAAS,YAAA,CAAa;AAAA,EACpB,QAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,2BACG,oBAAA,CAAqB,QAAA,EAArB,EAA8B,KAAA,EAAO,WACnC,QAAA,EACH,CAAA;AAEJ;AAEA,MAAM,IAAA,GAAO,WAAW,SAASA,KAAAA,CAC/B,EAAE,EAAA,EAAI,GAAG,KAAA,EAAM,EACf,GAAA,EACA;AACA,EAAA,MAAM,WAAA,GAAc,WAAW,oBAAoB,CAAA;AACnD,EAAA,MAAM,SAAA,GAAY,MAAM,WAAA,IAAe,GAAA;AAEvC,EAAA,uBACE,GAAA,CAAC,QAAA,CAAS,eAAA,EAAT,EACE,QAAA,EAAA,KAAA,CAAM,aAAA,CAAc,SAAA,EAAW,EAAE,GAAG,KAAA,EAAO,GAAA,EAAK,CAAA,EACnD,CAAA;AAEJ,CAAC","file":"link.js","sourcesContent":["'use client'\n\nimport * as Headless from '@headlessui/react'\nimport React, { createContext, forwardRef, useContext } from 'react'\n\ntype LinkComponent = React.ElementType\n\ntype LinkProps = Omit<React.ComponentPropsWithoutRef<'a'>, 'href'> & {\n as?: LinkComponent\n href: React.ComponentPropsWithoutRef<'a'>['href'] | object\n}\n\nconst LinkComponentContext = createContext<LinkComponent | null>(null)\n\nfunction LinkProvider({\n children,\n component,\n}: {\n children: React.ReactNode\n component: LinkComponent\n}) {\n return (\n <LinkComponentContext.Provider value={component}>\n {children}\n </LinkComponentContext.Provider>\n )\n}\n\nconst Link = forwardRef(function Link(\n { as, ...props }: LinkProps,\n ref: React.ForwardedRef<HTMLAnchorElement>\n) {\n const ContextLink = useContext(LinkComponentContext)\n const component = as ?? ContextLink ?? 'a'\n\n return (\n <Headless.DataInteractive>\n {React.createElement(component, { ...props, ref })}\n </Headless.DataInteractive>\n )\n})\n\nexport { Link, LinkProvider }\nexport type { LinkComponent, LinkProps }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/link.tsx"],"names":["Link","ExternalLink"],"mappings":"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","file":"link.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React, { createContext, forwardRef, useContext } from 'react'\n\nimport { cn } from '../lib/utils.js'\n\n// Shared visual base for all *styled* variants. Pulled out so the `unstyled`\n// variant can omit it entirely (otherwise it wouldn't actually be unstyled).\nconst styledBase = [\n // Typography + transition\n 'font-medium underline decoration-current underline-offset-4 transition-colors',\n // Text colour derives from --link-color; --link-halo and --link-halo-active\n // derive from --link-color via color-mix so each variant only sets the one\n // token and the hover/active halos follow automatically.\n 'text-(--link-color)',\n '[--link-halo:color-mix(in_oklch,var(--link-color)_10%,transparent)]',\n '[--link-halo-active:color-mix(in_oklch,var(--link-color)_18%,transparent)]',\n // Hover / active halos use box-shadow + background-color rather than\n // padding, so inline links sit flush against surrounding text. The\n // shadows extend the halo 2px above and 4px below the line box, matching\n // the GOV.UK Design System focus pattern.\n 'hover:bg-(--link-halo) hover:decoration-2',\n 'hover:shadow-[0_-2px_0_var(--link-halo),0_4px_0_var(--link-halo)]',\n // Wrapped lines each get their own halo\n '[box-decoration-break:clone] [-webkit-box-decoration-break:clone]',\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--link-color)',\n // Default sizing for icon children — without this, an unsized SVG inside\n // a Link collapses to 0×0 in flex layouts. `vertical-align: -0.15em`\n // aligns the icon's box to the text's x-height for inline-flow usage;\n // flex contexts ignore vertical-align and should set `items-baseline` (or\n // similar) on the Link itself. Consumers can override per-icon by passing\n // a `size-*` or `align-*` class on the icon itself.\n '*:data-[slot=icon]:inline-block *:data-[slot=icon]:size-[1em] *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:align-[-0.15em]',\n]\n\nconst linkVariants = cva('', {\n variants: {\n variant: {\n primary: [\n ...styledBase,\n // Link\n '[--link-color:var(--color-primary-800)] dark:[--link-color:var(--color-primary-200)]',\n // Visited — set the text colour directly. `:visited` is restricted by\n // browsers to a small set of paint-only properties (color, *-color,\n // fill, stroke) and ignores custom properties, so we can't shift\n // --link-color here. Setting `text-*` works, and the underline follows\n // because the base uses `decoration-current` (currentColor).\n 'visited:text-primary-600 dark:visited:text-primary-300',\n // Active — deeper halo via --link-halo-active\n 'active:bg-(--link-halo-active) active:decoration-2',\n 'active:shadow-[0_-2px_0_var(--link-halo-active),0_4px_0_var(--link-halo-active)]',\n ],\n secondary: [\n ...styledBase,\n '[--link-color:var(--color-primary-200)] dark:[--link-color:var(--color-primary-800)]',\n ],\n white: [\n ...styledBase,\n '[--link-color:var(--color-white)] dark:[--link-color:var(--color-grey-800)]',\n ],\n // Zero classes — the consumer (typically Button / BadgeButton) is\n // supplying its own complete visual treatment and doesn't want any\n // Link styling to compose on top. Intentionally omits the icon defaults\n // too, so the wrapping component has full control of icon sizing.\n unstyled: [],\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n})\n\ntype LinkComponent = React.ElementType\n\ntype LinkProps = Omit<React.ComponentPropsWithoutRef<'a'>, 'href'> &\n VariantProps<typeof linkVariants> & {\n as?: LinkComponent\n href: React.ComponentPropsWithoutRef<'a'>['href'] | object\n }\n\nconst LinkComponentContext = createContext<LinkComponent | null>(null)\n\nfunction LinkProvider({\n children,\n component,\n}: {\n children: React.ReactNode\n component: LinkComponent\n}) {\n return (\n <LinkComponentContext.Provider value={component}>\n {children}\n </LinkComponentContext.Provider>\n )\n}\n\n/**\n * Polymorphic anchor wrapper. Renders an `<a>` by default, or any element\n * provided via the `as` prop, or via a `<LinkProvider component={…}>` context\n * (use the context to inject a framework Link like Next.js `next/link`).\n *\n * Hover / active / focus styling on consumers should use the native CSS\n * pseudo-class utilities (`hover:`, `active:`, `focus-visible:`, and their\n * `group-…` variants) — Tailwind v4 maps them to real CSS, no JS state\n * tracking required.\n */\n/**\n * Anchor-only HTML attributes. When `Link` is rendered as a non-anchor\n * intrinsic element (e.g. `as=\"button\"`), forwarding these produces invalid\n * markup like `<button href=\"…\">` and React DOM warnings, so they are\n * stripped. Custom components passed via `as` / `LinkProvider` are assumed to\n * be anchor-like (e.g. `next/link`) and receive the full prop set.\n */\nconst ANCHOR_ONLY_PROPS = [\n 'href',\n 'target',\n 'rel',\n 'download',\n 'ping',\n 'referrerPolicy',\n 'hrefLang',\n 'type',\n] as const\n\nconst Link = forwardRef(function Link(\n { as, variant, className, ...props }: LinkProps,\n ref: React.ForwardedRef<HTMLAnchorElement>\n) {\n const ContextLink = useContext(LinkComponentContext)\n const component = as ?? ContextLink ?? 'a'\n\n // Drop anchor-only props when the resolved element is a non-anchor\n // intrinsic tag (e.g. `as=\"button\"`). String components other than 'a'\n // are real DOM tags that can't accept `href`/`target`/etc; non-string\n // components (framework links) keep the full set.\n const isNonAnchorIntrinsic =\n typeof component === 'string' && component !== 'a'\n\n const elementProps = { ...props } as Record<string, unknown>\n if (isNonAnchorIntrinsic) {\n for (const prop of ANCHOR_ONLY_PROPS) {\n delete elementProps[prop]\n }\n }\n\n return React.createElement(component, {\n ...elementProps,\n className: cn(linkVariants({ variant }), className),\n ref,\n })\n})\n\n/**\n * Open-in-new-tab glyph used by `ExternalLink`. Defined inline (rather than\n * imported from `Icons`) so that consumers of `Link` / `ExternalLink` don't\n * tree-pull the full icon set. Sized and aligned through the `[data-slot=icon]`\n * rules in `linkVariants`.\n */\nfunction OpenInNewIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n data-slot=\"icon\"\n fill=\"currentColor\"\n viewBox=\"0 -960 960 960\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h240q17 0 28.5 11.5T480-800q0 17-11.5 28.5T440-760H200v560h560v-240q0-17 11.5-28.5T800-480q17 0 28.5 11.5T840-440v240q0 33-23.5 56.5T760-120H200Zm560-584L416-360q-11 11-28 11t-28-11q-11-11-11-28t11-28l344-344H600q-17 0-28.5-11.5T560-800q0-17 11.5-28.5T600-840h200q17 0 28.5 11.5T840-800v200q0 17-11.5 28.5T800-560q-17 0-28.5-11.5T760-600v-104Z\" />\n </svg>\n )\n}\n\ntype ExternalLinkProps = LinkProps & {\n /**\n * Screen-reader suffix announced after the link text. Defaults to\n * `\"(opens in a new tab)\"`. Pass an empty string to suppress.\n */\n newTabLabel?: string\n /**\n * Custom trailing icon. Pass `null` to hide the icon entirely. If omitted,\n * the default open-in-new glyph is rendered.\n */\n icon?: React.ReactNode | null\n}\n\n/**\n * Anchor preconfigured for cross-origin / new-tab navigation. Sets\n * `target=\"_blank\"` and `rel=\"noopener noreferrer\"` by default, renders a\n * trailing open-in-new icon, and appends a visually-hidden suffix so screen\n * readers announce that the link opens a new tab.\n *\n * All `Link` props are forwarded — `variant`, `as`, `className`, etc. —\n * and any of `target`, `rel`, `icon`, or `newTabLabel` can be overridden.\n */\nconst ExternalLink = forwardRef(function ExternalLink(\n {\n children,\n icon,\n newTabLabel = '(opens in a new tab)',\n target = '_blank',\n rel = 'noopener noreferrer',\n ...props\n }: ExternalLinkProps,\n ref: React.ForwardedRef<HTMLAnchorElement>\n) {\n const trailingIcon =\n icon === null ? null : (icon ?? <OpenInNewIcon className=\"ml-0.5\" />)\n\n return (\n <Link {...props} target={target} rel={rel} ref={ref}>\n {children}\n {trailingIcon}\n {newTabLabel ? <span className=\"sr-only\"> {newTabLabel}</span> : null}\n </Link>\n )\n})\n\nexport { ExternalLink, Link, LinkProvider, linkVariants }\nexport type { ExternalLinkProps, LinkComponent, LinkProps }\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Button } from '../components/button.js';
|
|
4
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '../components/card.js';
|
|
5
|
+
import { FieldGroup, Field, FieldLabel, FieldDescription } from '../components/field.js';
|
|
6
|
+
import { Input } from '../components/input.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
|
|
9
|
+
function LoginForm({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-6", className), ...props, children: /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
|
|
14
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(CardTitle, { children: "Login to your account" }),
|
|
16
|
+
/* @__PURE__ */ jsx(CardDescription, { children: "Enter your email below to login to your account" })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("form", { children: /* @__PURE__ */ jsxs(FieldGroup, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "email", children: "Email" }),
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
Input,
|
|
23
|
+
{
|
|
24
|
+
id: "email",
|
|
25
|
+
type: "email",
|
|
26
|
+
placeholder: "m@example.com",
|
|
27
|
+
required: true
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsxs(Field, { className: "relative", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "password", children: "Password" }),
|
|
33
|
+
/* @__PURE__ */ jsx(Input, { id: "password", type: "password", required: true }),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"a",
|
|
36
|
+
{
|
|
37
|
+
href: "#",
|
|
38
|
+
className: "absolute top-0 right-0 text-sm underline-offset-4 hover:underline",
|
|
39
|
+
children: "Forgot your password?"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Login" }),
|
|
45
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", type: "button", children: "Login with Google" }),
|
|
46
|
+
/* @__PURE__ */ jsxs(FieldDescription, { className: "text-center", children: [
|
|
47
|
+
"Don't have an account? ",
|
|
48
|
+
/* @__PURE__ */ jsx("a", { href: "#", children: "Sign up" })
|
|
49
|
+
] })
|
|
50
|
+
] })
|
|
51
|
+
] }) }) })
|
|
52
|
+
] }) });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { LoginForm };
|
|
56
|
+
//# sourceMappingURL=login-form.js.map
|
|
57
|
+
//# sourceMappingURL=login-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/login-form.tsx"],"names":[],"mappings":";;;;;;;AAqBO,SAAS,SAAA,CAAU;AAAA,EACxB,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAgC;AAC9B,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,SAAS,CAAA,EAAI,GAAG,KAAA,EACxD,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAU,QAAA,EACd,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,UAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,aAAU,QAAA,EAAA,uBAAA,EAAqB,CAAA;AAAA,sBAChC,GAAA,CAAC,mBAAgB,QAAA,EAAA,iDAAA,EAEjB;AAAA,KAAA,EACF,CAAA;AAAA,oBACA,GAAA,CAAC,WAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EACC,+BAAC,UAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA,OAAA,EAAK,CAAA;AAAA,wBACjC,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,EAAA,EAAG,OAAA;AAAA,YACH,IAAA,EAAK,OAAA;AAAA,YACL,WAAA,EAAY,eAAA;AAAA,YACZ,QAAA,EAAQ;AAAA;AAAA;AACV,OAAA,EACF,CAAA;AAAA,sBACA,IAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAU,UAAA,EACf,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,UAAA,EAAW,QAAA,EAAA,UAAA,EAAQ,CAAA;AAAA,4BACtC,KAAA,EAAA,EAAM,EAAA,EAAG,YAAW,IAAA,EAAK,UAAA,EAAW,UAAQ,IAAA,EAAC,CAAA;AAAA,wBAU9C,GAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,GAAA;AAAA,YACL,SAAA,EAAU,mEAAA;AAAA,YACX,QAAA,EAAA;AAAA;AAAA;AAED,OAAA,EACF,CAAA;AAAA,2BACC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,QAAA,EAAA,OAAA,EAAK,CAAA;AAAA,4BAC1B,MAAA,EAAA,EAAO,OAAA,EAAQ,SAAA,EAAU,IAAA,EAAK,UAAS,QAAA,EAAA,mBAAA,EAExC,CAAA;AAAA,wBACA,IAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAU,aAAA,EAAc,QAAA,EAAA;AAAA,UAAA,yBAAA;AAAA,0BACZ,GAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAK,GAAA,EAAI,QAAA,EAAA,SAAA,EAAO;AAAA,SAAA,EACjD;AAAA,OAAA,EACF;AAAA,KAAA,EACF,GACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ","file":"login-form.js","sourcesContent":["'use client'\n\nimport type * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '../components/card.js'\nimport {\n Field,\n FieldDescription,\n FieldGroup,\n FieldLabel,\n} from '../components/field.js'\nimport { Input } from '../components/input.js'\nimport { cn } from '../lib/utils.js'\n\nexport function LoginForm({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card className=\"w-full\">\n <CardHeader>\n <CardTitle>Login to your account</CardTitle>\n <CardDescription>\n Enter your email below to login to your account\n </CardDescription>\n </CardHeader>\n <CardContent>\n <form>\n <FieldGroup>\n <Field>\n <FieldLabel htmlFor=\"email\">Email</FieldLabel>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"m@example.com\"\n required\n />\n </Field>\n <Field className=\"relative\">\n <FieldLabel htmlFor=\"password\">Password</FieldLabel>\n <Input id=\"password\" type=\"password\" required />\n {/*\n * Placed AFTER the input in DOM (rather than next to the\n * label) so keyboard tab order is email → password → forgot,\n * not email → forgot → password. Visually positioned at the\n * top-right via absolute positioning to preserve the\n * \"Forgot your password?\" alongside-label layout. See WCAG\n * 2.4.3 Focus Order test in\n * login-form.accessibility.stories.tsx.\n */}\n <a\n href=\"#\"\n className=\"absolute top-0 right-0 text-sm underline-offset-4 hover:underline\"\n >\n Forgot your password?\n </a>\n </Field>\n <Field>\n <Button type=\"submit\">Login</Button>\n <Button variant=\"outline\" type=\"button\">\n Login with Google\n </Button>\n <FieldDescription className=\"text-center\">\n Don't have an account? <a href=\"#\">Sign up</a>\n </FieldDescription>\n </Field>\n </FieldGroup>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
3
|
+
|
|
4
|
+
type SeparatorProps = Separator$1.Props & {
|
|
5
|
+
/**
|
|
6
|
+
* When true, the separator is purely presentational and is hidden from
|
|
7
|
+
* assistive tech by setting `role="none"`. Defaults to `false`, in which
|
|
8
|
+
* case Base UI's default `role="separator"` is left intact so AT users
|
|
9
|
+
* hear it as a region boundary.
|
|
10
|
+
*/
|
|
11
|
+
decorative?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function Separator({ className, orientation, decorative, role, ...props }: SeparatorProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Separator, type SeparatorProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
decorative = false,
|
|
10
|
+
role,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
const sharedClassName = cn(
|
|
14
|
+
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
|
|
15
|
+
className
|
|
16
|
+
);
|
|
17
|
+
const isPresentational = decorative || role === "none" || role === "presentation";
|
|
18
|
+
if (isPresentational) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "separator",
|
|
23
|
+
"data-orientation": orientation,
|
|
24
|
+
role: "none",
|
|
25
|
+
className: sharedClassName,
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
Separator$1,
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "separator",
|
|
34
|
+
orientation,
|
|
35
|
+
role: role ?? "separator",
|
|
36
|
+
className: sharedClassName,
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Separator };
|
|
43
|
+
//# sourceMappingURL=separator.js.map
|
|
44
|
+
//# sourceMappingURL=separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/separator.tsx"],"names":["SeparatorPrimitive"],"mappings":";;;;AAkBA,SAAS,SAAA,CAAU;AAAA,EACjB,SAAA;AAAA,EACA,WAAA,GAAc,YAAA;AAAA,EACd,UAAA,GAAa,KAAA;AAAA,EACb,IAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAmB;AAMjB,EAAA,MAAM,eAAA,GAAkB,EAAA;AAAA,IACtB,sKAAA;AAAA,IACA;AAAA,GACF;AAOA,EAAA,MAAM,gBAAA,GACJ,UAAA,IAAc,IAAA,KAAS,MAAA,IAAU,IAAA,KAAS,cAAA;AAE5C,EAAA,IAAI,gBAAA,EAAkB;AAIpB,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAU,WAAA;AAAA,QACV,kBAAA,EAAkB,WAAA;AAAA,QAClB,IAAA,EAAK,MAAA;AAAA,QACL,SAAA,EAAW,eAAA;AAAA,QACV,GAAI;AAAA;AAAA,KACP;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAACA,WAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,WAAA;AAAA,MACA,MAAM,IAAA,IAAQ,WAAA;AAAA,MACd,SAAA,EAAW,eAAA;AAAA,MACV,GAAG;AAAA;AAAA,GACN;AAEJ","file":"separator.js","sourcesContent":["'use client'\n\nimport type * as React from 'react'\n\nimport { Separator as SeparatorPrimitive } from '@base-ui/react/separator'\n\nimport { cn } from '../lib/utils.js'\n\ntype SeparatorProps = SeparatorPrimitive.Props & {\n /**\n * When true, the separator is purely presentational and is hidden from\n * assistive tech by setting `role=\"none\"`. Defaults to `false`, in which\n * case Base UI's default `role=\"separator\"` is left intact so AT users\n * hear it as a region boundary.\n */\n decorative?: boolean\n}\n\nfunction Separator({\n className,\n orientation = 'horizontal',\n decorative = false,\n role,\n ...props\n}: SeparatorProps) {\n // Base UI's Separator emits `data-orientation=\"horizontal|vertical\"` for\n // CSS targeting AND `aria-orientation` for assistive tech. The previous\n // `data-horizontal:` / `data-vertical:` selectors targeted non-existent\n // boolean attributes and never matched, leaving the separator with no\n // explicit axis sizing.\n const sharedClassName = cn(\n 'shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch',\n className\n )\n\n // A consumer passing `role=\"none\"` / `\"presentation\"` is asking for a\n // presentational separator just as `decorative` does — treat them the same.\n // Otherwise Base UI would still emit `aria-orientation` (which it sets from\n // the orientation prop regardless of role), recreating the axe\n // `aria-allowed-attr` violation that `decorative` exists to avoid.\n const isPresentational =\n decorative || role === 'none' || role === 'presentation'\n\n if (isPresentational) {\n // Render a plain <div> for presentational separators. Bypass the\n // primitive so the rendered element carries no ARIA semantics at all\n // (no `aria-orientation`).\n return (\n <div\n data-slot=\"separator\"\n data-orientation={orientation}\n role=\"none\"\n className={sharedClassName}\n {...(props as React.HTMLAttributes<HTMLDivElement>)}\n />\n )\n }\n\n return (\n <SeparatorPrimitive\n data-slot=\"separator\"\n orientation={orientation}\n role={role ?? 'separator'}\n className={sharedClassName}\n {...props}\n />\n )\n}\n\nexport { Separator }\nexport type { SeparatorProps }\n"]}
|
|
@@ -9,11 +9,17 @@ declare const theme: {
|
|
|
9
9
|
lg: string;
|
|
10
10
|
xl: string;
|
|
11
11
|
};
|
|
12
|
+
color: {
|
|
13
|
+
primary: string;
|
|
14
|
+
accent: string;
|
|
15
|
+
white: string;
|
|
16
|
+
};
|
|
12
17
|
};
|
|
13
18
|
type SpinnerProps = {
|
|
14
19
|
className?: string;
|
|
15
20
|
size?: keyof typeof theme.size;
|
|
21
|
+
color?: keyof typeof theme.color;
|
|
16
22
|
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
17
|
-
declare function Spinner({ className, size, ...props }: SpinnerProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function Spinner({ className, size, color, ...props }: SpinnerProps): react_jsx_runtime.JSX.Element;
|
|
18
24
|
|
|
19
25
|
export { Spinner };
|
|
@@ -9,16 +9,27 @@ const theme = {
|
|
|
9
9
|
md: "h-6 w-6",
|
|
10
10
|
lg: "h-8 w-8",
|
|
11
11
|
xl: "h-10 w-10"
|
|
12
|
+
},
|
|
13
|
+
color: {
|
|
14
|
+
primary: "fill-primary-800 text-grey-400",
|
|
15
|
+
accent: "fill-accent-600 text-grey-400",
|
|
16
|
+
white: "fill-white text-white/30"
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
|
-
function Spinner({
|
|
19
|
+
function Spinner({
|
|
20
|
+
className,
|
|
21
|
+
size = "md",
|
|
22
|
+
color = "primary",
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
15
25
|
return /* @__PURE__ */ jsx("span", { role: "status", ...props, children: /* @__PURE__ */ jsxs(
|
|
16
26
|
"svg",
|
|
17
27
|
{
|
|
18
28
|
fill: "none",
|
|
19
29
|
viewBox: "0 0 100 101",
|
|
20
30
|
className: cn(
|
|
21
|
-
"inline animate-spin
|
|
31
|
+
"inline animate-spin",
|
|
32
|
+
theme.color[color],
|
|
22
33
|
theme.size[size],
|
|
23
34
|
className
|
|
24
35
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/spinner.tsx"],"names":[],"mappings":";;;AAKA,MAAM,KAAA,GAAQ;AAAA,EACZ,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/components/spinner.tsx"],"names":[],"mappings":";;;AAKA,MAAM,KAAA,GAAQ;AAAA,EACZ,IAAA,EAAM;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI,SAAA;AAAA,IACJ,EAAA,EAAI;AAAA,GACN;AAAA,EACA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,gCAAA;AAAA,IACT,MAAA,EAAQ,+BAAA;AAAA,IACR,KAAA,EAAO;AAAA;AAEX,CAAA;AAQA,SAAS,OAAA,CAAQ;AAAA,EACf,SAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,KAAA,GAAQ,SAAA;AAAA,EACR,GAAG;AACL,CAAA,EAAiB;AACf,EAAA,uBACE,GAAA,CAAC,MAAA,EAAA,EAAK,IAAA,EAAK,QAAA,EAAU,GAAG,KAAA,EACtB,QAAA,kBAAA,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,MAAA;AAAA,MACL,OAAA,EAAQ,aAAA;AAAA,MACR,SAAA,EAAW,EAAA;AAAA,QACT,qBAAA;AAAA,QACA,KAAA,CAAM,MAAM,KAAK,CAAA;AAAA,QACjB,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA,QACf;AAAA,OACF;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,CAAA,EAAE,8WAAA;AAAA,YACF,IAAA,EAAK;AAAA;AAAA,SACP;AAAA,wBACA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,CAAA,EAAE,+kBAAA;AAAA,YACF,IAAA,EAAK;AAAA;AAAA;AACP;AAAA;AAAA,GACF,EACF,CAAA;AAEJ","file":"spinner.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../lib/utils.js'\n\nconst theme = {\n size: {\n xs: 'h-3 w-3',\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n xl: 'h-10 w-10',\n },\n color: {\n primary: 'fill-primary-800 text-grey-400',\n accent: 'fill-accent-600 text-grey-400',\n white: 'fill-white text-white/30',\n },\n}\n\ntype SpinnerProps = {\n className?: string\n size?: keyof typeof theme.size\n color?: keyof typeof theme.color\n} & React.HTMLAttributes<HTMLSpanElement>\n\nfunction Spinner({\n className,\n size = 'md',\n color = 'primary',\n ...props\n}: SpinnerProps) {\n return (\n <span role=\"status\" {...props}>\n <svg\n fill=\"none\"\n viewBox=\"0 0 100 101\"\n className={cn(\n 'inline animate-spin',\n theme.color[color],\n theme.size[size],\n className\n )}\n >\n <path\n d=\"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z\"\n fill=\"currentFill\"\n />\n </svg>\n </span>\n )\n}\n\nexport { Spinner }\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ export { Badge, BadgeButton, badgeVariants } from './components/badge.js';
|
|
|
2
2
|
export { Button, TouchTarget, buttonVariants } from './components/button.js';
|
|
3
3
|
export { DescriptionDetails, DescriptionList, DescriptionTerm } from './components/description-list.js';
|
|
4
4
|
export { IconName, Icons } from './components/icons.js';
|
|
5
|
-
export { Link, LinkComponent, LinkProps, LinkProvider } from './components/link.js';
|
|
5
|
+
export { ExternalLink, ExternalLinkProps, Link, LinkComponent, LinkProps, LinkProvider, linkVariants } from './components/link.js';
|
|
6
6
|
export { Logo } from './components/logo.js';
|
|
7
7
|
export { Spinner } from './components/spinner.js';
|
|
8
8
|
export { aboriginal, allPalettes, brand, colorThemes, colors, diverging, semantic, sequential } from './lib/color-palette.js';
|
|
9
9
|
export { addStartStopToColorArray, colorDataArray, createColorArray, createColorData, darkenColor, generateColorThemes, generateDataVisColors, generateInterpolatedColors, getColorValue, getSurroundingColors, interpolateColors, isLightColor, lightenColor, oklchConverter, renderColorOutput, renderColorOutputToDTFM, shades, themeIndices, themeTokens } from './lib/colors.js';
|
|
10
10
|
export { ABORIGINAL_HUES, BRAND_HUES, DEFAULT_THEME, THEME_VAR_NAMES, ThemeCategory, ThemeVars, buildThemeVars, getAccentHues, getAccentSwatch, getColorHues, getHueLabel, getPrimarySwatch, resolveAccentHue, resolvePrimaryHue } from './lib/theme-palette.js';
|
|
11
11
|
export { camelCase, cn, humaniseVariant, kebabCase, truncate } from './lib/utils.js';
|
|
12
|
+
import '@base-ui/react/button';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import 'class-variance-authority/types';
|
|
14
|
-
import '@headlessui/react';
|
|
15
15
|
import 'class-variance-authority';
|
|
16
16
|
import 'react';
|
|
17
17
|
import './types/types.js';
|