@nswds/ui 6.0.0 → 7.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/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +9 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/header.d.ts +1 -1
- package/dist/components/input-group.d.ts +19 -1
- package/dist/components/input-group.js +356 -16
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/link.d.ts +1 -1
- package/dist/components/masthead.d.ts +1 -1
- package/dist/components/skip-link.d.ts +1 -1
- package/dist/components/textarea.d.ts +4 -2
- package/dist/components/textarea.js +48 -11
- package/dist/components/textarea.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +4 -4
|
@@ -1,17 +1,54 @@
|
|
|
1
|
+
"use client"
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Input } from '@base-ui/react/input';
|
|
2
4
|
import { cn } from '../lib/utils.js';
|
|
3
5
|
|
|
4
|
-
function Textarea({ className, ...props }) {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
function Textarea({ className, ref, ...props }) {
|
|
7
|
+
return (
|
|
8
|
+
// Base UI's Input IS `Field.Control`, so rendering it as a `<textarea>`
|
|
9
|
+
// buys the multi-line control the same Field wiring the single-line Input
|
|
10
|
+
// already has: inside a `<Field>` it is the registered control, so the
|
|
11
|
+
// label association, `aria-describedby` for the description/error and
|
|
12
|
+
// `aria-invalid` are handled for us. The primitive is typed for `<input>`,
|
|
13
|
+
// hence the cast on the otherwise-identical props.
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
Input,
|
|
16
|
+
{
|
|
17
|
+
ref,
|
|
18
|
+
render: /* @__PURE__ */ jsx("textarea", {}),
|
|
19
|
+
"data-slot": "textarea",
|
|
20
|
+
className: cn(
|
|
21
|
+
// No `outline-none` here: it sets `--tw-outline-style: none` globally
|
|
22
|
+
// on the element, which then suppresses the focus outline below
|
|
23
|
+
// (which reads `outline-style: var(--tw-outline-style)`).
|
|
24
|
+
//
|
|
25
|
+
// Sizing is the one deliberate departure from Input: `field-sizing-content`
|
|
26
|
+
// grows the box with its content from a three-line floor instead of
|
|
27
|
+
// pinning it to Input's single-line `h-12`. Everything else — padding,
|
|
28
|
+
// radius, type size, colour, state handling — is Input's.
|
|
29
|
+
"field-sizing-content min-h-24 w-full min-w-0 resize-none rounded-sm px-4 py-2 text-base motion-safe:transition-colors",
|
|
30
|
+
// Every colour routes through the --input-* semantic tokens (layer 3,
|
|
31
|
+
// theme.css / the registry theme item). Dark mode and brand themes
|
|
32
|
+
// restyle the control by remapping tokens — no dark: variants here.
|
|
33
|
+
"border border-(--input-border) bg-(--input-surface) text-(--input-foreground)",
|
|
34
|
+
// Hover
|
|
35
|
+
"hover:bg-(--input-surface-hover)",
|
|
36
|
+
// Focus — `focus-visible:` per the design-system policy (matches
|
|
37
|
+
// Button/Link/Input). For text fields this is behaviour-preserving:
|
|
38
|
+
// browsers flag keyboard-editable controls as :focus-visible even
|
|
39
|
+
// when focused by pointer, so the ring still shows on click.
|
|
40
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring)",
|
|
41
|
+
// Placeholder styles
|
|
42
|
+
"placeholder:text-(--input-placeholder)",
|
|
43
|
+
// Disabled
|
|
44
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
45
|
+
// Invalid — 2px danger border, danger hover surface (Figma error variants)
|
|
46
|
+
"aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring)",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
)
|
|
15
52
|
);
|
|
16
53
|
}
|
|
17
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/textarea.tsx"],"names":["InputPrimitive"],"mappings":";;;;AAOA,SAAS,SAAS,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAqC;AAChF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOE,GAAA;AAAA,MAACA,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,MAAA,sBAAS,UAAA,EAAA,EAAS,CAAA;AAAA,QAClB,WAAA,EAAU,UAAA;AAAA,QACV,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAST,uHAAA;AAAA;AAAA;AAAA;AAAA,UAIA,+EAAA;AAAA;AAAA,UAEA,kCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKA,mHAAA;AAAA;AAAA,UAEA,wCAAA;AAAA;AAAA,UAEA,8EAAA;AAAA;AAAA,UAEA,oLAAA;AAAA,UACA;AAAA,SACF;AAAA,QAIC,GAAI;AAAA;AAAA;AACP;AAEJ","file":"textarea.js","sourcesContent":["'use client'\n\nimport { Input as InputPrimitive } from '@base-ui/react/input'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Textarea({ className, ref, ...props }: React.ComponentProps<'textarea'>) {\n return (\n // Base UI's Input IS `Field.Control`, so rendering it as a `<textarea>`\n // buys the multi-line control the same Field wiring the single-line Input\n // already has: inside a `<Field>` it is the registered control, so the\n // label association, `aria-describedby` for the description/error and\n // `aria-invalid` are handled for us. The primitive is typed for `<input>`,\n // hence the cast on the otherwise-identical props.\n <InputPrimitive\n ref={ref as React.Ref<HTMLElement>}\n render={<textarea />}\n data-slot='textarea'\n className={cn(\n // No `outline-none` here: it sets `--tw-outline-style: none` globally\n // on the element, which then suppresses the focus outline below\n // (which reads `outline-style: var(--tw-outline-style)`).\n //\n // Sizing is the one deliberate departure from Input: `field-sizing-content`\n // grows the box with its content from a three-line floor instead of\n // pinning it to Input's single-line `h-12`. Everything else — padding,\n // radius, type size, colour, state handling — is Input's.\n 'field-sizing-content min-h-24 w-full min-w-0 resize-none rounded-sm px-4 py-2 text-base motion-safe:transition-colors',\n // Every colour routes through the --input-* semantic tokens (layer 3,\n // theme.css / the registry theme item). Dark mode and brand themes\n // restyle the control by remapping tokens — no dark: variants here.\n 'border border-(--input-border) bg-(--input-surface) text-(--input-foreground)',\n // Hover\n 'hover:bg-(--input-surface-hover)',\n // Focus — `focus-visible:` per the design-system policy (matches\n // Button/Link/Input). For text fields this is behaviour-preserving:\n // browsers flag keyboard-editable controls as :focus-visible even\n // when focused by pointer, so the ring still shows on click.\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring)',\n // Placeholder styles\n 'placeholder:text-(--input-placeholder)',\n // Disabled\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n // Invalid — 2px danger border, danger hover surface (Figma error variants)\n 'aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring)',\n className,\n )}\n // Spread last, mirroring Input: callers must be able to override\n // `data-slot` (InputGroupTextarea relabels it `input-group-control` so\n // the group's wrapper owns the focus treatment).\n {...(props as InputPrimitive.Props)}\n />\n )\n}\n\nexport { Textarea }\n\nexport type TextareaProps = React.ComponentProps<typeof Textarea>\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { Field, FieldContent, FieldContentProps, FieldDescription, FieldDescript
|
|
|
20
20
|
export { Footer, FooterAcknowledgement, FooterAcknowledgementProps, FooterColor, FooterLegalLinkItem, FooterLegalLinks, FooterLegalLinksProps, FooterLinkItem, FooterNav, FooterNavColumn, FooterNavColumnProps, FooterNavLink, FooterNavLinkProps, FooterNavProps, FooterProps, FooterSmallPrint, FooterSmallPrintProps, FooterSocialLink, FooterSocialLinkItem, FooterSocialLinkProps, footerColors, footerContainerVariants, footerLogoType, footerVariants } from './components/footer.js';
|
|
21
21
|
export { Header, HeaderActions, HeaderActionsProps, HeaderBrand, HeaderBrandProps, HeaderColor, HeaderProps, headerColors, headerContainerVariants, headerVariants } from './components/header.js';
|
|
22
22
|
export { HoverCard, HoverCardContent, HoverCardTrigger } from './components/hover-card.js';
|
|
23
|
-
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from './components/input-group.js';
|
|
23
|
+
export { InputGroup, InputGroupAction, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, inputGroupActionVariants } from './components/input-group.js';
|
|
24
24
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from './components/input-otp.js';
|
|
25
25
|
export { Input, InputProps } from './components/input.js';
|
|
26
26
|
export { Kbd, KbdGroup } from './components/kbd.js';
|
|
@@ -55,7 +55,7 @@ export { Switch } from './components/switch.js';
|
|
|
55
55
|
export { TabNav, TabNavLink, TabNavLinkProps, TabNavProps, tabNavLinkVariants, tabNavListVariants } from './components/tab-nav.js';
|
|
56
56
|
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './components/table.js';
|
|
57
57
|
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants } from './components/tabs.js';
|
|
58
|
-
export { Textarea } from './components/textarea.js';
|
|
58
|
+
export { Textarea, TextareaProps } from './components/textarea.js';
|
|
59
59
|
export { ThemeSwitcher, ThemeSwitcherProps, ThemeSwitcherTheme } from './components/theme-switcher.js';
|
|
60
60
|
export { ToggleGroup, ToggleGroupItem } from './components/toggle-group.js';
|
|
61
61
|
export { Toggle, toggleVariants } from './components/toggle.js';
|