@ratio-ui/core 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/catalogue.json +2829 -72
- package/dist/components/alert/Alert.d.ts +18 -0
- package/dist/components/alert/Alert.js +67 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/alert-dialog/AlertDialog.d.ts +48 -0
- package/dist/components/alert-dialog/AlertDialog.js +76 -0
- package/dist/components/alert-dialog/index.d.ts +2 -0
- package/dist/components/alert-dialog/index.js +1 -0
- package/dist/components/app-shell/AppShell.d.ts +22 -0
- package/dist/components/app-shell/AppShell.js +39 -0
- package/dist/components/app-shell/context.js +5 -0
- package/dist/components/app-shell/index.d.ts +2 -0
- package/dist/components/app-shell/index.js +1 -0
- package/dist/components/avatar/Avatar.d.ts +22 -0
- package/dist/components/avatar/Avatar.js +38 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/button/Button.d.ts +37 -0
- package/dist/components/button/Button.js +41 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/calendar/Calendar.d.ts +20 -0
- package/dist/components/calendar/Calendar.js +119 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/Card.d.ts +33 -0
- package/dist/components/card/Card.js +53 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +10 -0
- package/dist/components/checkbox/Checkbox.js +28 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/checkbox-list/CheckboxList.d.ts +36 -0
- package/dist/components/checkbox-list/CheckboxList.js +93 -0
- package/dist/components/checkbox-list/index.d.ts +2 -0
- package/dist/components/checkbox-list/index.js +1 -0
- package/dist/components/collapsible/Collapsible.d.ts +24 -0
- package/dist/components/collapsible/Collapsible.js +58 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/data-table/DataTable.d.ts +65 -0
- package/dist/components/data-table/DataTable.js +141 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/DatePicker.d.ts +33 -0
- package/dist/components/date-picker/DatePicker.js +104 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/DateRangePicker.d.ts +39 -0
- package/dist/components/date-range-picker/DateRangePicker.js +142 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/definition/Definition.d.ts +14 -0
- package/dist/components/definition/Definition.js +29 -0
- package/dist/components/definition/index.d.ts +2 -0
- package/dist/components/definition/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +44 -0
- package/dist/components/dialog/Dialog.js +79 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +73 -0
- package/dist/components/dropdown-menu/DropdownMenu.js +116 -0
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/empty-state/EmptyState.d.ts +15 -0
- package/dist/components/empty-state/EmptyState.js +30 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/field/Field.d.ts +35 -0
- package/dist/components/field/Field.js +67 -0
- package/dist/components/field/Label.d.ts +8 -0
- package/dist/components/field/Label.js +13 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/field/index.js +3 -0
- package/dist/components/filter-tabs/FilterTabs.d.ts +28 -0
- package/dist/components/filter-tabs/FilterTabs.js +37 -0
- package/dist/components/filter-tabs/index.d.ts +2 -0
- package/dist/components/filter-tabs/index.js +1 -0
- package/dist/components/global-search/GlobalSearch.d.ts +51 -0
- package/dist/components/global-search/GlobalSearch.js +144 -0
- package/dist/components/global-search/index.d.ts +2 -0
- package/dist/components/global-search/index.js +1 -0
- package/dist/components/icon/registry.d.ts +3 -2
- package/dist/components/icon/registry.js +57 -1
- package/dist/components/input/Input.d.ts +19 -0
- package/dist/components/input/Input.js +26 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input-group/InputGroup.d.ts +42 -0
- package/dist/components/input-group/InputGroup.js +83 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +1 -0
- package/dist/components/kbd/Kbd.d.ts +17 -0
- package/dist/components/kbd/Kbd.js +21 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/link/Link.d.ts +22 -0
- package/dist/components/link/Link.js +31 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/index.js +1 -0
- package/dist/components/link-provider/LinkProvider.d.ts +29 -0
- package/dist/components/link-provider/LinkProvider.js +15 -0
- package/dist/components/link-provider/RatioLink.js +18 -0
- package/dist/components/link-provider/context.js +4 -0
- package/dist/components/link-provider/index.d.ts +2 -0
- package/dist/components/link-provider/index.js +1 -0
- package/dist/components/media-grid/MediaGrid.d.ts +49 -0
- package/dist/components/media-grid/MediaGrid.js +303 -0
- package/dist/components/media-grid/index.d.ts +2 -0
- package/dist/components/media-grid/index.js +1 -0
- package/dist/components/metric-strip/MetricStrip.d.ts +23 -0
- package/dist/components/metric-strip/MetricStrip.js +39 -0
- package/dist/components/metric-strip/index.d.ts +2 -0
- package/dist/components/metric-strip/index.js +1 -0
- package/dist/components/money-input/MoneyInput.d.ts +30 -0
- package/dist/components/money-input/MoneyInput.js +72 -0
- package/dist/components/money-input/index.d.ts +2 -0
- package/dist/components/money-input/index.js +1 -0
- package/dist/components/page-header/PageHeader.d.ts +37 -0
- package/dist/components/page-header/PageHeader.js +62 -0
- package/dist/components/page-header/index.d.ts +2 -0
- package/dist/components/page-header/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +18 -0
- package/dist/components/pagination/Pagination.js +59 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/popover/Popover.d.ts +27 -0
- package/dist/components/popover/Popover.js +47 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/save-bar/SaveBar.d.ts +27 -0
- package/dist/components/save-bar/SaveBar.js +37 -0
- package/dist/components/save-bar/index.d.ts +2 -0
- package/dist/components/save-bar/index.js +1 -0
- package/dist/components/search-field/SearchField.d.ts +23 -0
- package/dist/components/search-field/SearchField.js +66 -0
- package/dist/components/search-field/index.d.ts +2 -0
- package/dist/components/search-field/index.js +1 -0
- package/dist/components/select/Select.d.ts +40 -0
- package/dist/components/select/Select.js +84 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/side-nav/SideNav.d.ts +64 -0
- package/dist/components/side-nav/SideNav.js +194 -0
- package/dist/components/side-nav/index.d.ts +2 -0
- package/dist/components/side-nav/index.js +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +13 -0
- package/dist/components/skeleton/Skeleton.js +21 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/spinner/Spinner.d.ts +11 -0
- package/dist/components/spinner/Spinner.js +16 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/status-pill/StatusPill.d.ts +14 -0
- package/dist/components/status-pill/StatusPill.js +19 -0
- package/dist/components/status-pill/index.d.ts +2 -0
- package/dist/components/status-pill/index.js +1 -0
- package/dist/components/summary-chips/SummaryChips.d.ts +17 -0
- package/dist/components/summary-chips/SummaryChips.js +19 -0
- package/dist/components/summary-chips/index.d.ts +2 -0
- package/dist/components/summary-chips/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +10 -0
- package/dist/components/switch/Switch.js +20 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/Table.d.ts +46 -0
- package/dist/components/table/Table.js +87 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table-loader/TableLoader.d.ts +31 -0
- package/dist/components/table-loader/TableLoader.js +35 -0
- package/dist/components/table-loader/index.d.ts +2 -0
- package/dist/components/table-loader/index.js +1 -0
- package/dist/components/tabs/Tabs.d.ts +23 -0
- package/dist/components/tabs/Tabs.js +41 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tag-input/TagInput.d.ts +44 -0
- package/dist/components/tag-input/TagInput.js +102 -0
- package/dist/components/tag-input/index.d.ts +2 -0
- package/dist/components/tag-input/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +15 -0
- package/dist/components/textarea/Textarea.js +21 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toaster/Toaster.d.ts +32 -0
- package/dist/components/toaster/Toaster.js +89 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +18 -0
- package/dist/components/tooltip/Tooltip.js +35 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/top-bar/StoreSwitcher.d.ts +26 -0
- package/dist/components/top-bar/StoreSwitcher.js +48 -0
- package/dist/components/top-bar/TopBar.d.ts +24 -0
- package/dist/components/top-bar/TopBar.js +53 -0
- package/dist/components/top-bar/index.d.ts +3 -0
- package/dist/components/top-bar/index.js +3 -0
- package/dist/components/unit-input/UnitInput.d.ts +33 -0
- package/dist/components/unit-input/UnitInput.js +47 -0
- package/dist/components/unit-input/index.d.ts +2 -0
- package/dist/components/unit-input/index.js +1 -0
- package/dist/index.d.ts +102 -1
- package/dist/index.js +54 -2
- package/dist/lib/cn.js +38 -27
- package/dist/lib/format.d.ts +92 -0
- package/dist/lib/format.js +222 -0
- package/dist/styles.css +1 -1
- package/package.json +205 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InputGroupSize } from "../input-group/InputGroup.js";
|
|
2
|
+
import "../input-group/index.js";
|
|
3
|
+
import { InputHTMLAttributes, JSX, Ref } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* The props of UnitInput: the HTML attributes of an input, except className, style, size and the ones the field sets
|
|
6
|
+
* itself (type, inputMode, step, onChange), with the unit and the number in and out. Mark an invalid field with
|
|
7
|
+
* aria-invalid, which draws the error ring around the whole group.
|
|
8
|
+
*/
|
|
9
|
+
export type UnitInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style' | 'size' | 'type' | 'inputMode' | 'step' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
|
|
10
|
+
/** The unit after the number, such as kg or cm. Screen readers read it as the field's description. */
|
|
11
|
+
unit: string;
|
|
12
|
+
/** The number, or null for an empty field. Pass it to control the field. */
|
|
13
|
+
value?: number | null;
|
|
14
|
+
/** The starting number when the field is not controlled. Defaults to empty. */
|
|
15
|
+
defaultValue?: number | null;
|
|
16
|
+
/** Called with the number as it is typed or cleared (null when empty), and with the rounded number on blur. */
|
|
17
|
+
onValueChange?: (value: number | null) => void;
|
|
18
|
+
/** The most decimals the number keeps; the field rounds to them on blur. Defaults to 3 (grams in kg). */
|
|
19
|
+
decimals?: number;
|
|
20
|
+
/** The smallest number; the field moves a smaller one up to it on blur. */
|
|
21
|
+
min?: number;
|
|
22
|
+
/** The largest number; the field moves a larger one down to it on blur. */
|
|
23
|
+
max?: number;
|
|
24
|
+
/** The height in px: 36 for forms, 32 for fields inside a table. Defaults to 36. */
|
|
25
|
+
size?: InputGroupSize;
|
|
26
|
+
/** Receives the input element. */
|
|
27
|
+
ref?: Ref<HTMLInputElement>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A number field with its unit after it, inside one ring: a weight in kg, a length in cm. It takes and gives a number,
|
|
31
|
+
* written without thousands separators as counts are, and keeps at most `decimals` decimals.
|
|
32
|
+
*/
|
|
33
|
+
export declare function UnitInput({ unit, value, defaultValue, onValueChange, decimals, min, max, size, id, name, disabled, readOnly, required, 'aria-describedby': describedBy, ref, ...rest }: UnitInputProps): JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FORMAT } from "../../lib/format.js";
|
|
2
|
+
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "../input-group/InputGroup.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { NumberField } from "@base-ui/react/number-field";
|
|
6
|
+
// src/components/unit-input/UnitInput.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A number field with its unit after it, inside one ring: a weight in kg, a length in cm. It takes and gives a number,
|
|
9
|
+
* written without thousands separators as counts are, and keeps at most `decimals` decimals.
|
|
10
|
+
*/
|
|
11
|
+
function UnitInput({ unit, value, defaultValue, onValueChange, decimals = 3, min, max, size = 36, id, name, disabled, readOnly, required, "aria-describedby": describedBy, ref, ...rest }) {
|
|
12
|
+
const unitId = useId();
|
|
13
|
+
return /* @__PURE__ */ jsx(NumberField.Root, {
|
|
14
|
+
id,
|
|
15
|
+
name,
|
|
16
|
+
value,
|
|
17
|
+
defaultValue: defaultValue ?? void 0,
|
|
18
|
+
onValueChange: (next) => onValueChange?.(next),
|
|
19
|
+
locale: FORMAT.locale,
|
|
20
|
+
format: {
|
|
21
|
+
maximumFractionDigits: decimals,
|
|
22
|
+
useGrouping: false
|
|
23
|
+
},
|
|
24
|
+
min,
|
|
25
|
+
max,
|
|
26
|
+
disabled,
|
|
27
|
+
readOnly,
|
|
28
|
+
required,
|
|
29
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
30
|
+
size,
|
|
31
|
+
"aria-disabled": disabled || void 0,
|
|
32
|
+
children: [/* @__PURE__ */ jsx(NumberField.Input, {
|
|
33
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, {}),
|
|
34
|
+
ref,
|
|
35
|
+
"aria-describedby": describedBy === void 0 ? unitId : `${unitId} ${describedBy}`,
|
|
36
|
+
...rest
|
|
37
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
38
|
+
align: "end",
|
|
39
|
+
children: /* @__PURE__ */ jsx(InputGroupText, {
|
|
40
|
+
id: unitId,
|
|
41
|
+
children: unit
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { UnitInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnitInput } from "./UnitInput.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,112 @@
|
|
|
1
|
+
import { Button, ButtonProps, ButtonVariant } from "./components/button/Button.js";
|
|
2
|
+
import "./components/button/index.js";
|
|
3
|
+
import { AlertDialog, AlertDialogAction, AlertDialogActionProps, AlertDialogCancel, AlertDialogCancelProps, AlertDialogContent, AlertDialogContentProps, AlertDialogDescription, AlertDialogDescriptionProps, AlertDialogFooter, AlertDialogFooterProps, AlertDialogHeader, AlertDialogHeaderProps, AlertDialogTitle, AlertDialogTitleProps, AlertDialogTrigger, AlertDialogTriggerProps } from "./components/alert-dialog/AlertDialog.js";
|
|
4
|
+
import "./components/alert-dialog/index.js";
|
|
5
|
+
import { Alert, AlertProps, AlertTone } from "./components/alert/Alert.js";
|
|
6
|
+
import "./components/alert/index.js";
|
|
7
|
+
import { AppShell, AppShellProps } from "./components/app-shell/AppShell.js";
|
|
8
|
+
import "./components/app-shell/index.js";
|
|
9
|
+
import { Avatar, AvatarProps, AvatarShape, AvatarSize, getInitials } from "./components/avatar/Avatar.js";
|
|
10
|
+
import "./components/avatar/index.js";
|
|
11
|
+
import { Calendar, CalendarProps } from "./components/calendar/Calendar.js";
|
|
12
|
+
import "./components/calendar/index.js";
|
|
13
|
+
import { Card, CardContent, CardContentProps, CardDescription, CardDescriptionProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps } from "./components/card/Card.js";
|
|
14
|
+
import "./components/card/index.js";
|
|
15
|
+
import { CheckboxList, CheckboxListItem, CheckboxListProps } from "./components/checkbox-list/CheckboxList.js";
|
|
16
|
+
import "./components/checkbox-list/index.js";
|
|
17
|
+
import { Checkbox, CheckboxProps } from "./components/checkbox/Checkbox.js";
|
|
18
|
+
import "./components/checkbox/index.js";
|
|
19
|
+
import { SummaryChip, SummaryChips, SummaryChipsProps } from "./components/summary-chips/SummaryChips.js";
|
|
20
|
+
import "./components/summary-chips/index.js";
|
|
21
|
+
import { Collapsible, CollapsibleProps } from "./components/collapsible/Collapsible.js";
|
|
22
|
+
import "./components/collapsible/index.js";
|
|
23
|
+
import { Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps } from "./components/table/Table.js";
|
|
24
|
+
import "./components/table/index.js";
|
|
25
|
+
import { DataTable, DataTableColumn, DataTableProps, DataTableSort } from "./components/data-table/DataTable.js";
|
|
26
|
+
import "./components/data-table/index.js";
|
|
27
|
+
import { InputGroup, InputGroupAddon, InputGroupAddonAlign, InputGroupAddonProps, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupShortcut, InputGroupShortcutProps, InputGroupSize, InputGroupText, InputGroupTextProps } from "./components/input-group/InputGroup.js";
|
|
28
|
+
import "./components/input-group/index.js";
|
|
29
|
+
import { DatePicker, DatePickerProps } from "./components/date-picker/DatePicker.js";
|
|
30
|
+
import "./components/date-picker/index.js";
|
|
31
|
+
import { DateRangePicker, DateRangePickerProps, DateRangeValue } from "./components/date-range-picker/DateRangePicker.js";
|
|
32
|
+
import "./components/date-range-picker/index.js";
|
|
33
|
+
import { Definition, DefinitionProps } from "./components/definition/Definition.js";
|
|
34
|
+
import "./components/definition/index.js";
|
|
35
|
+
import { Dialog, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps } from "./components/dialog/Dialog.js";
|
|
36
|
+
import "./components/dialog/index.js";
|
|
37
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuRadioItemProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuShortcut, DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubContentProps, DropdownMenuSubProps, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./components/dropdown-menu/DropdownMenu.js";
|
|
38
|
+
import "./components/dropdown-menu/index.js";
|
|
39
|
+
import { EmptyState, EmptyStateProps } from "./components/empty-state/EmptyState.js";
|
|
40
|
+
import "./components/empty-state/index.js";
|
|
41
|
+
import { Field, FieldControlProps, FieldProps } from "./components/field/Field.js";
|
|
42
|
+
import { Label, LabelProps } from "./components/field/Label.js";
|
|
43
|
+
import "./components/field/index.js";
|
|
44
|
+
import { FilterTabs, FilterTabsItem, FilterTabsProps } from "./components/filter-tabs/FilterTabs.js";
|
|
45
|
+
import "./components/filter-tabs/index.js";
|
|
1
46
|
import { IconName } from "./components/icon/registry.js";
|
|
2
47
|
import { Icon, IconProps, IconSize, IconTone } from "./components/icon/Icon.js";
|
|
3
48
|
import "./components/icon/index.js";
|
|
49
|
+
import { GlobalSearch, GlobalSearchGroup, GlobalSearchProps, GlobalSearchResult } from "./components/global-search/GlobalSearch.js";
|
|
50
|
+
import "./components/global-search/index.js";
|
|
4
51
|
import { Space } from "./lib/space.js";
|
|
5
52
|
import { Inline, InlineProps } from "./components/inline/Inline.js";
|
|
6
53
|
import "./components/inline/index.js";
|
|
54
|
+
import { Input, InputProps, InputSize } from "./components/input/Input.js";
|
|
55
|
+
import "./components/input/index.js";
|
|
56
|
+
import { Kbd, KbdGroup, KbdGroupProps, KbdProps } from "./components/kbd/Kbd.js";
|
|
57
|
+
import "./components/kbd/index.js";
|
|
58
|
+
import { LinkProvider, LinkProviderProps, LinkRender, LinkRenderProps } from "./components/link-provider/LinkProvider.js";
|
|
59
|
+
import "./components/link-provider/index.js";
|
|
60
|
+
import { Link, LinkProps } from "./components/link/Link.js";
|
|
61
|
+
import "./components/link/index.js";
|
|
62
|
+
import { MediaGrid, MediaGridItem, MediaGridProps } from "./components/media-grid/MediaGrid.js";
|
|
63
|
+
import "./components/media-grid/index.js";
|
|
64
|
+
import { MetricSegment, MetricStrip, MetricStripProps } from "./components/metric-strip/MetricStrip.js";
|
|
65
|
+
import "./components/metric-strip/index.js";
|
|
66
|
+
import { MoneyInput, MoneyInputProps } from "./components/money-input/MoneyInput.js";
|
|
67
|
+
import "./components/money-input/index.js";
|
|
68
|
+
import { StatusPill, StatusPillProps, StatusPillTone } from "./components/status-pill/StatusPill.js";
|
|
69
|
+
import "./components/status-pill/index.js";
|
|
70
|
+
import { PageHeader, PageHeaderMenuItem, PageHeaderProps } from "./components/page-header/PageHeader.js";
|
|
71
|
+
import "./components/page-header/index.js";
|
|
72
|
+
import { Pagination, PaginationProps } from "./components/pagination/Pagination.js";
|
|
73
|
+
import "./components/pagination/index.js";
|
|
74
|
+
import { Popover, PopoverContent, PopoverContentProps, PopoverDescription, PopoverDescriptionProps, PopoverHeader, PopoverHeaderProps, PopoverProps, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps } from "./components/popover/Popover.js";
|
|
75
|
+
import "./components/popover/index.js";
|
|
76
|
+
import { SaveBar, SaveBarProps } from "./components/save-bar/SaveBar.js";
|
|
77
|
+
import "./components/save-bar/index.js";
|
|
78
|
+
import { SearchField, SearchFieldProps } from "./components/search-field/SearchField.js";
|
|
79
|
+
import "./components/search-field/index.js";
|
|
80
|
+
import { Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupProps, SelectItem, SelectItemProps, SelectLabel, SelectLabelProps, SelectProps, SelectSeparator, SelectSeparatorProps, SelectSize, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps } from "./components/select/Select.js";
|
|
81
|
+
import "./components/select/index.js";
|
|
82
|
+
import { SideNav, SideNavAccount, SideNavItem, SideNavProps, SideNavSection } from "./components/side-nav/SideNav.js";
|
|
83
|
+
import "./components/side-nav/index.js";
|
|
84
|
+
import { Skeleton, SkeletonProps, SkeletonShape } from "./components/skeleton/Skeleton.js";
|
|
85
|
+
import "./components/skeleton/index.js";
|
|
86
|
+
import { Spinner, SpinnerProps } from "./components/spinner/Spinner.js";
|
|
87
|
+
import "./components/spinner/index.js";
|
|
7
88
|
import { Stack, StackProps } from "./components/stack/Stack.js";
|
|
8
89
|
import "./components/stack/index.js";
|
|
90
|
+
import { Switch, SwitchProps } from "./components/switch/Switch.js";
|
|
91
|
+
import "./components/switch/index.js";
|
|
92
|
+
import { TableLoader, TableLoaderColumn, TableLoaderProps } from "./components/table-loader/TableLoader.js";
|
|
93
|
+
import "./components/table-loader/index.js";
|
|
94
|
+
import { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsTrigger, TabsTriggerProps } from "./components/tabs/Tabs.js";
|
|
95
|
+
import "./components/tabs/index.js";
|
|
96
|
+
import { TagInput, TagInputProps } from "./components/tag-input/TagInput.js";
|
|
97
|
+
import "./components/tag-input/index.js";
|
|
9
98
|
import { Text, TextProps, TextTone, TextVariant } from "./components/text/Text.js";
|
|
10
99
|
import "./components/text/index.js";
|
|
11
|
-
|
|
100
|
+
import { Textarea, TextareaProps, TextareaSize } from "./components/textarea/Textarea.js";
|
|
101
|
+
import "./components/textarea/index.js";
|
|
102
|
+
import { ToastOptions, Toaster, ToasterProps, toast } from "./components/toaster/Toaster.js";
|
|
103
|
+
import "./components/toaster/index.js";
|
|
104
|
+
import { Tooltip, TooltipContent, TooltipContentProps, TooltipProps, TooltipProvider, TooltipProviderProps, TooltipTrigger, TooltipTriggerProps } from "./components/tooltip/Tooltip.js";
|
|
105
|
+
import "./components/tooltip/index.js";
|
|
106
|
+
import { TopBar, TopBarProps } from "./components/top-bar/TopBar.js";
|
|
107
|
+
import { StoreOption, StoreSwitcher, StoreSwitcherProps } from "./components/top-bar/StoreSwitcher.js";
|
|
108
|
+
import "./components/top-bar/index.js";
|
|
109
|
+
import { UnitInput, UnitInputProps } from "./components/unit-input/UnitInput.js";
|
|
110
|
+
import "./components/unit-input/index.js";
|
|
111
|
+
import { DateInput, FORMAT, MONEY_NUMBER_FORMAT, amountToPaise, currencySymbol, formatCount, formatDate, formatIsoDate, formatMoney, formatPaise, formatPaiseForEditing, formatTime, numberSeparators, paiseToAmount, parseDate, parseMoney } from "./lib/format.js";
|
|
112
|
+
export { Alert, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, type AlertProps, type AlertTone, AppShell, type AppShellProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, Button, type ButtonProps, type ButtonVariant, Calendar, type CalendarProps, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, CheckboxList, type CheckboxListItem, type CheckboxListProps, type CheckboxProps, Collapsible, type CollapsibleProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSort, DateInput, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, type DateRangeValue, Definition, type DefinitionProps, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, DropdownMenu, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, FORMAT, Field, type FieldControlProps, type FieldProps, FilterTabs, type FilterTabsItem, type FilterTabsProps, GlobalSearch, type GlobalSearchGroup, type GlobalSearchProps, type GlobalSearchResult, Icon, type IconName, type IconProps, type IconSize, type IconTone, Inline, type InlineProps, Input, InputGroup, InputGroupAddon, type InputGroupAddonAlign, type InputGroupAddonProps, InputGroupInput, type InputGroupInputProps, type InputGroupProps, InputGroupShortcut, type InputGroupShortcutProps, type InputGroupSize, InputGroupText, type InputGroupTextProps, type InputProps, type InputSize, Kbd, KbdGroup, type KbdGroupProps, type KbdProps, Label, type LabelProps, Link, type LinkProps, LinkProvider, type LinkProviderProps, type LinkRender, type LinkRenderProps, MONEY_NUMBER_FORMAT, MediaGrid, type MediaGridItem, type MediaGridProps, type MetricSegment, MetricStrip, type MetricStripProps, MoneyInput, type MoneyInputProps, PageHeader, type PageHeaderMenuItem, type PageHeaderProps, Pagination, type PaginationProps, Popover, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, PopoverHeader, type PopoverHeaderProps, type PopoverProps, PopoverTitle, type PopoverTitleProps, PopoverTrigger, type PopoverTriggerProps, SaveBar, type SaveBarProps, SearchField, type SearchFieldProps, Select, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, type SelectProps, SelectSeparator, type SelectSeparatorProps, type SelectSize, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, SideNav, type SideNavAccount, type SideNavItem, type SideNavProps, type SideNavSection, Skeleton, type SkeletonProps, type SkeletonShape, type Space, Spinner, type SpinnerProps, Stack, type StackProps, StatusPill, type StatusPillProps, type StatusPillTone, type StoreOption, StoreSwitcher, type StoreSwitcherProps, type SummaryChip, SummaryChips, type SummaryChipsProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableLoader, type TableLoaderColumn, type TableLoaderProps, type TableProps, TableRow, type TableRowProps, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, TagInput, type TagInputProps, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type TextareaSize, type ToastOptions, Toaster, type ToasterProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, TopBar, type TopBarProps, UnitInput, type UnitInputProps, amountToPaise, currencySymbol, formatCount, formatDate, formatIsoDate, formatMoney, formatPaise, formatPaiseForEditing, formatTime, getInitials, numberSeparators, paiseToAmount, parseDate, parseMoney, toast };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
import { Icon } from "./components/icon/Icon.js";
|
|
2
|
+
import { Text } from "./components/text/Text.js";
|
|
3
|
+
import { Alert } from "./components/alert/Alert.js";
|
|
4
|
+
import { Button } from "./components/button/Button.js";
|
|
5
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog/AlertDialog.js";
|
|
6
|
+
import { AppShell } from "./components/app-shell/AppShell.js";
|
|
7
|
+
import { Avatar, getInitials } from "./components/avatar/Avatar.js";
|
|
8
|
+
import { FORMAT, MONEY_NUMBER_FORMAT, amountToPaise, currencySymbol, formatCount, formatDate, formatIsoDate, formatMoney, formatPaise, formatPaiseForEditing, formatTime, numberSeparators, paiseToAmount, parseDate, parseMoney } from "./lib/format.js";
|
|
9
|
+
import { Calendar } from "./components/calendar/Calendar.js";
|
|
10
|
+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card/Card.js";
|
|
11
|
+
import { Checkbox } from "./components/checkbox/Checkbox.js";
|
|
12
|
+
import { CheckboxList } from "./components/checkbox-list/CheckboxList.js";
|
|
13
|
+
import { SummaryChips } from "./components/summary-chips/SummaryChips.js";
|
|
14
|
+
import { Collapsible } from "./components/collapsible/Collapsible.js";
|
|
15
|
+
import { Pagination } from "./components/pagination/Pagination.js";
|
|
16
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table/Table.js";
|
|
17
|
+
import { DataTable } from "./components/data-table/DataTable.js";
|
|
18
|
+
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupShortcut, InputGroupText } from "./components/input-group/InputGroup.js";
|
|
19
|
+
import { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger } from "./components/popover/Popover.js";
|
|
20
|
+
import { DatePicker } from "./components/date-picker/DatePicker.js";
|
|
21
|
+
import { DateRangePicker } from "./components/date-range-picker/DateRangePicker.js";
|
|
22
|
+
import { Definition } from "./components/definition/Definition.js";
|
|
23
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./components/dialog/Dialog.js";
|
|
24
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu/DropdownMenu.js";
|
|
25
|
+
import { EmptyState } from "./components/empty-state/EmptyState.js";
|
|
26
|
+
import { Label } from "./components/field/Label.js";
|
|
27
|
+
import { Field } from "./components/field/Field.js";
|
|
28
|
+
import { FilterTabs } from "./components/filter-tabs/FilterTabs.js";
|
|
29
|
+
import { Kbd, KbdGroup } from "./components/kbd/Kbd.js";
|
|
30
|
+
import { GlobalSearch } from "./components/global-search/GlobalSearch.js";
|
|
2
31
|
import { Inline } from "./components/inline/Inline.js";
|
|
32
|
+
import { Input } from "./components/input/Input.js";
|
|
33
|
+
import { Link } from "./components/link/Link.js";
|
|
34
|
+
import { LinkProvider } from "./components/link-provider/LinkProvider.js";
|
|
35
|
+
import { MediaGrid } from "./components/media-grid/MediaGrid.js";
|
|
36
|
+
import { MetricStrip } from "./components/metric-strip/MetricStrip.js";
|
|
37
|
+
import { MoneyInput } from "./components/money-input/MoneyInput.js";
|
|
38
|
+
import { StatusPill } from "./components/status-pill/StatusPill.js";
|
|
39
|
+
import { PageHeader } from "./components/page-header/PageHeader.js";
|
|
40
|
+
import { SaveBar } from "./components/save-bar/SaveBar.js";
|
|
41
|
+
import { SearchField } from "./components/search-field/SearchField.js";
|
|
42
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "./components/select/Select.js";
|
|
43
|
+
import { SideNav } from "./components/side-nav/SideNav.js";
|
|
44
|
+
import { Skeleton } from "./components/skeleton/Skeleton.js";
|
|
45
|
+
import { Spinner } from "./components/spinner/Spinner.js";
|
|
3
46
|
import { Stack } from "./components/stack/Stack.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
47
|
+
import { Switch } from "./components/switch/Switch.js";
|
|
48
|
+
import { TableLoader } from "./components/table-loader/TableLoader.js";
|
|
49
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs/Tabs.js";
|
|
50
|
+
import { TagInput } from "./components/tag-input/TagInput.js";
|
|
51
|
+
import { Textarea } from "./components/textarea/Textarea.js";
|
|
52
|
+
import { Toaster, toast } from "./components/toaster/Toaster.js";
|
|
53
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip/Tooltip.js";
|
|
54
|
+
import { TopBar } from "./components/top-bar/TopBar.js";
|
|
55
|
+
import { StoreSwitcher } from "./components/top-bar/StoreSwitcher.js";
|
|
56
|
+
import { UnitInput } from "./components/unit-input/UnitInput.js";
|
|
57
|
+
export { Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AppShell, Avatar, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxList, Collapsible, DataTable, DatePicker, DateRangePicker, Definition, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FORMAT, Field, FilterTabs, GlobalSearch, Icon, Inline, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupShortcut, InputGroupText, Kbd, KbdGroup, Label, Link, LinkProvider, MONEY_NUMBER_FORMAT, MediaGrid, MetricStrip, MoneyInput, PageHeader, Pagination, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, SaveBar, SearchField, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, SideNav, Skeleton, Spinner, Stack, StatusPill, StoreSwitcher, SummaryChips, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableLoader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, Text, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, UnitInput, amountToPaise, currencySymbol, formatCount, formatDate, formatIsoDate, formatMoney, formatPaise, formatPaiseForEditing, formatTime, getInitials, numberSeparators, paiseToAmount, parseDate, parseMoney, toast };
|
package/dist/lib/cn.js
CHANGED
|
@@ -3,33 +3,44 @@ import { extendTailwindMerge } from "tailwind-merge";
|
|
|
3
3
|
// src/lib/cn.ts
|
|
4
4
|
const twMerge = extendTailwindMerge({
|
|
5
5
|
prefix: "rt",
|
|
6
|
-
extend: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
6
|
+
extend: {
|
|
7
|
+
theme: {
|
|
8
|
+
text: [
|
|
9
|
+
"display",
|
|
10
|
+
"h1",
|
|
11
|
+
"h5",
|
|
12
|
+
"s1",
|
|
13
|
+
"s2",
|
|
14
|
+
"b1",
|
|
15
|
+
"b2",
|
|
16
|
+
"b3",
|
|
17
|
+
"b4",
|
|
18
|
+
"c1",
|
|
19
|
+
"c2",
|
|
20
|
+
"c3",
|
|
21
|
+
"label",
|
|
22
|
+
"btn",
|
|
23
|
+
"btn-sm"
|
|
24
|
+
],
|
|
25
|
+
shadow: [
|
|
26
|
+
"ring-subtle",
|
|
27
|
+
"ring-focus",
|
|
28
|
+
"ring-strong",
|
|
29
|
+
"ring-hairline",
|
|
30
|
+
"ring-accent-hairline",
|
|
31
|
+
"ring-destructive",
|
|
32
|
+
"ring-invalid"
|
|
33
|
+
],
|
|
34
|
+
container: ["content"]
|
|
35
|
+
},
|
|
36
|
+
classGroups: {
|
|
37
|
+
h: [{ h: ["progress"] }],
|
|
38
|
+
w: [{ w: ["anchor"] }],
|
|
39
|
+
"min-w": [{ "min-w": ["anchor"] }],
|
|
40
|
+
"max-w": [{ "max-w": ["available"] }],
|
|
41
|
+
"max-h": [{ "max-h": ["available"] }]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
33
44
|
});
|
|
34
45
|
/**
|
|
35
46
|
* Joins class values the way clsx does, then drops every rt: utility that a later one overrides.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The formats of design question 6, pending its answer: money in rupees with Indian grouping and two decimals
|
|
3
|
+
* (1,23,456.50), dates as day/month/year (28/10/2026), times on a 12-hour clock with a lower-case am or pm (3:05 pm).
|
|
4
|
+
* Counts carry no separators, as the design system says. Dates and times are written in the viewer's time zone.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FORMAT: {
|
|
7
|
+
/** The locale whose grouping and currency symbols money uses; also the locale a number field formats and parses with. */
|
|
8
|
+
readonly locale: "en-IN";
|
|
9
|
+
/** The currency of an amount when none is given (ISO 4217). */
|
|
10
|
+
readonly currency: "INR";
|
|
11
|
+
/** The decimals every amount shows, which is also how many minor units (paise) make one rupee: 10 to this power. */
|
|
12
|
+
readonly moneyDecimals: 2;
|
|
13
|
+
/** How a date is written and typed: DD, MM and YYYY with the separators between them. A date field's placeholder. */
|
|
14
|
+
readonly datePattern: "DD/MM/YYYY";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A date, a timestamp in milliseconds or a date string that `Date` reads, such as an ISO 8601 date from an API.
|
|
18
|
+
* A date-only string (2026-10-28) is that calendar day wherever the viewer is.
|
|
19
|
+
*/
|
|
20
|
+
export type DateInput = Date | number | string;
|
|
21
|
+
/**
|
|
22
|
+
* Writes an amount of money: the currency symbol, Indian digit grouping and two decimals, so 123456.5 is ₹1,23,456.50
|
|
23
|
+
* and -1234.5 is -₹1,234.50.
|
|
24
|
+
* @param amount The amount in the currency's main unit (rupees, not paise).
|
|
25
|
+
* @param currency The ISO 4217 code; rupees when left out.
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatMoney(amount: number, currency?: string): string;
|
|
28
|
+
/** Writes a count with no thousands separators, as the design system says: 123456, never 1,23,456. */
|
|
29
|
+
export declare function formatCount(count: number): string;
|
|
30
|
+
/** Writes a date in FORMAT.datePattern, two-digit day and month: 28/10/2026. Throws a RangeError on a value that is not a date. */
|
|
31
|
+
export declare function formatDate(value: DateInput): string;
|
|
32
|
+
/** Writes a calendar day as YYYY-MM-DD, the form a server reads: 2026-10-28. It is not the display format. Throws a RangeError on a value that is not a date. */
|
|
33
|
+
export declare function formatIsoDate(value: DateInput): string;
|
|
34
|
+
/**
|
|
35
|
+
* Reads a date typed in FORMAT.datePattern as that calendar day at local midnight: '28/10/2026' is 28 October 2026, and
|
|
36
|
+
* '3/1/2026' is 3 January. Returns null for anything else, including a day the calendar does not have (31/02/2026), so
|
|
37
|
+
* a date field can show its error rather than roll the date over.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseDate(text: string): Date | null;
|
|
40
|
+
/** Writes a time on a 12-hour clock, minutes in two digits, with a lower-case am or pm: 3:05 pm, 12:07 am. Throws a RangeError on a value that is not a date. */
|
|
41
|
+
export declare function formatTime(value: DateInput): string;
|
|
42
|
+
/**
|
|
43
|
+
* The options a number field formats money with, beside `locale={FORMAT.locale}`: two decimals, grouped as the locale
|
|
44
|
+
* groups (1,23,456.50). MoneyInput passes both to Base UI's NumberField.
|
|
45
|
+
*/
|
|
46
|
+
export declare const MONEY_NUMBER_FORMAT: {
|
|
47
|
+
readonly minimumFractionDigits: 2;
|
|
48
|
+
readonly maximumFractionDigits: 2;
|
|
49
|
+
readonly useGrouping: true;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The group separator and the decimal sign of a locale, FORMAT.locale when left out: { group: ',', decimal: '.' }.
|
|
53
|
+
* @param locale A BCP 47 locale.
|
|
54
|
+
*/
|
|
55
|
+
export declare function numberSeparators(locale?: string): {
|
|
56
|
+
group: string;
|
|
57
|
+
decimal: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The symbol a money field shows before the amount: ₹ for rupees.
|
|
61
|
+
* @param currency The ISO 4217 code; rupees when left out.
|
|
62
|
+
*/
|
|
63
|
+
export declare function currencySymbol(currency?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* The amount in rupees for integer paise, for a number field that holds rupees: 12345650 is 123456.5.
|
|
66
|
+
* Throws a RangeError on a value that is not a whole number of paise.
|
|
67
|
+
*/
|
|
68
|
+
export declare function paiseToAmount(paise: number): number;
|
|
69
|
+
/**
|
|
70
|
+
* Integer paise for an amount in rupees, rounded to the nearest paisa: 123456.5 is 12345650, and 0.1 + 0.2 is 30.
|
|
71
|
+
* Returns null for NaN, an infinity or an amount too large for exact paise.
|
|
72
|
+
*/
|
|
73
|
+
export declare function amountToPaise(amount: number): number | null;
|
|
74
|
+
/**
|
|
75
|
+
* Writes integer paise as money: 12345650 is ₹1,23,456.50 and -500 is -₹5.00.
|
|
76
|
+
* Throws a RangeError on a value that is not a whole number of paise.
|
|
77
|
+
* @param paise The amount in paise, the currency's minor unit.
|
|
78
|
+
* @param currency The ISO 4217 code; rupees when left out.
|
|
79
|
+
*/
|
|
80
|
+
export declare function formatPaise(paise: number, currency?: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Writes integer paise for a money field to edit: grouped, two decimals, no currency symbol (the field shows it as a
|
|
83
|
+
* prefix), so 12345650 is 1,23,456.50. parseMoney reads it back. Throws a RangeError on a value that is not a whole
|
|
84
|
+
* number of paise.
|
|
85
|
+
*/
|
|
86
|
+
export declare function formatPaiseForEditing(paise: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* Reads typed or pasted money as integer paise: '₹1,23,456.50', '1,23,456.5' and '123,456.50' are 12345650, '123456' is
|
|
89
|
+
* 12345600, ' 12.3 ' is 1230 and '-₹5' is -500. Returns null for anything that is not an amount: no digits, letters,
|
|
90
|
+
* another currency's symbol, two minus signs, groups that are not 2 or 3 digits, or more decimals than paise hold (12.345).
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseMoney(text: string): number | null;
|