@nswds/ui 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/badge.d.ts +10 -22
- package/dist/components/badge.js +22 -7
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +6 -40
- package/dist/components/button.js +8 -7
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +7 -7
- package/dist/components/card.js +22 -6
- package/dist/components/card.js.map +1 -1
- package/dist/components/description-list.d.ts +9 -3
- package/dist/components/description-list.js +6 -0
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/field.d.ts +10 -10
- package/dist/components/field.js +32 -5
- package/dist/components/field.js.map +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +7 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js +2 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/labeled-separator.d.ts +1 -1
- package/dist/components/labeled-separator.js +2 -0
- package/dist/components/labeled-separator.js.map +1 -1
- package/dist/components/link.d.ts +3 -23
- package/dist/components/link.js +8 -7
- package/dist/components/link.js.map +1 -1
- package/dist/components/logo.d.ts +3 -2
- package/dist/components/logo.js +2 -2
- package/dist/components/logo.js.map +1 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -0
- package/dist/components/separator.js.map +1 -1
- package/dist/components/spinner.d.ts +4 -2
- package/dist/components/spinner.js +2 -1
- package/dist/components/spinner.js.map +1 -1
- package/package.json +3 -4
package/dist/components/link.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import React, { createContext,
|
|
4
|
+
import React, { createContext, useContext } from 'react';
|
|
5
5
|
import { cn } from '../lib/utils.js';
|
|
6
6
|
|
|
7
7
|
const styledBase = [
|
|
@@ -82,7 +82,7 @@ const ANCHOR_ONLY_PROPS = [
|
|
|
82
82
|
"referrerPolicy",
|
|
83
83
|
"hrefLang"
|
|
84
84
|
];
|
|
85
|
-
|
|
85
|
+
function Link({ as, variant, className, ref, ...props }) {
|
|
86
86
|
const ContextLink = useContext(LinkComponentContext);
|
|
87
87
|
const component = as ?? ContextLink ?? "a";
|
|
88
88
|
const isNonAnchorIntrinsic = typeof component === "string" && component !== "a";
|
|
@@ -97,7 +97,7 @@ const Link = forwardRef(function Link2({ as, variant, className, ...props }, ref
|
|
|
97
97
|
className: cn(linkVariants({ variant }), className),
|
|
98
98
|
ref
|
|
99
99
|
});
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
function OpenInNewIcon(props) {
|
|
102
102
|
return /* @__PURE__ */ jsx(
|
|
103
103
|
"svg",
|
|
@@ -111,14 +111,15 @@ function OpenInNewIcon(props) {
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
function ExternalLink({
|
|
115
115
|
children,
|
|
116
116
|
icon,
|
|
117
117
|
newTabLabel = "(opens in a new tab)",
|
|
118
118
|
target = "_blank",
|
|
119
119
|
rel = "noopener noreferrer",
|
|
120
|
+
ref,
|
|
120
121
|
...props
|
|
121
|
-
}
|
|
122
|
+
}) {
|
|
122
123
|
const trailingIcon = icon === null ? null : icon ?? /* @__PURE__ */ jsx(OpenInNewIcon, { className: "ml-0.5" });
|
|
123
124
|
return /* @__PURE__ */ jsxs(Link, { ...props, target, rel, ref, children: [
|
|
124
125
|
children,
|
|
@@ -128,7 +129,7 @@ const ExternalLink = forwardRef(function ExternalLink2({
|
|
|
128
129
|
newTabLabel
|
|
129
130
|
] }) : null
|
|
130
131
|
] });
|
|
131
|
-
}
|
|
132
|
+
}
|
|
132
133
|
|
|
133
134
|
export { ExternalLink, Link, LinkProvider, linkVariants };
|
|
134
135
|
//# sourceMappingUR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A,GAAM,qBAAA;AAAA,EACN,GAAG;AACL,CAAA,EACA,GAAA,EACA;AACA,EAAA,MAAM,YAAA,GACJ,SAAS,IAAA,GAAO,IAAA,GAAQ,wBAAQ,GAAA,CAAC,aAAA,EAAA,EAAc,WAAU,QAAA,EAAS,CAAA;AAEpE,EAAA,4BACG,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO,MAAA,EAAgB,KAAU,GAAA,EACxC,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA,mBAAc,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA;AAAA,MAAA,GAAA;AAAA,MAAE;AAAA,KAAA,EAAY,CAAA,GAAU;AAAA,GAAA,EACnE,CAAA;AAEJ,CAAC","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] 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"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/link.tsx"],"names":[],"mappings":";;;;;AASA,MAAM,UAAA,GAAa;AAAA;AAAA,EAEjB,+EAAA;AAAA;AAAA;AAAA;AAAA,EAIA,qBAAA;AAAA,EACA,qEAAA;AAAA,EACA,4EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,2CAAA;AAAA,EACA,mEAAA;AAAA;AAAA,EAEA,mEAAA;AAAA,EACA,mHAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA;AACF,CAAA;AAEA,MAAM,YAAA,GAAe,IAAI,EAAA,EAAI;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS;AAAA,QACP,GAAG,UAAA;AAAA;AAAA,QAEH,sFAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMA,wDAAA;AAAA;AAAA,QAEA,oDAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,SAAA,EAAW;AAAA,QACT,GAAG,UAAA;AAAA,QACH;AAAA,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,GAAG,UAAA;AAAA,QACH;AAAA,OACF;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,UAAU;AAAC;AACb,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS;AAAA;AAEb,CAAC;AAWD,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;AAmBA,MAAM,iB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GAAS,QAAA;AAAA,EACT,GAAA,GAAM,qBAAA;AAAA,EACN,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsB;AACpB,EAAA,MAAM,YAAA,GACJ,SAAS,IAAA,GAAO,IAAA,GAAQ,wBAAQ,GAAA,CAAC,aAAA,EAAA,EAAc,WAAU,QAAA,EAAS,CAAA;AAEpE,EAAA,4BACG,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO,MAAA,EAAgB,KAAU,GAAA,EACxC,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA,mBAAc,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA;AAAA,MAAA,GAAA;AAAA,MAAE;AAAA,KAAA,EAAY,CAAA,GAAU;AAAA,GAAA,EACnE,CAAA;AAEJ","file":"link.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React, { createContext, 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 ref?: React.Ref<HTMLAnchorElement>\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] as const\n\nfunction Link({ as, variant, className, ref, ...props }: LinkProps) {\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 */\nfunction ExternalLink({\n children,\n icon,\n newTabLabel = '(opens in a new tab)',\n target = '_blank',\n rel = 'noopener noreferrer',\n ref,\n ...props\n}: ExternalLinkProps) {\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"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
3
3
|
|
|
4
4
|
type LogoProps = ComponentPropsWithoutRef<'svg'> & {
|
|
5
5
|
logoType?: 'default' | 'reversed' | 'mono-white' | 'mono-black';
|
|
6
|
+
ref?: Ref<SVGSVGElement>;
|
|
6
7
|
};
|
|
7
|
-
declare function Logo({ logoType, ...props }: LogoProps): React.JSX.Element;
|
|
8
|
+
declare function Logo({ logoType, ref, ...props }: LogoProps): React.JSX.Element;
|
|
8
9
|
|
|
9
10
|
export { Logo, type LogoProps };
|
package/dist/components/logo.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
|
-
function Logo({ logoType = "default", ...props }) {
|
|
4
|
+
function Logo({ logoType = "default", ref, ...props }) {
|
|
5
5
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6
6
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "NSW Government" }),
|
|
7
|
-
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 259 280", "aria-hidden": "true", ...props, children: [
|
|
7
|
+
/* @__PURE__ */ jsxs("svg", { ref, viewBox: "0 0 259 280", "aria-hidden": "true", ...props, children: [
|
|
8
8
|
/* @__PURE__ */ jsx(
|
|
9
9
|
"path",
|
|
10
10
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/logo.tsx"],"names":[],"mappings":";;;AAOO,SAAS,KAAK,EAAE,QAAA,GAAW,SAAA,EAAW,GAAG,OAAM,EAAc;AAClE,EAA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AAA;AAAA,UACC,CAAA,EAAE,ueAAA;AAAA,UACF,SAAA,EAAW,IAAA;AAAA,YAAA,CACR,QAAA,KAAa,SAAA,IAAa,QAAA,KAAa,UAAA,KACtC,kCAAA;AAAA,YACF,aAAa,YAAA,IAAgB,YAAA;AAAA,YAC7B,aAAa,YAAA,IAAgB;AAAA;AAC/B;AAAA;AACF,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"logo.js","sourcesContent":["import clsx from 'clsx'\nimport type { ComponentPropsWithoutRef } from 'react'\n\ntype LogoProps = ComponentPropsWithoutRef<'svg'> & {\n logoType?: 'default' | 'reversed' | 'mono-white' | 'mono-black'\n}\n\nexport function Logo({ logoType = 'default', ...props }: LogoProps) {\n return (\n <>\n <span className=\"sr-only\">NSW Government</span>\n <svg viewBox=\"0 0 259 280\" aria-hidden=\"true\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M24.208 270.207h-5.045v-4.277l11.15.054v13.676H26.08v-2.491c-.266.278-.553.556-.86.833-.673.585-1.49 1.07-2.433 1.434-.96.373-2.143.564-3.513.564-2.33 0-4.385-.539-6.109-1.6-1.727-1.065-3.073-2.594-4.007-4.538-.926-1.927-1.395-4.231-1.395-6.85 0-2.657.494-4.994 1.47-6.946.971-1.96 2.363-3.498 4.132-4.571 1.768-1.065 3.849-1.604 6.183-1.604 1.515 0 2.915.245 4.156.725 1.255.485 2.36 1.157 3.273 1.985a9.61 9.61 0 0 1 2.192 2.852 8.196 8.196 0 0 1 .872 3.319l.021.435h-6.038l-.062-.339a5.22 5.22 0 0 0-.814-1.981 4.562 4.562 0 0 0-1.537-1.43c-.614-.352-1.345-.531-2.175-.531-1.005 0-1.931.261-2.741.775-.806.51-1.458 1.351-1.935 2.495-.486 1.169-.731 2.74-.731 4.679 0 1.579.162 2.897.482 3.925.311 1.011.739 1.819 1.266 2.403.523.581 1.117.991 1.773 1.219a6.036 6.036 0 0 0 2.089.369c.669 0 1.27-.112 1.79-.328.523-.224.98-.514 1.354-.866.377-.356.676-.746.884-1.152.216-.41.349-.816.399-1.21l.14-1.028Zm20.878-16.312c2.354 0 4.435.534 6.179 1.587 1.752 1.061 3.13 2.59 4.086 4.546.947 1.935 1.428 4.281 1.428 6.967 0 2.648-.473 4.969-1.412 6.9-.946 1.948-2.317 3.469-4.073 4.521-1.744 1.053-3.837 1.583-6.212 1.583-2.396 0-4.502-.534-6.254-1.583-1.753-1.044-3.135-2.557-4.099-4.505-.947-1.927-1.428-4.252-1.428-6.912 0-2.673.486-5.015 1.449-6.954.968-1.956 2.355-3.486 4.12-4.551 1.764-1.061 3.853-1.599 6.216-1.599Zm0 21.185c1.117 0 2.093-.265 2.898-.787.802-.523 1.433-1.372 1.881-2.516.453-1.185.686-2.772.686-4.712 0-1.993-.237-3.618-.698-4.832-.444-1.181-1.08-2.056-1.885-2.603-.814-.543-1.782-.82-2.878-.82-1.1 0-2.072.277-2.886.82-.81.543-1.453 1.422-1.906 2.611-.47 1.223-.706 2.843-.706 4.82 0 1.944.237 3.531.702 4.712.452 1.148 1.092 1.997 1.902 2.515.81.527 1.781.792 2.89.792Zm23.764-2.93-6.162-17.829H57.09l8.654 25.251h6.195l8.73-25.251h-5.607L68.85 272.15Zm30.312-2.827H88.863v5.206l12.043.016v5.027H83.103v-25.251h17.632l-.016 4.99H88.892v5.089h10.27v4.923Zm22.482-1.529c.685-.613 1.246-1.401 1.678-2.341.419-.933.635-2.081.635-3.419 0-1.497-.311-2.835-.93-3.983-.619-1.169-1.599-2.093-2.919-2.756-1.3-.647-2.973-.974-4.975-.974h-10.738v25.243h5.759v-9.404h4.24l3.991 9.404h6.046l-4.651-10.456c.673-.357 1.3-.8 1.864-1.314Zm-3.513-5.64c0 .999-.336 1.79-1.025 2.428-.69.63-1.649.949-2.857.949h-4.095v-6.606h4.456c1.038 0 1.873.286 2.545.875.657.576.976 1.347.976 2.354Zm15.159-7.833 10.527 15.23v-15.23h5.776v25.251h-5.086l-10.98-15.86v15.86h-5.759v-25.251h5.522Zm33.949 16.461-5.29-16.461h-7.894v25.251h5.809v-16.266l5.124 16.266h4.485l5.162-16.357v16.357h5.826v-25.251h-7.878l-5.344 16.461Zm33.727-1.459h-10.298v5.206l12.046.016v5.027h-17.806v-25.251h17.636l-.021 4.99h-11.818v5.089h10.261v4.923Zm21.494.228-10.523-15.23h-5.527v25.251h5.756v-15.86l10.979 15.86h5.087v-25.251h-5.772v15.23Zm15.586-10.004h-7.388v-5.226h20.402v5.226h-7.217v20.025h-5.797v-20.025Z\"\n className={clsx(\n logoType === 'default' && 'fill-nsw-blue-800 dark:fill-white',\n (logoType === 'reversed' || logoType === 'mono-white') &&\n 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M146.699 209.236c-1.482-2.395-3.717-4.571-6.64-6.465-2.919-1.894-6.897-3.34-11.81-4.297l-13.678-2.814c-4.132-.891-6.981-2.043-8.468-3.419-1.449-1.343-2.184-3.129-2.184-5.309 0-1.388.316-2.652.943-3.759.623-1.111 1.528-2.093 2.687-2.922 1.166-.828 2.616-1.483 4.306-1.943 1.711-.469 3.633-.705 5.714-.705 2.74 0 5.211.361 7.346 1.078 2.109.713 3.857 1.881 5.194 3.481 1.338 1.6 2.16 3.775 2.442 6.465l.038.373h16.971l-.008-.427c-.075-4.575-1.371-8.773-3.85-12.474-2.483-3.705-6.141-6.681-10.879-8.852-4.726-2.164-10.623-3.262-17.528-3.262-5.801 0-11.117 1.011-15.805 3.009-4.7 2.002-8.475 4.89-11.212 8.587-2.749 3.717-4.12 8.164-4.078 13.224.112 6.175 1.99 11.186 5.577 14.903 3.576 3.697 8.476 6.158 14.567 7.306l13.795 2.81c2.529.502 4.825 1.16 6.823 1.96 1.96.784 3.525 1.803 4.651 3.03 1.1 1.197 1.657 2.772 1.657 4.67 0 2.114-.694 3.9-2.06 5.301-1.4 1.434-3.301 2.515-5.643 3.224-2.388.721-5.058 1.086-7.936 1.086-2.807 0-5.394-.435-7.686-1.297-2.28-.85-4.194-2.093-5.689-3.693-1.491-1.591-2.513-3.585-3.04-5.918l-.075-.327H83.846l.045.46c.407 4.045 1.666 7.629 3.738 10.659 2.068 3.009 4.717 5.545 7.873 7.551 3.148 1.993 6.677 3.514 10.494 4.513a46.33 46.33 0 0 0 11.693 1.5c6.466 0 12.2-1.019 17.046-3.034 4.867-2.022 8.717-4.807 11.449-8.276 2.753-3.493 4.148-7.476 4.148-11.848 0-2.064-.232-4.36-.697-6.822-.478-2.482-1.466-4.948-2.936-7.327ZM25.937 191.763l36.916 53.312H77.87v-79.724H61.072v51.282L25.754 165.53l-.125-.179H9.19v79.724h16.748v-53.312Zm196.637 24.577 14.388-50.987h16.457l-23.587 79.724h-13.367l-14.554-50.469-14.659 50.469h-13.147l-23.533-79.724h16.511l14.384 50.979 14.389-50.979h12.167l14.551 50.987Z\"\n className={clsx(\n logoType === 'default' && 'fill-nsw-blue-800 dark:fill-white',\n (logoType === 'reversed' || logoType === 'mono-white') &&\n 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n d=\"M122.291 145.572c-19.75-2.424-38.934 3.904-72.69-5.263-3.447-.937-4.718 2.694-2.854 5.736 9.07 14.803 54.881 3.203 75.635 1.065.906-.095.814-1.426-.091-1.538ZM208.735 140.309c-33.756 9.167-52.941 2.839-72.691 5.263-.905.112-1 1.447-.091 1.538 20.759 2.138 66.566 13.738 75.635-1.065 1.864-3.042.594-6.673-2.853-5.736ZM59.882 119.132c-6.864-10.058-12.474-21.31-16.818-33.69-13.101 3.826-26.51 9.346-40.16 16.57a5.388 5.388 0 0 0-2.902 4.67 5.38 5.38 0 0 0 2.653 4.812c26.431 15.802 52.273 24.841 76.93 26.933-7.34-4.475-14.072-11.044-19.703-19.295ZM23.059 85.513a201.529 201.529 0 0 1 17.976-6.233c-2.126-6.896-3.87-14.12-5.249-21.658-6.827-.85-13.89-1.4-21.199-1.641-.062 0-.128-.004-.19-.004a5.391 5.391 0 0 0-4.647 2.602 5.383 5.383 0 0 0-.12 5.483c4.243 7.659 8.724 14.808 13.429 21.45ZM88.005 135.572c4.099 1.807 8.293 2.818 12.358 3.029-9.953-7.12-17.773-19.192-22.278-34.58-5.805-19.81-7.745-41.666-5.83-65.247-7.832-4.936-16.32-9.557-25.46-13.85a5.428 5.428 0 0 0-5.402.43 5.396 5.396 0 0 0-2.388 4.841c2.126 34.215 10.95 62.915 26.223 85.298 6.404 9.391 14.281 16.332 22.777 20.079ZM107.488 23.577A253.323 253.323 0 0 0 92.235 6.735c-1.063-1.078-2.433-1.65-3.85-1.65-.506 0-1.017.075-1.523.224-1.923.568-3.314 2.106-3.733 4.115-1.072 5.164-3.11 15.69-4.012 26.101 7.014 4.613 13.492 9.49 19.426 14.621 2.3-8.757 5.29-17.63 8.945-26.569ZM255.42 102.007c-13.65-7.223-27.058-12.744-40.16-16.569-4.343 12.38-9.953 23.631-16.818 33.689-5.63 8.255-12.362 14.82-19.708 19.296 24.658-2.093 50.5-11.132 76.931-26.934 1.715-1.024 2.707-2.822 2.653-4.811-.045-1.99-1.133-3.734-2.898-4.671ZM235.273 85.513c4.705-6.643 9.186-13.796 13.43-21.455.963-1.74.922-3.788-.121-5.483a5.4 5.4 0 0 0-4.837-2.598c-7.309.24-14.377.796-21.199 1.641-1.375 7.539-3.123 14.762-5.249 21.658a203.803 203.803 0 0 1 17.976 6.237ZM180.247 104.025c-4.505 15.384-12.329 27.46-22.278 34.58 4.065-.211 8.263-1.227 12.358-3.034 8.496-3.746 16.373-10.688 22.777-20.075 15.273-22.383 24.097-51.082 26.223-85.297a5.394 5.394 0 0 0-2.388-4.84 5.428 5.428 0 0 0-5.402-.432c-9.14 4.29-17.628 8.91-25.46 13.85 1.915 23.582-.029 45.434-5.83 65.248ZM179.214 35.52c-.901-10.406-2.94-20.932-4.011-26.1-.416-2.01-1.811-3.547-3.733-4.115a5.39 5.39 0 0 0-1.524-.224c-1.416 0-2.787.572-3.85 1.65-5.485 5.549-10.568 11.164-15.252 16.842 3.654 8.939 6.644 17.812 8.949 26.565 5.934-5.127 12.407-10.005 19.421-14.617ZM129.144 87.229c6.64-13.092 17.246-24.829 25.21-32.243-4.372-17.779-11.104-34.55-20.397-52.097C132.998 1.078 131.195 0 129.148 0s-3.845 1.082-4.808 2.889c-9.389 17.604-16.237 35.122-20.377 52.093 8.313 7.688 19.28 20.224 25.181 32.247Z\"\n className={clsx(\n (logoType === 'default' || logoType === 'reversed') &&\n 'fill-nsw-red-600 dark:fill-white',\n logoType === 'mono-white' && 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n d=\"M153.541 133.686c6.885-4.833 13.77-13.254 18.139-24.97 8.458-22.681 9.334-47.945 8.122-65.823-15.331 10.215-39.665 31.55-47.975 54.36-3.911 10.734-5.734 25.355-2.72 33.511 1.259 3.411 3.401 5.997 6.345 7.227 4.46 1.865 11.312.456 18.089-4.305ZM125.713 95.261c-2.027-4.724-4.261-9.18-7.728-14.186-9.809-14.16-23.026-26.933-39.475-38.185-.17 2.652-2.57 31.297 5.851 59.304 6.408 21.302 17.354 29.98 23.354 33.333 6.038 3.369 11.561 4.165 18.039 2.557-6.565-8.935-5.747-27.27-.041-42.823Z\"\n className={clsx(\n (logoType === 'default' || logoType === 'reversed') &&\n 'fill-nsw-red-600 dark:fill-white',\n logoType === 'mono-white' && 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n </svg>\n </>\n )\n}\n\nexport type { LogoProps }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/logo.tsx"],"names":[],"mappings":";;;AAQO,SAAS,KAAK,EAAE,QAAA,GAAW,WAAW,GAAA,EAAK,GAAG,OAAM,EAAc;AACvE,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU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a,SAAA,IAAa,QAAA,KAAa,UAAA,KACtC,kCAAA;AAAA,YACF,aAAa,YAAA,IAAgB,YAAA;AAAA,YAC7B,aAAa,YAAA,IAAgB;AAAA;AAC/B;AAAA;AACF,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"logo.js","sourcesContent":["import clsx from 'clsx'\nimport type { ComponentPropsWithoutRef, Ref } from 'react'\n\ntype LogoProps = ComponentPropsWithoutRef<'svg'> & {\n logoType?: 'default' | 'reversed' | 'mono-white' | 'mono-black'\n ref?: Ref<SVGSVGElement>\n}\n\nexport function Logo({ logoType = 'default', ref, ...props }: LogoProps) {\n return (\n <>\n <span className=\"sr-only\">NSW Government</span>\n <svg ref={ref} viewBox=\"0 0 259 280\" aria-hidden=\"true\" {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M24.208 270.207h-5.045v-4.277l11.15.054v13.676H26.08v-2.491c-.266.278-.553.556-.86.833-.673.585-1.49 1.07-2.433 1.434-.96.373-2.143.564-3.513.564-2.33 0-4.385-.539-6.109-1.6-1.727-1.065-3.073-2.594-4.007-4.538-.926-1.927-1.395-4.231-1.395-6.85 0-2.657.494-4.994 1.47-6.946.971-1.96 2.363-3.498 4.132-4.571 1.768-1.065 3.849-1.604 6.183-1.604 1.515 0 2.915.245 4.156.725 1.255.485 2.36 1.157 3.273 1.985a9.61 9.61 0 0 1 2.192 2.852 8.196 8.196 0 0 1 .872 3.319l.021.435h-6.038l-.062-.339a5.22 5.22 0 0 0-.814-1.981 4.562 4.562 0 0 0-1.537-1.43c-.614-.352-1.345-.531-2.175-.531-1.005 0-1.931.261-2.741.775-.806.51-1.458 1.351-1.935 2.495-.486 1.169-.731 2.74-.731 4.679 0 1.579.162 2.897.482 3.925.311 1.011.739 1.819 1.266 2.403.523.581 1.117.991 1.773 1.219a6.036 6.036 0 0 0 2.089.369c.669 0 1.27-.112 1.79-.328.523-.224.98-.514 1.354-.866.377-.356.676-.746.884-1.152.216-.41.349-.816.399-1.21l.14-1.028Zm20.878-16.312c2.354 0 4.435.534 6.179 1.587 1.752 1.061 3.13 2.59 4.086 4.546.947 1.935 1.428 4.281 1.428 6.967 0 2.648-.473 4.969-1.412 6.9-.946 1.948-2.317 3.469-4.073 4.521-1.744 1.053-3.837 1.583-6.212 1.583-2.396 0-4.502-.534-6.254-1.583-1.753-1.044-3.135-2.557-4.099-4.505-.947-1.927-1.428-4.252-1.428-6.912 0-2.673.486-5.015 1.449-6.954.968-1.956 2.355-3.486 4.12-4.551 1.764-1.061 3.853-1.599 6.216-1.599Zm0 21.185c1.117 0 2.093-.265 2.898-.787.802-.523 1.433-1.372 1.881-2.516.453-1.185.686-2.772.686-4.712 0-1.993-.237-3.618-.698-4.832-.444-1.181-1.08-2.056-1.885-2.603-.814-.543-1.782-.82-2.878-.82-1.1 0-2.072.277-2.886.82-.81.543-1.453 1.422-1.906 2.611-.47 1.223-.706 2.843-.706 4.82 0 1.944.237 3.531.702 4.712.452 1.148 1.092 1.997 1.902 2.515.81.527 1.781.792 2.89.792Zm23.764-2.93-6.162-17.829H57.09l8.654 25.251h6.195l8.73-25.251h-5.607L68.85 272.15Zm30.312-2.827H88.863v5.206l12.043.016v5.027H83.103v-25.251h17.632l-.016 4.99H88.892v5.089h10.27v4.923Zm22.482-1.529c.685-.613 1.246-1.401 1.678-2.341.419-.933.635-2.081.635-3.419 0-1.497-.311-2.835-.93-3.983-.619-1.169-1.599-2.093-2.919-2.756-1.3-.647-2.973-.974-4.975-.974h-10.738v25.243h5.759v-9.404h4.24l3.991 9.404h6.046l-4.651-10.456c.673-.357 1.3-.8 1.864-1.314Zm-3.513-5.64c0 .999-.336 1.79-1.025 2.428-.69.63-1.649.949-2.857.949h-4.095v-6.606h4.456c1.038 0 1.873.286 2.545.875.657.576.976 1.347.976 2.354Zm15.159-7.833 10.527 15.23v-15.23h5.776v25.251h-5.086l-10.98-15.86v15.86h-5.759v-25.251h5.522Zm33.949 16.461-5.29-16.461h-7.894v25.251h5.809v-16.266l5.124 16.266h4.485l5.162-16.357v16.357h5.826v-25.251h-7.878l-5.344 16.461Zm33.727-1.459h-10.298v5.206l12.046.016v5.027h-17.806v-25.251h17.636l-.021 4.99h-11.818v5.089h10.261v4.923Zm21.494.228-10.523-15.23h-5.527v25.251h5.756v-15.86l10.979 15.86h5.087v-25.251h-5.772v15.23Zm15.586-10.004h-7.388v-5.226h20.402v5.226h-7.217v20.025h-5.797v-20.025Z\"\n className={clsx(\n logoType === 'default' && 'fill-nsw-blue-800 dark:fill-white',\n (logoType === 'reversed' || logoType === 'mono-white') &&\n 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M146.699 209.236c-1.482-2.395-3.717-4.571-6.64-6.465-2.919-1.894-6.897-3.34-11.81-4.297l-13.678-2.814c-4.132-.891-6.981-2.043-8.468-3.419-1.449-1.343-2.184-3.129-2.184-5.309 0-1.388.316-2.652.943-3.759.623-1.111 1.528-2.093 2.687-2.922 1.166-.828 2.616-1.483 4.306-1.943 1.711-.469 3.633-.705 5.714-.705 2.74 0 5.211.361 7.346 1.078 2.109.713 3.857 1.881 5.194 3.481 1.338 1.6 2.16 3.775 2.442 6.465l.038.373h16.971l-.008-.427c-.075-4.575-1.371-8.773-3.85-12.474-2.483-3.705-6.141-6.681-10.879-8.852-4.726-2.164-10.623-3.262-17.528-3.262-5.801 0-11.117 1.011-15.805 3.009-4.7 2.002-8.475 4.89-11.212 8.587-2.749 3.717-4.12 8.164-4.078 13.224.112 6.175 1.99 11.186 5.577 14.903 3.576 3.697 8.476 6.158 14.567 7.306l13.795 2.81c2.529.502 4.825 1.16 6.823 1.96 1.96.784 3.525 1.803 4.651 3.03 1.1 1.197 1.657 2.772 1.657 4.67 0 2.114-.694 3.9-2.06 5.301-1.4 1.434-3.301 2.515-5.643 3.224-2.388.721-5.058 1.086-7.936 1.086-2.807 0-5.394-.435-7.686-1.297-2.28-.85-4.194-2.093-5.689-3.693-1.491-1.591-2.513-3.585-3.04-5.918l-.075-.327H83.846l.045.46c.407 4.045 1.666 7.629 3.738 10.659 2.068 3.009 4.717 5.545 7.873 7.551 3.148 1.993 6.677 3.514 10.494 4.513a46.33 46.33 0 0 0 11.693 1.5c6.466 0 12.2-1.019 17.046-3.034 4.867-2.022 8.717-4.807 11.449-8.276 2.753-3.493 4.148-7.476 4.148-11.848 0-2.064-.232-4.36-.697-6.822-.478-2.482-1.466-4.948-2.936-7.327ZM25.937 191.763l36.916 53.312H77.87v-79.724H61.072v51.282L25.754 165.53l-.125-.179H9.19v79.724h16.748v-53.312Zm196.637 24.577 14.388-50.987h16.457l-23.587 79.724h-13.367l-14.554-50.469-14.659 50.469h-13.147l-23.533-79.724h16.511l14.384 50.979 14.389-50.979h12.167l14.551 50.987Z\"\n className={clsx(\n logoType === 'default' && 'fill-nsw-blue-800 dark:fill-white',\n (logoType === 'reversed' || logoType === 'mono-white') &&\n 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n d=\"M122.291 145.572c-19.75-2.424-38.934 3.904-72.69-5.263-3.447-.937-4.718 2.694-2.854 5.736 9.07 14.803 54.881 3.203 75.635 1.065.906-.095.814-1.426-.091-1.538ZM208.735 140.309c-33.756 9.167-52.941 2.839-72.691 5.263-.905.112-1 1.447-.091 1.538 20.759 2.138 66.566 13.738 75.635-1.065 1.864-3.042.594-6.673-2.853-5.736ZM59.882 119.132c-6.864-10.058-12.474-21.31-16.818-33.69-13.101 3.826-26.51 9.346-40.16 16.57a5.388 5.388 0 0 0-2.902 4.67 5.38 5.38 0 0 0 2.653 4.812c26.431 15.802 52.273 24.841 76.93 26.933-7.34-4.475-14.072-11.044-19.703-19.295ZM23.059 85.513a201.529 201.529 0 0 1 17.976-6.233c-2.126-6.896-3.87-14.12-5.249-21.658-6.827-.85-13.89-1.4-21.199-1.641-.062 0-.128-.004-.19-.004a5.391 5.391 0 0 0-4.647 2.602 5.383 5.383 0 0 0-.12 5.483c4.243 7.659 8.724 14.808 13.429 21.45ZM88.005 135.572c4.099 1.807 8.293 2.818 12.358 3.029-9.953-7.12-17.773-19.192-22.278-34.58-5.805-19.81-7.745-41.666-5.83-65.247-7.832-4.936-16.32-9.557-25.46-13.85a5.428 5.428 0 0 0-5.402.43 5.396 5.396 0 0 0-2.388 4.841c2.126 34.215 10.95 62.915 26.223 85.298 6.404 9.391 14.281 16.332 22.777 20.079ZM107.488 23.577A253.323 253.323 0 0 0 92.235 6.735c-1.063-1.078-2.433-1.65-3.85-1.65-.506 0-1.017.075-1.523.224-1.923.568-3.314 2.106-3.733 4.115-1.072 5.164-3.11 15.69-4.012 26.101 7.014 4.613 13.492 9.49 19.426 14.621 2.3-8.757 5.29-17.63 8.945-26.569ZM255.42 102.007c-13.65-7.223-27.058-12.744-40.16-16.569-4.343 12.38-9.953 23.631-16.818 33.689-5.63 8.255-12.362 14.82-19.708 19.296 24.658-2.093 50.5-11.132 76.931-26.934 1.715-1.024 2.707-2.822 2.653-4.811-.045-1.99-1.133-3.734-2.898-4.671ZM235.273 85.513c4.705-6.643 9.186-13.796 13.43-21.455.963-1.74.922-3.788-.121-5.483a5.4 5.4 0 0 0-4.837-2.598c-7.309.24-14.377.796-21.199 1.641-1.375 7.539-3.123 14.762-5.249 21.658a203.803 203.803 0 0 1 17.976 6.237ZM180.247 104.025c-4.505 15.384-12.329 27.46-22.278 34.58 4.065-.211 8.263-1.227 12.358-3.034 8.496-3.746 16.373-10.688 22.777-20.075 15.273-22.383 24.097-51.082 26.223-85.297a5.394 5.394 0 0 0-2.388-4.84 5.428 5.428 0 0 0-5.402-.432c-9.14 4.29-17.628 8.91-25.46 13.85 1.915 23.582-.029 45.434-5.83 65.248ZM179.214 35.52c-.901-10.406-2.94-20.932-4.011-26.1-.416-2.01-1.811-3.547-3.733-4.115a5.39 5.39 0 0 0-1.524-.224c-1.416 0-2.787.572-3.85 1.65-5.485 5.549-10.568 11.164-15.252 16.842 3.654 8.939 6.644 17.812 8.949 26.565 5.934-5.127 12.407-10.005 19.421-14.617ZM129.144 87.229c6.64-13.092 17.246-24.829 25.21-32.243-4.372-17.779-11.104-34.55-20.397-52.097C132.998 1.078 131.195 0 129.148 0s-3.845 1.082-4.808 2.889c-9.389 17.604-16.237 35.122-20.377 52.093 8.313 7.688 19.28 20.224 25.181 32.247Z\"\n className={clsx(\n (logoType === 'default' || logoType === 'reversed') &&\n 'fill-nsw-red-600 dark:fill-white',\n logoType === 'mono-white' && 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n\n <path\n d=\"M153.541 133.686c6.885-4.833 13.77-13.254 18.139-24.97 8.458-22.681 9.334-47.945 8.122-65.823-15.331 10.215-39.665 31.55-47.975 54.36-3.911 10.734-5.734 25.355-2.72 33.511 1.259 3.411 3.401 5.997 6.345 7.227 4.46 1.865 11.312.456 18.089-4.305ZM125.713 95.261c-2.027-4.724-4.261-9.18-7.728-14.186-9.809-14.16-23.026-26.933-39.475-38.185-.17 2.652-2.57 31.297 5.851 59.304 6.408 21.302 17.354 29.98 23.354 33.333 6.038 3.369 11.561 4.165 18.039 2.557-6.565-8.935-5.747-27.27-.041-42.823Z\"\n className={clsx(\n (logoType === 'default' || logoType === 'reversed') &&\n 'fill-nsw-red-600 dark:fill-white',\n logoType === 'mono-white' && 'fill-white',\n logoType === 'mono-black' && 'fill-black dark:fill-white'\n )}\n />\n </svg>\n </>\n )\n}\n\nexport type { LogoProps }\n"]}
|
|
@@ -10,6 +10,6 @@ type SeparatorProps = Separator$1.Props & {
|
|
|
10
10
|
*/
|
|
11
11
|
decorative?: boolean;
|
|
12
12
|
};
|
|
13
|
-
declare function Separator({ className, orientation, decorative, role, ...props }: SeparatorProps): React.JSX.Element;
|
|
13
|
+
declare function Separator({ className, orientation, decorative, role, ref, ...props }: SeparatorProps): React.JSX.Element;
|
|
14
14
|
|
|
15
15
|
export { Separator, type SeparatorProps };
|
|
@@ -8,6 +8,7 @@ function Separator({
|
|
|
8
8
|
orientation = "horizontal",
|
|
9
9
|
decorative = false,
|
|
10
10
|
role,
|
|
11
|
+
ref,
|
|
11
12
|
...props
|
|
12
13
|
}) {
|
|
13
14
|
const sharedClassName = cn(
|
|
@@ -19,6 +20,7 @@ function Separator({
|
|
|
19
20
|
return /* @__PURE__ */ jsx(
|
|
20
21
|
"div",
|
|
21
22
|
{
|
|
23
|
+
ref,
|
|
22
24
|
"data-slot": "separator",
|
|
23
25
|
"data-orientation": orientation,
|
|
24
26
|
role: "none",
|
|
@@ -30,6 +32,7 @@ function Separator({
|
|
|
30
32
|
return /* @__PURE__ */ jsx(
|
|
31
33
|
Separator$1,
|
|
32
34
|
{
|
|
35
|
+
ref,
|
|
33
36
|
"data-slot": "separator",
|
|
34
37
|
orientation,
|
|
35
38
|
role: role ?? "separator",
|
|
@@ -1 +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"]}
|
|
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,GAAA;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,GAAA;AAAA,QACA,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,GAAA;AAAA,MACA,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 ref,\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 ref={ref as React.Ref<HTMLDivElement>}\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 ref={ref}\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"]}
|
|
@@ -28,7 +28,9 @@ type SpinnerProps = {
|
|
|
28
28
|
* already conveys the busy state (e.g. inside a Button with a label).
|
|
29
29
|
*/
|
|
30
30
|
label?: string;
|
|
31
|
-
} & React.HTMLAttributes<HTMLSpanElement
|
|
32
|
-
|
|
31
|
+
} & React.HTMLAttributes<HTMLSpanElement> & {
|
|
32
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
33
|
+
};
|
|
34
|
+
declare function Spinner({ className, svgClassName, size, color, label, ref, ...props }: SpinnerProps): React.JSX.Element;
|
|
33
35
|
|
|
34
36
|
export { Spinner, type SpinnerProps };
|
|
@@ -27,9 +27,10 @@ function Spinner({
|
|
|
27
27
|
size = "md",
|
|
28
28
|
color = "primary",
|
|
29
29
|
label = "Loading",
|
|
30
|
+
ref,
|
|
30
31
|
...props
|
|
31
32
|
}) {
|
|
32
|
-
return /* @__PURE__ */ jsxs("span", { role: "status", className, ...props, children: [
|
|
33
|
+
return /* @__PURE__ */ jsxs("span", { ref, role: "status", className, ...props, children: [
|
|
33
34
|
/* @__PURE__ */ jsxs(
|
|
34
35
|
"svg",
|
|
35
36
|
{
|
|
@@ -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,GACN;AAAA,EACA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,gCAAA;AAAA,IACT,MAAA,EAAQ,+BAAA;AAAA,IACR,KAAA,EAAO,0BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKP,OAAA,EAAS;AAAA;AAEb,CAAA;
|
|
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,0BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKP,OAAA,EAAS;AAAA;AAEb,CAAA;AAmBA,SAAS,OAAA,CAAQ;AAAA,EACf,SAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiB;AACf,EAAA,4BACG,MAAA,EAAA,EAAK,GAAA,EAAU,MAAK,QAAA,EAAS,SAAA,EAAuB,GAAG,KAAA,EACtD,QAAA,EAAA;AAAA,oBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,MAAA;AAAA,QACL,OAAA,EAAQ,aAAA;AAAA,QACR,aAAA,EAAY,MAAA;AAAA,QACZ,SAAA,EAAW,EAAA;AAAA,UACT,gDAAA;AAAA,UACA,KAAA,CAAM,MAAM,KAAK,CAAA;AAAA,UACjB,KAAA,CAAM,KAAK,IAAI,CAAA;AAAA,UACf;AAAA,SACF;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,CAAA,EAAE,8WAAA;AAAA,cACF,IAAA,EAAK;AAAA;AAAA,WACP;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,CAAA,EAAE,+kBAAA;AAAA,cACF,IAAA,EAAK;AAAA;AAAA;AACP;AAAA;AAAA,KACF;AAAA,IACC,wBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAW,iBAAM,CAAA,GAAU;AAAA,GAAA,EACtD,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 // Inherit the surrounding text colour (e.g. inside a Button, where the\n // text colour varies per variant/colour). The arc uses currentColor at\n // full strength; the track is the same colour dimmed via opacity on the\n // first <path>, so the two-tone effect works from a single hue.\n current: 'fill-current text-current [&>path:first-child]:opacity-25',\n },\n}\n\ntype SpinnerProps = {\n /** Applied to the outer status element, like every other spread prop. */\n className?: string\n /** Applied to the inner svg (sizing/colour live there). */\n svgClassName?: string\n size?: keyof typeof theme.size\n color?: keyof typeof theme.color\n /**\n * Accessible name announced for the `role=\"status\"` element. Defaults to\n * \"Loading\"; pass an empty string to suppress when surrounding content\n * already conveys the busy state (e.g. inside a Button with a label).\n */\n label?: string\n} & React.HTMLAttributes<HTMLSpanElement> & {\n ref?: React.Ref<HTMLSpanElement>\n }\n\nfunction Spinner({\n className,\n svgClassName,\n size = 'md',\n color = 'primary',\n label = 'Loading',\n ref,\n ...props\n}: SpinnerProps) {\n return (\n <span ref={ref} role=\"status\" className={className} {...props}>\n <svg\n fill=\"none\"\n viewBox=\"0 0 100 101\"\n aria-hidden=\"true\"\n className={cn(\n 'inline animate-spin motion-reduce:animate-none',\n theme.color[color],\n theme.size[size],\n svgClassName\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 {label ? <span className=\"sr-only\">{label}</span> : null}\n </span>\n )\n}\n\nexport { Spinner }\nexport type { SpinnerProps }\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nswds/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "UI components for NSW Government digital products, providing reusable design elements and patterns for consistent user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/digitalnsw/nswds-ui#readme",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"check:icons": "node scripts/generate-icons.mjs check",
|
|
44
44
|
"check:package": "publint --strict && attw --pack . --profile esm-only --exclude-entrypoints ./postcss.config",
|
|
45
45
|
"lint": "eslint",
|
|
46
|
-
"format": "prettier --write \"**/*.{ts,tsx}\"",
|
|
47
46
|
"registry:build": "npm run registry:validate && shadcn build registry.json --cwd . --output ../../apps/registry/public/r && node scripts/rewrite-registry-aliases.mjs ../../apps/registry/public/r",
|
|
48
47
|
"registry:validate": "shadcn registry validate registry.json --cwd .",
|
|
49
48
|
"typecheck": "tsc --noEmit"
|
|
@@ -56,8 +55,8 @@
|
|
|
56
55
|
"tailwind-merge": "^3.6.0"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
|
-
"react": "^
|
|
60
|
-
"react-dom": "^
|
|
58
|
+
"react": "^19.0.0",
|
|
59
|
+
"react-dom": "^19.0.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@arethetypeswrong/cli": "^0.18.3",
|