@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.
Files changed (66) hide show
  1. package/dist/auth/index.cjs.js +1 -1
  2. package/dist/auth/index.es.js +1 -1
  3. package/dist/{auth-divider-D_3gKZ6g.js → auth-divider-BIATan1F.js} +3 -3
  4. package/dist/{auth-divider-itm5-j5G.cjs → auth-divider-CVKfA8Cp.cjs} +1 -1
  5. package/dist/beatui.css +393 -36
  6. package/dist/beatui.tailwind.css +393 -36
  7. package/dist/better-auth/index.cjs.js +1 -1
  8. package/dist/better-auth/index.es.js +2 -2
  9. package/dist/deep-merge-B33Qtlmw.cjs +1 -0
  10. package/dist/{deep-merge-CzZVsVF-.js → deep-merge-BUsrE2v4.js} +130 -130
  11. package/dist/{duration-input-BrYLC1js.cjs → duration-input-C5il_E0F.cjs} +1 -1
  12. package/dist/{duration-input-CFu6vq-y.js → duration-input-DoCCrqOG.js} +1 -1
  13. package/dist/index.cjs.js +4 -4
  14. package/dist/index.es.js +5609 -5130
  15. package/dist/json-schema/index.cjs.js +1 -1
  16. package/dist/json-schema/index.es.js +107 -107
  17. package/dist/json-structure/index.cjs.js +1 -1
  18. package/dist/json-structure/index.es.js +3 -3
  19. package/dist/{modal-YKqlh4Dk.js → modal-BHlp4QeT.js} +1 -1
  20. package/dist/{modal-DCxNGrzk.cjs → modal-BmpfNL48.cjs} +1 -1
  21. package/dist/{notice-Q0A1gIho.cjs → notice-BBnSXYUc.cjs} +1 -1
  22. package/dist/{notice-Du3tWJTW.js → notice-BXKtBEiC.js} +1 -1
  23. package/dist/types/components/data/data-table-context.d.ts +9 -1
  24. package/dist/types/components/data/data-table-row-details.d.ts +21 -0
  25. package/dist/types/components/data/data-table-types.d.ts +23 -0
  26. package/dist/types/components/data/index.d.ts +1 -0
  27. package/dist/types/components/form/control/control.d.ts +5 -5
  28. package/dist/types/components/form/control/list-control.d.ts +11 -11
  29. package/dist/types/components/form/fieldset/fieldset.d.ts +60 -0
  30. package/dist/types/components/form/fieldset/index.d.ts +1 -0
  31. package/dist/types/components/form/index.d.ts +1 -0
  32. package/dist/types/components/form/input/combobox-input.d.ts +2 -2
  33. package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
  34. package/dist/types/components/form/input/date-time-input.d.ts +1 -1
  35. package/dist/types/components/form/input/dropdown-input.d.ts +2 -2
  36. package/dist/types/components/form/input/field-layout.d.ts +64 -0
  37. package/dist/types/components/form/input/{input-wrapper.d.ts → field.d.ts} +23 -14
  38. package/dist/types/components/form/input/index.d.ts +2 -1
  39. package/dist/types/components/form/input/multi-select.d.ts +2 -2
  40. package/dist/types/components/form/input/native-select.d.ts +1 -1
  41. package/dist/types/components/form/input/range-slider.d.ts +19 -2
  42. package/dist/types/components/form/input/select-tags-input.d.ts +1 -1
  43. package/dist/types/components/format/format-bigint.d.ts +64 -0
  44. package/dist/types/components/format/format-date-time.d.ts +54 -0
  45. package/dist/types/components/format/format-date.d.ts +82 -0
  46. package/dist/types/components/format/format-display-name.d.ts +70 -0
  47. package/dist/types/components/format/format-file-size.d.ts +30 -0
  48. package/dist/types/components/format/format-list.d.ts +61 -0
  49. package/dist/types/components/format/format-number.d.ts +88 -0
  50. package/dist/types/components/format/format-plural.d.ts +96 -0
  51. package/dist/types/components/format/format-relative-time.d.ts +62 -0
  52. package/dist/types/components/format/format-time.d.ts +66 -0
  53. package/dist/types/components/format/index.d.ts +11 -0
  54. package/dist/types/components/i18n/locale-selector.d.ts +1 -1
  55. package/dist/types/components/json-schema/controls/composition-shared.d.ts +1 -1
  56. package/dist/types/components/json-schema/controls/shared-utils.d.ts +3 -3
  57. package/dist/types/components/json-schema/widgets/string-controls.d.ts +2 -2
  58. package/dist/types/components/json-schema-display/display-wrapper.d.ts +1 -1
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/use-form-CP6nftVl.cjs +2 -0
  61. package/dist/{use-form-D_TJyZhP.js → use-form-CmQdxpOi.js} +474 -434
  62. package/dist/{widget-customization-DELy3SMQ.cjs → widget-customization-B0y-eesp.cjs} +1 -1
  63. package/dist/{widget-customization-BAchyOUo.js → widget-customization-CKbR4Dsg.js} +2 -2
  64. package/package.json +1 -1
  65. package/dist/deep-merge-Bydz6jLt.cjs +0 -1
  66. package/dist/use-form-BvBkVEKi.cjs +0 -2
