base-themes 0.1.2 → 0.1.3
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/CHANGELOG.md +25 -0
- package/CODE_OF_CONDUCT.md +22 -0
- package/CONTRIBUTING.md +98 -0
- package/LICENSE +21 -0
- package/README.md +316 -3
- package/RELEASE.md +80 -0
- package/SECURITY.md +49 -0
- package/bin/base-themes.mjs +143 -0
- package/dist/base-themes.css +1 -1
- package/dist/base-themes.js +857 -302
- package/dist/llms-full.txt +288 -0
- package/dist/llms.txt +79 -0
- package/dist/types/blocks/AuthCard.d.ts +2 -0
- package/dist/types/blocks/CommandPaletteBlock.d.ts +2 -0
- package/dist/types/blocks/DashboardShell.d.ts +2 -0
- package/dist/types/blocks/DataTableBlock.d.ts +2 -0
- package/dist/types/blocks/PricingPanel.d.ts +2 -0
- package/dist/types/blocks/SettingsForm.d.ts +2 -0
- package/dist/types/blocks/TeamActivityFeed.d.ts +2 -0
- package/dist/types/blocks/ThemeShowcaseCard.d.ts +2 -0
- package/dist/types/blocks/index.d.ts +8 -0
- package/dist/types/components/ui/Input.d.ts +3 -0
- package/dist/types/components/ui/index.d.ts +1 -1
- package/dist/types/lib.d.ts +1 -0
- package/docs/adoption-dashboard.md +149 -0
- package/docs/analytics-setup.md +145 -0
- package/docs/community-gallery-proposal.md +64 -0
- package/docs/community-proof-telemetry.md +47 -0
- package/docs/contributor-issue-seeds.md +240 -0
- package/docs/registry-access-telemetry.md +87 -0
- package/docs/release-announcement-kit.md +229 -0
- package/docs/search-console-setup.md +111 -0
- package/docs/theme-token-contract.md +113 -0
- package/examples/dashboard/README.md +24 -0
- package/examples/dashboard/index.html +12 -0
- package/examples/dashboard/package-lock.json +1212 -0
- package/examples/dashboard/package.json +24 -0
- package/examples/dashboard/src/App.tsx +115 -0
- package/examples/dashboard/src/main.tsx +11 -0
- package/examples/dashboard/src/styles.css +129 -0
- package/examples/dashboard/src/vite-env.d.ts +4 -0
- package/examples/dashboard/tsconfig.app.json +23 -0
- package/examples/dashboard/tsconfig.json +7 -0
- package/examples/dashboard/tsconfig.node.json +15 -0
- package/examples/dashboard/vite.config.ts +6 -0
- package/examples/next/README.md +29 -0
- package/examples/next/app/base-themes-demo.tsx +70 -0
- package/examples/next/app/layout.tsx +16 -0
- package/examples/next/app/page.tsx +9 -0
- package/examples/next/app/styles.css +106 -0
- package/examples/next/next-env.d.ts +6 -0
- package/examples/next/next.config.ts +5 -0
- package/examples/next/package-lock.json +1199 -0
- package/examples/next/package.json +27 -0
- package/examples/next/tsconfig.json +36 -0
- package/examples/registry-copy/README.md +73 -0
- package/examples/registry-copy/plan-copy.mjs +130 -0
- package/examples/theme-customization/README.md +26 -0
- package/examples/theme-customization/index.html +12 -0
- package/examples/theme-customization/package-lock.json +1212 -0
- package/examples/theme-customization/package.json +24 -0
- package/examples/theme-customization/src/App.tsx +138 -0
- package/examples/theme-customization/src/main.tsx +11 -0
- package/examples/theme-customization/src/styles.css +138 -0
- package/examples/theme-customization/src/vite-env.d.ts +4 -0
- package/examples/theme-customization/tsconfig.app.json +23 -0
- package/examples/theme-customization/tsconfig.json +7 -0
- package/examples/theme-customization/tsconfig.node.json +15 -0
- package/examples/theme-customization/vite.config.ts +6 -0
- package/examples/vite/README.md +32 -0
- package/examples/vite/index.html +12 -0
- package/examples/vite/package-lock.json +1200 -0
- package/examples/vite/package.json +24 -0
- package/examples/vite/src/App.tsx +101 -0
- package/examples/vite/src/main.tsx +11 -0
- package/examples/vite/src/styles.css +125 -0
- package/examples/vite/src/vite-env.d.ts +4 -0
- package/examples/vite/tsconfig.app.json +23 -0
- package/examples/vite/tsconfig.json +7 -0
- package/examples/vite/tsconfig.node.json +15 -0
- package/examples/vite/vite.config.ts +6 -0
- package/llms-full.txt +288 -0
- package/llms.txt +79 -0
- package/package.json +157 -14
- package/registry/items/accordion.json +101 -0
- package/registry/items/alert-dialog.json +107 -0
- package/registry/items/autocomplete.json +106 -0
- package/registry/items/avatar.json +101 -0
- package/registry/items/block-auth-card.json +105 -0
- package/registry/items/block-command-palette.json +99 -0
- package/registry/items/block-dashboard-shell.json +101 -0
- package/registry/items/block-data-table.json +99 -0
- package/registry/items/block-pricing-panel.json +99 -0
- package/registry/items/block-settings-form.json +107 -0
- package/registry/items/block-team-activity-feed.json +99 -0
- package/registry/items/block-theme-showcase-card.json +99 -0
- package/registry/items/button.json +102 -0
- package/registry/items/checkbox-group.json +106 -0
- package/registry/items/checkbox.json +102 -0
- package/registry/items/collapsible.json +101 -0
- package/registry/items/combobox.json +101 -0
- package/registry/items/context-menu.json +106 -0
- package/registry/items/csp-provider.json +96 -0
- package/registry/items/dialog.json +102 -0
- package/registry/items/direction-provider.json +101 -0
- package/registry/items/drawer.json +101 -0
- package/registry/items/field.json +101 -0
- package/registry/items/fieldset.json +101 -0
- package/registry/items/form.json +101 -0
- package/registry/items/input.json +102 -0
- package/registry/items/menu.json +101 -0
- package/registry/items/menubar.json +106 -0
- package/registry/items/meter.json +101 -0
- package/registry/items/navigation-menu.json +101 -0
- package/registry/items/number-field.json +101 -0
- package/registry/items/otp-field.json +101 -0
- package/registry/items/popover.json +102 -0
- package/registry/items/preview-card.json +101 -0
- package/registry/items/progress.json +101 -0
- package/registry/items/radio-group.json +102 -0
- package/registry/items/radio.json +101 -0
- package/registry/items/scroll-area.json +101 -0
- package/registry/items/select.json +102 -0
- package/registry/items/separator.json +101 -0
- package/registry/items/slider.json +102 -0
- package/registry/items/switch.json +102 -0
- package/registry/items/tabs.json +101 -0
- package/registry/items/theme-bauhaus.json +107 -0
- package/registry/items/theme-bento.json +107 -0
- package/registry/items/theme-calm.json +107 -0
- package/registry/items/theme-cyberpunk.json +108 -0
- package/registry/items/theme-data-dense.json +107 -0
- package/registry/items/theme-editorial.json +107 -0
- package/registry/items/theme-enterprise.json +108 -0
- package/registry/items/theme-fluent.json +107 -0
- package/registry/items/theme-glass.json +107 -0
- package/registry/items/theme-linear.json +107 -0
- package/registry/items/theme-luxury.json +107 -0
- package/registry/items/theme-material.json +107 -0
- package/registry/items/theme-minimal.json +107 -0
- package/registry/items/theme-mono.json +107 -0
- package/registry/items/theme-neo-brutalism.json +107 -0
- package/registry/items/theme-playful.json +107 -0
- package/registry/items/theme-retro.json +107 -0
- package/registry/items/theme-shadcn.json +107 -0
- package/registry/items/theme-soft-ui.json +107 -0
- package/registry/items/theme-terminal.json +107 -0
- package/registry/items/toast.json +106 -0
- package/registry/items/toggle-group.json +101 -0
- package/registry/items/toggle.json +101 -0
- package/registry/items/toolbar.json +101 -0
- package/registry/items/tooltip.json +102 -0
- package/registry/registry.json +564 -49
- package/registry/shadcn-registry.json +415 -0
- package/research/telemetry-fixtures/analytics-events.jsonl +9 -0
- package/research/telemetry-fixtures/bundle-report.json +44 -0
- package/research/telemetry-fixtures/community-proof.csv +5 -0
- package/research/telemetry-fixtures/registry-access.jsonl +10 -0
- package/research/telemetry-fixtures/search-console-export.csv +4 -0
- package/scripts/registry-plan.mjs +434 -0
- package/scripts/render-launch-actions.mjs +405 -0
- package/scripts/render-launch-status.mjs +373 -0
- package/scripts/render-release-announcement.mjs +329 -0
- package/scripts/verify-launch-readiness.mjs +415 -0
- package/scripts/verify-telemetry-fixtures.mjs +85 -0
- package/scripts/verify-telemetry-report.mjs +89 -0
- package/skills/base-themes/SKILL.md +151 -47
- package/src/blocks/AuthCard.tsx +29 -0
- package/src/blocks/Blocks.css +182 -0
- package/src/blocks/CommandPaletteBlock.tsx +32 -0
- package/src/blocks/DashboardShell.tsx +36 -0
- package/src/blocks/DataTableBlock.tsx +44 -0
- package/src/blocks/PricingPanel.tsx +28 -0
- package/src/blocks/SettingsForm.tsx +37 -0
- package/src/blocks/TeamActivityFeed.tsx +38 -0
- package/src/blocks/ThemeShowcaseCard.tsx +32 -0
- package/src/blocks/index.ts +8 -0
- package/src/components/ui/Accordion.css +42 -0
- package/src/components/ui/Accordion.tsx +41 -0
- package/src/components/ui/AlertDialog.css +40 -0
- package/src/components/ui/AlertDialog.tsx +52 -0
- package/src/components/ui/Autocomplete.css +3 -0
- package/src/components/ui/Autocomplete.tsx +50 -0
- package/src/components/ui/Avatar.css +45 -0
- package/src/components/ui/Avatar.tsx +36 -0
- package/src/components/ui/Button.css +79 -0
- package/src/components/ui/Button.tsx +20 -0
- package/src/components/ui/Checkbox.css +37 -0
- package/src/components/ui/Checkbox.tsx +32 -0
- package/src/components/ui/CheckboxGroup.tsx +21 -0
- package/src/components/ui/Collapsible.css +34 -0
- package/src/components/ui/Collapsible.tsx +29 -0
- package/src/components/ui/Combobox.css +75 -0
- package/src/components/ui/Combobox.tsx +53 -0
- package/src/components/ui/ContextMenu.css +9 -0
- package/src/components/ui/ContextMenu.tsx +47 -0
- package/src/components/ui/CspProvider.tsx +10 -0
- package/src/components/ui/Dialog.css +41 -0
- package/src/components/ui/Dialog.tsx +45 -0
- package/src/components/ui/DirectionProvider.tsx +17 -0
- package/src/components/ui/Drawer.css +77 -0
- package/src/components/ui/Drawer.tsx +56 -0
- package/src/components/ui/Field.css +19 -0
- package/src/components/ui/Field.tsx +24 -0
- package/src/components/ui/Fieldset.css +16 -0
- package/src/components/ui/Fieldset.tsx +19 -0
- package/src/components/ui/Form.css +5 -0
- package/src/components/ui/Form.tsx +12 -0
- package/src/components/ui/Input.css +50 -0
- package/src/components/ui/Input.tsx +62 -0
- package/src/components/ui/Menu.css +59 -0
- package/src/components/ui/Menu.tsx +50 -0
- package/src/components/ui/Menubar.css +26 -0
- package/src/components/ui/Menubar.tsx +42 -0
- package/src/components/ui/Meter.css +45 -0
- package/src/components/ui/Meter.tsx +37 -0
- package/src/components/ui/NavigationMenu.css +103 -0
- package/src/components/ui/NavigationMenu.tsx +64 -0
- package/src/components/ui/NumberField.css +38 -0
- package/src/components/ui/NumberField.tsx +28 -0
- package/src/components/ui/OtpField.css +28 -0
- package/src/components/ui/OtpField.tsx +24 -0
- package/src/components/ui/Popover.css +25 -0
- package/src/components/ui/Popover.tsx +37 -0
- package/src/components/ui/PreviewCard.css +33 -0
- package/src/components/ui/PreviewCard.tsx +43 -0
- package/src/components/ui/Progress.css +33 -0
- package/src/components/ui/Progress.tsx +28 -0
- package/src/components/ui/Radio.tsx +22 -0
- package/src/components/ui/RadioGroup.css +42 -0
- package/src/components/ui/RadioGroup.tsx +29 -0
- package/src/components/ui/ScrollArea.css +42 -0
- package/src/components/ui/ScrollArea.tsx +22 -0
- package/src/components/ui/Select.css +86 -0
- package/src/components/ui/Select.tsx +39 -0
- package/src/components/ui/Separator.css +14 -0
- package/src/components/ui/Separator.tsx +12 -0
- package/src/components/ui/Slider.css +39 -0
- package/src/components/ui/Slider.tsx +21 -0
- package/src/components/ui/Switch.css +45 -0
- package/src/components/ui/Switch.tsx +29 -0
- package/src/components/ui/Tabs.css +72 -0
- package/src/components/ui/Tabs.tsx +44 -0
- package/src/components/ui/Toast.css +75 -0
- package/src/components/ui/Toast.tsx +48 -0
- package/src/components/ui/Toggle.tsx +12 -0
- package/src/components/ui/ToggleGroup.css +35 -0
- package/src/components/ui/ToggleGroup.tsx +30 -0
- package/src/components/ui/Toolbar.css +60 -0
- package/src/components/ui/Toolbar.tsx +36 -0
- package/src/components/ui/Tooltip.css +14 -0
- package/src/components/ui/Tooltip.tsx +31 -0
- package/src/components/ui/index.ts +83 -0
- package/src/components/ui/useDirection.ts +1 -0
- package/src/components/ui/useToastManager.ts +11 -0
- package/src/docs/blockMeta.json +66 -0
- package/src/docs/componentMeta.json +322 -0
- package/src/docs/staticPageMeta.json +143 -0
- package/src/docs/themeMeta.json +22 -0
- package/src/styles/tokenContract.json +61 -0
- package/workers/analytics-receiver.mjs +170 -0
- package/wrangler.analytics.jsonc +12 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.bento-combobox {
|
|
2
|
+
width: min(100%, 330px);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.bento-combobox-input {
|
|
6
|
+
display: flex;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 44px;
|
|
9
|
+
align-items: center;
|
|
10
|
+
padding: 0 12px;
|
|
11
|
+
border: 1px solid var(--bt-border-strong);
|
|
12
|
+
border-radius: var(--bt-radius-sm);
|
|
13
|
+
color: var(--bt-fg);
|
|
14
|
+
background: var(--bt-surface);
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
outline: none;
|
|
17
|
+
transition: border-color 140ms ease;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.bento-combobox-input:focus {
|
|
21
|
+
border-color: var(--bt-secondary);
|
|
22
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--bt-secondary), transparent 84%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[dir='rtl'] .bento-combobox-input,
|
|
26
|
+
.bento-combobox-input:dir(rtl) {
|
|
27
|
+
text-align: right;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.bento-combobox-popup {
|
|
31
|
+
min-width: 220px;
|
|
32
|
+
padding: 6px;
|
|
33
|
+
border: 1px solid var(--bt-border-strong);
|
|
34
|
+
border-radius: var(--bt-radius);
|
|
35
|
+
background: var(--bt-surface);
|
|
36
|
+
box-shadow: var(--bt-shadow);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.bento-combobox-item {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 10px;
|
|
43
|
+
min-height: 36px;
|
|
44
|
+
padding: 0 10px;
|
|
45
|
+
border-radius: var(--bt-radius-sm);
|
|
46
|
+
color: var(--bt-fg);
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[dir='rtl'] .bento-combobox-popup,
|
|
52
|
+
.bento-combobox-popup:dir(rtl) {
|
|
53
|
+
text-align: right;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[dir='rtl'] .bento-combobox-item,
|
|
57
|
+
.bento-combobox-item:dir(rtl) {
|
|
58
|
+
flex-direction: row-reverse;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.bento-combobox-item[data-highlighted] {
|
|
62
|
+
background: var(--bt-surface-muted);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.bento-combobox-no-results {
|
|
66
|
+
padding: 12px;
|
|
67
|
+
color: var(--bt-muted-fg);
|
|
68
|
+
text-align: center;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
[data-theme='dark'] .bento-combobox-popup {
|
|
73
|
+
background: var(--bt-select-popup-bg, var(--bt-surface));
|
|
74
|
+
box-shadow: var(--bt-shadow);
|
|
75
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Combobox as BaseCombobox } from '@base-ui/react/combobox'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Combobox.css'
|
|
5
|
+
|
|
6
|
+
type ComboboxOption = { value: string; label: string }
|
|
7
|
+
|
|
8
|
+
type ComboboxProps = {
|
|
9
|
+
options: ComboboxOption[]
|
|
10
|
+
placeholder?: string
|
|
11
|
+
label?: string
|
|
12
|
+
className?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Combobox({ options, placeholder = 'Search...', label, className }: ComboboxProps) {
|
|
16
|
+
const [query, setQuery] = useState('')
|
|
17
|
+
|
|
18
|
+
const filtered = options.filter((opt) =>
|
|
19
|
+
opt.label.toLowerCase().includes(query.toLowerCase()),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={clsx('bento-combobox', className)}>
|
|
24
|
+
{label && <label className="field-label">{label}</label>}
|
|
25
|
+
<BaseCombobox.Root
|
|
26
|
+
inputValue={query}
|
|
27
|
+
onInputValueChange={setQuery}
|
|
28
|
+
>
|
|
29
|
+
<BaseCombobox.Input
|
|
30
|
+
className="bento-combobox-input"
|
|
31
|
+
placeholder={placeholder}
|
|
32
|
+
/>
|
|
33
|
+
<BaseCombobox.Portal>
|
|
34
|
+
<BaseCombobox.Positioner sideOffset={8}>
|
|
35
|
+
<BaseCombobox.Popup className="bento-combobox-popup">
|
|
36
|
+
{filtered.length === 0 ? (
|
|
37
|
+
<div className="bento-combobox-no-results">No results</div>
|
|
38
|
+
) : (
|
|
39
|
+
filtered.map((opt) => (
|
|
40
|
+
<BaseCombobox.Item className="bento-combobox-item" key={opt.value} value={opt.value}>
|
|
41
|
+
{opt.label}
|
|
42
|
+
</BaseCombobox.Item>
|
|
43
|
+
))
|
|
44
|
+
)}
|
|
45
|
+
</BaseCombobox.Popup>
|
|
46
|
+
</BaseCombobox.Positioner>
|
|
47
|
+
</BaseCombobox.Portal>
|
|
48
|
+
</BaseCombobox.Root>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { ComboboxProps, ComboboxOption }
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu'
|
|
2
|
+
import { type ReactNode } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Menu.css'
|
|
5
|
+
import './ContextMenu.css'
|
|
6
|
+
|
|
7
|
+
export type ContextMenuItemData = {
|
|
8
|
+
label: string
|
|
9
|
+
icon?: ReactNode
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
onClick?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ContextMenuProps = {
|
|
15
|
+
children: ReactNode
|
|
16
|
+
items: (ContextMenuItemData | 'separator')[]
|
|
17
|
+
className?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function ContextMenu({ children, items, className }: ContextMenuProps) {
|
|
21
|
+
return (
|
|
22
|
+
<BaseContextMenu.Root>
|
|
23
|
+
<BaseContextMenu.Trigger className="bento-context-menu-trigger">
|
|
24
|
+
{children}
|
|
25
|
+
</BaseContextMenu.Trigger>
|
|
26
|
+
<BaseContextMenu.Portal>
|
|
27
|
+
<BaseContextMenu.Positioner className="bento-menu-positioner" sideOffset={8}>
|
|
28
|
+
<BaseContextMenu.Popup className={clsx('bento-menu-popup', className)}>
|
|
29
|
+
{items.map((item, index) => {
|
|
30
|
+
if (item === 'separator') {
|
|
31
|
+
return <BaseContextMenu.Separator key={index} className="bento-menu-separator" />
|
|
32
|
+
}
|
|
33
|
+
return (
|
|
34
|
+
<BaseContextMenu.Item key={index} className="bento-menu-item" disabled={item.disabled} onClick={item.onClick}>
|
|
35
|
+
{item.icon}
|
|
36
|
+
{item.label}
|
|
37
|
+
</BaseContextMenu.Item>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
</BaseContextMenu.Popup>
|
|
41
|
+
</BaseContextMenu.Positioner>
|
|
42
|
+
</BaseContextMenu.Portal>
|
|
43
|
+
</BaseContextMenu.Root>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { BaseContextMenu }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSPProvider as BaseCSPProvider } from '@base-ui/react/csp-provider'
|
|
2
|
+
import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
export type CspProviderProps = ComponentProps<typeof BaseCSPProvider>
|
|
5
|
+
|
|
6
|
+
export function CspProvider(props: CspProviderProps) {
|
|
7
|
+
return <BaseCSPProvider {...props} />
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { BaseCSPProvider }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.bento-dialog-backdrop {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: 50;
|
|
5
|
+
background: var(--backdrop);
|
|
6
|
+
backdrop-filter: blur(6px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bento-dialog-popup {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 50%;
|
|
12
|
+
left: 50%;
|
|
13
|
+
z-index: 51;
|
|
14
|
+
width: min(420px, calc(100vw - 32px));
|
|
15
|
+
padding: 22px;
|
|
16
|
+
border: 1px solid var(--bt-border);
|
|
17
|
+
border-radius: var(--bt-radius);
|
|
18
|
+
background: var(--bt-surface);
|
|
19
|
+
box-shadow: var(--bt-shadow);
|
|
20
|
+
transform: translate(-50%, -50%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.bento-dialog-topline {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
gap: 16px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.bento-dialog-title {
|
|
31
|
+
color: var(--bt-fg);
|
|
32
|
+
font-size: 20px;
|
|
33
|
+
font-weight: var(--bt-font-weight, 780);
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.bento-dialog-description {
|
|
38
|
+
margin: 14px 0 18px;
|
|
39
|
+
color: var(--bt-muted-fg);
|
|
40
|
+
line-height: 1.6;
|
|
41
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog'
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import { X } from 'lucide-react'
|
|
5
|
+
import './Dialog.css'
|
|
6
|
+
|
|
7
|
+
type DialogProps = {
|
|
8
|
+
trigger: ReactElement
|
|
9
|
+
title: string
|
|
10
|
+
description?: string
|
|
11
|
+
children?: ReactNode
|
|
12
|
+
className?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Dialog({ trigger, title, description, children, className }: DialogProps) {
|
|
16
|
+
return (
|
|
17
|
+
<BaseDialog.Root>
|
|
18
|
+
<BaseDialog.Trigger render={trigger} />
|
|
19
|
+
<BaseDialog.Portal>
|
|
20
|
+
<BaseDialog.Backdrop className="bento-dialog-backdrop" />
|
|
21
|
+
<BaseDialog.Popup className={clsx('bento-dialog-popup', className)}>
|
|
22
|
+
<div className="bento-dialog-topline">
|
|
23
|
+
<BaseDialog.Title className="bento-dialog-title">{title}</BaseDialog.Title>
|
|
24
|
+
<BaseDialog.Close
|
|
25
|
+
className="bento-button icon"
|
|
26
|
+
aria-label="Close dialog"
|
|
27
|
+
render={<button type="button" />}
|
|
28
|
+
>
|
|
29
|
+
<X size={18} />
|
|
30
|
+
</BaseDialog.Close>
|
|
31
|
+
</div>
|
|
32
|
+
{description && (
|
|
33
|
+
<BaseDialog.Description className="bento-dialog-description">
|
|
34
|
+
{description}
|
|
35
|
+
</BaseDialog.Description>
|
|
36
|
+
)}
|
|
37
|
+
{children}
|
|
38
|
+
</BaseDialog.Popup>
|
|
39
|
+
</BaseDialog.Portal>
|
|
40
|
+
</BaseDialog.Root>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { BaseDialog }
|
|
45
|
+
export type { DialogProps }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DirectionProvider as BaseDirectionProvider, type TextDirection } from '@base-ui/react/direction-provider'
|
|
2
|
+
import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
export type DirectionProviderProps = ComponentProps<typeof BaseDirectionProvider>
|
|
5
|
+
|
|
6
|
+
export function DirectionProvider({ children, direction = 'ltr' }: DirectionProviderProps) {
|
|
7
|
+
return (
|
|
8
|
+
<BaseDirectionProvider direction={direction}>
|
|
9
|
+
<span dir={direction} style={{ display: 'contents' }}>
|
|
10
|
+
{children}
|
|
11
|
+
</span>
|
|
12
|
+
</BaseDirectionProvider>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { BaseDirectionProvider }
|
|
17
|
+
export type { TextDirection }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.bento-drawer-backdrop {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: 50;
|
|
5
|
+
background: var(--backdrop);
|
|
6
|
+
backdrop-filter: blur(6px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bento-drawer-popup {
|
|
10
|
+
position: fixed;
|
|
11
|
+
z-index: 51;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
border: 1px solid var(--bt-border);
|
|
16
|
+
background: var(--bt-surface);
|
|
17
|
+
box-shadow: var(--bt-shadow);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.bento-drawer-popup[data-side='left'] {
|
|
21
|
+
top: 0;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
width: min(360px, 90vw);
|
|
25
|
+
border-left: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bento-drawer-popup[data-side='right'] {
|
|
29
|
+
top: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
width: min(360px, 90vw);
|
|
33
|
+
border-right: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.bento-drawer-popup[data-side='top'] {
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
height: min(300px, 50vh);
|
|
41
|
+
border-top: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.bento-drawer-popup[data-side='bottom'] {
|
|
45
|
+
bottom: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
right: 0;
|
|
48
|
+
height: min(300px, 50vh);
|
|
49
|
+
border-bottom: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.bento-drawer-header {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
padding: 16px 20px;
|
|
57
|
+
border-bottom: 1px solid var(--bt-border);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.bento-drawer-title {
|
|
61
|
+
color: var(--bt-fg);
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
font-weight: 780;
|
|
64
|
+
margin: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.bento-drawer-description {
|
|
68
|
+
padding: 14px 20px;
|
|
69
|
+
color: var(--bt-muted-fg);
|
|
70
|
+
line-height: 1.6;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.bento-drawer-body {
|
|
74
|
+
flex: 1;
|
|
75
|
+
padding: 0 20px 20px;
|
|
76
|
+
overflow: auto;
|
|
77
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Drawer as BaseDrawer } from '@base-ui/react/drawer'
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import { X } from 'lucide-react'
|
|
5
|
+
import './Drawer.css'
|
|
6
|
+
|
|
7
|
+
type DrawerProps = {
|
|
8
|
+
trigger: ReactElement
|
|
9
|
+
title: string
|
|
10
|
+
description?: string
|
|
11
|
+
children?: ReactNode
|
|
12
|
+
side?: 'left' | 'right' | 'top' | 'bottom'
|
|
13
|
+
className?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Drawer({
|
|
17
|
+
trigger,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
children,
|
|
21
|
+
side = 'right',
|
|
22
|
+
className,
|
|
23
|
+
}: DrawerProps) {
|
|
24
|
+
return (
|
|
25
|
+
<BaseDrawer.Root>
|
|
26
|
+
<BaseDrawer.Trigger render={trigger} />
|
|
27
|
+
<BaseDrawer.Portal>
|
|
28
|
+
<BaseDrawer.Backdrop className="bento-drawer-backdrop" />
|
|
29
|
+
<BaseDrawer.Popup
|
|
30
|
+
className={clsx('bento-drawer-popup', className)}
|
|
31
|
+
{...({ 'data-side': side } as Record<string, unknown>)}
|
|
32
|
+
>
|
|
33
|
+
<div className="bento-drawer-header">
|
|
34
|
+
<BaseDrawer.Title className="bento-drawer-title">{title}</BaseDrawer.Title>
|
|
35
|
+
<BaseDrawer.Close
|
|
36
|
+
className="bento-button icon"
|
|
37
|
+
aria-label="Close drawer"
|
|
38
|
+
render={<button type="button" />}
|
|
39
|
+
>
|
|
40
|
+
<X size={18} />
|
|
41
|
+
</BaseDrawer.Close>
|
|
42
|
+
</div>
|
|
43
|
+
{description && (
|
|
44
|
+
<BaseDrawer.Description className="bento-drawer-description">
|
|
45
|
+
{description}
|
|
46
|
+
</BaseDrawer.Description>
|
|
47
|
+
)}
|
|
48
|
+
<div className="bento-drawer-body">{children}</div>
|
|
49
|
+
</BaseDrawer.Popup>
|
|
50
|
+
</BaseDrawer.Portal>
|
|
51
|
+
</BaseDrawer.Root>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { BaseDrawer }
|
|
56
|
+
export type { DrawerProps }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.bento-field {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: 8px;
|
|
4
|
+
width: min(100%, 360px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.bento-field-description,
|
|
8
|
+
.bento-field-error {
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.bento-field-description {
|
|
14
|
+
color: var(--bt-muted-fg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.bento-field-error {
|
|
18
|
+
color: var(--bt-primary-hover);
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Field as BaseField } from '@base-ui/react/field'
|
|
2
|
+
import { type ComponentPropsWithoutRef, type ReactElement } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Field.css'
|
|
5
|
+
|
|
6
|
+
export type FieldProps = ComponentPropsWithoutRef<typeof BaseField.Root> & {
|
|
7
|
+
label: string
|
|
8
|
+
description?: string
|
|
9
|
+
error?: string
|
|
10
|
+
children: ReactElement
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function Field({ label, description, error, children, className, ...rest }: FieldProps) {
|
|
14
|
+
return (
|
|
15
|
+
<BaseField.Root className={clsx('bento-field', className)} invalid={Boolean(error)} {...rest}>
|
|
16
|
+
<BaseField.Label className="field-label">{label}</BaseField.Label>
|
|
17
|
+
<BaseField.Control render={children} />
|
|
18
|
+
{description && <BaseField.Description className="bento-field-description">{description}</BaseField.Description>}
|
|
19
|
+
{error && <BaseField.Error className="bento-field-error">{error}</BaseField.Error>}
|
|
20
|
+
</BaseField.Root>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { BaseField }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.bento-fieldset {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: 14px;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
padding: 16px;
|
|
6
|
+
border: 1px solid var(--bt-border);
|
|
7
|
+
border-radius: var(--bt-radius);
|
|
8
|
+
background: var(--bt-surface);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.bento-fieldset-legend {
|
|
12
|
+
padding: 0 4px;
|
|
13
|
+
color: var(--bt-fg);
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
font-weight: 760;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset'
|
|
2
|
+
import { type ComponentPropsWithoutRef } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Fieldset.css'
|
|
5
|
+
|
|
6
|
+
export type FieldsetProps = ComponentPropsWithoutRef<typeof BaseFieldset.Root> & {
|
|
7
|
+
legend: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Fieldset({ legend, children, className, ...rest }: FieldsetProps) {
|
|
11
|
+
return (
|
|
12
|
+
<BaseFieldset.Root className={clsx('bento-fieldset', className)} {...rest}>
|
|
13
|
+
<BaseFieldset.Legend className="bento-fieldset-legend">{legend}</BaseFieldset.Legend>
|
|
14
|
+
{children}
|
|
15
|
+
</BaseFieldset.Root>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { BaseFieldset }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Form as BaseForm } from '@base-ui/react/form'
|
|
2
|
+
import { type ComponentPropsWithoutRef, forwardRef } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Form.css'
|
|
5
|
+
|
|
6
|
+
export type FormProps = ComponentPropsWithoutRef<typeof BaseForm>
|
|
7
|
+
|
|
8
|
+
export const Form = forwardRef<HTMLFormElement, FormProps>(({ className, ...rest }, ref) => (
|
|
9
|
+
<BaseForm ref={ref} className={clsx('bento-form', className)} {...rest} />
|
|
10
|
+
))
|
|
11
|
+
|
|
12
|
+
Form.displayName = 'Form'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.bento-input,
|
|
2
|
+
.bento-textarea {
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-height: 42px;
|
|
5
|
+
padding: 0 12px;
|
|
6
|
+
border: 1px solid var(--bt-border-strong);
|
|
7
|
+
border-radius: var(--bt-radius-sm);
|
|
8
|
+
color: var(--bt-fg);
|
|
9
|
+
background: var(--bt-surface);
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
transition: border-color var(--bt-duration, 140ms) ease, box-shadow var(--bt-duration, 140ms) ease;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.bento-input:focus,
|
|
15
|
+
.bento-textarea:focus {
|
|
16
|
+
border-color: var(--bt-secondary);
|
|
17
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--bt-primary), transparent 82%);
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.bento-textarea {
|
|
22
|
+
min-height: 80px;
|
|
23
|
+
padding: 10px 12px;
|
|
24
|
+
resize: vertical;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.bento-field {
|
|
28
|
+
display: grid;
|
|
29
|
+
gap: 8px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.bento-field-label {
|
|
33
|
+
color: var(--bt-muted-fg);
|
|
34
|
+
font-size: 13px;
|
|
35
|
+
font-weight: 760;
|
|
36
|
+
text-transform: uppercase;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.bento-field-error {
|
|
40
|
+
color: var(--bt-danger);
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.field-label {
|
|
46
|
+
color: var(--bt-muted-fg);
|
|
47
|
+
font-size: 13px;
|
|
48
|
+
font-weight: 760;
|
|
49
|
+
text-transform: uppercase;
|
|
50
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Input as BaseInput } from '@base-ui/react/input'
|
|
2
|
+
import { type ComponentPropsWithoutRef, forwardRef } from 'react'
|
|
3
|
+
import clsx from 'clsx'
|
|
4
|
+
import './Input.css'
|
|
5
|
+
|
|
6
|
+
export type InputProps = ComponentPropsWithoutRef<typeof BaseInput> & {
|
|
7
|
+
label?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
11
|
+
({ label, className, id, ...rest }, ref) => {
|
|
12
|
+
const inner = (
|
|
13
|
+
<BaseInput
|
|
14
|
+
ref={ref}
|
|
15
|
+
id={id}
|
|
16
|
+
className={clsx('bento-input', className)}
|
|
17
|
+
{...rest}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if (!label) return inner
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="bento-field">
|
|
25
|
+
<label className="bento-field-label" htmlFor={id}>{label}</label>
|
|
26
|
+
{inner}
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
Input.displayName = 'Input'
|
|
33
|
+
|
|
34
|
+
export type TextareaProps = ComponentPropsWithoutRef<'textarea'> & {
|
|
35
|
+
label?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
39
|
+
({ label, className, id, ...rest }, ref) => {
|
|
40
|
+
const inner = (
|
|
41
|
+
<textarea
|
|
42
|
+
ref={ref}
|
|
43
|
+
id={id}
|
|
44
|
+
className={clsx('bento-textarea', className)}
|
|
45
|
+
{...rest}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
if (!label) return inner
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="bento-field">
|
|
53
|
+
<label className="bento-field-label" htmlFor={id}>{label}</label>
|
|
54
|
+
{inner}
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
Textarea.displayName = 'Textarea'
|
|
61
|
+
|
|
62
|
+
export { BaseInput }
|