@pearpages/pulp-react 0.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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/ListboxOptions-DLsT-dkV.d.ts +11 -0
- package/dist/ToggleField-C-qKSgHh.d.ts +3 -0
- package/dist/accordion.css +90 -0
- package/dist/accordion.css.map +1 -0
- package/dist/accordion.d.ts +71 -0
- package/dist/accordion.js +6 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.css +246 -0
- package/dist/alert.css.map +1 -0
- package/dist/alert.d.ts +46 -0
- package/dist/alert.js +10 -0
- package/dist/alert.js.map +1 -0
- package/dist/badge.css +89 -0
- package/dist/badge.css.map +1 -0
- package/dist/badge.d.ts +38 -0
- package/dist/badge.js +5 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.css +162 -0
- package/dist/button.css.map +1 -0
- package/dist/button.d.ts +61 -0
- package/dist/button.js +8 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.css +128 -0
- package/dist/calendar.css.map +1 -0
- package/dist/calendar.d.ts +48 -0
- package/dist/calendar.js +6 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.css +66 -0
- package/dist/card.css.map +1 -0
- package/dist/card.d.ts +69 -0
- package/dist/card.js +5 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.css +106 -0
- package/dist/checkbox.css.map +1 -0
- package/dist/checkbox.d.ts +41 -0
- package/dist/checkbox.js +7 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunk-2PXTVZ7H.js +95 -0
- package/dist/chunk-2PXTVZ7H.js.map +1 -0
- package/dist/chunk-2ZP4ZBI5.js +43 -0
- package/dist/chunk-2ZP4ZBI5.js.map +1 -0
- package/dist/chunk-3GWESUGD.js +28 -0
- package/dist/chunk-3GWESUGD.js.map +1 -0
- package/dist/chunk-4HRNRTXI.js +25 -0
- package/dist/chunk-4HRNRTXI.js.map +1 -0
- package/dist/chunk-5SBKZS56.js +56 -0
- package/dist/chunk-5SBKZS56.js.map +1 -0
- package/dist/chunk-6I26MMQF.js +19 -0
- package/dist/chunk-6I26MMQF.js.map +1 -0
- package/dist/chunk-75GTNRBH.js +45 -0
- package/dist/chunk-75GTNRBH.js.map +1 -0
- package/dist/chunk-7DS4I7OJ.js +30 -0
- package/dist/chunk-7DS4I7OJ.js.map +1 -0
- package/dist/chunk-ASNTNTJW.js +27 -0
- package/dist/chunk-ASNTNTJW.js.map +1 -0
- package/dist/chunk-ASOQ2MVR.js +19 -0
- package/dist/chunk-ASOQ2MVR.js.map +1 -0
- package/dist/chunk-AWQHULJC.js +31 -0
- package/dist/chunk-AWQHULJC.js.map +1 -0
- package/dist/chunk-BBV4L5WO.js +43 -0
- package/dist/chunk-BBV4L5WO.js.map +1 -0
- package/dist/chunk-CZBCGLEM.js +9 -0
- package/dist/chunk-CZBCGLEM.js.map +1 -0
- package/dist/chunk-DWE374JX.js +65 -0
- package/dist/chunk-DWE374JX.js.map +1 -0
- package/dist/chunk-DXOOW6Q6.js +159 -0
- package/dist/chunk-DXOOW6Q6.js.map +1 -0
- package/dist/chunk-F3OFZGGE.js +116 -0
- package/dist/chunk-F3OFZGGE.js.map +1 -0
- package/dist/chunk-FH54XQ35.js +125 -0
- package/dist/chunk-FH54XQ35.js.map +1 -0
- package/dist/chunk-FXRSZUDH.js +38 -0
- package/dist/chunk-FXRSZUDH.js.map +1 -0
- package/dist/chunk-GTTXRDXV.js +181 -0
- package/dist/chunk-GTTXRDXV.js.map +1 -0
- package/dist/chunk-I4KC4V6A.js +31 -0
- package/dist/chunk-I4KC4V6A.js.map +1 -0
- package/dist/chunk-I5OZ63W7.js +50 -0
- package/dist/chunk-I5OZ63W7.js.map +1 -0
- package/dist/chunk-IDNGNQNV.js +41 -0
- package/dist/chunk-IDNGNQNV.js.map +1 -0
- package/dist/chunk-J5S2HVHO.js +67 -0
- package/dist/chunk-J5S2HVHO.js.map +1 -0
- package/dist/chunk-K5QGGQOV.js +84 -0
- package/dist/chunk-K5QGGQOV.js.map +1 -0
- package/dist/chunk-KPQGS4PG.js +77 -0
- package/dist/chunk-KPQGS4PG.js.map +1 -0
- package/dist/chunk-MI4QUKQS.js +8 -0
- package/dist/chunk-MI4QUKQS.js.map +1 -0
- package/dist/chunk-MRQWUCBA.js +57 -0
- package/dist/chunk-MRQWUCBA.js.map +1 -0
- package/dist/chunk-MXWXJZFS.js +48 -0
- package/dist/chunk-MXWXJZFS.js.map +1 -0
- package/dist/chunk-N7L66GMG.js +129 -0
- package/dist/chunk-N7L66GMG.js.map +1 -0
- package/dist/chunk-NAYFLTK6.js +32 -0
- package/dist/chunk-NAYFLTK6.js.map +1 -0
- package/dist/chunk-O6OBFL3Q.js +155 -0
- package/dist/chunk-O6OBFL3Q.js.map +1 -0
- package/dist/chunk-OGIQRHNF.js +52 -0
- package/dist/chunk-OGIQRHNF.js.map +1 -0
- package/dist/chunk-OUFAFINB.js +45 -0
- package/dist/chunk-OUFAFINB.js.map +1 -0
- package/dist/chunk-OXYP34CG.js +43 -0
- package/dist/chunk-OXYP34CG.js.map +1 -0
- package/dist/chunk-P5C2U5ZF.js +73 -0
- package/dist/chunk-P5C2U5ZF.js.map +1 -0
- package/dist/chunk-PM4YO67Q.js +53 -0
- package/dist/chunk-PM4YO67Q.js.map +1 -0
- package/dist/chunk-Q6J6BMSB.js +86 -0
- package/dist/chunk-Q6J6BMSB.js.map +1 -0
- package/dist/chunk-T76YSNTZ.js +33 -0
- package/dist/chunk-T76YSNTZ.js.map +1 -0
- package/dist/chunk-TGMDOQCL.js +53 -0
- package/dist/chunk-TGMDOQCL.js.map +1 -0
- package/dist/chunk-TVI5AXLE.js +41 -0
- package/dist/chunk-TVI5AXLE.js.map +1 -0
- package/dist/chunk-U6QRAD73.js +22 -0
- package/dist/chunk-U6QRAD73.js.map +1 -0
- package/dist/chunk-UX42PQLT.js +76 -0
- package/dist/chunk-UX42PQLT.js.map +1 -0
- package/dist/chunk-XDVS7HX7.js +100 -0
- package/dist/chunk-XDVS7HX7.js.map +1 -0
- package/dist/chunk-Y4TZA77G.js +57 -0
- package/dist/chunk-Y4TZA77G.js.map +1 -0
- package/dist/chunk-YUHS5S5Y.js +12 -0
- package/dist/chunk-YUHS5S5Y.js.map +1 -0
- package/dist/chunk-Z4PN6B2C.js +17 -0
- package/dist/chunk-Z4PN6B2C.js.map +1 -0
- package/dist/chunk-ZVDN3GRI.js +49 -0
- package/dist/chunk-ZVDN3GRI.js.map +1 -0
- package/dist/combobox.css +280 -0
- package/dist/combobox.css.map +1 -0
- package/dist/combobox.d.ts +75 -0
- package/dist/combobox.js +10 -0
- package/dist/combobox.js.map +1 -0
- package/dist/component-manifest.json +3370 -0
- package/dist/date-picker.css +267 -0
- package/dist/date-picker.css.map +1 -0
- package/dist/date-picker.d.ts +59 -0
- package/dist/date-picker.js +8 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.css +62 -0
- package/dist/dialog.css.map +1 -0
- package/dist/dialog.d.ts +56 -0
- package/dist/dialog.js +3 -0
- package/dist/dialog.js.map +1 -0
- package/dist/field.css +28 -0
- package/dist/field.css.map +1 -0
- package/dist/field.d.ts +98 -0
- package/dist/field.js +5 -0
- package/dist/field.js.map +1 -0
- package/dist/floating-Bw-LN_QT.d.ts +5 -0
- package/dist/heading.css +30 -0
- package/dist/heading.css.map +1 -0
- package/dist/heading.d.ts +316 -0
- package/dist/heading.js +4 -0
- package/dist/heading.js.map +1 -0
- package/dist/icon-button.css +177 -0
- package/dist/icon-button.css.map +1 -0
- package/dist/icon-button.d.ts +29 -0
- package/dist/icon-button.js +9 -0
- package/dist/icon-button.js.map +1 -0
- package/dist/icon.css +25 -0
- package/dist/icon.css.map +1 -0
- package/dist/icon.d.ts +33 -0
- package/dist/icon.js +4 -0
- package/dist/icon.js.map +1 -0
- package/dist/index.css +2345 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/inline.css +63 -0
- package/dist/inline.css.map +1 -0
- package/dist/inline.d.ts +322 -0
- package/dist/inline.js +4 -0
- package/dist/inline.js.map +1 -0
- package/dist/listbox.css +95 -0
- package/dist/listbox.css.map +1 -0
- package/dist/listbox.d.ts +47 -0
- package/dist/listbox.js +7 -0
- package/dist/listbox.js.map +1 -0
- package/dist/menu.css +102 -0
- package/dist/menu.css.map +1 -0
- package/dist/menu.d.ts +76 -0
- package/dist/menu.js +9 -0
- package/dist/menu.js.map +1 -0
- package/dist/pagination.css +212 -0
- package/dist/pagination.css.map +1 -0
- package/dist/pagination.d.ts +52 -0
- package/dist/pagination.js +10 -0
- package/dist/pagination.js.map +1 -0
- package/dist/picker.css +209 -0
- package/dist/picker.css.map +1 -0
- package/dist/picker.d.ts +57 -0
- package/dist/picker.js +8 -0
- package/dist/picker.js.map +1 -0
- package/dist/popover.css +48 -0
- package/dist/popover.css.map +1 -0
- package/dist/popover.d.ts +68 -0
- package/dist/popover.js +7 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress.css +83 -0
- package/dist/progress.css.map +1 -0
- package/dist/progress.d.ts +40 -0
- package/dist/progress.js +5 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio.css +107 -0
- package/dist/radio.css.map +1 -0
- package/dist/radio.d.ts +68 -0
- package/dist/radio.js +6 -0
- package/dist/radio.js.map +1 -0
- package/dist/select.css +98 -0
- package/dist/select.css.map +1 -0
- package/dist/select.d.ts +39 -0
- package/dist/select.js +6 -0
- package/dist/select.js.map +1 -0
- package/dist/skeleton.css +59 -0
- package/dist/skeleton.css.map +1 -0
- package/dist/skeleton.d.ts +34 -0
- package/dist/skeleton.js +4 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.css +126 -0
- package/dist/slider.css.map +1 -0
- package/dist/slider.d.ts +61 -0
- package/dist/slider.js +5 -0
- package/dist/slider.js.map +1 -0
- package/dist/spinner.css +60 -0
- package/dist/spinner.css.map +1 -0
- package/dist/spinner.d.ts +34 -0
- package/dist/spinner.js +5 -0
- package/dist/spinner.js.map +1 -0
- package/dist/stack.css +60 -0
- package/dist/stack.css.map +1 -0
- package/dist/stack.d.ts +319 -0
- package/dist/stack.js +4 -0
- package/dist/stack.js.map +1 -0
- package/dist/switch.css +97 -0
- package/dist/switch.css.map +1 -0
- package/dist/switch.d.ts +35 -0
- package/dist/switch.js +7 -0
- package/dist/switch.js.map +1 -0
- package/dist/table.css +188 -0
- package/dist/table.css.map +1 -0
- package/dist/table.d.ts +137 -0
- package/dist/table.js +6 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.css +75 -0
- package/dist/tabs.css.map +1 -0
- package/dist/tabs.d.ts +73 -0
- package/dist/tabs.js +5 -0
- package/dist/tabs.js.map +1 -0
- package/dist/text-field.css +75 -0
- package/dist/text-field.css.map +1 -0
- package/dist/text-field.d.ts +43 -0
- package/dist/text-field.js +6 -0
- package/dist/text-field.js.map +1 -0
- package/dist/text.css +53 -0
- package/dist/text.css.map +1 -0
- package/dist/text.d.ts +331 -0
- package/dist/text.js +4 -0
- package/dist/text.js.map +1 -0
- package/dist/textarea.css +84 -0
- package/dist/textarea.css.map +1 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +6 -0
- package/dist/textarea.js.map +1 -0
- package/dist/toast.css +300 -0
- package/dist/toast.css.map +1 -0
- package/dist/toast.d.ts +60 -0
- package/dist/toast.js +11 -0
- package/dist/toast.js.map +1 -0
- package/dist/tooltip.css +36 -0
- package/dist/tooltip.css.map +1 -0
- package/dist/tooltip.d.ts +34 -0
- package/dist/tooltip.js +5 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/visually-hidden.css +15 -0
- package/dist/visually-hidden.css.map +1 -0
- package/dist/visually-hidden.d.ts +308 -0
- package/dist/visually-hidden.js +4 -0
- package/dist/visually-hidden.js.map +1 -0
- package/package.json +261 -0
package/dist/picker.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Picker } from './chunk-J5S2HVHO.js';
|
|
2
|
+
import './chunk-4HRNRTXI.js';
|
|
3
|
+
import './chunk-YUHS5S5Y.js';
|
|
4
|
+
import './chunk-T76YSNTZ.js';
|
|
5
|
+
import './chunk-ASNTNTJW.js';
|
|
6
|
+
import './chunk-MI4QUKQS.js';
|
|
7
|
+
//# sourceMappingURL=picker.js.map
|
|
8
|
+
//# sourceMappingURL=picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"picker.js"}
|
package/dist/popover.css
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* src/internal/floating.css */
|
|
2
|
+
@property --_gap { syntax: "<length>"; inherits: false; initial-value: 0px; }
|
|
3
|
+
|
|
4
|
+
/* src/popover/Popover.module.css */
|
|
5
|
+
@layer components {
|
|
6
|
+
.Popover_content {
|
|
7
|
+
--_gap: var(--popover-gap);
|
|
8
|
+
position: fixed;
|
|
9
|
+
z-index: var(--popover-layer);
|
|
10
|
+
inset-block-start: var(--_y);
|
|
11
|
+
inset-inline-start: var(--_x);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--popover-gap);
|
|
15
|
+
inline-size: var(--popover-width);
|
|
16
|
+
max-inline-size: calc(100vw - 2 * var(--space-4));
|
|
17
|
+
padding: var(--popover-padding);
|
|
18
|
+
border: var(--size-hairline) solid var(--popover-border);
|
|
19
|
+
border-radius: var(--popover-radius);
|
|
20
|
+
background-color: var(--popover-bg);
|
|
21
|
+
color: var(--popover-fg);
|
|
22
|
+
font-family: var(--font-family-body);
|
|
23
|
+
box-shadow: var(--popover-shadow);
|
|
24
|
+
animation: Popover_fade var(--popover-duration) var(--motion-easing-standard);
|
|
25
|
+
&:focus-visible {
|
|
26
|
+
outline: var(--popover-focus-ring-width) solid var(--popover-focus-ring);
|
|
27
|
+
outline-offset: var(--popover-focus-ring-offset);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
.Popover_title {
|
|
31
|
+
margin: 0;
|
|
32
|
+
font-family: var(--font-family-display);
|
|
33
|
+
font-size: var(--font-size-md);
|
|
34
|
+
font-weight: var(--font-weight-semibold);
|
|
35
|
+
line-height: var(--font-line-height-tight);
|
|
36
|
+
}
|
|
37
|
+
@keyframes Popover_fade {
|
|
38
|
+
from {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
@media (prefers-reduced-motion: reduce) {
|
|
43
|
+
.Popover_content {
|
|
44
|
+
animation: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/*# sourceMappingURL=popover.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/floating.css","../src/popover/Popover.module.css"],"sourcesContent":["/*\n * Registers the gap the floating hook reads. An unregistered custom property\n * computes to its specified text (\"calc(0.25rem * 2)\"), which no number\n * parser can use; a registered <length> computes to pixels (\"8px\"). Browsers\n * without @property (Firefox before 128) fall back to a gap of 0.\n * Outside the components layer on purpose: registration is not cascaded.\n */\n\n@property --_gap {\n syntax: \"<length>\";\n inherits: false;\n /* stylelint-disable-next-line length-zero-no-unit -- a registered <length> needs a unit in its initial value */\n initial-value: 0px;\n}\n","/* Every value is a token (--popover-*). Position comes in as --_x/--_y from the floating hook. */\n\n@layer components {\n .content {\n --_gap: var(--popover-gap);\n\n position: fixed;\n z-index: var(--popover-layer);\n inset-block-start: var(--_y);\n inset-inline-start: var(--_x);\n display: flex;\n flex-direction: column;\n gap: var(--popover-gap);\n inline-size: var(--popover-width);\n max-inline-size: calc(100vw - 2 * var(--space-4));\n padding: var(--popover-padding);\n border: var(--size-hairline) solid var(--popover-border);\n border-radius: var(--popover-radius);\n background-color: var(--popover-bg);\n color: var(--popover-fg);\n font-family: var(--font-family-body);\n box-shadow: var(--popover-shadow);\n animation: fade var(--popover-duration) var(--motion-easing-standard);\n\n &:focus-visible {\n outline: var(--popover-focus-ring-width) solid var(--popover-focus-ring);\n outline-offset: var(--popover-focus-ring-offset);\n }\n }\n\n .title {\n margin: 0;\n font-family: var(--font-family-display);\n font-size: var(--font-size-md);\n font-weight: var(--font-weight-semibold);\n line-height: var(--font-line-height-tight);\n }\n\n @keyframes fade {\n from {\n opacity: 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .content {\n animation: none;\n }\n }\n}\n"],"mappings":";AAQA,UAAU,OAAO,EACf,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,KAAK,EAEf,aAAa,EAAE,GAAG;;;ACVpB;AACE,GAACA;AACC,YAAQ,IAAI;AAEZ,cAAU;AACV,aAAS,IAAI;AACb,uBAAmB,IAAI;AACvB,wBAAoB,IAAI;AACxB,aAAS;AACT,oBAAgB;AAChB,SAAK,IAAI;AACT,iBAAa,IAAI;AACjB,qBAAiB,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI;AACtC,aAAS,IAAI;AACb,YAAQ,IAAI,iBAAiB,MAAM,IAAI;AACvC,mBAAe,IAAI;AACnB,sBAAkB,IAAI;AACtB,WAAO,IAAI;AACX,iBAAa,IAAI;AACjB,gBAAY,IAAI;AAChB,eAAW,aAAK,IAAI,oBAAoB,IAAI;AAE5C,KAAC;AACC,eAAS,IAAI,4BAA4B,MAAM,IAAI;AACnD,sBAAgB,IAAI;AACtB;AACF;AAEA,GAACC;AACC,YAAQ;AACR,iBAAa,IAAI;AACjB,eAAW,IAAI;AACf,iBAAa,IAAI;AACjB,iBAAa,IAAI;AACnB;AAEA,aAhBaC;AAiBX;AACE,eAAS;AACX;AACF;AAEA,UAAO,wBAAyB;AAC9B,KA1CDF;AA2CG,iBAAW;AACb;AACF;AACF;","names":["content","title","fade"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ButtonHTMLAttributes, Ref, HTMLAttributes } from 'react';
|
|
3
|
+
import { F as FloatingPlacement } from './floating-Bw-LN_QT.js';
|
|
4
|
+
import '@floating-ui/react-dom';
|
|
5
|
+
|
|
6
|
+
type PopoverPlacement = FloatingPlacement;
|
|
7
|
+
interface PopoverProps {
|
|
8
|
+
/** Controlled open state. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** @default false */
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
/** Preferred side; flips when there is no room. @default 'bottom-start' */
|
|
14
|
+
placement?: PopoverPlacement;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A non-modal layer anchored to its trigger: a small form, a filter, a
|
|
19
|
+
* detail panel. The page stays interactive; Escape, a click outside or
|
|
20
|
+
* `Popover.Close` dismiss it and focus returns to the trigger. Compose with
|
|
21
|
+
* `Popover.Trigger`, `Popover.Content` and `Popover.Close`. For anything that
|
|
22
|
+
* must block the page, use Dialog.
|
|
23
|
+
*
|
|
24
|
+
* @status stable
|
|
25
|
+
* @category Overlays
|
|
26
|
+
* @accessibility A non-modal `role="dialog"` named by `title` (or `aria-label`); the trigger has `aria-haspopup="dialog"` and `aria-expanded`. Focus moves to the first focusable element on open and back to the trigger on close; Escape and a click outside dismiss it.
|
|
27
|
+
* @do Give it a `title` or `aria-label`.
|
|
28
|
+
* Use `Popover.Close` inside forms so a keyboard user has a clear exit.
|
|
29
|
+
* @dont Put a long form or a destructive confirmation in it; use Dialog.
|
|
30
|
+
* Open it on hover; that is Tooltip.
|
|
31
|
+
*/
|
|
32
|
+
declare function Popover({ open, defaultOpen, onOpenChange, placement, children }: PopoverProps): react.JSX.Element;
|
|
33
|
+
declare namespace Popover {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
var Trigger: typeof PopoverTrigger;
|
|
36
|
+
var Content: typeof PopoverContent;
|
|
37
|
+
var Close: typeof PopoverClose;
|
|
38
|
+
}
|
|
39
|
+
interface PopoverTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
40
|
+
/** Render the child element as the trigger instead of a plain button. @default false */
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
ref?: Ref<HTMLButtonElement>;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
declare function PopoverTrigger({ asChild, onClick, ref, children, ...rest }: PopoverTriggerProps): react.JSX.Element;
|
|
46
|
+
declare namespace PopoverTrigger {
|
|
47
|
+
var displayName: string;
|
|
48
|
+
}
|
|
49
|
+
interface PopoverContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
50
|
+
/** Rendered as the dialog's heading and used as its accessible name. Otherwise pass `aria-label`. */
|
|
51
|
+
title?: ReactNode;
|
|
52
|
+
ref?: Ref<HTMLDivElement>;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
declare function PopoverContent({ title, className, ref, children, ...rest }: PopoverContentProps): react.ReactPortal | null;
|
|
56
|
+
declare namespace PopoverContent {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
interface PopoverCloseProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}
|
|
63
|
+
declare function PopoverClose({ asChild, onClick, children, ...rest }: PopoverCloseProps): react.JSX.Element;
|
|
64
|
+
declare namespace PopoverClose {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Popover, type PopoverPlacement, type PopoverProps };
|
package/dist/popover.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"popover.js"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* src/visually-hidden/VisuallyHidden.module.css */
|
|
2
|
+
@layer components {
|
|
3
|
+
.VisuallyHidden_root {
|
|
4
|
+
position: absolute;
|
|
5
|
+
inline-size: var(--visually-hidden-size);
|
|
6
|
+
block-size: var(--visually-hidden-size);
|
|
7
|
+
padding: 0;
|
|
8
|
+
margin: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
clip-path: inset(50%);
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
border: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* src/progress/Progress.module.css */
|
|
17
|
+
@layer components {
|
|
18
|
+
.Progress_progress {
|
|
19
|
+
--_height: var(--progress-height-md);
|
|
20
|
+
--_indicator: var(--progress-indicator-primary);
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--progress-gap);
|
|
24
|
+
font-family: var(--font-family-body);
|
|
25
|
+
&[data-size=sm] {
|
|
26
|
+
--_height: var(--progress-height-sm);
|
|
27
|
+
}
|
|
28
|
+
&[data-tone=success] {
|
|
29
|
+
--_indicator: var(--progress-indicator-success);
|
|
30
|
+
}
|
|
31
|
+
&[data-tone=warning] {
|
|
32
|
+
--_indicator: var(--progress-indicator-warning);
|
|
33
|
+
}
|
|
34
|
+
&[data-tone=error] {
|
|
35
|
+
--_indicator: var(--progress-indicator-error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.Progress_header {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
gap: var(--space-3);
|
|
42
|
+
font-size: var(--progress-label-font-size);
|
|
43
|
+
}
|
|
44
|
+
.Progress_label {
|
|
45
|
+
color: var(--progress-label-fg);
|
|
46
|
+
}
|
|
47
|
+
.Progress_value {
|
|
48
|
+
color: var(--progress-value-fg);
|
|
49
|
+
font-variant-numeric: tabular-nums;
|
|
50
|
+
}
|
|
51
|
+
.Progress_track {
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
block-size: var(--_height);
|
|
54
|
+
border-radius: var(--progress-radius);
|
|
55
|
+
background-color: var(--progress-track);
|
|
56
|
+
}
|
|
57
|
+
.Progress_indicator {
|
|
58
|
+
block-size: 100%;
|
|
59
|
+
inline-size: var(--_value, 0%);
|
|
60
|
+
border-radius: var(--progress-radius);
|
|
61
|
+
background-color: var(--_indicator);
|
|
62
|
+
transition: inline-size var(--progress-duration) var(--motion-easing-standard);
|
|
63
|
+
}
|
|
64
|
+
.Progress_progress[data-indeterminate] .Progress_indicator {
|
|
65
|
+
inline-size: 40%;
|
|
66
|
+
animation: Progress_slide calc(4 * var(--progress-duration)) var(--motion-easing-standard) infinite;
|
|
67
|
+
}
|
|
68
|
+
@keyframes Progress_slide {
|
|
69
|
+
from {
|
|
70
|
+
translate: -100% 0;
|
|
71
|
+
}
|
|
72
|
+
to {
|
|
73
|
+
translate: 250% 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
@media (prefers-reduced-motion: reduce) {
|
|
77
|
+
.Progress_progress[data-indeterminate] .Progress_indicator {
|
|
78
|
+
inline-size: 50%;
|
|
79
|
+
animation: none;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/*# sourceMappingURL=progress.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/visually-hidden/VisuallyHidden.module.css","../src/progress/Progress.module.css"],"sourcesContent":["/* The clip-path technique: present in the accessibility tree, absent from the layout. */\n\n@layer components {\n .root {\n position: absolute;\n inline-size: var(--visually-hidden-size);\n block-size: var(--visually-hidden-size);\n padding: 0;\n margin: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n}\n","/* Every value is a token (--progress-*). The fill width is the per-instance --_value custom property. */\n\n@layer components {\n .progress {\n --_height: var(--progress-height-md);\n --_indicator: var(--progress-indicator-primary);\n\n display: flex;\n flex-direction: column;\n gap: var(--progress-gap);\n font-family: var(--font-family-body);\n\n &[data-size=\"sm\"] { --_height: var(--progress-height-sm); }\n &[data-tone=\"success\"] { --_indicator: var(--progress-indicator-success); }\n &[data-tone=\"warning\"] { --_indicator: var(--progress-indicator-warning); }\n &[data-tone=\"error\"] { --_indicator: var(--progress-indicator-error); }\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n gap: var(--space-3);\n font-size: var(--progress-label-font-size);\n }\n\n .label {\n color: var(--progress-label-fg);\n }\n\n .value {\n color: var(--progress-value-fg);\n font-variant-numeric: tabular-nums;\n }\n\n .track {\n overflow: hidden;\n block-size: var(--_height);\n border-radius: var(--progress-radius);\n background-color: var(--progress-track);\n }\n\n .indicator {\n block-size: 100%;\n inline-size: var(--_value, 0%);\n border-radius: var(--progress-radius);\n background-color: var(--_indicator);\n transition: inline-size var(--progress-duration) var(--motion-easing-standard);\n }\n\n .progress[data-indeterminate] .indicator {\n inline-size: 40%;\n animation: slide calc(4 * var(--progress-duration)) var(--motion-easing-standard) infinite;\n }\n\n @keyframes slide {\n from {\n translate: -100% 0;\n }\n\n to {\n translate: 250% 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .progress[data-indeterminate] .indicator {\n inline-size: 50%;\n animation: none;\n }\n }\n}\n"],"mappings":";AAEA;AACE,GAACA;AACC,cAAU;AACV,iBAAa,IAAI;AACjB,gBAAY,IAAI;AAChB,aAAS;AACT,YAAQ;AACR,cAAU;AACV,eAAW,MAAM;AACjB,iBAAa;AACb,YAAQ;AACV;AACF;;;ACZA;AACE,GAACC;AACC,eAAW,IAAI;AACf,kBAAc,IAAI;AAElB,aAAS;AACT,oBAAgB;AAChB,SAAK,IAAI;AACT,iBAAa,IAAI;AAEjB,KAAC,CAAC;AAAkB,iBAAW,IAAI;AAAuB;AAC1D,KAAC,CAAC;AAAuB,oBAAc,IAAI;AAA+B;AAC1E,KAAC,CAAC;AAAuB,oBAAc,IAAI;AAA+B;AAC1E,KAAC,CAAC;AAAqB,oBAAc,IAAI;AAA6B;AACxE;AAEA,GAACC;AACC,aAAS;AACT,qBAAiB;AACjB,SAAK,IAAI;AACT,eAAW,IAAI;AACjB;AAEA,GAACC;AACC,WAAO,IAAI;AACb;AAEA,GAACC;AACC,WAAO,IAAI;AACX,0BAAsB;AACxB;AAEA,GAACC;AACC,cAAU;AACV,gBAAY,IAAI;AAChB,mBAAe,IAAI;AACnB,sBAAkB,IAAI;AACxB;AAEA,GAACC;AACC,gBAAY;AACZ,iBAAa,IAAI,QAAQ,EAAE;AAC3B,mBAAe,IAAI;AACnB,sBAAkB,IAAI;AACtB,gBAAY,YAAY,IAAI,qBAAqB,IAAI;AACvD;AAEA,GA9CCL,iBA8CQ,CAAC,oBAAoB,CAR7BK;AASC,iBAAa;AACb,eAAW,eAAM,KAAK,EAAE,EAAE,IAAI,sBAAsB,IAAI,0BAA0B;AACpF;AAEA,aAHaC;AAIX;AACE,iBAAW,MAAM;AACnB;AAEA;AACE,iBAAW,KAAK;AAClB;AACF;AAEA,UAAO,wBAAyB;AAC9B,KA9DDN,iBA8DU,CAAC,oBAAoB,CAxB/BK;AAyBG,mBAAa;AACb,iBAAW;AACb;AACF;AACF;","names":["root","progress","header","label","value","track","indicator","slide"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, Ref } from 'react';
|
|
3
|
+
|
|
4
|
+
type ProgressTone = 'primary' | 'success' | 'warning' | 'error';
|
|
5
|
+
type ProgressSize = 'sm' | 'md';
|
|
6
|
+
interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
7
|
+
/** Current value; omit for indeterminate. */
|
|
8
|
+
value?: number;
|
|
9
|
+
/** @default 100 */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Required: what is progressing. Visible unless `hideLabel`. */
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
/** Keep the label for assistive technology only. @default false */
|
|
14
|
+
hideLabel?: boolean;
|
|
15
|
+
/** Human-readable value ("3 of 10 files"); defaults to a percentage. */
|
|
16
|
+
valueText?: string;
|
|
17
|
+
/** @default 'primary' */
|
|
18
|
+
tone?: ProgressTone;
|
|
19
|
+
/** @default 'md' */
|
|
20
|
+
size?: ProgressSize;
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A determinate or indeterminate progress bar. The bar is `role="progressbar"`
|
|
25
|
+
* labelled by the visible (or visually hidden) label; the fill width is the
|
|
26
|
+
* one place in the library that carries a per-instance inline value, set as
|
|
27
|
+
* a custom property. Indeterminate motion stops under reduced motion.
|
|
28
|
+
*
|
|
29
|
+
* @status stable
|
|
30
|
+
* @category Feedback
|
|
31
|
+
* @accessibility `role="progressbar"` labelled by the required `label` (visible or visually hidden), with `aria-valuenow`/`aria-valuemin`/`aria-valuemax` when determinate and `aria-valuetext` from `valueText`. Indeterminate bars omit `aria-valuenow`.
|
|
32
|
+
* @do Set `valueText` when the percentage is not the meaningful reading ("3 of 5 files").
|
|
33
|
+
* @dont Use it for an unknown wait shorter than a few seconds; use Spinner.
|
|
34
|
+
*/
|
|
35
|
+
declare function Progress({ value, max, label, hideLabel, valueText, tone, size, className, ref, ...rest }: ProgressProps): react.JSX.Element;
|
|
36
|
+
declare namespace Progress {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Progress, type ProgressProps, type ProgressSize, type ProgressTone };
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"progress.js"}
|
package/dist/radio.css
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* src/field/Field.module.css */
|
|
2
|
+
@layer components {
|
|
3
|
+
.Field_field {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--field-gap);
|
|
7
|
+
}
|
|
8
|
+
.Field_label {
|
|
9
|
+
font-size: var(--field-label-font-size);
|
|
10
|
+
font-weight: var(--field-label-font-weight);
|
|
11
|
+
color: var(--field-label-fg);
|
|
12
|
+
}
|
|
13
|
+
.Field_required {
|
|
14
|
+
margin-inline-start: var(--field-required-gap);
|
|
15
|
+
color: var(--field-required-fg);
|
|
16
|
+
}
|
|
17
|
+
.Field_description {
|
|
18
|
+
margin: 0;
|
|
19
|
+
font-size: var(--field-description-font-size);
|
|
20
|
+
color: var(--field-description-fg);
|
|
21
|
+
}
|
|
22
|
+
.Field_error {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-size: var(--field-error-font-size);
|
|
25
|
+
color: var(--field-error-fg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* src/radio/Radio.module.css */
|
|
30
|
+
@layer components {
|
|
31
|
+
.Radio_group {
|
|
32
|
+
--_size: var(--radio-size-md);
|
|
33
|
+
--_border: var(--radio-border);
|
|
34
|
+
font-family: var(--font-family-body);
|
|
35
|
+
&[data-size=sm] {
|
|
36
|
+
--_size: var(--radio-size-sm);
|
|
37
|
+
}
|
|
38
|
+
&[data-size=lg] {
|
|
39
|
+
--_size: var(--radio-size-lg);
|
|
40
|
+
}
|
|
41
|
+
&[data-invalid] {
|
|
42
|
+
--_border: var(--radio-border-invalid);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.Radio_items {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: var(--radio-group-gap);
|
|
49
|
+
&[data-orientation=horizontal] {
|
|
50
|
+
flex-flow: row wrap;
|
|
51
|
+
gap: var(--radio-group-gap) var(--space-4);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
.Radio_radio {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--radio-gap);
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
&[data-disabled] {
|
|
60
|
+
cursor: not-allowed;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.Radio_label {
|
|
64
|
+
font-size: var(--field-label-font-size);
|
|
65
|
+
color: var(--field-label-fg);
|
|
66
|
+
}
|
|
67
|
+
.Radio_input {
|
|
68
|
+
display: grid;
|
|
69
|
+
flex: none;
|
|
70
|
+
place-content: center;
|
|
71
|
+
inline-size: var(--_size);
|
|
72
|
+
block-size: var(--_size);
|
|
73
|
+
margin: 0;
|
|
74
|
+
border: var(--size-hairline) solid var(--_border);
|
|
75
|
+
border-radius: var(--radio-radius);
|
|
76
|
+
background-color: var(--radio-bg);
|
|
77
|
+
appearance: none;
|
|
78
|
+
cursor: inherit;
|
|
79
|
+
transition: border-color var(--radio-motion-duration) var(--motion-easing-standard);
|
|
80
|
+
&::after {
|
|
81
|
+
content: "";
|
|
82
|
+
inline-size: calc(var(--_size) / 2);
|
|
83
|
+
block-size: calc(var(--_size) / 2);
|
|
84
|
+
border-radius: var(--radio-radius);
|
|
85
|
+
background-color: var(--radio-dot);
|
|
86
|
+
scale: 0;
|
|
87
|
+
transition: scale var(--radio-motion-duration) var(--motion-easing-standard);
|
|
88
|
+
}
|
|
89
|
+
&:checked {
|
|
90
|
+
border-color: var(--radio-border-checked);
|
|
91
|
+
&::after {
|
|
92
|
+
scale: 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
&:focus-visible {
|
|
96
|
+
outline: var(--radio-focus-ring-width) solid var(--radio-focus-ring);
|
|
97
|
+
outline-offset: var(--radio-focus-ring-offset);
|
|
98
|
+
}
|
|
99
|
+
&:disabled {
|
|
100
|
+
opacity: 0.55;
|
|
101
|
+
}
|
|
102
|
+
&:hover:not(:disabled, :checked) {
|
|
103
|
+
border-color: var(--radio-border-hover);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/*# sourceMappingURL=radio.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/field/Field.module.css","../src/radio/Radio.module.css"],"sourcesContent":["/* Every value is a token (--field-*). The control itself brings its own styles. */\n\n@layer components {\n .field {\n display: flex;\n flex-direction: column;\n gap: var(--field-gap);\n }\n\n .label {\n font-size: var(--field-label-font-size);\n font-weight: var(--field-label-font-weight);\n color: var(--field-label-fg);\n }\n\n .required {\n margin-inline-start: var(--field-required-gap);\n color: var(--field-required-fg);\n }\n\n .description {\n margin: 0;\n font-size: var(--field-description-font-size);\n color: var(--field-description-fg);\n }\n\n .error {\n margin: 0;\n font-size: var(--field-error-font-size);\n color: var(--field-error-fg);\n }\n}\n","/* Every value is a token (--radio-*). The input draws itself; the dot is its ::after. */\n\n@layer components {\n .group {\n --_size: var(--radio-size-md);\n --_border: var(--radio-border);\n\n font-family: var(--font-family-body);\n\n &[data-size=\"sm\"] { --_size: var(--radio-size-sm); }\n &[data-size=\"lg\"] { --_size: var(--radio-size-lg); }\n &[data-invalid] { --_border: var(--radio-border-invalid); }\n }\n\n .items {\n display: flex;\n flex-direction: column;\n gap: var(--radio-group-gap);\n\n &[data-orientation=\"horizontal\"] {\n flex-flow: row wrap;\n gap: var(--radio-group-gap) var(--space-4);\n }\n }\n\n .radio {\n display: inline-flex;\n align-items: center;\n gap: var(--radio-gap);\n cursor: pointer;\n\n &[data-disabled] {\n cursor: not-allowed;\n }\n }\n\n .label {\n font-size: var(--field-label-font-size);\n color: var(--field-label-fg);\n }\n\n .input {\n display: grid;\n flex: none;\n place-content: center;\n inline-size: var(--_size);\n block-size: var(--_size);\n margin: 0;\n border: var(--size-hairline) solid var(--_border);\n border-radius: var(--radio-radius);\n background-color: var(--radio-bg);\n appearance: none;\n cursor: inherit;\n transition: border-color var(--radio-motion-duration) var(--motion-easing-standard);\n\n /* Sized from the box, not in percent: a grid item's percentage resolves against an auto area and collapses. */\n &::after {\n content: \"\";\n inline-size: calc(var(--_size) / 2);\n block-size: calc(var(--_size) / 2);\n border-radius: var(--radio-radius);\n background-color: var(--radio-dot);\n scale: 0;\n transition: scale var(--radio-motion-duration) var(--motion-easing-standard);\n }\n\n &:checked {\n border-color: var(--radio-border-checked);\n\n &::after {\n scale: 1;\n }\n }\n\n &:focus-visible {\n outline: var(--radio-focus-ring-width) solid var(--radio-focus-ring);\n outline-offset: var(--radio-focus-ring-offset);\n }\n\n &:disabled {\n opacity: 0.55;\n }\n\n &:hover:not(:disabled, :checked) {\n border-color: var(--radio-border-hover);\n }\n }\n}\n"],"mappings":";AAEA;AACE,GAACA;AACC,aAAS;AACT,oBAAgB;AAChB,SAAK,IAAI;AACX;AAEA,GAACC;AACC,eAAW,IAAI;AACf,iBAAa,IAAI;AACjB,WAAO,IAAI;AACb;AAEA,GAACC;AACC,yBAAqB,IAAI;AACzB,WAAO,IAAI;AACb;AAEA,GAACC;AACC,YAAQ;AACR,eAAW,IAAI;AACf,WAAO,IAAI;AACb;AAEA,GAACC;AACC,YAAQ;AACR,eAAW,IAAI;AACf,WAAO,IAAI;AACb;AACF;;;AC7BA;AACE,GAACC;AACC,aAAS,IAAI;AACb,eAAW,IAAI;AAEf,iBAAa,IAAI;AAEjB,KAAC,CAAC;AAAkB,eAAS,IAAI;AAAkB;AACnD,KAAC,CAAC;AAAkB,eAAS,IAAI;AAAkB;AACnD,KAAC,CAAC;AAAgB,iBAAW,IAAI;AAAyB;AAC5D;AAEA,GAACC;AACC,aAAS;AACT,oBAAgB;AAChB,SAAK,IAAI;AAET,KAAC,CAAC;AACA,iBAAW,IAAI;AACf,WAAK,IAAI,mBAAmB,IAAI;AAClC;AACF;AAEA,GAACC;AACC,aAAS;AACT,iBAAa;AACb,SAAK,IAAI;AACT,YAAQ;AAER,KAAC,CAAC;AACA,cAAQ;AACV;AACF;AAEA,GAACC;AACC,eAAW,IAAI;AACf,WAAO,IAAI;AACb;AAEA,GAACC;AACC,aAAS;AACT,UAAM;AACN,mBAAe;AACf,iBAAa,IAAI;AACjB,gBAAY,IAAI;AAChB,YAAQ;AACR,YAAQ,IAAI,iBAAiB,MAAM,IAAI;AACvC,mBAAe,IAAI;AACnB,sBAAkB,IAAI;AACtB,gBAAY;AACZ,YAAQ;AACR,gBAAY,aAAa,IAAI,yBAAyB,IAAI;AAG1D,KAAC;AACC,eAAS;AACT,mBAAa,KAAK,IAAI,SAAS,EAAE;AACjC,kBAAY,KAAK,IAAI,SAAS,EAAE;AAChC,qBAAe,IAAI;AACnB,wBAAkB,IAAI;AACtB,aAAO;AACP,kBAAY,MAAM,IAAI,yBAAyB,IAAI;AACrD;AAEA,KAAC;AACC,oBAAc,IAAI;AAElB,OAAC;AACC,eAAO;AACT;AACF;AAEA,KAAC;AACC,eAAS,IAAI,0BAA0B,MAAM,IAAI;AACjD,sBAAgB,IAAI;AACtB;AAEA,KAAC;AACC,eAAS;AACX;AAEA,KAAC,MAAM,KAAK,WAAW;AACrB,oBAAc,IAAI;AACpB;AACF;AACF;","names":["field","label","required","description","error","group","items","radio","label","input"]}
|
package/dist/radio.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode, Ref, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type RadioSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
type RadioGroupOrientation = 'vertical' | 'horizontal';
|
|
6
|
+
interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
7
|
+
/** Visible group label. */
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
error?: ReactNode;
|
|
11
|
+
/** Form field name shared by the radios. Generated when omitted. */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** Controlled selected value. */
|
|
14
|
+
value?: string;
|
|
15
|
+
/** Initially selected value when uncontrolled. */
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
/** @default 'vertical' */
|
|
19
|
+
orientation?: RadioGroupOrientation;
|
|
20
|
+
/** @default 'md' */
|
|
21
|
+
size?: RadioSize;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
ref?: Ref<HTMLDivElement>;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A set of native radios under one label. The group is labelled by
|
|
29
|
+
* reference (`aria-labelledby`) and described through Field, so description
|
|
30
|
+
* and error apply to the whole set. Keyboard is the browser's own: arrows
|
|
31
|
+
* move and select within the group. Controlled or uncontrolled by `value`.
|
|
32
|
+
*
|
|
33
|
+
* @status stable
|
|
34
|
+
* @category Forms
|
|
35
|
+
* @accessibility A `radiogroup` labelled by reference through Field and described by its description and error. Native radios: arrows move and select within the group, Tab leaves it.
|
|
36
|
+
* @do Use it for two to five exclusive options that should all be visible.
|
|
37
|
+
* @dont Preselect a consequential choice; leave the group empty and mark it required.
|
|
38
|
+
*/
|
|
39
|
+
declare function RadioGroup({ label, description, error, name, value, defaultValue, onValueChange, orientation, size, disabled, required, id, className, ref, children, ...rest }: RadioGroupProps): react.JSX.Element;
|
|
40
|
+
declare namespace RadioGroup {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'name' | 'checked' | 'defaultChecked' | 'onChange'> {
|
|
44
|
+
/** The value this radio contributes to the group. */
|
|
45
|
+
value: string;
|
|
46
|
+
/** Visible label beside the radio. */
|
|
47
|
+
label: ReactNode;
|
|
48
|
+
/** The `<input>` element. */
|
|
49
|
+
ref?: Ref<HTMLInputElement>;
|
|
50
|
+
/** Applied to the wrapping label, not the input. */
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/** One option of a RadioGroup. Must be rendered inside `RadioGroup`. */
|
|
54
|
+
/**
|
|
55
|
+
* One option of a RadioGroup: a native radio with its own visible label.
|
|
56
|
+
*
|
|
57
|
+
* @status stable
|
|
58
|
+
* @category Forms
|
|
59
|
+
* @accessibility A native `input type="radio"` labelled by its visible text; the group semantics, description and error come from RadioGroup.
|
|
60
|
+
* @do Render it only inside RadioGroup.
|
|
61
|
+
* @dont Disable a single radio without saying why in its label or the group description.
|
|
62
|
+
*/
|
|
63
|
+
declare function Radio({ value, label, disabled, className, ref, ...rest }: RadioProps): react.JSX.Element;
|
|
64
|
+
declare namespace Radio {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Radio, RadioGroup, type RadioGroupOrientation, type RadioGroupProps, type RadioProps, type RadioSize };
|
package/dist/radio.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"radio.js"}
|
package/dist/select.css
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* src/field/Field.module.css */
|
|
2
|
+
@layer components {
|
|
3
|
+
.Field_field {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--field-gap);
|
|
7
|
+
}
|
|
8
|
+
.Field_label {
|
|
9
|
+
font-size: var(--field-label-font-size);
|
|
10
|
+
font-weight: var(--field-label-font-weight);
|
|
11
|
+
color: var(--field-label-fg);
|
|
12
|
+
}
|
|
13
|
+
.Field_required {
|
|
14
|
+
margin-inline-start: var(--field-required-gap);
|
|
15
|
+
color: var(--field-required-fg);
|
|
16
|
+
}
|
|
17
|
+
.Field_description {
|
|
18
|
+
margin: 0;
|
|
19
|
+
font-size: var(--field-description-font-size);
|
|
20
|
+
color: var(--field-description-fg);
|
|
21
|
+
}
|
|
22
|
+
.Field_error {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-size: var(--field-error-font-size);
|
|
25
|
+
color: var(--field-error-fg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* src/select/Select.module.css */
|
|
30
|
+
@layer components {
|
|
31
|
+
.Select_field {
|
|
32
|
+
--_height: var(--select-height-md);
|
|
33
|
+
--_font-size: var(--select-font-size-md);
|
|
34
|
+
--_border: var(--select-border-default);
|
|
35
|
+
font-family: var(--select-font-family);
|
|
36
|
+
&[data-size=sm] {
|
|
37
|
+
--_height: var(--select-height-sm);
|
|
38
|
+
--_font-size: var(--select-font-size-sm);
|
|
39
|
+
}
|
|
40
|
+
&[data-size=lg] {
|
|
41
|
+
--_height: var(--select-height-lg);
|
|
42
|
+
--_font-size: var(--select-font-size-lg);
|
|
43
|
+
}
|
|
44
|
+
&[data-invalid] {
|
|
45
|
+
--_border: var(--select-border-invalid);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.Select_control {
|
|
49
|
+
display: grid;
|
|
50
|
+
align-items: center;
|
|
51
|
+
& > * {
|
|
52
|
+
grid-area: 1 / 1;
|
|
53
|
+
}
|
|
54
|
+
&::after {
|
|
55
|
+
content: "";
|
|
56
|
+
inline-size: var(--space-2);
|
|
57
|
+
block-size: var(--space-2);
|
|
58
|
+
margin-inline-end: var(--select-chevron-inset);
|
|
59
|
+
border-inline-end: var(--select-chevron-width) solid var(--select-chevron);
|
|
60
|
+
border-block-end: var(--select-chevron-width) solid var(--select-chevron);
|
|
61
|
+
justify-self: end;
|
|
62
|
+
rotate: 45deg;
|
|
63
|
+
translate: 0 -25%;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
grid-area: 1 / 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.Select_select {
|
|
69
|
+
inline-size: 100%;
|
|
70
|
+
min-block-size: var(--_height);
|
|
71
|
+
padding-block: 0;
|
|
72
|
+
padding-inline: var(--select-padding-inline) var(--select-chevron-gap);
|
|
73
|
+
border: var(--size-hairline) solid var(--_border);
|
|
74
|
+
border-radius: var(--select-radius);
|
|
75
|
+
background-color: var(--select-bg);
|
|
76
|
+
color: var(--select-fg);
|
|
77
|
+
font-size: var(--_font-size);
|
|
78
|
+
appearance: none;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
transition: border-color var(--select-motion-duration) var(--motion-easing-standard);
|
|
81
|
+
&:focus-visible {
|
|
82
|
+
border-color: var(--select-border-focus);
|
|
83
|
+
outline: var(--select-focus-ring-width) solid var(--select-focus-ring);
|
|
84
|
+
outline-offset: var(--select-focus-ring-offset);
|
|
85
|
+
}
|
|
86
|
+
&:disabled {
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
opacity: 0.55;
|
|
89
|
+
}
|
|
90
|
+
&:hover:not(:disabled, :focus-visible) {
|
|
91
|
+
border-color: var(--select-border-hover);
|
|
92
|
+
}
|
|
93
|
+
&:has(option[value=""]:checked) {
|
|
94
|
+
color: var(--select-placeholder);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/*# sourceMappingURL=select.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/field/Field.module.css","../src/select/Select.module.css"],"sourcesContent":["/* Every value is a token (--field-*). The control itself brings its own styles. */\n\n@layer components {\n .field {\n display: flex;\n flex-direction: column;\n gap: var(--field-gap);\n }\n\n .label {\n font-size: var(--field-label-font-size);\n font-weight: var(--field-label-font-weight);\n color: var(--field-label-fg);\n }\n\n .required {\n margin-inline-start: var(--field-required-gap);\n color: var(--field-required-fg);\n }\n\n .description {\n margin: 0;\n font-size: var(--field-description-font-size);\n color: var(--field-description-fg);\n }\n\n .error {\n margin: 0;\n font-size: var(--field-error-font-size);\n color: var(--field-error-fg);\n }\n}\n","/*\n * Every value is a token (--select-*). The chevron is the wrapper's ::after,\n * sharing the select's grid cell. Size and invalid state resolve into private\n * custom properties on the root.\n */\n\n@layer components {\n .field {\n --_height: var(--select-height-md);\n --_font-size: var(--select-font-size-md);\n --_border: var(--select-border-default);\n\n font-family: var(--select-font-family);\n\n &[data-size=\"sm\"] {\n --_height: var(--select-height-sm);\n --_font-size: var(--select-font-size-sm);\n }\n\n &[data-size=\"lg\"] {\n --_height: var(--select-height-lg);\n --_font-size: var(--select-font-size-lg);\n }\n\n &[data-invalid] { --_border: var(--select-border-invalid); }\n }\n\n .control {\n display: grid;\n align-items: center;\n\n & > * {\n grid-area: 1 / 1;\n }\n\n &::after {\n content: \"\";\n inline-size: var(--space-2);\n block-size: var(--space-2);\n margin-inline-end: var(--select-chevron-inset);\n border-inline-end: var(--select-chevron-width) solid var(--select-chevron);\n border-block-end: var(--select-chevron-width) solid var(--select-chevron);\n justify-self: end;\n rotate: 45deg;\n translate: 0 -25%;\n pointer-events: none;\n grid-area: 1 / 1;\n }\n }\n\n .select {\n inline-size: 100%;\n min-block-size: var(--_height);\n padding-block: 0;\n padding-inline: var(--select-padding-inline) var(--select-chevron-gap);\n border: var(--size-hairline) solid var(--_border);\n border-radius: var(--select-radius);\n background-color: var(--select-bg);\n color: var(--select-fg);\n font-size: var(--_font-size);\n appearance: none;\n cursor: pointer;\n transition: border-color var(--select-motion-duration) var(--motion-easing-standard);\n\n &:focus-visible {\n border-color: var(--select-border-focus);\n outline: var(--select-focus-ring-width) solid var(--select-focus-ring);\n outline-offset: var(--select-focus-ring-offset);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.55;\n }\n\n &:hover:not(:disabled, :focus-visible) {\n border-color: var(--select-border-hover);\n }\n\n &:has(option[value=\"\"]:checked) {\n color: var(--select-placeholder);\n }\n }\n}\n"],"mappings":";AAEA;AACE,GAACA;AACC,aAAS;AACT,oBAAgB;AAChB,SAAK,IAAI;AACX;AAEA,GAACC;AACC,eAAW,IAAI;AACf,iBAAa,IAAI;AACjB,WAAO,IAAI;AACb;AAEA,GAACC;AACC,yBAAqB,IAAI;AACzB,WAAO,IAAI;AACb;AAEA,GAACC;AACC,YAAQ;AACR,eAAW,IAAI;AACf,WAAO,IAAI;AACb;AAEA,GAACC;AACC,YAAQ;AACR,eAAW,IAAI;AACf,WAAO,IAAI;AACb;AACF;;;ACzBA;AACE,GAACC;AACC,eAAW,IAAI;AACf,kBAAc,IAAI;AAClB,eAAW,IAAI;AAEf,iBAAa,IAAI;AAEjB,KAAC,CAAC;AACA,iBAAW,IAAI;AACf,oBAAc,IAAI;AACpB;AAEA,KAAC,CAAC;AACA,iBAAW,IAAI;AACf,oBAAc,IAAI;AACpB;AAEA,KAAC,CAAC;AAAgB,iBAAW,IAAI;AAA0B;AAC7D;AAEA,GAACC;AACC,aAAS;AACT,iBAAa;AAEb,MAAE,EAAE;AACF,iBAAW,EAAE,EAAE;AACjB;AAEA,KAAC;AACC,eAAS;AACT,mBAAa,IAAI;AACjB,kBAAY,IAAI;AAChB,yBAAmB,IAAI;AACvB,yBAAmB,IAAI,wBAAwB,MAAM,IAAI;AACzD,wBAAkB,IAAI,wBAAwB,MAAM,IAAI;AACxD,oBAAc;AACd,cAAQ;AACR,iBAAW,EAAE;AACb,sBAAgB;AAChB,iBAAW,EAAE,EAAE;AACjB;AACF;AAEA,GAACC;AACC,iBAAa;AACb,oBAAgB,IAAI;AACpB,mBAAe;AACf,oBAAgB,IAAI,yBAAyB,IAAI;AACjD,YAAQ,IAAI,iBAAiB,MAAM,IAAI;AACvC,mBAAe,IAAI;AACnB,sBAAkB,IAAI;AACtB,WAAO,IAAI;AACX,eAAW,IAAI;AACf,gBAAY;AACZ,YAAQ;AACR,gBAAY,aAAa,IAAI,0BAA0B,IAAI;AAE3D,KAAC;AACC,oBAAc,IAAI;AAClB,eAAS,IAAI,2BAA2B,MAAM,IAAI;AAClD,sBAAgB,IAAI;AACtB;AAEA,KAAC;AACC,cAAQ;AACR,eAAS;AACX;AAEA,KAAC,MAAM,KAAK,WAAW;AACrB,oBAAc,IAAI;AACpB;AAEA,KAAC,KAAK,MAAM,CAAC,SAAS;AACpB,aAAO,IAAI;AACb;AACF;AACF;","names":["field","label","required","description","error","field","control","select"]}
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SelectHTMLAttributes, ReactNode, Ref } from 'react';
|
|
3
|
+
|
|
4
|
+
type SelectSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
6
|
+
/** Visible label. Always rendered. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Presence marks the control invalid and announces the message. */
|
|
10
|
+
error?: ReactNode;
|
|
11
|
+
/** @default 'md' */
|
|
12
|
+
size?: SelectSize;
|
|
13
|
+
/** An empty first option shown until a value is chosen. */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** The `<select>` element. */
|
|
16
|
+
ref?: Ref<HTMLSelectElement>;
|
|
17
|
+
/** Applied to the wrapper, not the select. */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** `<option>` and `<optgroup>` elements. */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A native `<select>` on top of Field: the browser's own popup, keyboard and
|
|
24
|
+
* assistive-technology support, with the closed control drawn from
|
|
25
|
+
* `--select-*` tokens. For rich options or multi-select, a listbox component
|
|
26
|
+
* comes later on a headless layer; this one stays native on purpose.
|
|
27
|
+
*
|
|
28
|
+
* @status stable
|
|
29
|
+
* @category Forms
|
|
30
|
+
* @accessibility A native `select` on top of Field: the browser's own popup, keyboard and screen-reader behaviour; the placeholder is a disabled empty option when `required`.
|
|
31
|
+
* @do Use it for a plain list of words; it is the most robust choice on every platform.
|
|
32
|
+
* @dont Use it for options that need a description or an icon; use Picker.
|
|
33
|
+
*/
|
|
34
|
+
declare function Select({ label, description, error, size, placeholder, required, disabled, id, className, ref, children, 'aria-describedby': describedBy, ...rest }: SelectProps): react.JSX.Element;
|
|
35
|
+
declare namespace Select {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Select, type SelectProps, type SelectSize };
|
package/dist/select.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"select.js"}
|