@milktop/react-ui 0.0.0-stage → 0.1.2
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 +173 -2
- package/dist/accordion/Accordion.d.ts +65 -0
- package/dist/accordion/Accordion.js +61 -0
- package/dist/accordion/accordion.css +17 -0
- package/dist/action-bar/ActionBar.d.ts +33 -0
- package/dist/action-bar/ActionBar.js +48 -0
- package/dist/action-bar/action-bar.css +22 -0
- package/dist/alert/Alert.d.ts +28 -0
- package/dist/alert/Alert.js +12 -0
- package/dist/alert/alert.css +32 -0
- package/dist/app-shell/AppShell.d.ts +38 -0
- package/dist/app-shell/AppShell.js +92 -0
- package/dist/app-shell/Topbar.d.ts +20 -0
- package/dist/app-shell/Topbar.js +13 -0
- package/dist/app-shell/app-shell.css +41 -0
- package/dist/app-shell/shell.d.ts +9 -0
- package/dist/app-shell/shell.js +3 -0
- package/dist/attachments/Attachments.d.ts +84 -0
- package/dist/attachments/Attachments.js +235 -0
- package/dist/attachments/attachments.css +86 -0
- package/dist/avatar/Avatar.d.ts +31 -0
- package/dist/avatar/Avatar.js +41 -0
- package/dist/avatar/AvatarGroup.d.ts +41 -0
- package/dist/avatar/AvatarGroup.js +17 -0
- package/dist/avatar/avatar.css +73 -0
- package/dist/badge/Badge.d.ts +26 -0
- package/dist/badge/Badge.js +10 -0
- package/dist/badge/badge.css +24 -0
- package/dist/banner/Banner.d.ts +33 -0
- package/dist/banner/Banner.js +14 -0
- package/dist/banner/banner.css +25 -0
- package/dist/breadcrumbs/Breadcrumbs.d.ts +39 -0
- package/dist/breadcrumbs/Breadcrumbs.js +28 -0
- package/dist/breadcrumbs/breadcrumbs.css +18 -0
- package/dist/button/Button.d.ts +40 -0
- package/dist/button/Button.js +19 -0
- package/dist/button/button.css +63 -0
- package/dist/card/Card.d.ts +355 -0
- package/dist/card/Card.js +56 -0
- package/dist/card/card.css +43 -0
- package/dist/chart/AreaChart.d.ts +19 -0
- package/dist/chart/AreaChart.js +61 -0
- package/dist/chart/BarChart.d.ts +3 -0
- package/dist/chart/BarChart.js +60 -0
- package/dist/chart/ChartFrame.d.ts +25 -0
- package/dist/chart/ChartFrame.js +22 -0
- package/dist/chart/DonutChart.d.ts +20 -0
- package/dist/chart/DonutChart.js +41 -0
- package/dist/chart/Sparkline.d.ts +26 -0
- package/dist/chart/Sparkline.js +36 -0
- package/dist/chart/chart.css +51 -0
- package/dist/chart/chart.d.ts +23 -0
- package/dist/chart/chart.js +19 -0
- package/dist/checkbox/Checkbox.d.ts +50 -0
- package/dist/checkbox/Checkbox.js +19 -0
- package/dist/checkbox/CheckboxGroup.d.ts +44 -0
- package/dist/checkbox/CheckboxGroup.js +80 -0
- package/dist/checkbox/checkbox.css +49 -0
- package/dist/collapsible/Collapsible.d.ts +41 -0
- package/dist/collapsible/Collapsible.js +15 -0
- package/dist/collapsible/collapsible.css +20 -0
- package/dist/color-scheme.d.ts +18 -0
- package/dist/color-scheme.js +84 -0
- package/dist/command/Command.d.ts +64 -0
- package/dist/command/Command.js +162 -0
- package/dist/command/command.css +47 -0
- package/dist/confirm/confirm.css +5 -0
- package/dist/confirm/confirm.d.ts +42 -0
- package/dist/confirm/confirm.js +115 -0
- package/dist/copy-button/CopyButton.d.ts +30 -0
- package/dist/copy-button/CopyButton.js +23 -0
- package/dist/copy-button/copy-button.css +12 -0
- package/dist/css.d.ts +2 -0
- package/dist/data-list/DataList.d.ts +55 -0
- package/dist/data-list/DataList.js +43 -0
- package/dist/data-list/data-list.css +19 -0
- package/dist/date-picker/DatePicker.d.ts +95 -0
- package/dist/date-picker/DatePicker.js +237 -0
- package/dist/date-picker/date-picker.css +53 -0
- package/dist/dialog/Dialog.d.ts +98 -0
- package/dist/dialog/Dialog.js +92 -0
- package/dist/dialog/dialog.css +31 -0
- package/dist/divider/Divider.d.ts +27 -0
- package/dist/divider/Divider.js +8 -0
- package/dist/divider/divider.css +12 -0
- package/dist/editable/Editable.d.ts +47 -0
- package/dist/editable/Editable.js +51 -0
- package/dist/editable/editable.css +25 -0
- package/dist/editor/Editor.d.ts +59 -0
- package/dist/editor/Editor.js +220 -0
- package/dist/editor/editor.css +42 -0
- package/dist/editor/image.d.ts +1 -0
- package/dist/editor/image.js +23 -0
- package/dist/empty-state/EmptyState.d.ts +22 -0
- package/dist/empty-state/EmptyState.js +9 -0
- package/dist/empty-state/empty-state.css +14 -0
- package/dist/event-calendar/EventCalendar.d.ts +213 -0
- package/dist/event-calendar/EventCalendar.js +686 -0
- package/dist/event-calendar/dates.d.ts +8 -0
- package/dist/event-calendar/dates.js +21 -0
- package/dist/event-calendar/event-calendar.css +157 -0
- package/dist/field/Field.d.ts +66 -0
- package/dist/field/Field.js +23 -0
- package/dist/field/field.css +26 -0
- package/dist/file-upload/FileUpload.d.ts +60 -0
- package/dist/file-upload/FileUpload.js +102 -0
- package/dist/file-upload/file-upload.css +32 -0
- package/dist/format/FormatNumber.d.ts +42 -0
- package/dist/format/FormatNumber.js +59 -0
- package/dist/format/LocaleProvider.d.ts +33 -0
- package/dist/format/LocaleProvider.js +48 -0
- package/dist/format/format.d.ts +37 -0
- package/dist/format/format.js +74 -0
- package/dist/format/messages.d.ts +211 -0
- package/dist/format/messages.js +202 -0
- package/dist/highlight/Highlight.d.ts +11 -0
- package/dist/highlight/Highlight.js +14 -0
- package/dist/highlight/highlight.css +17 -0
- package/dist/hover-card/HoverCard.d.ts +47 -0
- package/dist/hover-card/HoverCard.js +18 -0
- package/dist/hover-card/hover-card.css +19 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +85 -0
- package/dist/input/Input.d.ts +41 -0
- package/dist/input/Input.js +48 -0
- package/dist/input/input.css +25 -0
- package/dist/kbd/Kbd.d.ts +19 -0
- package/dist/kbd/Kbd.js +20 -0
- package/dist/kbd/kbd.css +8 -0
- package/dist/menu/Menu.d.ts +223 -0
- package/dist/menu/Menu.js +275 -0
- package/dist/menu/menu.css +38 -0
- package/dist/native-select/NativeSelect.d.ts +36 -0
- package/dist/native-select/NativeSelect.js +51 -0
- package/dist/native-select/native-select.css +16 -0
- package/dist/number-input/NumberInput.d.ts +56 -0
- package/dist/number-input/NumberInput.js +67 -0
- package/dist/number-input/number-input.css +21 -0
- package/dist/page/Page.d.ts +30 -0
- package/dist/page/Page.js +9 -0
- package/dist/page/page.css +17 -0
- package/dist/pagination/Pagination.d.ts +31 -0
- package/dist/pagination/Pagination.js +58 -0
- package/dist/pagination/pagination.css +15 -0
- package/dist/password-input/PasswordInput.d.ts +47 -0
- package/dist/password-input/PasswordInput.js +35 -0
- package/dist/password-input/password-input.css +18 -0
- package/dist/pin-input/PinInput.d.ts +45 -0
- package/dist/pin-input/PinInput.js +22 -0
- package/dist/pin-input/pin-input.css +13 -0
- package/dist/popover/Popover.d.ts +65 -0
- package/dist/popover/Popover.js +26 -0
- package/dist/popover/popover.css +16 -0
- package/dist/progress/Progress.d.ts +56 -0
- package/dist/progress/Progress.js +28 -0
- package/dist/progress/progress.css +24 -0
- package/dist/prose/Prose.d.ts +23 -0
- package/dist/prose/Prose.js +10 -0
- package/dist/prose/prose.css +29 -0
- package/dist/radio-group/RadioGroup.d.ts +59 -0
- package/dist/radio-group/RadioGroup.js +37 -0
- package/dist/radio-group/radio-group.css +30 -0
- package/dist/rolling-number/RollingNumber.d.ts +27 -0
- package/dist/rolling-number/RollingNumber.js +18 -0
- package/dist/rolling-number/rolling-number.css +10 -0
- package/dist/segment-group/Segmented.d.ts +68 -0
- package/dist/segment-group/Segmented.js +79 -0
- package/dist/segment-group/segment-group.css +25 -0
- package/dist/select/ListSelect.d.ts +5 -0
- package/dist/select/ListSelect.js +82 -0
- package/dist/select/SearchSelect.d.ts +43 -0
- package/dist/select/SearchSelect.js +219 -0
- package/dist/select/Select.d.ts +147 -0
- package/dist/select/Select.js +32 -0
- package/dist/select/items.d.ts +17 -0
- package/dist/select/items.js +14 -0
- package/dist/select/search-select.css +45 -0
- package/dist/select/select.css +52 -0
- package/dist/sheet/Sheet.d.ts +88 -0
- package/dist/sheet/Sheet.js +66 -0
- package/dist/sheet/sheet.css +44 -0
- package/dist/sidebar/NavGroup.d.ts +29 -0
- package/dist/sidebar/NavGroup.js +78 -0
- package/dist/sidebar/NavItem.d.ts +33 -0
- package/dist/sidebar/NavItem.js +50 -0
- package/dist/sidebar/NavSection.d.ts +20 -0
- package/dist/sidebar/NavSection.js +44 -0
- package/dist/sidebar/Sidebar.d.ts +65 -0
- package/dist/sidebar/Sidebar.js +59 -0
- package/dist/sidebar/SidebarUser.d.ts +31 -0
- package/dist/sidebar/SidebarUser.js +14 -0
- package/dist/sidebar/context.d.ts +13 -0
- package/dist/sidebar/context.js +6 -0
- package/dist/sidebar/sidebar.css +109 -0
- package/dist/skeleton/Skeleton.d.ts +25 -0
- package/dist/skeleton/Skeleton.js +8 -0
- package/dist/skeleton/skeleton.css +13 -0
- package/dist/slider/Slider.d.ts +70 -0
- package/dist/slider/Slider.js +65 -0
- package/dist/slider/slider.css +17 -0
- package/dist/sortable-list/SortableList.d.ts +46 -0
- package/dist/sortable-list/SortableList.js +85 -0
- package/dist/sortable-list/sortable-list.css +25 -0
- package/dist/spinner/Spinner.d.ts +18 -0
- package/dist/spinner/Spinner.js +11 -0
- package/dist/spinner/spinner.css +9 -0
- package/dist/stat/Stat.d.ts +42 -0
- package/dist/stat/Stat.js +21 -0
- package/dist/stat/Stats.d.ts +23 -0
- package/dist/stat/Stats.js +8 -0
- package/dist/stat/stat.css +34 -0
- package/dist/swatch-picker/SwatchPicker.d.ts +45 -0
- package/dist/swatch-picker/SwatchPicker.js +54 -0
- package/dist/swatch-picker/swatch-picker.css +38 -0
- package/dist/switch/Switch.d.ts +39 -0
- package/dist/switch/Switch.js +17 -0
- package/dist/switch/switch.css +13 -0
- package/dist/table/Table.d.ts +90 -0
- package/dist/table/Table.js +145 -0
- package/dist/table/table.css +44 -0
- package/dist/tabs/Tabs.d.ts +87 -0
- package/dist/tabs/Tabs.js +90 -0
- package/dist/tabs/tabs.css +53 -0
- package/dist/tags-input/TagsInput.d.ts +69 -0
- package/dist/tags-input/TagsInput.js +95 -0
- package/dist/tags-input/tags-input.css +37 -0
- package/dist/textarea/Textarea.d.ts +24 -0
- package/dist/textarea/Textarea.js +51 -0
- package/dist/textarea/textarea.css +14 -0
- package/dist/theme-toggle/ThemeToggle.d.ts +49 -0
- package/dist/theme-toggle/ThemeToggle.js +71 -0
- package/dist/theme-toggle/theme-toggle.css +23 -0
- package/dist/theme.css +121 -0
- package/dist/time-input/TimeInput.d.ts +25 -0
- package/dist/time-input/TimeInput.js +20 -0
- package/dist/timeline/Timeline.d.ts +50 -0
- package/dist/timeline/Timeline.js +15 -0
- package/dist/timeline/timeline.css +29 -0
- package/dist/toast/Toaster.d.ts +36 -0
- package/dist/toast/Toaster.js +25 -0
- package/dist/toast/toast.css +33 -0
- package/dist/tooltip/Tooltip.d.ts +55 -0
- package/dist/tooltip/Tooltip.js +48 -0
- package/dist/tooltip/tooltip.css +18 -0
- package/dist/tree-view/TreeView.d.ts +86 -0
- package/dist/tree-view/TreeView.js +74 -0
- package/dist/tree-view/tree-view.css +29 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.js +59 -0
- package/package.json +99 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A richer preview that opens while the pointer rests on (or keyboard focus
|
|
3
|
+
* is on) a trigger, e.g. a person's details over their name.
|
|
4
|
+
*
|
|
5
|
+
* <HoverCard trigger={<a href="/students/1">Ada Lovelace</a>}>…card content…</HoverCard>
|
|
6
|
+
*
|
|
7
|
+
* It stays open while the pointer is over the card, so its content can be
|
|
8
|
+
* selected or clicked. Keep anything essential reachable another way (touch
|
|
9
|
+
* has no hover).
|
|
10
|
+
*
|
|
11
|
+
* - `trigger`: your link or button (it gets the trigger's props)
|
|
12
|
+
* - `placement`: 'bottom' (default), 'top', 'right-start', …
|
|
13
|
+
* - `openDelay`, `closeDelay`: in ms (400 and 200)
|
|
14
|
+
* - `arrow`: points the card at its trigger; `disabled`
|
|
15
|
+
* - `open`, `defaultOpen`; `onOpenChange`
|
|
16
|
+
*
|
|
17
|
+
* By hand: HoverCard.Root, Trigger, Positioner, Content, Arrow, ArrowTip.
|
|
18
|
+
*/
|
|
19
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
20
|
+
import { HoverCard as Ark, type HoverCardOpenChangeDetails } from '@ark-ui/react/hover-card';
|
|
21
|
+
import { type Classes } from '../utils.js';
|
|
22
|
+
import '../theme.css';
|
|
23
|
+
import './hover-card.css';
|
|
24
|
+
export type HoverCardProps = Omit<Ark.ContentProps, 'children'> & {
|
|
25
|
+
trigger?: ReactElement | null;
|
|
26
|
+
placement?: NonNullable<Ark.RootProps['positioning']>['placement'];
|
|
27
|
+
openDelay?: number;
|
|
28
|
+
closeDelay?: number;
|
|
29
|
+
arrow?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
open?: boolean;
|
|
32
|
+
defaultOpen?: boolean;
|
|
33
|
+
onOpenChange?: (open: boolean, details: HoverCardOpenChangeDetails) => void;
|
|
34
|
+
classes?: Classes<'positioner' | 'content' | 'arrow' | 'arrowTip'>;
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
};
|
|
37
|
+
declare function HoverCardShortcut({ trigger, placement, openDelay, closeDelay, arrow, disabled, open, defaultOpen, onOpenChange, className, classes, children, ...rest }: HoverCardProps): import("react").JSX.Element;
|
|
38
|
+
export declare const HoverCard: typeof HoverCardShortcut & {
|
|
39
|
+
Root: (props: Ark.RootProps) => import("react").JSX.Element;
|
|
40
|
+
Trigger: import("react").ForwardRefExoticComponent<Ark.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
Positioner: import("react").ForwardRefExoticComponent<Ark.PositionerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
42
|
+
Content: import("react").ForwardRefExoticComponent<Ark.ContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
Arrow: import("react").ForwardRefExoticComponent<Ark.ArrowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
|
+
ArrowTip: import("react").ForwardRefExoticComponent<Ark.ArrowTipProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
Context: (props: Ark.ContextProps) => ReactNode;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HoverCard as Ark } from '@ark-ui/react/hover-card';
|
|
3
|
+
import { cx, on, partsOf, withParts } from '../utils.js';
|
|
4
|
+
import '../theme.css';
|
|
5
|
+
import './hover-card.css';
|
|
6
|
+
function HoverCardShortcut({ trigger = null, placement = 'bottom', openDelay = 400, closeDelay = 200, arrow = false, disabled = false, open, defaultOpen, onOpenChange, className, classes, children, ...rest }) {
|
|
7
|
+
const part = partsOf('hover-card', classes);
|
|
8
|
+
return (_jsxs(Ark.Root, { openDelay: openDelay, closeDelay: closeDelay, disabled: disabled, lazyMount: true, unmountOnExit: true, positioning: { placement, strategy: 'fixed', gutter: 8 }, ...(open !== undefined && { open }), ...(defaultOpen !== undefined && { defaultOpen }), ...on('onOpenChange', onOpenChange, (details) => details.open), children: [trigger && _jsx(Ark.Trigger, { asChild: true, children: trigger }), _jsx(Ark.Positioner, { ...part('positioner'), children: _jsxs(Ark.Content, { ...rest, ...part('content'), className: cx(className, classes?.content), children: [arrow && _jsx(Ark.Arrow, { ...part('arrow'), children: _jsx(Ark.ArrowTip, { ...part('arrow-tip') }) }), children] }) })] }));
|
|
9
|
+
}
|
|
10
|
+
export const HoverCard = withParts(HoverCardShortcut, {
|
|
11
|
+
Root: Ark.Root,
|
|
12
|
+
Trigger: Ark.Trigger,
|
|
13
|
+
Positioner: Ark.Positioner,
|
|
14
|
+
Content: Ark.Content,
|
|
15
|
+
Arrow: Ark.Arrow,
|
|
16
|
+
ArrowTip: Ark.ArrowTip,
|
|
17
|
+
Context: Ark.Context,
|
|
18
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@layer ui {
|
|
2
|
+
/* Zag copies the content's z-index onto its positioner. */
|
|
3
|
+
[data-scope=hover-card][data-part=content] {
|
|
4
|
+
z-index: 50; font-weight: 400; width: 18rem; max-width: calc(100vw - 32px); padding: 1rem; box-sizing: border-box; outline: none;
|
|
5
|
+
background: var(--ui-surface); color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
|
|
6
|
+
border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 2px); box-shadow: var(--ui-shadow);
|
|
7
|
+
--arrow-size: 12px; --arrow-background: var(--ui-surface); transform-origin: var(--transform-origin);
|
|
8
|
+
/* Comes in from the trigger's side. */
|
|
9
|
+
&[data-placement^=bottom] { --dy: -4px; }
|
|
10
|
+
&[data-placement^=top] { --dy: 4px; }
|
|
11
|
+
&[data-placement^=right] { --dx: -4px; }
|
|
12
|
+
&[data-placement^=left] { --dx: 4px; }
|
|
13
|
+
&[data-state=open] { animation: ui-hover-card-in 150ms ease-out; }
|
|
14
|
+
&[data-state=closed] { animation: ui-hover-card-out 120ms ease-in forwards; }
|
|
15
|
+
}
|
|
16
|
+
[data-scope=hover-card][data-part=arrow-tip] { border-top: 1px solid var(--ui-border); border-left: 1px solid var(--ui-border); }
|
|
17
|
+
@keyframes ui-hover-card-in { from { opacity: 0; transform: translateY(var(--dy, 0)) translateX(var(--dx, 0)) scale(0.97); } }
|
|
18
|
+
@keyframes ui-hover-card-out { to { opacity: 0; transform: scale(0.97); } }
|
|
19
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference path="./css.d.ts" />
|
|
2
|
+
export { Button } from './button/Button.js';
|
|
3
|
+
export { CopyButton } from './copy-button/CopyButton.js';
|
|
4
|
+
export { Badge } from './badge/Badge.js';
|
|
5
|
+
export { Card } from './card/Card.js';
|
|
6
|
+
export { Alert } from './alert/Alert.js';
|
|
7
|
+
export { Progress } from './progress/Progress.js';
|
|
8
|
+
export { Skeleton } from './skeleton/Skeleton.js';
|
|
9
|
+
export { Spinner } from './spinner/Spinner.js';
|
|
10
|
+
export { EmptyState } from './empty-state/EmptyState.js';
|
|
11
|
+
export { Input } from './input/Input.js';
|
|
12
|
+
export { Textarea } from './textarea/Textarea.js';
|
|
13
|
+
export { PasswordInput } from './password-input/PasswordInput.js';
|
|
14
|
+
export { NumberInput } from './number-input/NumberInput.js';
|
|
15
|
+
export { PinInput } from './pin-input/PinInput.js';
|
|
16
|
+
export { TagsInput } from './tags-input/TagsInput.js';
|
|
17
|
+
export { Slider } from './slider/Slider.js';
|
|
18
|
+
export { FileUpload } from './file-upload/FileUpload.js';
|
|
19
|
+
export { Field, Fields } from './field/Field.js';
|
|
20
|
+
export { Select, Combobox, createListCollection } from './select/Select.js';
|
|
21
|
+
export { DatePicker, parseDate } from './date-picker/DatePicker.js';
|
|
22
|
+
export { Checkbox } from './checkbox/Checkbox.js';
|
|
23
|
+
export { CheckboxGroup } from './checkbox/CheckboxGroup.js';
|
|
24
|
+
export { Switch } from './switch/Switch.js';
|
|
25
|
+
export { RadioGroup } from './radio-group/RadioGroup.js';
|
|
26
|
+
export { Segmented } from './segment-group/Segmented.js';
|
|
27
|
+
export { ThemeToggle } from './theme-toggle/ThemeToggle.js';
|
|
28
|
+
export { colorScheme, useColorScheme, type Scheme } from './color-scheme.js';
|
|
29
|
+
export { Tooltip } from './tooltip/Tooltip.js';
|
|
30
|
+
export { Menu, ContextMenu, MenuItem, MenuSeparator, MenuGroup, MenuCheckbox, MenuRadioGroup, MenuRadio, Submenu, type MenuEntry, type MenuOptionChange, } from './menu/Menu.js';
|
|
31
|
+
export { Tabs, Tab } from './tabs/Tabs.js';
|
|
32
|
+
export { Dialog } from './dialog/Dialog.js';
|
|
33
|
+
export { confirm, type ConfirmOptions } from './confirm/confirm.js';
|
|
34
|
+
export { Sheet } from './sheet/Sheet.js';
|
|
35
|
+
export { Popover } from './popover/Popover.js';
|
|
36
|
+
export { HoverCard } from './hover-card/HoverCard.js';
|
|
37
|
+
export { Toaster, Toast, toaster, createToaster } from './toast/Toaster.js';
|
|
38
|
+
export { ActionBar } from './action-bar/ActionBar.js';
|
|
39
|
+
export { Avatar } from './avatar/Avatar.js';
|
|
40
|
+
export { AvatarGroup } from './avatar/AvatarGroup.js';
|
|
41
|
+
export { AppShell, useShell } from './app-shell/AppShell.js';
|
|
42
|
+
export { Topbar } from './app-shell/Topbar.js';
|
|
43
|
+
export { Sidebar, type SidebarSection, type SidebarLink } from './sidebar/Sidebar.js';
|
|
44
|
+
export { NavSection } from './sidebar/NavSection.js';
|
|
45
|
+
export { NavGroup } from './sidebar/NavGroup.js';
|
|
46
|
+
export { NavItem } from './sidebar/NavItem.js';
|
|
47
|
+
export { SidebarUser } from './sidebar/SidebarUser.js';
|
|
48
|
+
export { Page } from './page/Page.js';
|
|
49
|
+
export { Breadcrumbs, type Crumb } from './breadcrumbs/Breadcrumbs.js';
|
|
50
|
+
export { Command, formatHotkey, type CommandItem } from './command/Command.js';
|
|
51
|
+
export { Table, sortRows, cellValue, type TableColumn, type TableSort } from './table/Table.js';
|
|
52
|
+
export { Pagination } from './pagination/Pagination.js';
|
|
53
|
+
export { DataList, DataItem, type DataEntry } from './data-list/DataList.js';
|
|
54
|
+
export { Stat } from './stat/Stat.js';
|
|
55
|
+
export { Stats } from './stat/Stats.js';
|
|
56
|
+
export { Timeline, TimelineItem } from './timeline/Timeline.js';
|
|
57
|
+
export { Accordion, AccordionItem, type AccordionEntry } from './accordion/Accordion.js';
|
|
58
|
+
export { Collapsible } from './collapsible/Collapsible.js';
|
|
59
|
+
export { SortableList } from './sortable-list/SortableList.js';
|
|
60
|
+
export { EventCalendar, type CalendarEvent, type CalendarResource, type CalendarView, type CalendarChange, type CalendarSelection, type CalendarKeys, type CalendarRow, type CalendarQuery, type CalendarTranslations, type CalendarMenuItem, } from './event-calendar/EventCalendar.js';
|
|
61
|
+
export { Attachments, formatSize, type Attachment, type AttachmentRejection } from './attachments/Attachments.js';
|
|
62
|
+
export { Banner } from './banner/Banner.js';
|
|
63
|
+
export { Kbd } from './kbd/Kbd.js';
|
|
64
|
+
export { Divider } from './divider/Divider.js';
|
|
65
|
+
export { FormatNumber, FormatBytes, FormatRelative } from './format/FormatNumber.js';
|
|
66
|
+
export { formatNumber, formatBytes, formatRelative, type FormatNumberOptions } from './format/format.js';
|
|
67
|
+
export { LocaleProvider, useLocale, useMessages, type LocaleProviderProps } from './format/LocaleProvider.js';
|
|
68
|
+
export { en, fr, type Messages, type CalendarMessages, type DeepPartial } from './format/messages.js';
|
|
69
|
+
export { RollingNumber } from './rolling-number/RollingNumber.js';
|
|
70
|
+
export { Prose } from './prose/Prose.js';
|
|
71
|
+
export { Highlight, type HighlightProps, type HighlightColor } from './highlight/Highlight.js';
|
|
72
|
+
export { NativeSelect } from './native-select/NativeSelect.js';
|
|
73
|
+
export { Editable } from './editable/Editable.js';
|
|
74
|
+
export { TimeInput } from './time-input/TimeInput.js';
|
|
75
|
+
export { SwatchPicker, swatches, type Swatch } from './swatch-picker/SwatchPicker.js';
|
|
76
|
+
export { TreeView, createTreeCollection as createTreeViewCollection, type TreeItem } from './tree-view/TreeView.js';
|
|
77
|
+
export { Editor, defaultTools, type EditorTool, type UploadedImage } from './editor/Editor.js';
|
|
78
|
+
export { AreaChart } from './chart/AreaChart.js';
|
|
79
|
+
export { BarChart } from './chart/BarChart.js';
|
|
80
|
+
export { Sparkline } from './chart/Sparkline.js';
|
|
81
|
+
export { DonutChart, type DonutSlice } from './chart/DonutChart.js';
|
|
82
|
+
export type { ChartRow, ChartSeries } from './chart/chart.js';
|
|
83
|
+
export { Portal } from '@ark-ui/react/portal';
|
|
84
|
+
export { cx } from './utils.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Every component is a shortcut (<Checkbox label="…" />) with its parts on it,
|
|
2
|
+
// for building it by hand (<Checkbox.Root>…</Checkbox.Root>).
|
|
3
|
+
export { Button } from './button/Button.js';
|
|
4
|
+
export { CopyButton } from './copy-button/CopyButton.js';
|
|
5
|
+
export { Badge } from './badge/Badge.js';
|
|
6
|
+
export { Card } from './card/Card.js';
|
|
7
|
+
export { Alert } from './alert/Alert.js';
|
|
8
|
+
export { Progress } from './progress/Progress.js';
|
|
9
|
+
export { Skeleton } from './skeleton/Skeleton.js';
|
|
10
|
+
export { Spinner } from './spinner/Spinner.js';
|
|
11
|
+
export { EmptyState } from './empty-state/EmptyState.js';
|
|
12
|
+
export { Input } from './input/Input.js';
|
|
13
|
+
export { Textarea } from './textarea/Textarea.js';
|
|
14
|
+
export { PasswordInput } from './password-input/PasswordInput.js';
|
|
15
|
+
export { NumberInput } from './number-input/NumberInput.js';
|
|
16
|
+
export { PinInput } from './pin-input/PinInput.js';
|
|
17
|
+
export { TagsInput } from './tags-input/TagsInput.js';
|
|
18
|
+
export { Slider } from './slider/Slider.js';
|
|
19
|
+
export { FileUpload } from './file-upload/FileUpload.js';
|
|
20
|
+
export { Field, Fields } from './field/Field.js';
|
|
21
|
+
export { Select, Combobox, createListCollection } from './select/Select.js';
|
|
22
|
+
export { DatePicker, parseDate } from './date-picker/DatePicker.js';
|
|
23
|
+
export { Checkbox } from './checkbox/Checkbox.js';
|
|
24
|
+
export { CheckboxGroup } from './checkbox/CheckboxGroup.js';
|
|
25
|
+
export { Switch } from './switch/Switch.js';
|
|
26
|
+
export { RadioGroup } from './radio-group/RadioGroup.js';
|
|
27
|
+
export { Segmented } from './segment-group/Segmented.js';
|
|
28
|
+
export { ThemeToggle } from './theme-toggle/ThemeToggle.js';
|
|
29
|
+
export { colorScheme, useColorScheme } from './color-scheme.js';
|
|
30
|
+
export { Tooltip } from './tooltip/Tooltip.js';
|
|
31
|
+
export { Menu, ContextMenu, MenuItem, MenuSeparator, MenuGroup, MenuCheckbox, MenuRadioGroup, MenuRadio, Submenu, } from './menu/Menu.js';
|
|
32
|
+
export { Tabs, Tab } from './tabs/Tabs.js';
|
|
33
|
+
export { Dialog } from './dialog/Dialog.js';
|
|
34
|
+
export { confirm } from './confirm/confirm.js';
|
|
35
|
+
export { Sheet } from './sheet/Sheet.js';
|
|
36
|
+
export { Popover } from './popover/Popover.js';
|
|
37
|
+
export { HoverCard } from './hover-card/HoverCard.js';
|
|
38
|
+
export { Toaster, Toast, toaster, createToaster } from './toast/Toaster.js';
|
|
39
|
+
export { ActionBar } from './action-bar/ActionBar.js';
|
|
40
|
+
export { Avatar } from './avatar/Avatar.js';
|
|
41
|
+
export { AvatarGroup } from './avatar/AvatarGroup.js';
|
|
42
|
+
export { AppShell, useShell } from './app-shell/AppShell.js';
|
|
43
|
+
export { Topbar } from './app-shell/Topbar.js';
|
|
44
|
+
export { Sidebar } from './sidebar/Sidebar.js';
|
|
45
|
+
export { NavSection } from './sidebar/NavSection.js';
|
|
46
|
+
export { NavGroup } from './sidebar/NavGroup.js';
|
|
47
|
+
export { NavItem } from './sidebar/NavItem.js';
|
|
48
|
+
export { SidebarUser } from './sidebar/SidebarUser.js';
|
|
49
|
+
export { Page } from './page/Page.js';
|
|
50
|
+
export { Breadcrumbs } from './breadcrumbs/Breadcrumbs.js';
|
|
51
|
+
export { Command, formatHotkey } from './command/Command.js';
|
|
52
|
+
export { Table, sortRows, cellValue } from './table/Table.js';
|
|
53
|
+
export { Pagination } from './pagination/Pagination.js';
|
|
54
|
+
export { DataList, DataItem } from './data-list/DataList.js';
|
|
55
|
+
export { Stat } from './stat/Stat.js';
|
|
56
|
+
export { Stats } from './stat/Stats.js';
|
|
57
|
+
export { Timeline, TimelineItem } from './timeline/Timeline.js';
|
|
58
|
+
export { Accordion, AccordionItem } from './accordion/Accordion.js';
|
|
59
|
+
export { Collapsible } from './collapsible/Collapsible.js';
|
|
60
|
+
export { SortableList } from './sortable-list/SortableList.js';
|
|
61
|
+
export { EventCalendar, } from './event-calendar/EventCalendar.js';
|
|
62
|
+
export { Attachments, formatSize } from './attachments/Attachments.js';
|
|
63
|
+
export { Banner } from './banner/Banner.js';
|
|
64
|
+
export { Kbd } from './kbd/Kbd.js';
|
|
65
|
+
export { Divider } from './divider/Divider.js';
|
|
66
|
+
export { FormatNumber, FormatBytes, FormatRelative } from './format/FormatNumber.js';
|
|
67
|
+
export { formatNumber, formatBytes, formatRelative } from './format/format.js';
|
|
68
|
+
export { LocaleProvider, useLocale, useMessages } from './format/LocaleProvider.js';
|
|
69
|
+
export { en, fr } from './format/messages.js';
|
|
70
|
+
export { RollingNumber } from './rolling-number/RollingNumber.js';
|
|
71
|
+
export { Prose } from './prose/Prose.js';
|
|
72
|
+
export { Highlight } from './highlight/Highlight.js';
|
|
73
|
+
export { NativeSelect } from './native-select/NativeSelect.js';
|
|
74
|
+
export { Editable } from './editable/Editable.js';
|
|
75
|
+
export { TimeInput } from './time-input/TimeInput.js';
|
|
76
|
+
export { SwatchPicker, swatches } from './swatch-picker/SwatchPicker.js';
|
|
77
|
+
export { TreeView, createTreeCollection as createTreeViewCollection } from './tree-view/TreeView.js';
|
|
78
|
+
export { Editor, defaultTools } from './editor/Editor.js';
|
|
79
|
+
export { AreaChart } from './chart/AreaChart.js';
|
|
80
|
+
export { BarChart } from './chart/BarChart.js';
|
|
81
|
+
export { Sparkline } from './chart/Sparkline.js';
|
|
82
|
+
export { DonutChart } from './chart/DonutChart.js';
|
|
83
|
+
// Ark's Portal, for overlays built by hand.
|
|
84
|
+
export { Portal } from '@ark-ui/react/portal';
|
|
85
|
+
export { cx } from './utils.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentProps, HTMLInputTypeAttribute, ReactNode } from 'react';
|
|
2
|
+
import { Field } from '@ark-ui/react/field';
|
|
3
|
+
import 'iconify-icon';
|
|
4
|
+
import { type Classes } from '../utils.js';
|
|
5
|
+
import '../theme.css';
|
|
6
|
+
import './input.css';
|
|
7
|
+
type KnownType<T = HTMLInputTypeAttribute> = T extends unknown ? (string extends T ? never : T) : never;
|
|
8
|
+
type Typed = {
|
|
9
|
+
type: 'number';
|
|
10
|
+
onValueChange?: (value: number) => void;
|
|
11
|
+
} | {
|
|
12
|
+
type?: Exclude<KnownType, 'number'>;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
};
|
|
15
|
+
export type InputProps = Omit<ComponentProps<'input'>, 'size' | 'prefix' | 'type'> & Typed & {
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
icon?: string | null;
|
|
18
|
+
prefix?: ReactNode;
|
|
19
|
+
suffix?: ReactNode;
|
|
20
|
+
start?: ReactNode;
|
|
21
|
+
end?: ReactNode;
|
|
22
|
+
size?: 'sm' | 'md';
|
|
23
|
+
round?: boolean;
|
|
24
|
+
classes?: Classes<'root' | 'label' | 'control' | 'icon' | 'prefix' | 'input' | 'suffix'>;
|
|
25
|
+
};
|
|
26
|
+
declare function InputShortcut({ label, type, icon, prefix, suffix, size, round, start, end, onValueChange, onChange, className, classes, ...rest }: InputProps): import("react").JSX.Element;
|
|
27
|
+
export declare const Input: typeof InputShortcut & {
|
|
28
|
+
Root: {
|
|
29
|
+
(props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
Control: {
|
|
33
|
+
(props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
Field: {
|
|
37
|
+
(props: Field.InputProps & import("react").RefAttributes<HTMLInputElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A text input: a box holding a native <input>, with optional content before
|
|
4
|
+
* and after it. Other attributes (placeholder, name, autoComplete, onChange…)
|
|
5
|
+
* go on the <input>.
|
|
6
|
+
*
|
|
7
|
+
* <Input label="Name" value={name} onValueChange={setName} />
|
|
8
|
+
* <Input icon="lucide:search" placeholder="Search…" />
|
|
9
|
+
*
|
|
10
|
+
* - `label`: a label above it (skipped inside a Field)
|
|
11
|
+
* - `value`, `defaultValue`: as on a native input
|
|
12
|
+
* - `onValueChange`: called with the new value (a number for type="number")
|
|
13
|
+
* - `type`: as on a native input
|
|
14
|
+
* - `icon`: an Iconify name shown before the input
|
|
15
|
+
* - `prefix`, `suffix`: text before or after it ('£', 'kg')
|
|
16
|
+
* - `start`, `end`: anything else before or after it (a button)
|
|
17
|
+
* - `size`: 'sm' or 'md'; `round`: a pill (a search box)
|
|
18
|
+
*
|
|
19
|
+
* By hand:
|
|
20
|
+
*
|
|
21
|
+
* <Input.Root data-size="sm">
|
|
22
|
+
* <Input.Control><Input.Field placeholder="…" /><Button size="sm">Go</Button></Input.Control>
|
|
23
|
+
* </Input.Root>
|
|
24
|
+
*/
|
|
25
|
+
import { useId } from 'react';
|
|
26
|
+
import { Field, useFieldContext } from '@ark-ui/react/field';
|
|
27
|
+
import 'iconify-icon';
|
|
28
|
+
import { cx, partOf, partsOf, withParts } from '../utils.js';
|
|
29
|
+
import '../theme.css';
|
|
30
|
+
import './input.css';
|
|
31
|
+
function InputShortcut({ label = null, type = 'text', icon = null, prefix = null, suffix = null, size = 'md', round = false, start = null, end = null, onValueChange, onChange, className, classes, ...rest }) {
|
|
32
|
+
const field = useFieldContext();
|
|
33
|
+
const part = partsOf('input', classes);
|
|
34
|
+
const ownId = useId();
|
|
35
|
+
const id = rest.id ?? `${ownId}-input`;
|
|
36
|
+
function change(e) {
|
|
37
|
+
onChange?.(e);
|
|
38
|
+
const handler = onValueChange;
|
|
39
|
+
handler?.(type === 'number' ? e.target.valueAsNumber : e.target.value);
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("div", { ...part('root'), className: cx(className, classes?.root), "data-size": size, "data-round": round || undefined, children: [label && !field && _jsx("label", { ...part('label'), htmlFor: id, children: label }), _jsxs("div", { ...part('control'), children: [start ?? (icon ? _jsx("iconify-icon", { ...part('icon'), icon: icon, "aria-hidden": "true" })
|
|
42
|
+
: prefix != null && _jsx("span", { ...part('prefix'), children: prefix })), _jsx(Field.Input, { type: type, id: field ? undefined : id, ...rest, ...part('input'), onChange: change }), end ?? (suffix != null && _jsx("span", { ...part('suffix'), children: suffix }))] })] }));
|
|
43
|
+
}
|
|
44
|
+
export const Input = withParts(InputShortcut, {
|
|
45
|
+
Root: partOf('input', 'root'),
|
|
46
|
+
Control: partOf('input', 'control'),
|
|
47
|
+
Field: partOf('input', 'input', Field.Input),
|
|
48
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@layer ui {
|
|
2
|
+
[data-scope=input][data-part=root] { display: block; min-width: 0; color: var(--ui-text); font-family: var(--ui-font); }
|
|
3
|
+
[data-scope=input][data-part=label] { display: block; font-size: 14px; font-weight: 500; margin-bottom: 0.375rem; }
|
|
4
|
+
[data-scope=input][data-part=control] {
|
|
5
|
+
display: flex; align-items: center; gap: 0.5rem; min-width: 0; box-sizing: border-box;
|
|
6
|
+
min-height: var(--ui-control-height); padding: 0 0.75rem;
|
|
7
|
+
background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
|
|
8
|
+
color: var(--ui-text); font-family: var(--ui-font); font-size: 14px;
|
|
9
|
+
|
|
10
|
+
&:focus-within { border-color: var(--ui-ring); outline: 2px solid var(--ui-ring-soft); }
|
|
11
|
+
&:has([aria-invalid=true]) { border-color: var(--ui-danger); }
|
|
12
|
+
&:has(:disabled) { opacity: 0.5; }
|
|
13
|
+
[data-round] > & { border-radius: 9999px; padding: 0 0.875rem; }
|
|
14
|
+
[data-size=sm] > & { min-height: var(--ui-control-height-sm); padding: 0 0.625rem; font-size: 13px; }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-scope=input][data-part=input] { flex: 1; min-width: 0; padding: 0; border: none; background: transparent;
|
|
18
|
+
outline: none; color: inherit; font: inherit;
|
|
19
|
+
&::placeholder { color: var(--ui-muted); }
|
|
20
|
+
&[type=number] { appearance: textfield; }
|
|
21
|
+
&::-webkit-inner-spin-button, &::-webkit-outer-spin-button { appearance: none; margin: 0; } }
|
|
22
|
+
[data-scope=input]:is([data-part=prefix], [data-part=suffix]) { display: flex; align-items: center; flex-shrink: 0;
|
|
23
|
+
color: var(--ui-muted); white-space: nowrap; }
|
|
24
|
+
[data-scope=input][data-part=icon] { display: block; width: 1em; height: 1em; font-size: 16px; color: var(--ui-muted); flex-shrink: 0; }
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A keyboard key, or a shortcut of several.
|
|
3
|
+
*
|
|
4
|
+
* <Kbd>Esc</Kbd>
|
|
5
|
+
* <Kbd keys={['⌘', 'K']} />
|
|
6
|
+
*
|
|
7
|
+
* - `keys`: several keys, each in its own box (the content, if given, is one key)
|
|
8
|
+
* - `size`: 'sm' or 'md'
|
|
9
|
+
*/
|
|
10
|
+
import { type HTMLAttributes } from 'react';
|
|
11
|
+
import { type Classes } from '../utils.js';
|
|
12
|
+
import '../theme.css';
|
|
13
|
+
import './kbd.css';
|
|
14
|
+
export type KbdProps = HTMLAttributes<HTMLElement> & {
|
|
15
|
+
keys?: string[] | null;
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
classes?: Classes<'root' | 'key'>;
|
|
18
|
+
};
|
|
19
|
+
export declare function Kbd({ keys, size, className, classes, children, ...rest }: KbdProps): import("react").JSX.Element;
|
package/dist/kbd/Kbd.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A keyboard key, or a shortcut of several.
|
|
4
|
+
*
|
|
5
|
+
* <Kbd>Esc</Kbd>
|
|
6
|
+
* <Kbd keys={['⌘', 'K']} />
|
|
7
|
+
*
|
|
8
|
+
* - `keys`: several keys, each in its own box (the content, if given, is one key)
|
|
9
|
+
* - `size`: 'sm' or 'md'
|
|
10
|
+
*/
|
|
11
|
+
import { Fragment } from 'react';
|
|
12
|
+
import { cx, partsOf } from '../utils.js';
|
|
13
|
+
import '../theme.css';
|
|
14
|
+
import './kbd.css';
|
|
15
|
+
export function Kbd({ keys = null, size = 'md', className, classes, children, ...rest }) {
|
|
16
|
+
const part = partsOf('kbd', classes);
|
|
17
|
+
if (!keys)
|
|
18
|
+
return _jsx("kbd", { ...rest, ...part('key'), className: cx(className, classes?.key), "data-size": size, children: children });
|
|
19
|
+
return (_jsx("span", { ...rest, ...part('root'), className: cx(className, classes?.root), "data-size": size, children: keys.map((key, i) => _jsx(Fragment, { children: _jsx("kbd", { ...part('key'), "data-size": size, children: key }) }, i)) }));
|
|
20
|
+
}
|
package/dist/kbd/kbd.css
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
@layer ui {
|
|
2
|
+
[data-scope=kbd][data-part=root] { display: inline-flex; align-items: center; gap: 0.1875rem; vertical-align: middle; }
|
|
3
|
+
[data-scope=kbd][data-part=key] { display: inline-flex; align-items: center; justify-content: center; min-width: 1.375rem; height: 1.375rem;
|
|
4
|
+
padding: 0 0.375rem; box-sizing: border-box; vertical-align: middle;
|
|
5
|
+
border: 1px solid var(--ui-border); border-bottom-width: 2px; border-radius: 5px; background: var(--ui-surface);
|
|
6
|
+
color: var(--ui-muted); font-family: var(--ui-font); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
7
|
+
&[data-size=sm] { min-width: 1.125rem; height: 1.125rem; padding: 0 0.25rem; font-size: 11px; border-bottom-width: 1px; } }
|
|
8
|
+
}
|