@forte-ui/react 1.0.0-alpha.1
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 +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# @forte-ui/react
|
|
2
|
+
|
|
3
|
+
An accessible React component library built on [Base UI](https://base-ui.com)
|
|
4
|
+
primitives. One CSS variable re-themes the entire system, motion respects every
|
|
5
|
+
user preference, and nothing ships a runtime: theming, dark mode, density,
|
|
6
|
+
radius presets and reduced motion are all resolved by the browser from plain
|
|
7
|
+
CSS custom properties.
|
|
8
|
+
|
|
9
|
+
- **One seed, whole palette.** Set `--forte-accent-seed` and every colour — all
|
|
10
|
+
twelve accent steps, brand-tinted neutrals, readable text on solid fills, in
|
|
11
|
+
light and dark — is derived from it with CSS relative colour syntax. The
|
|
12
|
+
derived pairs are contrast-checked against WCAG floors across ~119k seeds in
|
|
13
|
+
CI.
|
|
14
|
+
- **Your CSS always wins.** Everything ships inside `@layer forte.*`,
|
|
15
|
+
which loses to unlayered author CSS by design. No `!important` anywhere, in
|
|
16
|
+
either direction.
|
|
17
|
+
- **Styling-solution agnostic.** State is exposed as `data-*` attributes,
|
|
18
|
+
parts as stable `data-forte` markers, and every knob is a custom property — so
|
|
19
|
+
plain CSS, CSS Modules, Tailwind, or CSS-in-JS all work without wrappers.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @forte-ui/react
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
React 18 or 19 is a peer dependency. Then import the one required stylesheet
|
|
28
|
+
once, at the root of your app, before any component renders:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import "@forte-ui/react/theme.css";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Per-component styles load automatically with each component you import — they
|
|
35
|
+
require a bundler that understands CSS imports from `node_modules` (Vite,
|
|
36
|
+
Next.js and webpack all qualify).
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Button } from "@forte-ui/react";
|
|
40
|
+
|
|
41
|
+
<Button variant="soft" tone="danger" size="lg">
|
|
42
|
+
Delete
|
|
43
|
+
</Button>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Theming
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
:root {
|
|
50
|
+
--forte-accent-seed: #7c3aed; /* one variable re-skins everything */
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Also available:
|
|
55
|
+
|
|
56
|
+
| Control | Values | What it does |
|
|
57
|
+
| :-- | :-- | :-- |
|
|
58
|
+
| `--forte-secondary-seed` | any in-gamut colour | second brand colour, same derivation |
|
|
59
|
+
| `--forte-neutral-tint` | `0` … `1` | pure grey → brand-tinted greys |
|
|
60
|
+
| `data-theme` | `"light"` / `"dark"` | otherwise follows the OS |
|
|
61
|
+
| `data-forte-radius` | `"none"` / `"soft"` / `"pill"` | radius preset |
|
|
62
|
+
| `data-forte-density` | `"compact"` / `"spacious"` | control heights and padding |
|
|
63
|
+
| `data-forte-motion` | `"reduce"` / `"off"` / `"full"` | motion preference override |
|
|
64
|
+
|
|
65
|
+
The `data-forte-*` switches work on any element and apply to its whole subtree.
|
|
66
|
+
To re-theme just a subtree (a different seed, a forced-dark panel), add
|
|
67
|
+
`.forte-theme` or `data-forte-theme` to the subtree root and set the seed there —
|
|
68
|
+
the ramps are re-declared on those selectors precisely so this works;
|
|
69
|
+
overriding the seed on an arbitrary element does nothing.
|
|
70
|
+
|
|
71
|
+
Supported seed envelope: lightness 0.45–0.90, chroma 0.02–0.30, inside the
|
|
72
|
+
sRGB gamut. Outside it the ramp still renders, but the derived contrast
|
|
73
|
+
guarantees no longer hold.
|
|
74
|
+
|
|
75
|
+
## Styling and overriding
|
|
76
|
+
|
|
77
|
+
The library's side of the contract, and what each part is for:
|
|
78
|
+
|
|
79
|
+
**Layers — your CSS wins.** All shipped CSS lives in
|
|
80
|
+
`@layer forte.reset → tokens → patterns → components → a11y → overrides`.
|
|
81
|
+
Every layer loses to *unlayered* author CSS, so a flat rule in your stylesheet
|
|
82
|
+
overrides anything the library sets, at any specificity, without
|
|
83
|
+
`!important`. (The flip side is a documented opt-out: an unlayered
|
|
84
|
+
`transition` or `--forte-motion-ok: 1` of yours will also defeat the library's
|
|
85
|
+
reduced-motion handling.)
|
|
86
|
+
|
|
87
|
+
**`className` on every part, applied last.** Every exported component and
|
|
88
|
+
sub-component accepts `className` after the internal classes, so utility
|
|
89
|
+
classes win their cascade ties.
|
|
90
|
+
|
|
91
|
+
**State is `data-*`, never a class name.** `data-variant`, `data-tone`,
|
|
92
|
+
`data-size`, `data-disabled`, `data-loading`, plus everything Base UI sets
|
|
93
|
+
(`data-checked`, `data-open`, …). Target it from plain CSS
|
|
94
|
+
(`[data-variant="solid"]`) or Tailwind arbitrary variants
|
|
95
|
+
(`data-[variant=solid]:…`) without wrapping the component.
|
|
96
|
+
|
|
97
|
+
**Parts are `data-forte`.** The hashed CSS Modules class names are not part of
|
|
98
|
+
the API — they change between releases. Every element the library renders
|
|
99
|
+
carries a stable `data-forte="<component>"` (root) or
|
|
100
|
+
`data-forte="<component>-<part>"` marker instead:
|
|
101
|
+
|
|
102
|
+
```css
|
|
103
|
+
/* every dialog surface, forever, regardless of release */
|
|
104
|
+
[data-forte="dialog-popup"] {
|
|
105
|
+
border: 2px solid var(--forte-color-border-strong);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* the spinner inside a button, scoped by composition */
|
|
109
|
+
[data-forte="button"] [data-forte="spinner"] {
|
|
110
|
+
opacity: 0.8;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Knobs are `--forte-<component>-*`.** Each component declares its knobs on its
|
|
115
|
+
own root element, defaulting to a global token — `--forte-button-radius` starts
|
|
116
|
+
at `var(--forte-radius-control)`. Set the knob on one element to re-skin one
|
|
117
|
+
instance; re-point the global token on `:root` or a theme scope to re-skin
|
|
118
|
+
every instance:
|
|
119
|
+
|
|
120
|
+
```css
|
|
121
|
+
.my-toolbar [data-forte="button"] {
|
|
122
|
+
--forte-button-radius: var(--forte-radius-pill);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Everything else is a token.** Colour, spacing, radius, control geometry,
|
|
127
|
+
shadows, durations, easings — the full inventory is in
|
|
128
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md). Consume them in your own CSS freely;
|
|
129
|
+
they are the same values the components use, so the two stay in step through
|
|
130
|
+
every theme change.
|
|
131
|
+
|
|
132
|
+
## Using Tailwind (v4)
|
|
133
|
+
|
|
134
|
+
The package ships a bridge that points Tailwind's theme at the forte-ui
|
|
135
|
+
tokens. Import it **before** Tailwind in the stylesheet that sets Tailwind up:
|
|
136
|
+
|
|
137
|
+
```css
|
|
138
|
+
@import "@forte-ui/react/tailwind.css";
|
|
139
|
+
@import "tailwindcss";
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
(`theme.css` is still required once in the app; the bridge only teaches
|
|
143
|
+
Tailwind the token names.)
|
|
144
|
+
|
|
145
|
+
The order is load-bearing. Tailwind v4's own styles are *layered*, and
|
|
146
|
+
cascade-layer order is fixed at first declaration — the bridge declares
|
|
147
|
+
`theme, base, forte, components, utilities`, which places Preflight below
|
|
148
|
+
the components (so `button { background: transparent }` cannot blank a Button)
|
|
149
|
+
and utilities above them (so `p-4` on a Button beats the button's own
|
|
150
|
+
padding). Import Tailwind first and `forte-ui` ends up above `utilities`
|
|
151
|
+
instead, and utility overrides on components silently stop working.
|
|
152
|
+
|
|
153
|
+
With the bridge in place, utilities and components are one system:
|
|
154
|
+
|
|
155
|
+
| Write | Get |
|
|
156
|
+
| :-- | :-- |
|
|
157
|
+
| `bg-primary`, `text-foreground-muted`, `border-border` | the semantic colour slots the components use |
|
|
158
|
+
| `bg-accent-9`, `bg-gray-3` | the raw 12-step ramps |
|
|
159
|
+
| `gap-5`, `p-4` | the eight `--forte-space-*` steps (`gap-5` is 1.5rem — steps, not a multiplier) |
|
|
160
|
+
| `p-surface` | density-aware surface padding |
|
|
161
|
+
| `text-2`, `font-medium`, `leading-tight` | the type scale |
|
|
162
|
+
| `rounded-control`, `rounded-surface`, `rounded-pill`, `rounded-1`…`6` | radius, following the `data-forte-radius` preset |
|
|
163
|
+
| `shadow-1`…`4` | elevation |
|
|
164
|
+
| `duration-fast`, `ease-spring-snappy` | the motion system (pair a spring easing with its matching duration) |
|
|
165
|
+
| `h-(--forte-control-h-md)` | any other token, via v4's `var()` shorthand |
|
|
166
|
+
|
|
167
|
+
Tailwind's stock `--color-*`, `--spacing-*`, `--text-*`, `--radius-*`,
|
|
168
|
+
`--shadow-*`, `--ease-*` and `--animate-*` scales are deliberately **deleted**
|
|
169
|
+
by the bridge: `bg-red-500` and `p-13` do not compile, because they would
|
|
170
|
+
survive review and then ignore the seed, dark mode and every theme scope.
|
|
171
|
+
(The stock spacing multiplier also cannot coexist with the token steps — the
|
|
172
|
+
steps go non-linear past 4, so mixing the two would make `p-8` larger than
|
|
173
|
+
`p-9`.) To opt back into a stock scale anyway, re-declare it in your own
|
|
174
|
+
`@theme` after the import. The `--container-*` scale (`max-w-lg`, …) and the
|
|
175
|
+
breakpoints are untouched.
|
|
176
|
+
|
|
177
|
+
Component state composes as arbitrary variants, no wrappers needed:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<Button className="data-[variant=solid]:shadow-2 data-[loading]:animate-pulse" />
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### If you use `tailwind-merge`
|
|
184
|
+
|
|
185
|
+
`tailwind-merge` ships knowing Tailwind's default theme, and the bridge
|
|
186
|
+
replaced most of it. Unrecognised classes are not merged — both survive and
|
|
187
|
+
the cascade decides — and, worse, the stock colour scale matches *any* name,
|
|
188
|
+
so `text-2` (a font size here) parses as a text colour and
|
|
189
|
+
`twMerge("text-2", "text-foreground-muted")` silently drops one. The package
|
|
190
|
+
ships a `cn` already configured for the bridge:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { cn } from "@forte-ui/react/cn";
|
|
194
|
+
|
|
195
|
+
cn("p-4", condition && "p-6"); // -> "p-6" when condition holds
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`tailwind-merge` is an *optional* peer dependency — install it alongside the
|
|
199
|
+
package to use this subpath; apps that never import it pay nothing.
|
|
200
|
+
|
|
201
|
+
If your app adds its own `@theme` keys, the bare `cn` cannot know them —
|
|
202
|
+
extend it with `createCn`, which takes the same `{ extend, override }` shape
|
|
203
|
+
as tailwind-merge itself and *appends* your names to the library's scales:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { createCn } from "@forte-ui/react/cn";
|
|
207
|
+
|
|
208
|
+
export const cn = createCn({
|
|
209
|
+
extend: {
|
|
210
|
+
theme: {
|
|
211
|
+
spacing: ["header"], // lands beside the library's `surface`
|
|
212
|
+
animate: ["reveal"],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
For setups that are not `cn`-shaped at all, the underlying
|
|
219
|
+
`tailwindMergeConfig` stays exported from `@forte-ui/react/tailwind-merge`
|
|
220
|
+
as a plain data object.
|
|
221
|
+
|
|
222
|
+
Colours need no entry — the colour scale already matches any name — and
|
|
223
|
+
neither do `font-*`, `font-weight-*`, `leading-*` or `tracking-*`, whose names
|
|
224
|
+
are Tailwind's own. A missed name does not error, it just stops overriding
|
|
225
|
+
its own family.
|
|
226
|
+
|
|
227
|
+
## Other styling setups
|
|
228
|
+
|
|
229
|
+
Nothing above is Tailwind-specific except the bridge. For CSS Modules,
|
|
230
|
+
vanilla-extract, styled-components or plain stylesheets, the same three hooks
|
|
231
|
+
carry the whole story: unlayered CSS beats the library, `data-*` selects
|
|
232
|
+
state and parts, and custom properties re-skin one instance or every
|
|
233
|
+
instance. If your setup puts *your* styles into cascade layers too, declare
|
|
234
|
+
your layers after `forte-ui` (import `theme.css` first, or name `forte-ui`
|
|
235
|
+
in your own `@layer` statement) so they keep winning.
|
|
236
|
+
|
|
237
|
+
## Contributing
|
|
238
|
+
|
|
239
|
+
Development conventions, the token inventory, and the accessibility rules
|
|
240
|
+
live in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { Accordion as n } from "@base-ui/react/accordion";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import './styles/Accordion.css';var a = {
|
|
7
|
+
root: "_root_1vl8x_38",
|
|
8
|
+
item: "_item_1vl8x_146",
|
|
9
|
+
header: "_header_1vl8x_186",
|
|
10
|
+
trigger: "_trigger_1vl8x_193",
|
|
11
|
+
label: "_label_1vl8x_252",
|
|
12
|
+
icon: "_icon_1vl8x_268",
|
|
13
|
+
panel: "_panel_1vl8x_27",
|
|
14
|
+
content: "_content_1vl8x_288"
|
|
15
|
+
}, o = t.createContext("divided");
|
|
16
|
+
function s(e) {
|
|
17
|
+
return /* @__PURE__ */ r("svg", {
|
|
18
|
+
width: "16",
|
|
19
|
+
height: "16",
|
|
20
|
+
viewBox: "0 0 16 16",
|
|
21
|
+
fill: "none",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
strokeWidth: "1.5",
|
|
24
|
+
strokeLinecap: "round",
|
|
25
|
+
strokeLinejoin: "round",
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
focusable: "false",
|
|
28
|
+
...e,
|
|
29
|
+
style: {
|
|
30
|
+
display: "block",
|
|
31
|
+
...e.style
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ r("path", { d: "m3.5 6 4.5 4.5L12.5 6" })
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function c({ variant: t = "divided", className: i, dir: s, children: c, ...l }) {
|
|
37
|
+
return /* @__PURE__ */ r(o.Provider, {
|
|
38
|
+
value: t,
|
|
39
|
+
children: /* @__PURE__ */ r(n.Root, {
|
|
40
|
+
className: e(a.root, i),
|
|
41
|
+
"data-forte": "accordion",
|
|
42
|
+
dir: s,
|
|
43
|
+
"data-variant": t,
|
|
44
|
+
...l,
|
|
45
|
+
children: c
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
var l = {
|
|
50
|
+
Root: c,
|
|
51
|
+
Item: t.forwardRef(function({ className: i, children: s, ...c }, l) {
|
|
52
|
+
let u = t.useContext(o);
|
|
53
|
+
return /* @__PURE__ */ r(n.Item, {
|
|
54
|
+
ref: l,
|
|
55
|
+
className: e(a.item, i),
|
|
56
|
+
"data-forte": "accordion-item",
|
|
57
|
+
"data-variant": u,
|
|
58
|
+
...c,
|
|
59
|
+
children: s
|
|
60
|
+
});
|
|
61
|
+
}),
|
|
62
|
+
Header: t.forwardRef(function({ className: i, children: s, ...c }, l) {
|
|
63
|
+
let u = t.useContext(o);
|
|
64
|
+
return /* @__PURE__ */ r(n.Header, {
|
|
65
|
+
ref: l,
|
|
66
|
+
className: e(a.header, i),
|
|
67
|
+
"data-forte": "accordion-header",
|
|
68
|
+
"data-variant": u,
|
|
69
|
+
...c,
|
|
70
|
+
children: s
|
|
71
|
+
});
|
|
72
|
+
}),
|
|
73
|
+
Trigger: t.forwardRef(function({ icon: c = /* @__PURE__ */ r(s, {}), labelClassName: l, className: u, children: d, ...f }, p) {
|
|
74
|
+
let m = t.useContext(o);
|
|
75
|
+
return /* @__PURE__ */ i(n.Trigger, {
|
|
76
|
+
ref: p,
|
|
77
|
+
className: e(a.trigger, "forte-focus-ring", u),
|
|
78
|
+
"data-forte": "accordion-trigger",
|
|
79
|
+
"data-focus-inset": "",
|
|
80
|
+
"data-variant": m,
|
|
81
|
+
...f,
|
|
82
|
+
children: [/* @__PURE__ */ r("span", {
|
|
83
|
+
className: e(a.label, l),
|
|
84
|
+
"data-forte": "accordion-label",
|
|
85
|
+
children: d
|
|
86
|
+
}), c === null ? null : /* @__PURE__ */ r("span", {
|
|
87
|
+
className: a.icon,
|
|
88
|
+
"data-forte": "accordion-icon",
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
children: c
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
}),
|
|
94
|
+
Panel: t.forwardRef(function({ contentClassName: i, className: s, children: c, ...l }, u) {
|
|
95
|
+
let d = t.useContext(o);
|
|
96
|
+
return /* @__PURE__ */ r(n.Panel, {
|
|
97
|
+
ref: u,
|
|
98
|
+
className: e(a.panel, s),
|
|
99
|
+
"data-forte": "accordion-panel",
|
|
100
|
+
"data-variant": d,
|
|
101
|
+
...l,
|
|
102
|
+
children: /* @__PURE__ */ r("div", {
|
|
103
|
+
className: e(a.content, i),
|
|
104
|
+
"data-forte": "accordion-content",
|
|
105
|
+
children: c
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
export { l as t };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import './styles/Alert.css';var i = {
|
|
6
|
+
root: "_root_6hqok_83",
|
|
7
|
+
icon: "_icon_6hqok_178",
|
|
8
|
+
title: "_title_6hqok_201",
|
|
9
|
+
description: "_description_6hqok_215",
|
|
10
|
+
action: "_action_6hqok_244",
|
|
11
|
+
close: "_close_6hqok_150"
|
|
12
|
+
}, a = t.createContext({
|
|
13
|
+
tone: "neutral",
|
|
14
|
+
dismiss: () => {}
|
|
15
|
+
}), o = typeof window > "u" ? t.useEffect : t.useLayoutEffect;
|
|
16
|
+
function s({ children: e, ...t }) {
|
|
17
|
+
return /* @__PURE__ */ n("svg", {
|
|
18
|
+
viewBox: "0 0 16 16",
|
|
19
|
+
fill: "none",
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeWidth: "1.6",
|
|
22
|
+
strokeLinecap: "round",
|
|
23
|
+
strokeLinejoin: "round",
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
focusable: "false",
|
|
26
|
+
...t,
|
|
27
|
+
children: e
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var c = {
|
|
31
|
+
success: /* @__PURE__ */ r(s, { children: [/* @__PURE__ */ n("circle", {
|
|
32
|
+
cx: "8",
|
|
33
|
+
cy: "8",
|
|
34
|
+
r: "6.4"
|
|
35
|
+
}), /* @__PURE__ */ n("path", { d: "m5.2 8.2 2 2 3.6-4.4" })] }),
|
|
36
|
+
danger: /* @__PURE__ */ r(s, { children: [/* @__PURE__ */ n("circle", {
|
|
37
|
+
cx: "8",
|
|
38
|
+
cy: "8",
|
|
39
|
+
r: "6.4"
|
|
40
|
+
}), /* @__PURE__ */ n("path", { d: "m5.8 5.8 4.4 4.4M10.2 5.8l-4.4 4.4" })] }),
|
|
41
|
+
warning: /* @__PURE__ */ r(s, { children: [
|
|
42
|
+
/* @__PURE__ */ n("path", { d: "M8 2.2 1.6 13.4h12.8L8 2.2Z" }),
|
|
43
|
+
/* @__PURE__ */ n("path", { d: "M8 6.4v3.1" }),
|
|
44
|
+
/* @__PURE__ */ n("path", { d: "M8 11.4h.01" })
|
|
45
|
+
] }),
|
|
46
|
+
info: /* @__PURE__ */ r(s, { children: [
|
|
47
|
+
/* @__PURE__ */ n("circle", {
|
|
48
|
+
cx: "8",
|
|
49
|
+
cy: "8",
|
|
50
|
+
r: "6.4"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ n("path", { d: "M8 7.4v3.6" }),
|
|
53
|
+
/* @__PURE__ */ n("path", { d: "M8 5h.01" })
|
|
54
|
+
] })
|
|
55
|
+
}, l = {
|
|
56
|
+
off: void 0,
|
|
57
|
+
polite: "status",
|
|
58
|
+
assertive: "alert"
|
|
59
|
+
}, u = {
|
|
60
|
+
Root: t.forwardRef(function({ variant: r = "soft", tone: s = "neutral", live: c = "off", open: u, defaultOpen: d = !0, onOpenChange: f, onExitComplete: p, className: m, children: h, style: g, ..._ }, v) {
|
|
61
|
+
let [y, b] = t.useState(d), x = u ?? y, [S, C] = t.useState(x), [w, T] = t.useState(null), E = t.useRef(0), D = t.useRef(null), O = t.useCallback((e) => {
|
|
62
|
+
D.current = e, typeof v == "function" ? v(e) : v && (v.current = e);
|
|
63
|
+
}, [v]);
|
|
64
|
+
o(() => {
|
|
65
|
+
if (x) {
|
|
66
|
+
C(!0), T(null);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
T((e) => {
|
|
70
|
+
if (e !== null) return e;
|
|
71
|
+
let t = D.current;
|
|
72
|
+
return t ? (E.current = t.getBoundingClientRect().height, "measured") : e;
|
|
73
|
+
});
|
|
74
|
+
}, [x]), o(() => {
|
|
75
|
+
if (w !== "measured") return;
|
|
76
|
+
let e = D.current;
|
|
77
|
+
e && (e.getBoundingClientRect(), T("leaving"));
|
|
78
|
+
}, [w]), o(() => {
|
|
79
|
+
if (w !== "leaving") return;
|
|
80
|
+
let e = D.current, t = () => {
|
|
81
|
+
C(!1), T(null), u === void 0 && b(!1), p?.();
|
|
82
|
+
}, n = e?.getAnimations() ?? [];
|
|
83
|
+
if (n.length === 0) {
|
|
84
|
+
t();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let r = !1;
|
|
88
|
+
return Promise.allSettled(n.map((e) => e.finished)).then(() => {
|
|
89
|
+
r || t();
|
|
90
|
+
}), () => {
|
|
91
|
+
r = !0;
|
|
92
|
+
};
|
|
93
|
+
}, [w]);
|
|
94
|
+
let k = t.useCallback(() => {
|
|
95
|
+
u === void 0 && b(!1), f?.(!1);
|
|
96
|
+
}, [u, f]), A = t.useMemo(() => ({
|
|
97
|
+
tone: s,
|
|
98
|
+
dismiss: k
|
|
99
|
+
}), [s, k]);
|
|
100
|
+
return S ? /* @__PURE__ */ n(a.Provider, {
|
|
101
|
+
value: A,
|
|
102
|
+
children: /* @__PURE__ */ n("div", {
|
|
103
|
+
ref: O,
|
|
104
|
+
role: l[c],
|
|
105
|
+
className: e(i.root, m),
|
|
106
|
+
"data-forte": "alert",
|
|
107
|
+
"data-variant": r,
|
|
108
|
+
"data-tone": s,
|
|
109
|
+
"data-exiting": w ? "" : void 0,
|
|
110
|
+
"data-ending-style": w === "leaving" ? "" : void 0,
|
|
111
|
+
style: w ? {
|
|
112
|
+
"--forte-alert-exit-from": `${E.current}px`,
|
|
113
|
+
...g
|
|
114
|
+
} : g,
|
|
115
|
+
..._,
|
|
116
|
+
children: h
|
|
117
|
+
})
|
|
118
|
+
}) : null;
|
|
119
|
+
}),
|
|
120
|
+
Icon: t.forwardRef(function({ className: r, children: o, ...s }, l) {
|
|
121
|
+
let { tone: u } = t.useContext(a), d = o ?? c[u];
|
|
122
|
+
return d == null || d === !1 ? null : /* @__PURE__ */ n("span", {
|
|
123
|
+
ref: l,
|
|
124
|
+
className: e(i.icon, r),
|
|
125
|
+
"data-forte": "alert-icon",
|
|
126
|
+
...s,
|
|
127
|
+
children: d
|
|
128
|
+
});
|
|
129
|
+
}),
|
|
130
|
+
Title: t.forwardRef(function({ className: t, children: r, ...a }, o) {
|
|
131
|
+
return /* @__PURE__ */ n("div", {
|
|
132
|
+
ref: o,
|
|
133
|
+
className: e(i.title, t),
|
|
134
|
+
"data-forte": "alert-title",
|
|
135
|
+
...a,
|
|
136
|
+
children: r
|
|
137
|
+
});
|
|
138
|
+
}),
|
|
139
|
+
Description: t.forwardRef(function({ className: t, children: r, ...a }, o) {
|
|
140
|
+
return /* @__PURE__ */ n("div", {
|
|
141
|
+
ref: o,
|
|
142
|
+
className: e(i.description, t),
|
|
143
|
+
"data-forte": "alert-description",
|
|
144
|
+
...a,
|
|
145
|
+
children: r
|
|
146
|
+
});
|
|
147
|
+
}),
|
|
148
|
+
Action: t.forwardRef(function({ className: t, children: r, ...a }, o) {
|
|
149
|
+
return /* @__PURE__ */ n("div", {
|
|
150
|
+
ref: o,
|
|
151
|
+
className: e(i.action, t),
|
|
152
|
+
"data-forte": "alert-action",
|
|
153
|
+
...a,
|
|
154
|
+
children: r
|
|
155
|
+
});
|
|
156
|
+
}),
|
|
157
|
+
Close: t.forwardRef(function({ className: r, children: o, onClick: s, ...c }, l) {
|
|
158
|
+
let { dismiss: u } = t.useContext(a);
|
|
159
|
+
return /* @__PURE__ */ n("button", {
|
|
160
|
+
ref: l,
|
|
161
|
+
type: "button",
|
|
162
|
+
className: e(i.close, "forte-focus-ring", r),
|
|
163
|
+
"data-forte": "alert-close",
|
|
164
|
+
"aria-label": "Dismiss",
|
|
165
|
+
onClick: (e) => {
|
|
166
|
+
s?.(e), e.defaultPrevented || u();
|
|
167
|
+
},
|
|
168
|
+
...c,
|
|
169
|
+
children: o ?? /* @__PURE__ */ n("svg", {
|
|
170
|
+
viewBox: "0 0 16 16",
|
|
171
|
+
fill: "none",
|
|
172
|
+
stroke: "currentColor",
|
|
173
|
+
strokeWidth: "1.6",
|
|
174
|
+
strokeLinecap: "round",
|
|
175
|
+
"aria-hidden": "true",
|
|
176
|
+
focusable: "false",
|
|
177
|
+
children: /* @__PURE__ */ n("path", { d: "m4.5 4.5 7 7M11.5 4.5l-7 7" })
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
})
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
export { u as t };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { useRender as n } from "@base-ui/react/use-render";
|
|
5
|
+
import './styles/AspectRatio.css';var r = { root: "_root_1s91t_47" }, i = {
|
|
6
|
+
square: "1 / 1",
|
|
7
|
+
video: "16 / 9",
|
|
8
|
+
wide: "21 / 9",
|
|
9
|
+
photo: "4 / 3",
|
|
10
|
+
portrait: "3 / 4",
|
|
11
|
+
story: "9 / 16",
|
|
12
|
+
golden: "1.618 / 1"
|
|
13
|
+
};
|
|
14
|
+
function a(e) {
|
|
15
|
+
return typeof e == "number" ? Number.isFinite(e) && e > 0 ? String(e) : "1" : i[e] || (e.includes(":") ? e.replace(":", " / ") : e);
|
|
16
|
+
}
|
|
17
|
+
var o = t.forwardRef(function({ ratio: t = 1, fit: i = "cover", variant: o = "plain", basis: s = "inline", clip: c = !0, render: l, className: u, style: d, ...f }, p) {
|
|
18
|
+
let m = {
|
|
19
|
+
"--forte-aspect-ratio-seed": a(t),
|
|
20
|
+
...d
|
|
21
|
+
};
|
|
22
|
+
return n({
|
|
23
|
+
render: l,
|
|
24
|
+
ref: p,
|
|
25
|
+
defaultTagName: "div",
|
|
26
|
+
props: {
|
|
27
|
+
className: e(r.root, "forte-focus-ring", u),
|
|
28
|
+
style: m,
|
|
29
|
+
"data-forte": "aspect-ratio",
|
|
30
|
+
"data-variant": o,
|
|
31
|
+
"data-fit": i,
|
|
32
|
+
"data-basis": s,
|
|
33
|
+
"data-clip": c ? "" : void 0,
|
|
34
|
+
...f
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { o as t };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Avatar as i } from "@base-ui/react/avatar";
|
|
6
|
+
import './styles/Avatar.css';var a = {
|
|
7
|
+
root: "_root_s5mge_42",
|
|
8
|
+
image: "_image_s5mge_161",
|
|
9
|
+
fallback: "_fallback_s5mge_190",
|
|
10
|
+
content: "_content_s5mge_208",
|
|
11
|
+
badge: "_badge_s5mge_105",
|
|
12
|
+
badgeContent: "_badgeContent_s5mge_449",
|
|
13
|
+
group: "_group_s5mge_52"
|
|
14
|
+
}, o = {
|
|
15
|
+
Root: t.forwardRef(function({ size: t = "md", shape: r = "circle", variant: o = "soft", tone: s = "neutral", className: c, children: l, ...u }, d) {
|
|
16
|
+
return /* @__PURE__ */ n(i.Root, {
|
|
17
|
+
ref: d,
|
|
18
|
+
className: e(a.root, c),
|
|
19
|
+
"data-forte": "avatar",
|
|
20
|
+
"data-size": t,
|
|
21
|
+
"data-shape": r,
|
|
22
|
+
"data-variant": o,
|
|
23
|
+
"data-tone": s,
|
|
24
|
+
...u,
|
|
25
|
+
children: l
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
Image: t.forwardRef(function({ className: t, ...r }, o) {
|
|
29
|
+
return /* @__PURE__ */ n(i.Image, {
|
|
30
|
+
ref: o,
|
|
31
|
+
className: e(a.image, t),
|
|
32
|
+
"data-forte": "avatar-image",
|
|
33
|
+
...r
|
|
34
|
+
});
|
|
35
|
+
}),
|
|
36
|
+
Fallback: t.forwardRef(function({ delay: t = 0, label: o, className: s, children: c, ...l }, u) {
|
|
37
|
+
return /* @__PURE__ */ r(i.Fallback, {
|
|
38
|
+
ref: u,
|
|
39
|
+
className: e(a.fallback, s),
|
|
40
|
+
"data-forte": "avatar-fallback",
|
|
41
|
+
delay: t,
|
|
42
|
+
...l,
|
|
43
|
+
children: [/* @__PURE__ */ n("span", {
|
|
44
|
+
className: a.content,
|
|
45
|
+
"data-forte": "avatar-fallback-content",
|
|
46
|
+
"aria-hidden": o ? "true" : void 0,
|
|
47
|
+
children: c
|
|
48
|
+
}), o ? /* @__PURE__ */ n("span", {
|
|
49
|
+
className: "forte-visually-hidden",
|
|
50
|
+
children: o
|
|
51
|
+
}) : null]
|
|
52
|
+
});
|
|
53
|
+
}),
|
|
54
|
+
Badge: t.forwardRef(function({ tone: t = "neutral", placement: i = "bottom-end", label: o, className: s, children: c, ...l }, u) {
|
|
55
|
+
let d = c == null || c === !1 || c === "";
|
|
56
|
+
return /* @__PURE__ */ r("span", {
|
|
57
|
+
ref: u,
|
|
58
|
+
className: e(a.badge, s),
|
|
59
|
+
"data-forte": "avatar-badge",
|
|
60
|
+
"data-tone": t,
|
|
61
|
+
"data-placement": i,
|
|
62
|
+
"data-dot": d ? "" : void 0,
|
|
63
|
+
"aria-hidden": o || !d ? void 0 : "true",
|
|
64
|
+
...l,
|
|
65
|
+
children: [/* @__PURE__ */ n("span", {
|
|
66
|
+
className: a.badgeContent,
|
|
67
|
+
"data-forte": "avatar-badge-content",
|
|
68
|
+
"aria-hidden": o ? "true" : void 0,
|
|
69
|
+
children: c
|
|
70
|
+
}), o ? /* @__PURE__ */ n("span", {
|
|
71
|
+
className: "forte-visually-hidden",
|
|
72
|
+
children: o
|
|
73
|
+
}) : null]
|
|
74
|
+
});
|
|
75
|
+
}),
|
|
76
|
+
Group: t.forwardRef(function({ className: t, children: r, ...i }, o) {
|
|
77
|
+
return /* @__PURE__ */ n("span", {
|
|
78
|
+
ref: o,
|
|
79
|
+
className: e(a.group, t),
|
|
80
|
+
"data-forte": "avatar-group",
|
|
81
|
+
...i,
|
|
82
|
+
children: r
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { o as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { useRender as a } from "@base-ui/react/use-render";
|
|
6
|
+
import './styles/Badge.css';var o = {
|
|
7
|
+
root: "_root_3atzu_44",
|
|
8
|
+
dot: "_dot_3atzu_165"
|
|
9
|
+
}, s = t.forwardRef(function({ variant: t = "soft", tone: s = "primary", size: c = "md", shape: l = "rounded", dot: u = !1, count: d, max: f = 99, render: p, className: m, children: h, ...g }, _) {
|
|
10
|
+
let v = d === void 0 ? void 0 : d > f ? `${f}+` : String(d);
|
|
11
|
+
return a({
|
|
12
|
+
render: p,
|
|
13
|
+
ref: _,
|
|
14
|
+
defaultTagName: "span",
|
|
15
|
+
props: {
|
|
16
|
+
className: e(o.root, "forte-focus-ring", m),
|
|
17
|
+
"data-forte": "badge",
|
|
18
|
+
"data-variant": t,
|
|
19
|
+
"data-tone": s,
|
|
20
|
+
"data-size": c,
|
|
21
|
+
"data-shape": l,
|
|
22
|
+
"data-count": d,
|
|
23
|
+
...g,
|
|
24
|
+
children: /* @__PURE__ */ i(n, { children: [u ? /* @__PURE__ */ r("span", {
|
|
25
|
+
className: o.dot,
|
|
26
|
+
"data-forte": "badge-dot",
|
|
27
|
+
"aria-hidden": "true"
|
|
28
|
+
}) : null, h ?? v] })
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { s as t };
|