@tempots/beatui 1.4.0 → 1.5.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/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-D_3gKZ6g.js → auth-divider-BIATan1F.js} +3 -3
- package/dist/{auth-divider-itm5-j5G.cjs → auth-divider-CVKfA8Cp.cjs} +1 -1
- package/dist/beatui.css +393 -36
- package/dist/beatui.tailwind.css +393 -36
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +2 -2
- package/dist/deep-merge-B33Qtlmw.cjs +1 -0
- package/dist/{deep-merge-CzZVsVF-.js → deep-merge-BUsrE2v4.js} +130 -130
- package/dist/{duration-input-BrYLC1js.cjs → duration-input-C5il_E0F.cjs} +1 -1
- package/dist/{duration-input-CFu6vq-y.js → duration-input-DoCCrqOG.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +5609 -5130
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +107 -107
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +3 -3
- package/dist/{modal-YKqlh4Dk.js → modal-BHlp4QeT.js} +1 -1
- package/dist/{modal-DCxNGrzk.cjs → modal-BmpfNL48.cjs} +1 -1
- package/dist/{notice-Q0A1gIho.cjs → notice-BBnSXYUc.cjs} +1 -1
- package/dist/{notice-Du3tWJTW.js → notice-BXKtBEiC.js} +1 -1
- 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/index.d.ts +1 -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/combobox-input.d.ts +2 -2
- package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
- package/dist/types/components/form/input/date-time-input.d.ts +1 -1
- package/dist/types/components/form/input/dropdown-input.d.ts +2 -2
- 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 +2 -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/range-slider.d.ts +19 -2
- package/dist/types/components/form/input/select-tags-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/index.d.ts +1 -0
- package/dist/use-form-CP6nftVl.cjs +2 -0
- package/dist/{use-form-D_TJyZhP.js → use-form-CmQdxpOi.js} +474 -434
- package/dist/{widget-customization-DELy3SMQ.cjs → widget-customization-B0y-eesp.cjs} +1 -1
- package/dist/{widget-customization-BAchyOUo.js → widget-customization-CKbR4Dsg.js} +2 -2
- package/package.json +1 -1
- package/dist/deep-merge-Bydz6jLt.cjs +0 -1
- package/dist/use-form-BvBkVEKi.cjs +0 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import type { ControlSize } from '../../theme';
|
|
3
|
+
import type { FieldLabelLayout } from '../input/field';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the `Fieldset` component.
|
|
6
|
+
*/
|
|
7
|
+
export interface FieldsetOptions {
|
|
8
|
+
/** Legend content (always visible header for the fieldset) */
|
|
9
|
+
legend?: TNode;
|
|
10
|
+
/** Description text displayed below the legend */
|
|
11
|
+
description?: TNode;
|
|
12
|
+
/** Visual variant of the fieldset container. @default 'plain' */
|
|
13
|
+
variant?: Value<'bordered' | 'plain' | 'card'>;
|
|
14
|
+
/** Whether the fieldset body can be collapsed/expanded. @default false */
|
|
15
|
+
collapsible?: Value<boolean>;
|
|
16
|
+
/** Initial collapsed state (only used when collapsible is true). @default false */
|
|
17
|
+
defaultCollapsed?: Value<boolean>;
|
|
18
|
+
/** Whether the entire fieldset (and all children) is disabled. @default false */
|
|
19
|
+
disabled?: Value<boolean>;
|
|
20
|
+
/** Label position cascaded to descendant Field components. @default 'vertical' */
|
|
21
|
+
layout?: Value<FieldLabelLayout>;
|
|
22
|
+
/** Label column width cascaded to descendant Field components. @default '7.5rem' */
|
|
23
|
+
labelWidth?: Value<string>;
|
|
24
|
+
/** Control size cascaded to descendant Field components. @default 'md' */
|
|
25
|
+
size?: Value<ControlSize>;
|
|
26
|
+
/** Gap between fields in the grid. @default 'md' */
|
|
27
|
+
gap?: Value<ControlSize>;
|
|
28
|
+
/** Number of explicit grid columns. When > 1, overrides auto-fit behaviour. @default 1 */
|
|
29
|
+
columns?: Value<number>;
|
|
30
|
+
/** Minimum field width before columns auto-collapse. @default '15rem' */
|
|
31
|
+
minFieldWidth?: Value<string>;
|
|
32
|
+
/** Reduced spacing mode cascaded to descendant Field components. @default false */
|
|
33
|
+
compact?: Value<boolean>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Groups related `Field` components with a shared layout context and optional header.
|
|
37
|
+
*
|
|
38
|
+
* Fieldset wraps its children in a `FieldLayout` provider, cascading layout configuration
|
|
39
|
+
* (layout mode, label width, column count, etc.) to all descendant `Field` components.
|
|
40
|
+
* Individual fields can still override provider values locally.
|
|
41
|
+
*
|
|
42
|
+
* Supports three visual variants (`bordered`, `plain`, `card`) and optional
|
|
43
|
+
* animated collapse behaviour.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* Fieldset(
|
|
48
|
+
* {
|
|
49
|
+
* legend: 'Personal Information',
|
|
50
|
+
* variant: 'bordered',
|
|
51
|
+
* layout: 'horizontal-fixed',
|
|
52
|
+
* labelWidth: '160px',
|
|
53
|
+
* columns: 2,
|
|
54
|
+
* },
|
|
55
|
+
* Field({ label: 'First Name', content: TextInput({ ... }) }),
|
|
56
|
+
* Field({ label: 'Last Name', content: TextInput({ ... }) }),
|
|
57
|
+
* )
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function Fieldset({ legend, description, variant, collapsible, defaultCollapsed, disabled, layout, labelWidth, size, gap, columns, minFieldWidth, compact, }: FieldsetOptions, ...children: TNode[]): import("@tempots/dom").Renderable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fieldset';
|
|
@@ -81,11 +81,11 @@ export declare const BaseComboboxControl: <T>(options: BaseControlOptions<T, Com
|
|
|
81
81
|
/**
|
|
82
82
|
* A complete combobox form control with label, description, error message, and validation.
|
|
83
83
|
*
|
|
84
|
-
* Combines {@link BaseComboboxControl} with
|
|
84
|
+
* Combines {@link BaseComboboxControl} with a {@link Field} to provide a
|
|
85
85
|
* full-featured form field with label, optional description, and validation error display.
|
|
86
86
|
*
|
|
87
87
|
* @template T - The type of the selectable option values
|
|
88
88
|
* @param options - Controller options including wrapper label/description and combobox configuration
|
|
89
89
|
* @returns A combobox input wrapped in a form field with label and error display
|
|
90
90
|
*/
|
|
91
|
-
export declare const ComboboxControl: <T>(options: ControlOptions<T, ComboboxInputOptions<T>>) => Renderable
|
|
91
|
+
export declare const ComboboxControl: <T>(options: ControlOptions<T, ComboboxInputOptions<T>>) => import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -67,4 +67,4 @@ export declare function BaseComboboxTagsControl<T>(options: BaseControlOptions<T
|
|
|
67
67
|
* @param options - Controller options for the combobox tags control.
|
|
68
68
|
* @returns A renderable form control component with wrapper.
|
|
69
69
|
*/
|
|
70
|
-
export declare function ComboboxTagsControl<T>(options: ControlOptions<T[], ComboboxTagsInputOptions<T>>): Renderable
|
|
70
|
+
export declare function ComboboxTagsControl<T>(options: ControlOptions<T[], ComboboxTagsInputOptions<T>>): import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -90,11 +90,11 @@ export declare const BaseDropdownControl: <T>(options: BaseControlOptions<T, Dro
|
|
|
90
90
|
/**
|
|
91
91
|
* A complete dropdown form control with label, description, error message, and validation.
|
|
92
92
|
*
|
|
93
|
-
* Combines {@link BaseDropdownControl} with
|
|
93
|
+
* Combines {@link BaseDropdownControl} with a {@link Field} to provide a
|
|
94
94
|
* full-featured form field with label, optional description, and validation error display.
|
|
95
95
|
*
|
|
96
96
|
* @template T - The type of the selectable option values
|
|
97
97
|
* @param options - Controller options including wrapper label/description and dropdown configuration
|
|
98
98
|
* @returns A dropdown input wrapped in a form field with label and error display
|
|
99
99
|
*/
|
|
100
|
-
export declare const DropdownControl: <T>(options: ControlOptions<T, DropdownInputOptions<T>>) => Renderable
|
|
100
|
+
export declare const DropdownControl: <T>(options: ControlOptions<T, DropdownInputOptions<T>>) => import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Provider, Value } from '@tempots/dom';
|
|
2
|
+
import type { ControlSize } from '../../theme';
|
|
3
|
+
import type { FieldLabelLayout } from './field';
|
|
4
|
+
/**
|
|
5
|
+
* Layout configuration values cascaded by the {@link FieldLayout} provider.
|
|
6
|
+
*
|
|
7
|
+
* When a `Fieldset` provides this context, descendant `Field` components
|
|
8
|
+
* automatically inherit these defaults. Local options on individual Fields
|
|
9
|
+
* take precedence over provider values.
|
|
10
|
+
*/
|
|
11
|
+
export interface FieldLayoutValue {
|
|
12
|
+
/** Label position relative to input. @default 'vertical' */
|
|
13
|
+
layout: Value<FieldLabelLayout>;
|
|
14
|
+
/** Label column width for horizontal layouts. @default '7.5rem' */
|
|
15
|
+
labelWidth: Value<string>;
|
|
16
|
+
/** Control size cascaded to children. @default 'md' */
|
|
17
|
+
size: Value<ControlSize>;
|
|
18
|
+
/** Gap between fields in a Fieldset. @default 'md' */
|
|
19
|
+
gap: Value<ControlSize>;
|
|
20
|
+
/** Number of grid columns. @default 1 */
|
|
21
|
+
columns: Value<number>;
|
|
22
|
+
/** Minimum field width before columns auto-collapse. @default '15rem' */
|
|
23
|
+
minFieldWidth: Value<string>;
|
|
24
|
+
/** Reduced spacing mode for data-dense interfaces. @default false */
|
|
25
|
+
compact: Value<boolean>;
|
|
26
|
+
}
|
|
27
|
+
/** Default values for the FieldLayout provider. */
|
|
28
|
+
export declare const FIELD_LAYOUT_DEFAULTS: FieldLayoutValue;
|
|
29
|
+
/**
|
|
30
|
+
* Options accepted by the {@link FieldLayout} provider.
|
|
31
|
+
*
|
|
32
|
+
* All properties are optional — unspecified properties fall back to
|
|
33
|
+
* {@link FIELD_LAYOUT_DEFAULTS}.
|
|
34
|
+
*/
|
|
35
|
+
export interface FieldLayoutOptions {
|
|
36
|
+
/** Label position relative to input. @default 'vertical' */
|
|
37
|
+
layout?: Value<FieldLabelLayout>;
|
|
38
|
+
/** Label column width for horizontal layouts. @default '7.5rem' */
|
|
39
|
+
labelWidth?: Value<string>;
|
|
40
|
+
/** Control size cascaded to children. @default 'md' */
|
|
41
|
+
size?: Value<ControlSize>;
|
|
42
|
+
/** Gap between fields in a Fieldset. @default 'md' */
|
|
43
|
+
gap?: Value<ControlSize>;
|
|
44
|
+
/** Number of grid columns. @default 1 */
|
|
45
|
+
columns?: Value<number>;
|
|
46
|
+
/** Minimum field width before columns auto-collapse. @default '15rem' */
|
|
47
|
+
minFieldWidth?: Value<string>;
|
|
48
|
+
/** Reduced spacing mode. @default false */
|
|
49
|
+
compact?: Value<boolean>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Provider that cascades form layout configuration to descendant `Field` components.
|
|
53
|
+
*
|
|
54
|
+
* Typically provided by a `Fieldset`, but can also be used directly via `Provide`:
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* Provide(FieldLayout, { layout: 'horizontal-fixed', labelWidth: '160px' },
|
|
59
|
+
* Field({ label: 'Name', content: TextInput({ ... }) }),
|
|
60
|
+
* Field({ label: 'Email', content: TextInput({ ... }) }),
|
|
61
|
+
* )
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const FieldLayout: Provider<FieldLayoutValue, any>;
|
|
@@ -2,26 +2,28 @@ import { TNode, Value } from '@tempots/dom';
|
|
|
2
2
|
/**
|
|
3
3
|
* A visual indicator (asterisk) appended to labels for required fields.
|
|
4
4
|
*
|
|
5
|
-
* Renders as a red asterisk (" *") with the `bc-
|
|
5
|
+
* Renders as a red asterisk (" *") with the `bc-field__required` class.
|
|
6
6
|
*/
|
|
7
7
|
export declare const RequiredSymbol: import("@tempots/dom").Renderable;
|
|
8
8
|
/**
|
|
9
|
-
* Layout modes for the
|
|
9
|
+
* Layout modes for the field structure.
|
|
10
10
|
*
|
|
11
11
|
* - `'vertical'` - Label above input (default)
|
|
12
12
|
* - `'horizontal'` - Label and input side-by-side with flexible label width
|
|
13
|
-
* - `'horizontal-
|
|
14
|
-
* - `'horizontal-
|
|
13
|
+
* - `'horizontal-fixed'` - Label on the left with fixed width, left-aligned
|
|
14
|
+
* - `'horizontal-end'` - Label on the left with fixed width, right-aligned (flush with input)
|
|
15
|
+
* - `'horizontal-label-right'` - Label on the right side of the input (for checkboxes, switches)
|
|
16
|
+
* - `'responsive'` - Horizontal-fixed above 480px, vertical below (container query)
|
|
15
17
|
*/
|
|
16
|
-
export type
|
|
18
|
+
export type FieldLabelLayout = 'vertical' | 'horizontal' | 'horizontal-fixed' | 'horizontal-end' | 'horizontal-label-right' | 'responsive';
|
|
17
19
|
/**
|
|
18
|
-
* Configuration options for the `
|
|
20
|
+
* Configuration options for the `Field` component.
|
|
19
21
|
*
|
|
20
22
|
* This type defines all the options for wrapping an input with label, description,
|
|
21
23
|
* error message, and contextual information. It's used by form controls and
|
|
22
24
|
* standalone inputs to provide consistent labeling and error display.
|
|
23
25
|
*/
|
|
24
|
-
export type
|
|
26
|
+
export type FieldOptions = {
|
|
25
27
|
/** Whether the wrapper should take full width of its container */
|
|
26
28
|
fullWidth?: Value<boolean>;
|
|
27
29
|
/** Label text or node to display above/beside the input */
|
|
@@ -45,9 +47,13 @@ export type InputWrapperOptions = {
|
|
|
45
47
|
/** Whether the input is disabled (applies disabled styling to label) */
|
|
46
48
|
disabled?: Value<boolean>;
|
|
47
49
|
/** Layout mode for label and input positioning */
|
|
48
|
-
layout?: Value<
|
|
49
|
-
/** CSS width value for label in
|
|
50
|
+
layout?: Value<FieldLabelLayout>;
|
|
51
|
+
/** CSS width value for label in horizontal layouts (e.g., '120px', '10rem') */
|
|
50
52
|
labelWidth?: Value<string>;
|
|
53
|
+
/** Reduced spacing mode for data-dense interfaces */
|
|
54
|
+
compact?: Value<boolean>;
|
|
55
|
+
/** Number of grid columns this field spans in a Fieldset grid */
|
|
56
|
+
span?: Value<number>;
|
|
51
57
|
};
|
|
52
58
|
/**
|
|
53
59
|
* Wraps an input element with label, description, error message, and accessibility attributes.
|
|
@@ -58,8 +64,9 @@ export type InputWrapperOptions = {
|
|
|
58
64
|
* - Description text for additional guidance
|
|
59
65
|
* - Error message display with ARIA live region announcements
|
|
60
66
|
* - Proper accessibility attributes (aria-describedby, aria-invalid, role="alert")
|
|
61
|
-
* - Multiple layout modes (vertical, horizontal, horizontal-label-right, horizontal-fixed)
|
|
67
|
+
* - Multiple layout modes (vertical, horizontal, horizontal-label-right, horizontal-fixed, responsive)
|
|
62
68
|
* - Automatic ID generation for linking label, description, and error to the input
|
|
69
|
+
* - FieldLayout provider integration: inherits layout settings from a parent Fieldset
|
|
63
70
|
*
|
|
64
71
|
* The component handles state styling (error, disabled) and ensures screen readers
|
|
65
72
|
* receive appropriate context through ARIA attributes.
|
|
@@ -73,17 +80,19 @@ export type InputWrapperOptions = {
|
|
|
73
80
|
* @param options.labelFor - ID of the input element
|
|
74
81
|
* @param options.hasError - Whether to apply error styling
|
|
75
82
|
* @param options.disabled - Whether to apply disabled styling
|
|
76
|
-
* @param options.layout - Layout mode (default: 'vertical')
|
|
83
|
+
* @param options.layout - Layout mode (default: inherited from FieldLayout or 'vertical')
|
|
77
84
|
* @param options.labelWidth - Fixed width for label in 'horizontal-fixed' layout
|
|
85
|
+
* @param options.compact - Reduced spacing mode
|
|
86
|
+
* @param options.span - Number of grid columns this field spans in a Fieldset grid
|
|
78
87
|
* @param options.context - Contextual info in the header (e.g., character count)
|
|
79
88
|
* @param options.labelChildren - Additional content after the label
|
|
80
89
|
* @param options.fullWidth - Whether to take full container width
|
|
81
90
|
* @param children - Additional nodes to append to the wrapper
|
|
82
|
-
* @returns A div element with the complete
|
|
91
|
+
* @returns A div element with the complete field structure
|
|
83
92
|
*
|
|
84
93
|
* @example
|
|
85
94
|
* ```ts
|
|
86
|
-
*
|
|
95
|
+
* Field({
|
|
87
96
|
* label: 'Email',
|
|
88
97
|
* description: 'We will never share your email',
|
|
89
98
|
* required: true,
|
|
@@ -94,4 +103,4 @@ export type InputWrapperOptions = {
|
|
|
94
103
|
* })
|
|
95
104
|
* ```
|
|
96
105
|
*/
|
|
97
|
-
export declare const
|
|
106
|
+
export declare const Field: (options: FieldOptions, ...children: TNode[]) => import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -22,7 +22,8 @@ export * from './files-input';
|
|
|
22
22
|
export * from './input-adornment';
|
|
23
23
|
export * from './input-container';
|
|
24
24
|
export * from './input-options';
|
|
25
|
-
export * from './
|
|
25
|
+
export * from './field';
|
|
26
|
+
export * from './field-layout';
|
|
26
27
|
export * from './lazy-native-select';
|
|
27
28
|
export * from './list-input';
|
|
28
29
|
export * from './mask-input';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
2
|
import { InputOptions } from './input-options';
|
|
3
3
|
import { DropdownOption } from './option';
|
|
4
4
|
import { BaseControlOptions, ControlOptions } from '../control';
|
|
@@ -95,4 +95,4 @@ export declare function BaseMultiSelectControl<T>(options: BaseControlOptions<T[
|
|
|
95
95
|
* @param options - Controller options for the multi-select control.
|
|
96
96
|
* @returns A renderable form control component with wrapper.
|
|
97
97
|
*/
|
|
98
|
-
export declare function MultiSelectControl<T>(options: ControlOptions<T[], MultiSelectOptions<T>>): Renderable
|
|
98
|
+
export declare function MultiSelectControl<T>(options: ControlOptions<T[], MultiSelectOptions<T>>): import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -59,4 +59,4 @@ export declare function BaseNativeSelectControl<T>(options: BaseControlOptions<T
|
|
|
59
59
|
* @param options - Controller options for the native select control.
|
|
60
60
|
* @returns A renderable form control component with wrapper.
|
|
61
61
|
*/
|
|
62
|
-
export declare function NativeSelectControl<T>(options: ControlOptions<T, NativeSelectOptions<T>>): Renderable
|
|
62
|
+
export declare function NativeSelectControl<T>(options: ControlOptions<T, NativeSelectOptions<T>>): import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -14,6 +14,17 @@ export interface RangeSliderTick {
|
|
|
14
14
|
/** Optional label displayed near the tick mark */
|
|
15
15
|
label?: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Definition of a marker dot on the range slider track.
|
|
19
|
+
* Markers are small circles rendered directly on the track,
|
|
20
|
+
* unlike ticks which extend outward from the track.
|
|
21
|
+
*/
|
|
22
|
+
export interface RangeSliderMarker {
|
|
23
|
+
/** The numeric value where this marker appears */
|
|
24
|
+
value: number;
|
|
25
|
+
/** Optional label displayed below (horizontal) or beside (vertical) the marker */
|
|
26
|
+
label?: string;
|
|
27
|
+
}
|
|
17
28
|
/**
|
|
18
29
|
* Style configuration for an individual track segment.
|
|
19
30
|
*/
|
|
@@ -70,10 +81,16 @@ export interface RangeSliderOptions {
|
|
|
70
81
|
/** Callback for multi-point mode changes */
|
|
71
82
|
onPointsChange?: (points: number[]) => void;
|
|
72
83
|
/**
|
|
73
|
-
* Tick marks along the slider track.
|
|
84
|
+
* Tick marks along the slider track (extend outward from the track).
|
|
74
85
|
* Can be `true` for automatic step-based ticks, or an array of custom tick definitions.
|
|
75
86
|
*/
|
|
76
87
|
ticks?: Value<boolean | RangeSliderTick[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Marker dots rendered directly on the track surface.
|
|
90
|
+
* Can be `true` for automatic step-based markers, or an array of custom marker definitions.
|
|
91
|
+
* Unlike ticks, markers are small circles that sit on the track itself.
|
|
92
|
+
*/
|
|
93
|
+
markers?: Value<boolean | RangeSliderMarker[]>;
|
|
77
94
|
/**
|
|
78
95
|
* Whether to show the current value label(s) above the thumb(s).
|
|
79
96
|
* @default false
|
|
@@ -172,4 +189,4 @@ export interface RangeSliderOptions {
|
|
|
172
189
|
* )
|
|
173
190
|
* ```
|
|
174
191
|
*/
|
|
175
|
-
export declare function RangeSlider({ min: minOpt, max: maxOpt, step: stepOpt, disabled, readonly: readonlyOpt, size, color, value, onChange, range, onRangeChange, points, onPointsChange, ticks, showValue, formatValue, segmentStyles, renderThumb, orientation: orientationOpt, }: RangeSliderOptions): import("@tempots/dom").Renderable;
|
|
192
|
+
export declare function RangeSlider({ min: minOpt, max: maxOpt, step: stepOpt, disabled, readonly: readonlyOpt, size, color, value, onChange, range, onRangeChange, points, onPointsChange, ticks, markers, showValue, formatValue, segmentStyles, renderThumb, orientation: orientationOpt, }: RangeSliderOptions): import("@tempots/dom").Renderable;
|
|
@@ -86,4 +86,4 @@ export declare function BaseSelectTagsControl<T>(options: BaseControlOptions<T[]
|
|
|
86
86
|
* @param options - Controller options for the select tags control.
|
|
87
87
|
* @returns A renderable form control component with wrapper.
|
|
88
88
|
*/
|
|
89
|
-
export declare function SelectTagsControl<T>(options: ControlOptions<T[], SelectTagsInputOptions<T>>): import("@tempots/dom").
|
|
89
|
+
export declare function SelectTagsControl<T>(options: ControlOptions<T[], SelectTagsInputOptions<T>>): import("@tempots/core").Renderable<import("@tempots/dom").DOMContext, typeof import("@tempots/dom").DOM_RENDERABLE_TYPE>;
|
|
@@ -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;
|