@@ -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;
@@ -0,0 +1,96 @@
1
+ import { TNode, Value } from '@tempots/dom';
2
+ /**
3
+ * CLDR plural category returned by `Intl.PluralRules`.
4
+ */
5
+ export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
6
+ /**
7
+ * Plural rule type: 'cardinal' for counting, 'ordinal' for ordering.
8
+ */
9
+ export type PluralType = 'cardinal' | 'ordinal';
10
+ /**
11
+ * A mapping from plural category to the string to display.
12
+ * The `other` category is required as a fallback.
13
+ * Strings may contain `{count}` which is replaced with the locale-formatted number.
14
+ */
15
+ export type PluralMessages = Partial<Record<PluralCategory, string>> & {
16
+ /** Required fallback for any unmatched category. */
17
+ other: string;
18
+ };
19
+ /**
20
+ * Options for the {@link FormatPlural} component.
21
+ */
22
+ export interface FormatPluralOptions {
23
+ /** The numeric value to determine plural category for. @default 3 @min 0 @max 1000 @step 1 */
24
+ value: Value<number>;
25
+ /** Mapping from plural category to display string. Supports {count} interpolation. */
26
+ messages: PluralMessages;
27
+ /** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
28
+ locale?: Value<string>;
29
+ /** Plural rule type. @default 'cardinal' */
30
+ type?: Value<PluralType>;
31
+ /** Minimum integer digits. @default undefined */
32
+ minimumIntegerDigits?: Value<number>;
33
+ /** Minimum fraction digits. @default undefined */
34
+ minimumFractionDigits?: Value<number>;
35
+ /** Maximum fraction digits. @default undefined */
36
+ maximumFractionDigits?: Value<number>;
37
+ /** Minimum significant digits. @default undefined */
38
+ minimumSignificantDigits?: Value<number>;
39
+ /** Maximum significant digits. @default undefined */
40
+ maximumSignificantDigits?: Value<number>;
41
+ }
42
+ /**
43
+ * Resolves the CLDR plural category for a number.
44
+ *
45
+ * @param value - The number to categorize
46
+ * @param locale - BCP 47 locale string (uses browser default if omitted)
47
+ * @param options - Intl.PluralRules options
48
+ * @returns The plural category
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * resolvePluralCategory(1, 'en-US') // 'one'
53
+ * resolvePluralCategory(5, 'en-US') // 'other'
54
+ * resolvePluralCategory(3, 'en-US', { type: 'ordinal' }) // 'few'
55
+ * ```
56
+ */
57
+ export declare function resolvePluralCategory(value: number, locale?: string, options?: Intl.PluralRulesOptions): PluralCategory;
58
+ /**
59
+ * Selects a message based on the plural category of a number and replaces
60
+ * `{count}` with the locale-formatted number.
61
+ *
62
+ * @param value - The number to categorize
63
+ * @param messages - Plural messages mapping
64
+ * @param locale - BCP 47 locale string (uses browser default if omitted)
65
+ * @param options - Intl.PluralRules options
66
+ * @returns The selected and interpolated message string
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * formatPlural(1, { one: '{count} item', other: '{count} items' }, 'en-US') // '1 item'
71
+ * formatPlural(5, { one: '{count} item', other: '{count} items' }, 'en-US') // '5 items'
72
+ * formatPlural(1000, { one: '{count} item', other: '{count} items' }, 'de-DE') // '1.000 items'
73
+ * ```
74
+ */
75
+ export declare function formatPlural(value: number, messages: PluralMessages, locale?: string, options?: Intl.PluralRulesOptions): string;
76
+ /**
77
+ * Locale-aware plural formatting component.
78
+ *
79
+ * Selects a message from a plural category map based on the value and renders
80
+ * it as a `<span>` that automatically updates when the locale or value changes.
81
+ * The `{count}` placeholder in messages is replaced with the locale-formatted number.
82
+ *
83
+ * @param options - Configuration for the plural format
84
+ * @returns A reactive `<span>` containing the selected plural message
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * FormatPlural({ value: 1, messages: { one: '{count} item', other: '{count} items' } })
89
+ * FormatPlural({
90
+ * value: 3,
91
+ * type: 'ordinal',
92
+ * messages: { one: '{count}st', two: '{count}nd', few: '{count}rd', other: '{count}th' },
93
+ * })
94
+ * ```
95
+ */
96
+ export declare function FormatPlural(options: FormatPluralOptions): TNode;
@@ -0,0 +1,62 @@
1
+ import { TNode, Value } from '@tempots/dom';
2
+ /**
3
+ * Relative time unit for `Intl.RelativeTimeFormat`.
4
+ */
5
+ export type RelativeTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
6
+ /**
7
+ * Numeric display style: 'always' => "1 day ago", 'auto' => "yesterday".
8
+ */
9
+ export type RelativeTimeNumeric = 'always' | 'auto';
10
+ /**
11
+ * Format verbosity for relative time.
12
+ */
13
+ export type RelativeTimeStyle = 'long' | 'short' | 'narrow';
14
+ /**
15
+ * Options for the {@link FormatRelativeTime} component.
16
+ */
17
+ export interface FormatRelativeTimeOptions {
18
+ /** Numeric offset (e.g., -2 for "2 days ago", 3 for "in 3 hours"). @default -2 @min -100 @max 100 @step 1 */
19
+ value: Value<number>;
20
+ /** The unit for the relative time. @default 'day' */
21
+ unit: Value<RelativeTimeUnit>;
22
+ /** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
23
+ locale?: Value<string>;
24
+ /** Numeric display. @default 'auto' */
25
+ numeric?: Value<RelativeTimeNumeric>;
26
+ /** Format verbosity. @default 'long' */
27
+ style?: Value<RelativeTimeStyle>;
28
+ }
29
+ /**
30
+ * Formats a relative time value with locale and Intl options.
31
+ *
32
+ * @param value - Numeric offset (negative = past, positive = future)
33
+ * @param unit - Time unit
34
+ * @param locale - BCP 47 locale string (uses browser default if omitted)
35
+ * @param options - Intl.RelativeTimeFormat options
36
+ * @returns The formatted relative time string
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * formatRelativeTime(-2, 'day', 'en-US') // '2 days ago'
41
+ * formatRelativeTime(-1, 'day', 'en-US', { numeric: 'auto' }) // 'yesterday'
42
+ * formatRelativeTime(3, 'hour', 'en-US') // 'in 3 hours'
43
+ * ```
44
+ */
45
+ export declare function formatRelativeTime(value: number, unit: RelativeTimeUnit, locale?: string, options?: Intl.RelativeTimeFormatOptions): string;
46
+ /**
47
+ * Locale-aware relative time formatting component.
48
+ *
49
+ * Renders a relative time expression (e.g., "2 days ago", "in 3 hours") as a
50
+ * `<span>` that automatically updates when the locale, value, or unit changes.
51
+ *
52
+ * @param options - Configuration for the relative time format
53
+ * @returns A reactive `<span>` containing the formatted relative time
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * FormatRelativeTime({ value: -2, unit: 'day' })
58
+ * FormatRelativeTime({ value: -1, unit: 'day', numeric: 'auto' })
59
+ * FormatRelativeTime({ value: 3, unit: 'hour', style: 'narrow' })
60
+ * ```
61
+ */
62
+ export declare function FormatRelativeTime(options: FormatRelativeTimeOptions): TNode;
@@ -0,0 +1,66 @@
1
+ import { TNode, Value } from '@tempots/dom';
2
+ import type { DateValue } from './format-date';
3
+ /**
4
+ * Preset time format styles matching `Intl.DateTimeFormat` timeStyle.
5
+ */
6
+ export type TimeFormatStyle = 'full' | 'long' | 'medium' | 'short';
7
+ /**
8
+ * Options for the {@link FormatTime} component.
9
+ */
10
+ export interface FormatTimeOptions {
11
+ /** The date/time value to extract time from. @default '2026-03-17T14:30:00' */
12
+ value: Value<DateValue>;
13
+ /** BCP 47 locale override. If omitted, uses the Locale provider. @default undefined */
14
+ locale?: Value<string>;
15
+ /** Time format preset. @default 'medium' */
16
+ timeStyle?: Value<TimeFormatStyle>;
17
+ /** Time zone. @default undefined (browser default) */
18
+ timeZone?: Value<string>;
19
+ /** Whether to use 12-hour time. @default undefined (locale default) */
20
+ hour12?: Value<boolean>;
21
+ /** Hour cycle override. @default undefined */
22
+ hourCycle?: Value<'h11' | 'h12' | 'h23' | 'h24'>;
23
+ /** Hour representation (mutually exclusive with timeStyle). @default undefined */
24
+ hour?: Value<'numeric' | '2-digit'>;
25
+ /** Minute representation (mutually exclusive with timeStyle). @default undefined */
26
+ minute?: Value<'numeric' | '2-digit'>;
27
+ /** Second representation (mutually exclusive with timeStyle). @default undefined */
28
+ second?: Value<'numeric' | '2-digit'>;
29
+ /** Fractional second digits (0-3, mutually exclusive with timeStyle). @default undefined */
30
+ fractionalSecondDigits?: Value<0 | 1 | 2 | 3>;
31
+ /** Time zone name display style (mutually exclusive with timeStyle). @default undefined */
32
+ timeZoneName?: Value<'long' | 'short' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric'>;
33
+ /** Day period display (mutually exclusive with timeStyle). @default undefined */
34
+ dayPeriod?: Value<'narrow' | 'short' | 'long'>;
35
+ }
36
+ /**
37
+ * Formats a time value with locale and Intl options.
38
+ *
39
+ * @param value - The date/time value to extract time from
40
+ * @param locale - BCP 47 locale string (uses browser default if omitted)
41
+ * @param options - Intl.DateTimeFormat options
42
+ * @returns The formatted time string
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * formatTime(new Date(), 'en-US', { timeStyle: 'short' }) // '2:30 PM'
47
+ * formatTime(new Date(), 'de-DE', { timeStyle: 'short' }) // '14:30'
48
+ * ```
49
+ */
50
+ export declare function formatTime(value: DateValue, locale?: string, options?: Intl.DateTimeFormatOptions): string;
51
+ /**
52
+ * Locale-aware time formatting component.
53
+ *
54
+ * Renders a formatted time as a `<span>` that automatically updates when
55
+ * the locale or value changes.
56
+ *
57
+ * @param options - Configuration for the time format
58
+ * @returns A reactive `<span>` containing the formatted time
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * FormatTime({ value: new Date(), timeStyle: 'short' })
63
+ * FormatTime({ value: plainTime, hour: 'numeric', minute: '2-digit', hour12: false })
64
+ * ```
65
+ */
66
+ export declare function FormatTime(options: FormatTimeOptions): TNode;
@@ -0,0 +1,11 @@
1
+ export * from './format-number';
2
+ export * from './format-bigint';
3
+ export * from './format-date';
4
+ export * from './format-time';
5
+ export * from './format-date-time';
6
+ export * from './format-relative-time';
7
+ export * from './format-list';
8
+ export * from './format-display-name';
9
+ export * from './format-plural';
10
+ export { FormatFileSize } from './format-file-size';
11
+ export type { FormatFileSizeComponentOptions } from './format-file-size';
@@ -27,7 +27,7 @@ export type LocaleSelectorOptions = {
27
27
  /**
28
28
  * A dropdown component for selecting the application locale.
29
29
  *
30
- * Renders a native `<select>` element wrapped in an `InputWrapper` with a language icon.
30
+ * Renders a native `<select>` element wrapped in a `Field` with a language icon.
31
31
  * The component reads the current locale from the `Locale` provider and optionally updates it
32
32
  * when the user makes a selection.
33
33
  *
@@ -29,6 +29,6 @@ export interface WithSelectorLayoutParams {
29
29
  /**
30
30
  * Wrap inner control with selector and layout based on context.
31
31
  * - At root: show selector + inner in a vertical Stack when showSelector is true
32
- * - Non-root: wrap content in InputWrapper and include selector when needed
32
+ * - Non-root: wrap content in Field and include selector when needed
33
33
  */
34
34
  export declare function WithSelectorLayout({ ctx, showSelector, selector, inner, }: WithSelectorLayoutParams): Renderable;
@@ -1,13 +1,13 @@
1
1
  import type { JSONSchema } from '../schema-context';
2
- import type { InputWrapperOptions, Controller } from '../../form';
2
+ import type { FieldOptions, Controller } from '../../form';
3
3
  import type { Renderable } from '@tempots/dom';
4
4
  import type { ResolvedWidget } from '../widgets/utils';
5
5
  /**
6
6
  * Convert schema definition to input wrapper options
7
7
  */
8
- export declare function definitionToInputWrapperOptions({ ctx, }: {
8
+ export declare function definitionToFieldOptions({ ctx, }: {
9
9
  ctx: import('../schema-context').SchemaContext;
10
- }): Partial<InputWrapperOptions>;
10
+ }): Partial<FieldOptions>;
11
11
  /**
12
12
  * Create placeholder value from schema definition
13
13
  */
@@ -1,8 +1,8 @@
1
- import { Controller, InputWrapperOptions } from '../../form';
1
+ import { Controller, FieldOptions } from '../../form';
2
2
  import { SchemaContext } from '../schema-context';
3
3
  import { Renderable } from '@tempots/dom';
4
4
  export declare function StringControl({ ctx, options, controller, }: {
5
5
  ctx: SchemaContext;
6
- options: Partial<InputWrapperOptions>;
6
+ options: Partial<FieldOptions>;
7
7
  controller: Controller<string | undefined>;
8
8
  }): Renderable;
@@ -5,7 +5,7 @@ import type { Mismatch } from './mismatch';
5
5
  * Display wrapper component.
6
6
  * Renders label (from ctx.widgetLabel), required indicator, deprecated badge,
7
7
  * description, and mismatch indicators around content.
8
- * Analog of InputWrapper + WithSchemaIssues for display mode.
8
+ * Analog of Field + WithSchemaIssues for display mode.
9
9
  */
10
10
  export declare function DisplayWrapper({ ctx, mismatches, children, }: {
11
11
  ctx: SchemaContext;
@@ -18,6 +18,7 @@ export * from './components/beatui';
18
18
  export * from './components/button';
19
19
  export * from './components/content';
20
20
  export * from './components/data';
21
+ export * from './components/format';
21
22
  export * from './components/form';
22
23
  export * from './components/i18n';
23
24
  export * from './components/layout';
@@ -0,0 +1,2 @@
1
+ "use strict";const s=require("@tempots/dom"),w=require("./translations-qefRsdGi.cjs"),P=require("./input-container-BkPcNDaZ.cjs"),B=require("./stack-dwLevGa2.cjs"),_=require("./session-id-B5lJMzbB.cjs"),p=require("@tempots/std"),j={layout:"vertical",labelWidth:"7.5rem",size:"md",gap:"md",columns:1,minFieldWidth:"15rem",compact:!1},E={mark:s.makeProviderMark("FieldLayout"),create:(i={},e)=>{let t=j;try{t=e.getProvider(E.mark).value}catch(a){if(!(a instanceof s.ProviderNotFoundError))throw a}return{value:{layout:i.layout??t.layout,labelWidth:i.labelWidth??t.labelWidth,size:i.size??t.size,gap:i.gap??t.gap,columns:i.columns??t.columns,minFieldWidth:i.minFieldWidth??t.minFieldWidth,compact:i.compact??t.compact},dispose:()=>{}}}},q=s.html.span(s.attr.class("bc-field__required")," *");function te(i,e){const t=["bc-field"];return i!=="vertical"&&t.push(`bc-field--${i}`),e&&t.push("bc-field--compact"),t.join(" ")}function se(i,e){const t=["bc-field__label-text"];return i?t.push("bc-field__label-text--error"):e?t.push("bc-field__label-text--disabled"):t.push("bc-field__label-text--default"),t.join(" ")}function ie(i,e,t){const n=[];return(i==="horizontal-fixed"||i==="horizontal-end"||i==="responsive")&&e!=null&&n.push(`--field-label-width: ${e}`),t!=null&&t>0&&n.push(`grid-column: span ${t}`),n.length>0?n.join("; "):void 0}function ne(i,e,t){const{fullWidth:n=!1,required:a,label:o,labelChildren:l,context:r,description:c,content:u,error:h,labelFor:m,hasError:g,disabled:y,span:b}=e,d=g??h!=null,C=y??!1,V=e.layout??i.layout,J=e.labelWidth??i.labelWidth,Q=e.compact??i.compact,x=_.sessionId("input-wrapper"),T=c?`${x}-description`:void 0,I=h!=null?`${x}-error`:void 0,W=s.computedOf(V)(f=>f!=="vertical"&&f!=="responsive"),X=s.computedOf(V,J,b??void 0)((f,v,ee)=>ie(f,s.Value.get(v),ee)),Z=s.computedOf(V,Q)((f,v)=>te(f,v??!1));return s.html.div(s.attr.class(Z),s.attr.class(s.Value.map(n,f=>f?"bc-field--full-width":"")),s.attr.style(X),o!=null||r!=null?s.html.div(s.attr.class("bc-field__header"),s.html.div(s.attr.class("bc-field__label-section"),s.html.label(s.attr.class("bc-field__label"),m!=null?s.attr.for(m):s.Empty,s.html.span(s.attr.class(s.computedOf(d,C)((f,v)=>se(f??!1,v??!1))),o),o!=null&&a?q:s.Empty),s.When(s.computedOf(W,c)((f,v)=>f&&v!=null),()=>s.html.div(s.attr.class("bc-field__description bc-field__description--under-label"),s.attr.id(T),c))),r!=null?B.Label(r):s.Empty,l):s.Empty,s.html.div(s.attr.class("bc-field__content"),[T,I].filter(Boolean).length>0?s.dataAttr("describedby",[T,I].filter(Boolean).join(" ")):s.Empty,a?s.dataAttr("required","true"):s.Empty,s.When(d,()=>s.dataAttr("invalid","true")),u),s.When(s.computedOf(W,c)((f,v)=>!f&&v!=null),()=>s.html.div(s.attr.class("bc-field__description"),s.attr.id(T),c)),s.When(d,()=>s.html.div(s.attr.class("bc-field__error"),s.attr.id(I),s.aria.live("polite"),s.attr.role("alert"),h)),...t)}const S=(i,...e)=>{const t={};return i.layout!==void 0&&(t.layout=i.layout),i.labelWidth!==void 0&&(t.labelWidth=i.labelWidth),i.compact!==void 0&&(t.compact=i.compact),s.Provide(E,t,()=>s.Use(E,n=>ne(n,i,e)))};function ae({size:i="sm",icon:e="line-md:close",disabled:t,roundedness:n="full",color:a="base",onClick:o,label:l},...r){return s.Use(w.BeatUII18n,c=>{const u=s.coalesce(l,c.$.closeModal);return P.Button({variant:"text",size:i,roundedness:n,disabled:t,color:a,onClick:o},s.attr.title(u),s.aria.label(u),...r,w.Icon({icon:e,size:i??"sm"}))})}const re=i=>{const{value:e,onBlur:t,onChange:n,onInput:a,placeholder:o,disabled:l,id:r,activeIcon:c,inactiveIcon:u,size:h="md"}=i,m=r??_.sessionId("checkbox"),g=`${m}-label`,y=()=>{if(s.Value.get(l??!1))return;const d=s.Value.get(e);n?.(!d),a?.(!d)},b=d=>{s.Value.get(l??!1)||(d.key===" "||d.key==="Enter")&&(d.preventDefault(),y())};return P.InputContainer({baseContainer:!0,growInput:!1,...i,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(e,d=>d?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(l??!1,d=>d?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(m),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(l??!1,d=>d?-1:0)),s.aria.checked(e),s.aria.disabled(l),o!=null?s.aria.labelledby(g):s.Empty,s.on.keydown(b),t!=null?s.on.blur(t):s.Empty,w.Icon({icon:s.computedOf(e,c,u)((d,C,V)=>d?C??"ri:checkbox-fill":V??"mdi:checkbox-blank-outline"),accessibility:"decorative",size:h})),o!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(g),s.attr.for(m),B.MutedLabel(o)):s.Empty)},s.on.click(y))},L=((i,e)=>()=>{i.markTouched(),e?.()}),F=(i,e)=>t=>{i.change(t),e?.(t)};function M(i,e){const{controller:t,onBlur:n,onChange:a,id:o,triggerOn:l,...r}=e;return i({id:o??t.name,disabled:t.disabled,value:t.signal,hasError:t.errorVisible,name:t.name,...r,onInput:l==="input"?F(t,a):void 0,onChange:l!=="input"?F(t,a):void 0,onBlur:L(t,n)})}function le(i,{id:e,labelFor:t,...n},...a){const o=e??n.controller.name??_.sessionId("control"),l=t??o;return S({...n,hasError:n.controller.errorVisible,error:s.TextNode(n.controller.error.map(r=>r??"")),labelFor:l,content:M(r=>i({...r,id:o}),n)},...a)}function H(i,e){const{toInput:t,fromInput:n,controller:a,...o}=e,l=a.transform(t,n);return M(i,{...o,controller:l})}function oe(i,{id:e,labelFor:t,...n},...a){const o=e??n.controller.name??_.sessionId("control");return S({...n,labelFor:t??o,content:H(i,{...n,id:o})},...a)}function ce(i){return i.split(".").map(t=>{const n=t.match(/^\[(\d+)\]$/);return n?Number(n[1]):t})}function $(i){return typeof i=="number"?`[${i}]`:`.${i}`}function z(i){if(i.length===0)return"";const[e,...t]=i;return[typeof e=="number"?`[${e}]`:e,...t.map($)].join("")}const de={valid:p.Validation.valid,invalid(i){return p.Validation.invalid({message:i})},invalidFields(i){const e={};for(const[t,n]of Object.entries(i))e[t]=typeof n=="string"?{message:n}:n;return p.Validation.invalid({dependencies:e})},fromError(i){return p.Validation.invalid(i)}};function D(i){return function(t){if(t.type==="valid")return t;let n=t.error;for(const a of i)if(n=n?.dependencies?.[a],n==null)return p.Validation.valid;return p.Validation.invalid(n)}}class k{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#i=[];disabledOrHasErrors;constructor(e,t,n,a,o,l=p.strictEqual){this.path=e,this.change=t,this.signal=n,this.status=a,this.#s=l,this.#t.set(n.value),this.error=a.map(r=>r?.type==="invalid"?r.error?.message:void 0),this.hasError=this.error.map(r=>r!=null),this.touched=this.#e.touched,o.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,o.validationMode)((r,c,u)=>u==="eager"?!!r:!!r&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((r,c)=>!!r&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((r,c)=>!this.#s(r,c)),this.dependencyErrors=a.map(r=>r?.type==="invalid"?r.error?.dependencies:void 0),this.parent=o,this.disabled=s.computedOf(this.#e.disabled,o.disabled)((r,c)=>r||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((r,c)=>r||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return z(this.path)}onDispose=e=>{this.#i.push(e)};dispose=()=>{for(const e of this.#i)try{e()}catch(t){console.error("Error in dispose callback:",t)}this.#i.length=0};setDisabled=e=>{this.#e.disabled.set(e)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(e=p.strictEqual)=>new U(this.path,this.change,this.signal,this.status,this.parent,e);object=(e=p.strictEqual)=>new N(this.path,this.change,this.signal,this.status,this.parent,e);transform=(e,t,n=[],a=p.strictEqual)=>new k([...this.path,...n],o=>this.change(t(o)),this.signal.map(e,a),this.status.map(D(n)),this.parent,a);asyncTransform=(e,t,n,a=[],o=p.strictEqual)=>new k([...this.path,...a],l=>{t(l).then(r=>this.change(r))},this.signal.mapAsync(e,n,void 0,o),this.status.map(D(a)),this.parent,o)}class N extends k{#e=new Map;#s=new Map;#t=new Map;#i=s.prop(!1);touchedDeep=this.#i;#a=new Map;#n=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#d;#o=()=>{let e=!1;for(const t of this.#s.values())if(t){e=!0;break}this.#i.set(this.touched.value||e)};constructor(e,t,n,a,o,l){super(e,t,n.map(c=>c??{},l),a,o,l),this.#c=this.touched.on(()=>{this.#o()}),this.#d=this.dirty.on(()=>{this.#r()});const r=this.signal.on(()=>this.#r());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#i.dispose();for(const c of this.#n.values())c();this.#n.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#d(),r()})}field=e=>{if(this.#e.has(e))return this.#e.get(e);const t=async l=>{this.change({...this.signal.value,[e]:l})},n=new k([...this.path,e],t,this.signal.map(l=>l[e]),this.status.map(D([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(e,n);const a=n.touched.on(l=>{this.#s.set(e,l),this.#o()});this.#t.set(e,a);const o=n.dirty.on(l=>{this.#a.set(e,l),this.#r()});return this.#n.set(e,o),n};markAllTouched=()=>{this.markTouched();const e=this.signal.value;for(const t of Object.keys(e))this.field(t).markTouched();for(const t of this.#e.values())t.markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value;for(const t of Object.keys(e))this.field(t).markPristine?.();for(const t of this.#e.values())t.markPristine?.()};#r=()=>{let e=!1;for(const t of this.#a.values())if(t){e=!0;break}this.#l.set(this.dirty.value||e)}}class U extends k{#e=new Array;length;#s=new Map;#t=new Map;#i=s.prop(!1);touchedDeep=this.#i;#a=new Map;#n=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#d;#o=()=>{let e=!1;for(const t of this.#s.values())if(t){e=!0;break}this.#i.set(this.touched.value||e)};constructor(e,t,n,a,o,l){const r=n.map(h=>h??[],l);super(e,t,r,a,o,l);const c=r.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((g,y)=>{const b=h.length+y;g.dispose(),this.#t.get(b)?.(),this.#t.delete(b),this.#s.delete(b),this.#n.get(b)?.(),this.#n.delete(b),this.#a.delete(b)}),this.#o(),this.#r())});this.length=r.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#d=this.dirty.on(()=>{this.#r()});const u=this.signal.on(()=>this.#r());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),r.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#i.dispose();for(const h of this.#n.values())h();this.#n.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#d(),u()})}item=e=>{if(this.#e[e])return this.#e[e];const t=async l=>{const r=this.signal.value.slice();r[e]=l,this.change(r)},n=new k([...this.path,e],t,this.signal.map(l=>l[e]),this.status.map(D([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[e]=n;const a=n.touched.on(l=>{this.#s.set(e,l),this.#o()});this.#t.set(e,a);const o=n.dirty.on(l=>{this.#a.set(e,l),this.#r()});return this.#n.set(e,o),n};push=(...e)=>{this.change([...this.signal.value,...e])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...e)=>{this.change([...e,...this.signal.value])};removeAt=e=>{this.splice(e,1)};splice=(e,t)=>{const n=this.signal.value.slice();n.splice(e,t),this.change(n)};move=(e,t,n=1)=>{if(n<1||e===t)return;const a=this.signal.value.slice(),o=a.splice(e,n);a.splice(t,0,...o),this.change(a)};markAllTouched=()=>{this.markTouched();const e=this.signal.value.length;for(let t=0;t<e;t++)this.item(t).markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value.length;for(let t=0;t<e;t++)this.item(t).markPristine?.()};#r=()=>{let e=!1;for(const t of this.#a.values())if(t){e=!0;break}this.#l.set(this.dirty.value||e)}}function R(i){function e(t){return typeof t=="number"?t:t.toString()}return i.map(t=>typeof t=="object"&&t.key!=null?e(t.key):e(t))}function Y(i){const e=i.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),t=i.filter(a=>a.path!=null&&a.path.length>0).reduce((a,o)=>{const l=R(o.path),r=l.pop();let c=a;for(const u of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[u]==null&&(c.dependencies[u]={}),c=c.dependencies[u];return c.dependencies==null&&(c.dependencies={}),c.dependencies[r]={message:o.message},a},{}),n=e.join(`
2
+ `);return{...t,message:n!=""?n:void 0}}function K({initialValue:i,onChange:e,validate:t,equals:n,validationMode:a,validateDebounceMs:o}){const l=s.Value.deriveProp(i),r=s.prop(p.Validation.valid),c=s.prop(!1),u=s.prop(a??"onTouched"),h=d=>{r.set(d)};let m;const g=async d=>{if(t!=null){const C=await t(d);h(C)}},y=async d=>{l.set(d),e?.(d);const C=u.value;if(t!=null){if(C==="onSubmit")return;const V=o??0;V>0?(m&&clearTimeout(m),m=setTimeout(()=>{g(d)},V)):await g(d)}},b=new k([],y,l,r,{disabled:c,validationMode:u},n??p.strictEqual);return b.onDispose(()=>{c.dispose(),l.dispose(),r.dispose(),u.dispose(),m&&clearTimeout(m)}),{controller:b,setStatus:h}}function A(i){return s.Fragment(s.attr.disabled(i.disabled),s.attr.name(i.name))}function he(i,{triggerOn:e="change"}={}){return s.Fragment(A(i),s.attr.value(i.signal),(e==="input"?s.on.input:s.on.change)(s.emitValue(i.change)))}function ue(i,{triggerOn:e="change"}={}){return s.Fragment(A(i),s.attr.valueAsNumber(i.signal),(e==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(i.change)))}function O(i){return i.issues!=null?p.Validation.invalid(Y(i.issues)):p.Validation.valid}async function pe({task:i,errorMessage:e,errorPath:t=["root"],validation:n}){try{const a=await i();return n!=null?n(a):p.Validation.valid}catch(a){const o=e??(a instanceof Error?a.message:"Operation failed");return t.length===1&&t[0]==="root"?p.Validation.invalid({message:o}):p.Validation.invalid({dependencies:G(t,o)})}}function G(i,e){if(i.length===1)return{[i[0]]:{message:e}};const[t,...n]=i;return{[t]:{dependencies:G(n,e)}}}function me({initialValue:i={},schema:e,onSubmit:t=async()=>p.Validation.valid,validationMode:n,validateDebounceMs:a}){const{controller:o,setStatus:l}=K({initialValue:i,validationMode:n??"onTouched",validateDebounceMs:a,validate:(n??"onTouched")==="onSubmit"||e==null?void 0:async h=>O(await e["~standard"].validate(h))}),r=s.prop(!1),c=o.object();return c.onDispose(()=>r.dispose()),{controller:c,setStatus:l,submit:async h=>{if(r.set(!0),h?.preventDefault(),c.markAllTouched(),e!=null){const g=c.signal.value,y=O(await e["~standard"].validate(g));if(l(y),y.type==="invalid"){r.set(!1);return}}const m=await t(c.signal.value);r.set(!1),m.type==="invalid"&&l(m)},submitting:r}}exports.ArrayController=U;exports.BaseControl=M;exports.BaseMappedControl=H;exports.CheckboxInput=re;exports.CloseButton=ae;exports.Control=le;exports.Controller=k;exports.ControllerValidation=de;exports.FIELD_LAYOUT_DEFAULTS=j;exports.Field=S;exports.FieldLayout=E;exports.MappedControl=oe;exports.ObjectController=N;exports.RequiredSymbol=q;exports.connectCommonAttributes=A;exports.connectNumberInput=ue;exports.connectStringInput=he;exports.convertStandardSchemaIssues=Y;exports.convertStandardSchemaPathToPath=R;exports.makeMapValidation=D;exports.makeOnBlurHandler=L;exports.makeOnChangeHandler=F;exports.parsePath=ce;exports.pathToString=z;exports.standardSchemaResultToValidation=O;exports.taskToValidation=pe;exports.useController=K;exports.useForm=me;exports.wrapSegment=$;