@tempots/beatui 1.4.0 → 1.6.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/dist/ar-Wr6gMs-M.cjs +1 -0
- package/dist/{ar-C-kUt6f9.js → ar-fdUqbCvM.js} +154 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-DewHpITQ.cjs +1 -0
- package/dist/{auth-divider-D_3gKZ6g.js → auth-divider-qnJuYK-x.js} +7 -7
- package/dist/beatui.css +2107 -171
- package/dist/beatui.tailwind.css +2107 -171
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +5 -5
- package/dist/{modal-YKqlh4Dk.js → custom-validation-BetUqAEz.js} +186 -186
- package/dist/custom-validation-CLscGHY4.cjs +1 -0
- package/dist/{de-CP0kbElb.js → de-C5-k5Eov.js} +156 -3
- package/dist/de-DZqdSEta.cjs +1 -0
- package/dist/deep-merge-D90SW1Ci.cjs +1 -0
- package/dist/deep-merge-ZVigk5Qf.js +1765 -0
- package/dist/{duration-input-BrYLC1js.cjs → duration-input-4AQnQpyo.cjs} +1 -1
- package/dist/{duration-input-CFu6vq-y.js → duration-input-GMBmT1BE.js} +4 -4
- package/dist/{editor-toolbar-group-QVdBUbB8.cjs → editor-toolbar-group-C_ft_T8D.cjs} +1 -1
- package/dist/{editor-toolbar-group-DWUWUO-B.js → editor-toolbar-group-FpOHrmtx.js} +2 -2
- package/dist/es-CJgYfRap.cjs +1 -0
- package/dist/{es-BtIkcnsw.js → es-h6jmoF4X.js} +156 -3
- package/dist/fa-BQ5PzwNY.cjs +1 -0
- package/dist/{fa-11-rZmQ-.js → fa-BuxK837l.js} +154 -1
- package/dist/fr-Bv3TG44U.cjs +1 -0
- package/dist/{fr-C-L2F8w2.js → fr-BwILQ9G2.js} +165 -12
- package/dist/he-5LbvgMCC.cjs +1 -0
- package/dist/{he-Bu1xGoQ9.js → he-yC9Sc7JD.js} +154 -1
- package/dist/{hi-CewH-MAH.js → hi-Da7rcCpP.js} +154 -1
- package/dist/hi-YWhWcG_L.cjs +1 -0
- package/dist/{index-BGKz2Nol.js → index-DI8bf9oC.js} +175 -172
- package/dist/index-DeUj-5ph.cjs +1 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +11806 -8105
- package/dist/{input-container-CO3DNqpp.js → input-container-8JFB11xN.js} +1 -1
- package/dist/{input-container-BkPcNDaZ.cjs → input-container-CyOgiiQD.cjs} +1 -1
- package/dist/it-BxOIJE45.cjs +1 -0
- package/dist/{it-5hiKQO_p.js → it-Yeklau78.js} +156 -3
- package/dist/ja-CNhjK06P.cjs +1 -0
- package/dist/{ja-CGfEmZrm.js → ja-Dxj9Q5Yd.js} +155 -2
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +110 -110
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +1 -1
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +5 -5
- package/dist/ko-DgkqcXTs.cjs +1 -0
- package/dist/{ko-DZthvREd.js → ko-gn_MsegK.js} +154 -1
- package/dist/lexical/index.cjs.js +1 -1
- package/dist/lexical/index.es.js +4 -4
- package/dist/nl-Dy9lmbBO.cjs +1 -0
- package/dist/{nl-CcKyHlQ7.js → nl-vHNFtXXb.js} +162 -9
- package/dist/{notice-Du3tWJTW.js → notice-B6ojfenv.js} +4 -4
- package/dist/{notice-Q0A1gIho.cjs → notice-p2IqXS5-.cjs} +1 -1
- package/dist/{oneof-branch-detection-DSzC0PkO.js → oneof-branch-detection-Q_jxvJIA.js} +1 -1
- package/dist/{oneof-branch-detection-BEkAezNi.cjs → oneof-branch-detection-xDDDdYRk.cjs} +1 -1
- package/dist/pl-BtYbtsmG.cjs +1 -0
- package/dist/{pl-Mwtjp4MV.js → pl-C0UdHla0.js} +184 -31
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -4
- package/dist/pt-CtNmqQ1X.cjs +1 -0
- package/dist/{pt-BaTsY-8f.js → pt-DGKtfN0d.js} +156 -3
- package/dist/ru-BaL_NPRU.cjs +1 -0
- package/dist/{ru-CvbGmz5s.js → ru-CpXYLt-v.js} +154 -1
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +1 -1
- package/dist/tailwind/vite-plugin.cjs.js +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/{text-input-D_IxFd0M.cjs → text-input-DS5zlXb2.cjs} +1 -1
- package/dist/{text-input-BAn02BzO.js → text-input-NJypZSnE.js} +1 -1
- package/dist/{toolbar-CnecqhaU.cjs → toolbar-BBwfe8U9.cjs} +1 -1
- package/dist/{toolbar-BKan3NHw.js → toolbar-BF2L6WKC.js} +1 -1
- package/dist/{tr-YFqQdZjM.js → tr-DIFZDFW_.js} +156 -3
- package/dist/tr-DwOd87oB.cjs +1 -0
- package/dist/{translations-CxDUnbXn.js → translations-5cXBrENb.js} +1 -1
- package/dist/{translations-DT5QQ4WO.js → translations-BCMP-h52.js} +269 -115
- package/dist/{translations-C_-cObaF.cjs → translations-BqWc0ZHz.cjs} +1 -1
- package/dist/translations-EwEmHe3v.cjs +1 -0
- package/dist/types/beatui-i18n/default.d.ts +109 -0
- package/dist/types/beatui-i18n/locales/en.d.ts +109 -0
- package/dist/types/beatui-i18n/translations.d.ts +109 -0
- package/dist/types/components/button/copy-button.d.ts +42 -0
- package/dist/types/components/button/index.d.ts +1 -0
- package/dist/types/components/button/toggle-button-group.d.ts +2 -2
- package/dist/types/components/button/toggle-button.d.ts +2 -2
- package/dist/types/components/data/data-table-context.d.ts +9 -1
- package/dist/types/components/data/data-table-row-details.d.ts +21 -0
- package/dist/types/components/data/data-table-types.d.ts +23 -0
- package/dist/types/components/data/date-picker-shared.d.ts +2 -5
- package/dist/types/components/data/date-picker.d.ts +1 -1
- package/dist/types/components/data/date-range-picker.d.ts +1 -1
- package/dist/types/components/data/index.d.ts +4 -0
- package/dist/types/components/data/stat-card.d.ts +108 -0
- package/dist/types/components/data/time-picker.d.ts +54 -0
- package/dist/types/components/data/virtual-scrolling/index.d.ts +1 -0
- package/dist/types/components/data/virtual-scrolling/virtual-list.d.ts +91 -0
- package/dist/types/components/form/control/control.d.ts +5 -5
- package/dist/types/components/form/control/list-control.d.ts +11 -11
- package/dist/types/components/form/fieldset/fieldset.d.ts +60 -0
- package/dist/types/components/form/fieldset/index.d.ts +1 -0
- package/dist/types/components/form/index.d.ts +1 -0
- package/dist/types/components/form/input/checkbox-input.d.ts +1 -1
- package/dist/types/components/form/input/color-input.d.ts +1 -1
- package/dist/types/components/form/input/color-picker/canvas-draw.d.ts +12 -0
- package/dist/types/components/form/input/color-picker/channel-picker.d.ts +71 -0
- package/dist/types/components/form/input/color-picker/hex-color-picker.d.ts +20 -0
- package/dist/types/components/form/input/color-picker/hsl-color-picker.d.ts +14 -0
- package/dist/types/components/form/input/color-picker/hwb-color-picker.d.ts +15 -0
- package/dist/types/components/form/input/color-picker/index.d.ts +7 -0
- package/dist/types/components/form/input/color-picker/oklch-color-picker.d.ts +15 -0
- package/dist/types/components/form/input/color-picker/rgb-color-picker.d.ts +17 -0
- package/dist/types/components/form/input/color-swatch-input.d.ts +1 -1
- package/dist/types/components/form/input/combobox-input.d.ts +3 -3
- package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
- package/dist/types/components/form/input/date-input.d.ts +1 -1
- package/dist/types/components/form/input/date-range-select-base.d.ts +23 -0
- package/dist/types/components/form/input/date-range-select.d.ts +64 -0
- package/dist/types/components/form/input/date-select.d.ts +52 -0
- package/dist/types/components/form/input/date-time-input.d.ts +2 -2
- package/dist/types/components/form/input/date-time-select-base.d.ts +23 -0
- package/dist/types/components/form/input/date-time-select.d.ts +66 -0
- package/dist/types/components/form/input/dropdown-input.d.ts +3 -3
- package/dist/types/components/form/input/email-input.d.ts +1 -1
- package/dist/types/components/form/input/field-layout.d.ts +64 -0
- package/dist/types/components/form/input/{input-wrapper.d.ts → field.d.ts} +23 -14
- package/dist/types/components/form/input/index.d.ts +19 -1
- package/dist/types/components/form/input/multi-select.d.ts +2 -2
- package/dist/types/components/form/input/native-select.d.ts +1 -1
- package/dist/types/components/form/input/nullable-date-select.d.ts +55 -0
- package/dist/types/components/form/input/nullable-date-time-select.d.ts +68 -0
- package/dist/types/components/form/input/nullable-time-select.d.ts +64 -0
- package/dist/types/components/form/input/number-input.d.ts +5 -40
- package/dist/types/components/form/input/number-stepper.d.ts +53 -0
- package/dist/types/components/form/input/open-date-range-select.d.ts +75 -0
- package/dist/types/components/form/input/otp-input.d.ts +2 -2
- package/dist/types/components/form/input/password-input.d.ts +1 -1
- package/dist/types/components/form/input/radio-group.d.ts +1 -1
- package/dist/types/components/form/input/range-slider.d.ts +23 -6
- package/dist/types/components/form/input/rating-input.d.ts +1 -1
- package/dist/types/components/form/input/segmented-input.d.ts +6 -2
- package/dist/types/components/form/input/segmented-select.d.ts +84 -0
- package/dist/types/components/form/input/select-tags-input.d.ts +1 -1
- package/dist/types/components/form/input/slider-input.d.ts +2 -2
- package/dist/types/components/form/input/sortable-list.d.ts +68 -0
- package/dist/types/components/form/input/switch.d.ts +1 -1
- package/dist/types/components/form/input/text-area.d.ts +1 -1
- package/dist/types/components/form/input/text-input.d.ts +1 -1
- package/dist/types/components/form/input/time-format.d.ts +31 -0
- package/dist/types/components/form/input/time-select-base.d.ts +23 -0
- package/dist/types/components/form/input/time-select.d.ts +61 -0
- package/dist/types/components/form/input/transfer-list.d.ts +56 -0
- package/dist/types/components/form/input/tri-state-checkbox-input.d.ts +1 -1
- package/dist/types/components/form/input/url-input.d.ts +1 -1
- package/dist/types/components/format/format-bigint.d.ts +64 -0
- package/dist/types/components/format/format-date-time.d.ts +54 -0
- package/dist/types/components/format/format-date.d.ts +82 -0
- package/dist/types/components/format/format-display-name.d.ts +70 -0
- package/dist/types/components/format/format-file-size.d.ts +30 -0
- package/dist/types/components/format/format-list.d.ts +61 -0
- package/dist/types/components/format/format-number.d.ts +88 -0
- package/dist/types/components/format/format-plural.d.ts +96 -0
- package/dist/types/components/format/format-relative-time.d.ts +62 -0
- package/dist/types/components/format/format-time.d.ts +66 -0
- package/dist/types/components/format/index.d.ts +11 -0
- package/dist/types/components/i18n/locale-selector.d.ts +1 -1
- package/dist/types/components/json-schema/controls/composition-shared.d.ts +1 -1
- package/dist/types/components/json-schema/controls/shared-utils.d.ts +3 -3
- package/dist/types/components/json-schema/widgets/string-controls.d.ts +2 -2
- package/dist/types/components/json-schema-display/display-wrapper.d.ts +1 -1
- package/dist/types/components/layout/nine-slice-scroll-view.d.ts +1 -1
- package/dist/types/components/navigation/index.d.ts +1 -0
- package/dist/types/components/navigation/stepper.d.ts +102 -0
- package/dist/types/components/overlay/index.d.ts +1 -1
- package/dist/types/components/overlay/spotlight.d.ts +62 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/ur-D9nLchps.cjs +1 -0
- package/dist/{ur-CdnwwnG_.js → ur-DBst-TXc.js} +154 -1
- package/dist/use-form-Dcra7GeE.cjs +2 -0
- package/dist/{use-form-D_TJyZhP.js → use-form-NfobsGNl.js} +474 -434
- package/dist/{vi-Bwvz1d_n.js → vi-DQOJp32U.js} +183 -30
- package/dist/vi-Dg1aiMr5.cjs +1 -0
- package/dist/widget-customization-BtkexHgm.js +1458 -0
- package/dist/widget-customization-pqmtsraC.cjs +1 -0
- package/dist/{zh-hy7Uw6c5.js → zh-DPK4HXl2.js} +154 -1
- package/dist/zh-tbwSTbmn.cjs +1 -0
- package/package.json +9 -9
- package/dist/ar-Dc56zcjW.cjs +0 -1
- package/dist/auth-divider-itm5-j5G.cjs +0 -1
- package/dist/de-DboQlEC4.cjs +0 -1
- package/dist/deep-merge-Bydz6jLt.cjs +0 -1
- package/dist/deep-merge-CzZVsVF-.js +0 -1704
- package/dist/es-CAmE_0Ph.cjs +0 -1
- package/dist/fa-D9LrFZdW.cjs +0 -1
- package/dist/fr-DKogQyss.cjs +0 -1
- package/dist/he-CVx91Jdr.cjs +0 -1
- package/dist/hi-BgrHV72l.cjs +0 -1
- package/dist/index-DFF7Uahh.cjs +0 -1
- package/dist/it-B1rA1F9l.cjs +0 -1
- package/dist/ja-DZnjjqoi.cjs +0 -1
- package/dist/ko-CDnYKYWU.cjs +0 -1
- package/dist/modal-DCxNGrzk.cjs +0 -1
- package/dist/nl-Bj8QnDEY.cjs +0 -1
- package/dist/pl-BmuuxxVd.cjs +0 -1
- package/dist/pt-RiC0yeVA.cjs +0 -1
- package/dist/ru-pRqtOQHF.cjs +0 -1
- package/dist/tr-B9JhBJeL.cjs +0 -1
- package/dist/translations-qefRsdGi.cjs +0 -1
- package/dist/types/components/overlay/command-palette.d.ts +0 -17
- package/dist/types/utils/color.d.ts +0 -346
- package/dist/ur-BZakU0iv.cjs +0 -1
- package/dist/use-form-BvBkVEKi.cjs +0 -2
- package/dist/vi-D1nly0nb.cjs +0 -1
- package/dist/widget-customization-BAchyOUo.js +0 -1066
- package/dist/widget-customization-DELy3SMQ.cjs +0 -1
- package/dist/zh-DBk7sSD9.cjs +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Any object with hour/minute/second — covers PlainTime and PlainDateTime. */
|
|
2
|
+
interface TimeLike {
|
|
3
|
+
hour: number;
|
|
4
|
+
minute: number;
|
|
5
|
+
second: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Format a time-like value as a 12-hour string (e.g. "2:30 PM").
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatTime12(t: TimeLike): string;
|
|
11
|
+
/**
|
|
12
|
+
* Format a time-like value as a 24-hour string (e.g. "14:30").
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatTime24(t: TimeLike): string;
|
|
15
|
+
/**
|
|
16
|
+
* Format a time-like value as a 12-hour string with seconds (e.g. "2:30:15 PM").
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatTime12WithSeconds(t: TimeLike): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format a time-like value as a 24-hour string with seconds (e.g. "14:30:15").
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatTime24WithSeconds(t: TimeLike): string;
|
|
23
|
+
/**
|
|
24
|
+
* Pick the correct formatter based on 12-hour and seconds flags.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatTimeAuto(t: TimeLike, is12Hour: boolean, withSeconds: boolean): string;
|
|
27
|
+
/**
|
|
28
|
+
* Detect whether a locale uses 12-hour time format.
|
|
29
|
+
*/
|
|
30
|
+
export declare function localeUses12Hour(locale: string): boolean;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { CommonInputOptions } from './input-options';
|
|
3
|
+
/**
|
|
4
|
+
* Internal base options for the time select shell (trigger + flyout).
|
|
5
|
+
* The actual picker content is provided via `panelContent`.
|
|
6
|
+
*/
|
|
7
|
+
export interface TimeSelectShellOptions extends CommonInputOptions {
|
|
8
|
+
/** The display text shown in the trigger. */
|
|
9
|
+
displayText: Value<string>;
|
|
10
|
+
/** The content to render inside the flyout panel. */
|
|
11
|
+
panelContent: TNode;
|
|
12
|
+
/** Callback invoked on blur. */
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
/** Content to render before the display text. */
|
|
15
|
+
before?: TNode;
|
|
16
|
+
/** Content to render after the display text. */
|
|
17
|
+
after?: TNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Shared shell for time selectors: trigger button + flyout panel.
|
|
21
|
+
* Used by both TimeSelect and NullableTimeSelect.
|
|
22
|
+
*/
|
|
23
|
+
export declare function TimeSelectShell(options: TimeSelectShellOptions): TNode;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type TNode, Value, type Merge } from '@tempots/dom';
|
|
2
|
+
import { CommonInputOptions } from './input-options';
|
|
3
|
+
import type { PlainTime } from '../../../temporal/types';
|
|
4
|
+
import { ThemeColorName } from '../../../tokens';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the {@link TimeSelect} component.
|
|
7
|
+
*/
|
|
8
|
+
export type TimeSelectOptions = Merge<CommonInputOptions, {
|
|
9
|
+
/** The selected time. */
|
|
10
|
+
value: Value<PlainTime>;
|
|
11
|
+
/** Callback invoked when the time changes. */
|
|
12
|
+
onChange?: (time: PlainTime) => void;
|
|
13
|
+
/** Callback invoked on blur. */
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
/** Theme color. @default 'primary' */
|
|
16
|
+
color?: Value<ThemeColorName>;
|
|
17
|
+
/** Whether to show seconds. @default false */
|
|
18
|
+
showSeconds?: Value<boolean>;
|
|
19
|
+
/** Whether to use 12-hour format. When omitted, auto-detected from the current locale. */
|
|
20
|
+
use12Hour?: Value<boolean>;
|
|
21
|
+
/** Step for minutes column. @default 1 */
|
|
22
|
+
minuteStep?: Value<number>;
|
|
23
|
+
/** Step for seconds column. @default 1 */
|
|
24
|
+
secondStep?: Value<number>;
|
|
25
|
+
/** Whether to show a "Now" button. @default false */
|
|
26
|
+
showNow?: Value<boolean>;
|
|
27
|
+
/** Format a PlainTime for display. When omitted, uses locale-aware 12/24-hour format. */
|
|
28
|
+
formatTime?: (time: PlainTime) => string;
|
|
29
|
+
/** Content to render before the display text. */
|
|
30
|
+
before?: TNode;
|
|
31
|
+
/** Content to render after the display text. */
|
|
32
|
+
after?: TNode;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* A dropdown time selector.
|
|
36
|
+
*
|
|
37
|
+
* Displays the selected time in a styled trigger button. Clicking opens a
|
|
38
|
+
* flyout panel with a {@link TimePicker} for selecting a time.
|
|
39
|
+
*
|
|
40
|
+
* When no custom `formatTime` is provided, the display adapts to the
|
|
41
|
+
* locale's 12/24-hour convention (or the explicit `use12Hour` prop).
|
|
42
|
+
*
|
|
43
|
+
* Use {@link NullableTimeSelect} when the time can be null/unset.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Configuration for the time selector
|
|
46
|
+
* @returns A time selector element
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { prop } from '@tempots/dom'
|
|
51
|
+
* import { TimeSelect } from '@tempots/beatui'
|
|
52
|
+
* import { Temporal } from '@js-temporal/polyfill'
|
|
53
|
+
*
|
|
54
|
+
* const time = prop(Temporal.PlainTime.from('14:30'))
|
|
55
|
+
* TimeSelect({
|
|
56
|
+
* value: time,
|
|
57
|
+
* onChange: v => time.set(v),
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function TimeSelect(options: TimeSelectOptions): TNode;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { ControlSize } from '../../theme';
|
|
3
|
+
import { ThemeColorName } from '../../../tokens';
|
|
4
|
+
/** Configuration options for the {@link TransferList} component. */
|
|
5
|
+
export interface TransferListOptions<T> {
|
|
6
|
+
/** Items available for selection (left panel). */
|
|
7
|
+
available: Value<T[]>;
|
|
8
|
+
/** Items currently selected (right panel). */
|
|
9
|
+
selected: Value<T[]>;
|
|
10
|
+
/** Callback invoked with the new selected items array after a transfer. */
|
|
11
|
+
onChange: (selected: T[]) => void;
|
|
12
|
+
/** Render function for each item. */
|
|
13
|
+
renderItem: (item: T) => TNode;
|
|
14
|
+
/** Extract a unique key from an item. */
|
|
15
|
+
keyOf: (item: T) => string;
|
|
16
|
+
/** Extract searchable text from an item. Defaults to {@link keyOf}. */
|
|
17
|
+
searchField?: (item: T) => string;
|
|
18
|
+
/** Whether to show search inputs on each panel. @default false */
|
|
19
|
+
searchable?: Value<boolean>;
|
|
20
|
+
/** Whether the component is disabled. @default false */
|
|
21
|
+
disabled?: Value<boolean>;
|
|
22
|
+
/** Size variant. @default 'md' */
|
|
23
|
+
size?: Value<ControlSize>;
|
|
24
|
+
/** Theme color. @default 'primary' */
|
|
25
|
+
color?: Value<ThemeColorName>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A dual-list component for transferring items between "available" and
|
|
29
|
+
* "selected" lists. Generic in `T` with user-provided render and key functions.
|
|
30
|
+
*
|
|
31
|
+
* Supports multi-select via checkboxes, move-selected / move-all actions
|
|
32
|
+
* in both directions, and optional search filtering per panel.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam T - The item type
|
|
35
|
+
* @param options - Configuration for the transfer list
|
|
36
|
+
* @returns A transfer list element
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { prop } from '@tempots/dom'
|
|
41
|
+
* import { TransferList } from '@tempots/beatui'
|
|
42
|
+
*
|
|
43
|
+
* const available = prop(['Apple', 'Banana', 'Cherry', 'Date'])
|
|
44
|
+
* const selected = prop<string[]>([])
|
|
45
|
+
*
|
|
46
|
+
* TransferList({
|
|
47
|
+
* available,
|
|
48
|
+
* selected,
|
|
49
|
+
* onChange: v => selected.set(v),
|
|
50
|
+
* renderItem: item => html.span(item),
|
|
51
|
+
* keyOf: item => item,
|
|
52
|
+
* searchable: true,
|
|
53
|
+
* })
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function TransferList<T>(options: TransferListOptions<T>): TNode;
|
|
@@ -49,7 +49,7 @@ export type TriStateCheckboxInputOptions = InputOptions<CheckboxState> & {
|
|
|
49
49
|
* const state = prop<CheckboxState>('unchecked')
|
|
50
50
|
* TriStateCheckboxInput({
|
|
51
51
|
* value: state,
|
|
52
|
-
* onChange: state.set,
|
|
52
|
+
* onChange: v => state.set(v),
|
|
53
53
|
* placeholder: 'Select all',
|
|
54
54
|
* })
|
|
55
55
|
* ```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the {@link FormatBigInt} component.
|
|
4
|
+
*
|
|
5
|
+
* Separate from FormatNumber because `bigint` values cannot use `percent`,
|
|
6
|
+
* `compact`, or significant digit options with `Intl.NumberFormat`.
|
|
7
|
+
*/
|
|
8
|
+
export interface FormatBigIntOptions {
|
|
9
|
+
/** The bigint value to format. @default 9007199254740993 */
|
|
10
|
+
value: Value<bigint>;
|
|
11
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
12
|
+
locale?: Value<string>;
|
|
13
|
+
/** Formatting style. @default 'decimal' */
|
|
14
|
+
style?: Value<'decimal' | 'currency' | 'unit'>;
|
|
15
|
+
/** ISO 4217 currency code (required when style is 'currency'). @default undefined */
|
|
16
|
+
currency?: Value<string>;
|
|
17
|
+
/** How to display the currency. @default 'symbol' */
|
|
18
|
+
currencyDisplay?: Value<'symbol' | 'narrowSymbol' | 'code' | 'name'>;
|
|
19
|
+
/** Sign display mode. @default 'auto' */
|
|
20
|
+
signDisplay?: Value<'auto' | 'never' | 'always' | 'exceptZero'>;
|
|
21
|
+
/** Unit identifier (e.g., 'kilometer') for style 'unit'. @default undefined */
|
|
22
|
+
unit?: Value<string>;
|
|
23
|
+
/** Unit display mode. @default 'short' */
|
|
24
|
+
unitDisplay?: Value<'short' | 'long' | 'narrow'>;
|
|
25
|
+
/** Use grouping separators. @default true */
|
|
26
|
+
useGrouping?: Value<boolean>;
|
|
27
|
+
/** Minimum integer digits. @default undefined */
|
|
28
|
+
minimumIntegerDigits?: Value<number>;
|
|
29
|
+
/** Minimum fraction digits. @default undefined */
|
|
30
|
+
minimumFractionDigits?: Value<number>;
|
|
31
|
+
/** Maximum fraction digits. @default undefined */
|
|
32
|
+
maximumFractionDigits?: Value<number>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Formats a bigint value with locale and Intl options.
|
|
36
|
+
*
|
|
37
|
+
* @param value - The bigint to format
|
|
38
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
39
|
+
* @param options - Intl.NumberFormat options
|
|
40
|
+
* @returns The formatted bigint string
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* formatBigInt(9007199254740993n, 'en-US') // '9,007,199,254,740,993'
|
|
45
|
+
* formatBigInt(123456789n, 'en-US', { style: 'currency', currency: 'JPY' }) // '¥123,456,789'
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatBigInt(value: bigint, locale?: string, options?: Intl.NumberFormatOptions): string;
|
|
49
|
+
/**
|
|
50
|
+
* Locale-aware bigint formatting component.
|
|
51
|
+
*
|
|
52
|
+
* Renders a formatted bigint as a `<span>` that automatically updates when
|
|
53
|
+
* the locale or value changes. Supports decimal, currency, and unit styles.
|
|
54
|
+
*
|
|
55
|
+
* @param options - Configuration for the bigint format
|
|
56
|
+
* @returns A reactive `<span>` containing the formatted bigint
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* FormatBigInt({ value: 9007199254740993n })
|
|
61
|
+
* FormatBigInt({ value: 123456789n, style: 'currency', currency: 'JPY' })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function FormatBigInt(options: FormatBigIntOptions): TNode;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import type { DateValue, DateFormatStyle } from './format-date';
|
|
3
|
+
import type { TimeFormatStyle } from './format-time';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the {@link FormatDateTime} component.
|
|
6
|
+
*/
|
|
7
|
+
export interface FormatDateTimeOptions {
|
|
8
|
+
/** The date/time value to format. @default '2026-03-17T14:30:00' */
|
|
9
|
+
value: Value<DateValue>;
|
|
10
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
11
|
+
locale?: Value<string>;
|
|
12
|
+
/** Date portion style. @default 'medium' */
|
|
13
|
+
dateStyle?: Value<DateFormatStyle>;
|
|
14
|
+
/** Time portion style. @default 'short' */
|
|
15
|
+
timeStyle?: Value<TimeFormatStyle>;
|
|
16
|
+
/** Time zone. @default undefined (browser default) */
|
|
17
|
+
timeZone?: Value<string>;
|
|
18
|
+
/** Calendar system. @default undefined */
|
|
19
|
+
calendar?: Value<string>;
|
|
20
|
+
/** Whether to use 12-hour time. @default undefined (locale default) */
|
|
21
|
+
hour12?: Value<boolean>;
|
|
22
|
+
/** Hour cycle override. @default undefined */
|
|
23
|
+
hourCycle?: Value<'h11' | 'h12' | 'h23' | 'h24'>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Formats a date and time value with locale and Intl options.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The date/time value to format
|
|
29
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
30
|
+
* @param options - Intl.DateTimeFormat options
|
|
31
|
+
* @returns The formatted date-time string
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* formatDateTime(new Date(), 'en-US') // 'Mar 17, 2026, 2:30 PM'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatDateTime(value: DateValue, locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
39
|
+
/**
|
|
40
|
+
* Locale-aware date and time formatting component.
|
|
41
|
+
*
|
|
42
|
+
* Renders a formatted date-time as a `<span>` that automatically updates when
|
|
43
|
+
* the locale or value changes.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Configuration for the date-time format
|
|
46
|
+
* @returns A reactive `<span>` containing the formatted date-time
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* FormatDateTime({ value: new Date() })
|
|
51
|
+
* FormatDateTime({ value: zonedDateTime, dateStyle: 'full', timeStyle: 'long' })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function FormatDateTime(options: FormatDateTimeOptions): TNode;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Any object with a `toLocaleString` method compatible with `Intl.DateTimeFormat` options.
|
|
4
|
+
* This covers all Temporal types (PlainDate, PlainDateTime, Instant, ZonedDateTime,
|
|
5
|
+
* PlainYearMonth, PlainMonthDay) without importing the polyfill.
|
|
6
|
+
*/
|
|
7
|
+
export type TemporalDateLike = {
|
|
8
|
+
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Accepted date value types.
|
|
12
|
+
* - `Date` — native JavaScript Date
|
|
13
|
+
* - `string` — ISO 8601 date string
|
|
14
|
+
* - `number` — Unix timestamp in milliseconds
|
|
15
|
+
* - `TemporalDateLike` — any Temporal type with `toLocaleString`
|
|
16
|
+
*/
|
|
17
|
+
export type DateValue = Date | string | number | TemporalDateLike;
|
|
18
|
+
/**
|
|
19
|
+
* Preset date format styles matching `Intl.DateTimeFormat` dateStyle.
|
|
20
|
+
*/
|
|
21
|
+
export type DateFormatStyle = 'full' | 'long' | 'medium' | 'short';
|
|
22
|
+
/**
|
|
23
|
+
* Options for the {@link FormatDate} component.
|
|
24
|
+
*/
|
|
25
|
+
export interface FormatDateOptions {
|
|
26
|
+
/** The date value to format. @default '2026-03-17' */
|
|
27
|
+
value: Value<DateValue>;
|
|
28
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
29
|
+
locale?: Value<string>;
|
|
30
|
+
/** Date format preset. @default 'medium' */
|
|
31
|
+
dateStyle?: Value<DateFormatStyle>;
|
|
32
|
+
/** Calendar system (e.g., 'gregory', 'islamic', 'hebrew'). @default undefined */
|
|
33
|
+
calendar?: Value<string>;
|
|
34
|
+
/** Numbering system (e.g., 'arab', 'latn'). @default undefined */
|
|
35
|
+
numberingSystem?: Value<string>;
|
|
36
|
+
/** Time zone for date interpretation. @default undefined (browser default) */
|
|
37
|
+
timeZone?: Value<string>;
|
|
38
|
+
/** Weekday representation (mutually exclusive with dateStyle). @default undefined */
|
|
39
|
+
weekday?: Value<'long' | 'short' | 'narrow'>;
|
|
40
|
+
/** Year representation (mutually exclusive with dateStyle). @default undefined */
|
|
41
|
+
year?: Value<'numeric' | '2-digit'>;
|
|
42
|
+
/** Month representation (mutually exclusive with dateStyle). @default undefined */
|
|
43
|
+
month?: Value<'numeric' | '2-digit' | 'long' | 'short' | 'narrow'>;
|
|
44
|
+
/** Day representation (mutually exclusive with dateStyle). @default undefined */
|
|
45
|
+
day?: Value<'numeric' | '2-digit'>;
|
|
46
|
+
/** Era representation (mutually exclusive with dateStyle). @default undefined */
|
|
47
|
+
era?: Value<'long' | 'short' | 'narrow'>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Formats a date value with locale and Intl options.
|
|
51
|
+
* Supports native Date, ISO strings, timestamps, and Temporal types.
|
|
52
|
+
*
|
|
53
|
+
* @param value - The date value to format
|
|
54
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
55
|
+
* @param options - Intl.DateTimeFormat options
|
|
56
|
+
* @returns The formatted date string
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* formatDate(new Date(), 'en-US', { dateStyle: 'full' }) // 'Monday, March 17, 2026'
|
|
61
|
+
* formatDate('2026-03-17', 'de-DE', { dateStyle: 'short' }) // '17.03.26'
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function formatDate(value: DateValue, locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
65
|
+
/**
|
|
66
|
+
* Locale-aware date formatting component.
|
|
67
|
+
*
|
|
68
|
+
* Renders a formatted date as a `<span>` that automatically updates when
|
|
69
|
+
* the locale or value changes. Supports preset styles, fine-grained part
|
|
70
|
+
* selection, calendar systems, and Temporal types.
|
|
71
|
+
*
|
|
72
|
+
* @param options - Configuration for the date format
|
|
73
|
+
* @returns A reactive `<span>` containing the formatted date
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* FormatDate({ value: new Date(), dateStyle: 'full' })
|
|
78
|
+
* FormatDate({ value: plainDate, dateStyle: 'long' })
|
|
79
|
+
* FormatDate({ value: '2026-03-17', weekday: 'short', month: 'short', day: 'numeric' })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function FormatDate(options: FormatDateOptions): TNode;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Type of display name to resolve.
|
|
4
|
+
*/
|
|
5
|
+
export type DisplayNameType = 'language' | 'region' | 'script' | 'currency' | 'calendar' | 'dateTimeField';
|
|
6
|
+
/**
|
|
7
|
+
* Format verbosity for display names.
|
|
8
|
+
*/
|
|
9
|
+
export type DisplayNameStyle = 'long' | 'short' | 'narrow';
|
|
10
|
+
/**
|
|
11
|
+
* Language display style (only for type 'language').
|
|
12
|
+
*/
|
|
13
|
+
export type DisplayNameLanguageDisplay = 'dialect' | 'standard';
|
|
14
|
+
/**
|
|
15
|
+
* Options for the {@link FormatDisplayName} component.
|
|
16
|
+
*/
|
|
17
|
+
export interface FormatDisplayNameOptions {
|
|
18
|
+
/** The code to look up (e.g., 'en-US', 'USD', 'Latn'). @default 'en-US' */
|
|
19
|
+
value: Value<string>;
|
|
20
|
+
/** The type of display name to resolve. @default 'language' */
|
|
21
|
+
type: Value<DisplayNameType>;
|
|
22
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
23
|
+
locale?: Value<string>;
|
|
24
|
+
/** Format verbosity. @default 'long' */
|
|
25
|
+
style?: Value<DisplayNameStyle>;
|
|
26
|
+
/** Language display style (only for type 'language'). @default 'dialect' */
|
|
27
|
+
languageDisplay?: Value<DisplayNameLanguageDisplay>;
|
|
28
|
+
/** Fallback behavior when code is not found. @default 'code' */
|
|
29
|
+
fallback?: Value<'code' | 'none'>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Formats a display name for a language, region, script, currency, calendar,
|
|
33
|
+
* or dateTimeField code.
|
|
34
|
+
*
|
|
35
|
+
* @param value - The code to look up
|
|
36
|
+
* @param type - The type of display name
|
|
37
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
38
|
+
* @param options - Additional display name options
|
|
39
|
+
* @returns The formatted display name string, or the code itself if not found
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* formatDisplayName('en-US', 'language', 'en') // 'American English'
|
|
44
|
+
* formatDisplayName('USD', 'currency', 'en') // 'US Dollar'
|
|
45
|
+
* formatDisplayName('JP', 'region', 'en') // 'Japan'
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatDisplayName(value: string, type: DisplayNameType, locale?: string, options?: {
|
|
49
|
+
style?: DisplayNameStyle;
|
|
50
|
+
languageDisplay?: DisplayNameLanguageDisplay;
|
|
51
|
+
fallback?: 'code' | 'none';
|
|
52
|
+
}): string;
|
|
53
|
+
/**
|
|
54
|
+
* Locale-aware display name formatting component.
|
|
55
|
+
*
|
|
56
|
+
* Renders the locale-aware name for a language, region, script, currency,
|
|
57
|
+
* calendar, or dateTimeField code as a `<span>` that automatically updates
|
|
58
|
+
* when the locale or value changes.
|
|
59
|
+
*
|
|
60
|
+
* @param options - Configuration for the display name format
|
|
61
|
+
* @returns A reactive `<span>` containing the formatted display name
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* FormatDisplayName({ value: 'en-US', type: 'language' })
|
|
66
|
+
* FormatDisplayName({ value: 'USD', type: 'currency' })
|
|
67
|
+
* FormatDisplayName({ value: 'JP', type: 'region' })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function FormatDisplayName(options: FormatDisplayNameOptions): TNode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the {@link FormatFileSize} component.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatFileSizeComponentOptions {
|
|
6
|
+
/** Byte count to format. @default 1536000 */
|
|
7
|
+
value: Value<number | bigint>;
|
|
8
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
9
|
+
locale?: Value<string>;
|
|
10
|
+
/** Unit labels. @default ['B', 'KB', 'MB', 'GB', 'TB'] */
|
|
11
|
+
units?: string[];
|
|
12
|
+
/** Decimal places for non-byte units. @default 0 */
|
|
13
|
+
decimalPlaces?: Value<number>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Locale-aware file size formatting component.
|
|
17
|
+
*
|
|
18
|
+
* Wraps the existing {@link formatFileSize} utility as a reactive component
|
|
19
|
+
* that reads the locale from the Locale provider.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Configuration for the file size format
|
|
22
|
+
* @returns A reactive `<span>` containing the formatted file size
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* FormatFileSize({ value: 1024 }) // '1 KB'
|
|
27
|
+
* FormatFileSize({ value: 1536, decimalPlaces: 1 }) // '1.5 KB'
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function FormatFileSize(options: FormatFileSizeComponentOptions): TNode;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* List semantics type for `Intl.ListFormat`.
|
|
4
|
+
*/
|
|
5
|
+
export type FormatListType = 'conjunction' | 'disjunction' | 'unit';
|
|
6
|
+
/**
|
|
7
|
+
* Format verbosity for list formatting.
|
|
8
|
+
*/
|
|
9
|
+
export type FormatListStyle = 'long' | 'short' | 'narrow';
|
|
10
|
+
/**
|
|
11
|
+
* Options for `Intl.ListFormat` (polyfill for ES2020 lib).
|
|
12
|
+
*/
|
|
13
|
+
interface ListFormatOptions {
|
|
14
|
+
type?: FormatListType;
|
|
15
|
+
style?: FormatListStyle;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Options for the {@link FormatList} component.
|
|
19
|
+
*/
|
|
20
|
+
export interface FormatListOptions {
|
|
21
|
+
/** Array of string items to join. @default undefined */
|
|
22
|
+
value: Value<string[]>;
|
|
23
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
24
|
+
locale?: Value<string>;
|
|
25
|
+
/** List semantics. @default 'conjunction' */
|
|
26
|
+
type?: Value<FormatListType>;
|
|
27
|
+
/** Format verbosity. @default 'long' */
|
|
28
|
+
style?: Value<FormatListStyle>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Formats a list of strings with locale and Intl options.
|
|
32
|
+
*
|
|
33
|
+
* @param value - Array of strings to join
|
|
34
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
35
|
+
* @param options - ListFormat options
|
|
36
|
+
* @returns The formatted list string
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* formatList(['Red', 'Green', 'Blue'], 'en-US') // 'Red, Green, and Blue'
|
|
41
|
+
* formatList(['A', 'B'], 'en-US', { type: 'disjunction' }) // 'A or B'
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatList(value: string[], locale?: string, options?: ListFormatOptions): string;
|
|
45
|
+
/**
|
|
46
|
+
* Locale-aware list formatting component.
|
|
47
|
+
*
|
|
48
|
+
* Renders a formatted list (e.g., "A, B, and C") as a `<span>` that
|
|
49
|
+
* automatically updates when the locale or value changes.
|
|
50
|
+
*
|
|
51
|
+
* @param options - Configuration for the list format
|
|
52
|
+
* @returns A reactive `<span>` containing the formatted list
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* FormatList({ value: ['Red', 'Green', 'Blue'] })
|
|
57
|
+
* FormatList({ value: ['A', 'B'], type: 'disjunction' })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function FormatList(options: FormatListOptions): TNode;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Style of number formatting.
|
|
4
|
+
*/
|
|
5
|
+
export type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';
|
|
6
|
+
/**
|
|
7
|
+
* Currency display mode when style is 'currency'.
|
|
8
|
+
*/
|
|
9
|
+
export type FormatNumberCurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name';
|
|
10
|
+
/**
|
|
11
|
+
* How to display the sign for the number.
|
|
12
|
+
*/
|
|
13
|
+
export type FormatNumberSignDisplay = 'auto' | 'never' | 'always' | 'exceptZero';
|
|
14
|
+
/**
|
|
15
|
+
* Notation style for number formatting.
|
|
16
|
+
*/
|
|
17
|
+
export type FormatNumberNotation = 'standard' | 'scientific' | 'engineering' | 'compact';
|
|
18
|
+
/**
|
|
19
|
+
* Options for the {@link FormatNumber} component.
|
|
20
|
+
*/
|
|
21
|
+
export interface FormatNumberOptions {
|
|
22
|
+
/** The number to format. @default 1234.56 */
|
|
23
|
+
value: Value<number>;
|
|
24
|
+
/** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
|
|
25
|
+
locale?: Value<string>;
|
|
26
|
+
/** Formatting style. @default 'decimal' */
|
|
27
|
+
style?: Value<FormatNumberStyle>;
|
|
28
|
+
/** ISO 4217 currency code (required when style is 'currency'). @default undefined */
|
|
29
|
+
currency?: Value<string>;
|
|
30
|
+
/** How to display the currency. @default 'symbol' */
|
|
31
|
+
currencyDisplay?: Value<FormatNumberCurrencyDisplay>;
|
|
32
|
+
/** Sign display mode. @default 'auto' */
|
|
33
|
+
signDisplay?: Value<FormatNumberSignDisplay>;
|
|
34
|
+
/** Notation. @default 'standard' */
|
|
35
|
+
notation?: Value<FormatNumberNotation>;
|
|
36
|
+
/** Compact display mode (used when notation is 'compact'). @default undefined */
|
|
37
|
+
compactDisplay?: Value<'short' | 'long'>;
|
|
38
|
+
/** Unit identifier (e.g., 'kilometer', 'liter') for style 'unit'. @default undefined */
|
|
39
|
+
unit?: Value<string>;
|
|
40
|
+
/** Unit display mode. @default 'short' */
|
|
41
|
+
unitDisplay?: Value<'short' | 'long' | 'narrow'>;
|
|
42
|
+
/** Use grouping separators (e.g., thousand commas). @default true */
|
|
43
|
+
useGrouping?: Value<boolean>;
|
|
44
|
+
/** Minimum integer digits. @default undefined */
|
|
45
|
+
minimumIntegerDigits?: Value<number>;
|
|
46
|
+
/** Minimum fraction digits. @default undefined */
|
|
47
|
+
minimumFractionDigits?: Value<number>;
|
|
48
|
+
/** Maximum fraction digits. @default undefined */
|
|
49
|
+
maximumFractionDigits?: Value<number>;
|
|
50
|
+
/** Minimum significant digits. @default undefined */
|
|
51
|
+
minimumSignificantDigits?: Value<number>;
|
|
52
|
+
/** Maximum significant digits. @default undefined */
|
|
53
|
+
maximumSignificantDigits?: Value<number>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Formats a number with locale and Intl options.
|
|
57
|
+
*
|
|
58
|
+
* @param value - The number to format
|
|
59
|
+
* @param locale - BCP 47 locale string (uses browser default if omitted)
|
|
60
|
+
* @param options - Intl.NumberFormat options
|
|
61
|
+
* @returns The formatted number string
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* formatNumber(1234.5, 'en-US') // '1,234.5'
|
|
66
|
+
* formatNumber(1234, 'en-US', { style: 'currency', currency: 'EUR' }) // '€1,234.00'
|
|
67
|
+
* formatNumber(0.85, 'en-US', { style: 'percent' }) // '85%'
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function formatNumber(value: number, locale?: string, options?: Intl.NumberFormatOptions): string;
|
|
71
|
+
/**
|
|
72
|
+
* Locale-aware number formatting component.
|
|
73
|
+
*
|
|
74
|
+
* Renders a formatted number as a `<span>` that automatically updates when
|
|
75
|
+
* the locale or value changes. Supports decimal, currency, percent, unit,
|
|
76
|
+
* and compact notation styles.
|
|
77
|
+
*
|
|
78
|
+
* @param options - Configuration for the number format
|
|
79
|
+
* @returns A reactive `<span>` containing the formatted number
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* FormatNumber({ value: 1234.5 })
|
|
84
|
+
* FormatNumber({ value: 1234, style: 'currency', currency: 'EUR' })
|
|
85
|
+
* FormatNumber({ value: 0.85, style: 'percent' })
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function FormatNumber(options: FormatNumberOptions): TNode;
|