@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,68 @@
|
|
|
1
|
+
import { type TNode, Value, type Merge } from '@tempots/dom';
|
|
2
|
+
import { CommonInputOptions } from './input-options';
|
|
3
|
+
import type { PlainDate, PlainDateTime } from '../../../temporal/types';
|
|
4
|
+
import { ThemeColorName } from '../../../tokens';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the {@link NullableDateTimeSelect} component.
|
|
7
|
+
*/
|
|
8
|
+
export type NullableDateTimeSelectOptions = Merge<CommonInputOptions, {
|
|
9
|
+
/** The selected date-time, or null when unset. */
|
|
10
|
+
value: Value<PlainDateTime | null>;
|
|
11
|
+
/** Callback invoked when the date-time changes (receives null when cleared). */
|
|
12
|
+
onChange?: (dateTime: PlainDateTime | null) => void;
|
|
13
|
+
/** Callback invoked on blur. */
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
/** Predicate returning true if a date should be disabled. */
|
|
16
|
+
isDateDisabled?: (date: PlainDate) => boolean;
|
|
17
|
+
/** Theme color. @default 'primary' */
|
|
18
|
+
color?: Value<ThemeColorName>;
|
|
19
|
+
/** The day the week starts on (0=Sun, 1=Mon). @default 0 */
|
|
20
|
+
weekStartsOn?: Value<number>;
|
|
21
|
+
/** Whether to show seconds in the time picker. @default false */
|
|
22
|
+
showSeconds?: Value<boolean>;
|
|
23
|
+
/** Whether to use 12-hour format. When omitted, auto-detected from locale. */
|
|
24
|
+
use12Hour?: Value<boolean>;
|
|
25
|
+
/** Step for minutes column. @default 1 */
|
|
26
|
+
minuteStep?: Value<number>;
|
|
27
|
+
/** Step for seconds column. @default 1 */
|
|
28
|
+
secondStep?: Value<number>;
|
|
29
|
+
/** Whether to show a "Now" button in the time picker. @default false */
|
|
30
|
+
showNow?: Value<boolean>;
|
|
31
|
+
/** Format a PlainDateTime for display. When omitted, uses locale-aware 12/24-hour format. */
|
|
32
|
+
formatDateTime?: (dt: PlainDateTime) => string;
|
|
33
|
+
/** Placeholder shown when no date-time is selected. @default i18n dateTimeSelectDateTime */
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/** Content to render before the display text. */
|
|
36
|
+
before?: TNode;
|
|
37
|
+
/** Content to render after the display text. */
|
|
38
|
+
after?: TNode;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* A dropdown date-time selector where the value may be null.
|
|
42
|
+
*
|
|
43
|
+
* Displays the selected date-time in a styled trigger button, or a placeholder
|
|
44
|
+
* when nothing is selected. A reset (clear) button is shown when a date-time
|
|
45
|
+
* is set, allowing the user to clear back to null.
|
|
46
|
+
*
|
|
47
|
+
* When no custom `formatDateTime` is provided, the time portion adapts to the
|
|
48
|
+
* locale's 12/24-hour convention (or the explicit `use12Hour` prop).
|
|
49
|
+
*
|
|
50
|
+
* Use {@link DateTimeSelect} when a date-time is always required.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Configuration for the nullable date-time selector
|
|
53
|
+
* @returns A nullable date-time selector element
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { prop } from '@tempots/dom'
|
|
58
|
+
* import { NullableDateTimeSelect } from '@tempots/beatui'
|
|
59
|
+
*
|
|
60
|
+
* const dt = prop<PlainDateTime | null>(null)
|
|
61
|
+
* NullableDateTimeSelect({
|
|
62
|
+
* value: dt,
|
|
63
|
+
* onChange: v => dt.set(v),
|
|
64
|
+
* placeholder: 'Select date and time',
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function NullableDateTimeSelect(options: NullableDateTimeSelectOptions): TNode;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 NullableTimeSelect} component.
|
|
7
|
+
*/
|
|
8
|
+
export type NullableTimeSelectOptions = Merge<CommonInputOptions, {
|
|
9
|
+
/** The selected time, or null when unset. */
|
|
10
|
+
value: Value<PlainTime | null>;
|
|
11
|
+
/** Callback invoked when the time changes (receives null when cleared). */
|
|
12
|
+
onChange?: (time: PlainTime | null) => 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
|
+
/** Placeholder shown when no time is selected. @default i18n timeSelectTime */
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/** Content to render before the display text. */
|
|
32
|
+
before?: TNode;
|
|
33
|
+
/** Content to render after the display text. */
|
|
34
|
+
after?: TNode;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* A dropdown time selector where the value may be null.
|
|
38
|
+
*
|
|
39
|
+
* Displays the selected time in a styled trigger button, or a placeholder when
|
|
40
|
+
* no time is selected. A reset (clear) button is shown in the trigger when a
|
|
41
|
+
* time is set, allowing the user to clear back to null.
|
|
42
|
+
*
|
|
43
|
+
* When no custom `formatTime` is provided, the display adapts to the
|
|
44
|
+
* locale's 12/24-hour convention (or the explicit `use12Hour` prop).
|
|
45
|
+
*
|
|
46
|
+
* Use {@link TimeSelect} when a time is always required.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Configuration for the nullable time selector
|
|
49
|
+
* @returns A nullable time selector element
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { prop } from '@tempots/dom'
|
|
54
|
+
* import { NullableTimeSelect } from '@tempots/beatui'
|
|
55
|
+
*
|
|
56
|
+
* const time = prop<PlainTime | null>(null)
|
|
57
|
+
* NullableTimeSelect({
|
|
58
|
+
* value: time,
|
|
59
|
+
* onChange: v => time.set(v),
|
|
60
|
+
* placeholder: 'Select a time',
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function NullableTimeSelect(options: NullableTimeSelectOptions): TNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Value } from '@tempots/dom';
|
|
1
|
+
import { Value, TNode } from '@tempots/dom';
|
|
2
2
|
import { InputOptions } from './input-options';
|
|
3
3
|
import { Merge } from '@tempots/std';
|
|
4
4
|
/**
|
|
@@ -15,44 +15,9 @@ export type NumberInputOptions = Merge<InputOptions<number>, {
|
|
|
15
15
|
min?: Value<number>;
|
|
16
16
|
/** Maximum allowed value. Disables increment when reached. @default 10 */
|
|
17
17
|
max?: Value<number>;
|
|
18
|
+
/** Unit of measurement label displayed after the input (e.g., "kg", "px", "%"). Rendered before stepper buttons. */
|
|
19
|
+
unit?: TNode;
|
|
20
|
+
/** When true, displays the value formatted with locale-aware grouping and decimals (derived from step) when the input is not focused. @default false */
|
|
21
|
+
formatted?: Value<boolean>;
|
|
18
22
|
}>;
|
|
19
|
-
/**
|
|
20
|
-
* A numeric input component wrapping a native `<input type="number">` with optional stepper buttons.
|
|
21
|
-
*
|
|
22
|
-
* Renders a styled number field inside an {@link InputContainer} with support for
|
|
23
|
-
* reactive values, min/max constraints, and an optional step increment. When `step`
|
|
24
|
-
* is provided, increment/decrement buttons appear alongside the input, and mouse
|
|
25
|
-
* wheel scrolling adjusts the value. Holding Shift while clicking steppers or
|
|
26
|
-
* scrolling applies a 10x multiplier to the step value.
|
|
27
|
-
*
|
|
28
|
-
* @param options - Configuration options for the number input
|
|
29
|
-
* @returns A styled number input element with optional stepper buttons, wrapped in an InputContainer
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { prop } from '@tempots/dom'
|
|
34
|
-
* import { NumberInput } from '@tempots/beatui'
|
|
35
|
-
*
|
|
36
|
-
* const quantity = prop(1)
|
|
37
|
-
* NumberInput({
|
|
38
|
-
* value: quantity,
|
|
39
|
-
* onChange: quantity.set,
|
|
40
|
-
* min: 0,
|
|
41
|
-
* max: 100,
|
|
42
|
-
* step: 1,
|
|
43
|
-
* placeholder: 'Quantity',
|
|
44
|
-
* })
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* // Without stepper buttons (no step provided)
|
|
50
|
-
* NumberInput({
|
|
51
|
-
* value: prop(0),
|
|
52
|
-
* onChange: (v) => console.log('Value:', v),
|
|
53
|
-
* min: -10,
|
|
54
|
-
* max: 10,
|
|
55
|
-
* })
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
23
|
export declare const NumberInput: (options: NumberInputOptions) => import("@tempots/dom").Renderable;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { ControlSize } from '../../theme';
|
|
3
|
+
import { ThemeColorName } from '../../../tokens';
|
|
4
|
+
/** Orientation of the stepper layout. */
|
|
5
|
+
export type NumberStepperOrientation = 'horizontal' | 'vertical';
|
|
6
|
+
/** Configuration options for the {@link NumberStepper} component. */
|
|
7
|
+
export interface NumberStepperOptions {
|
|
8
|
+
/** The current numeric value. @default 1*/
|
|
9
|
+
value: Value<number>;
|
|
10
|
+
/** Callback invoked when the value changes. */
|
|
11
|
+
onChange: (value: number) => void;
|
|
12
|
+
/** Minimum allowed value. @default 0 */
|
|
13
|
+
min?: Value<number>;
|
|
14
|
+
/** Maximum allowed value. @default 100 */
|
|
15
|
+
max?: Value<number>;
|
|
16
|
+
/** Increment/decrement step. @default 1 */
|
|
17
|
+
step?: Value<number>;
|
|
18
|
+
/** Size of the stepper. @default 'md' */
|
|
19
|
+
size?: Value<ControlSize>;
|
|
20
|
+
/** Theme color. @default 'base' */
|
|
21
|
+
color?: Value<ThemeColorName>;
|
|
22
|
+
/** Whether the stepper is disabled. @default false */
|
|
23
|
+
disabled?: Value<boolean>;
|
|
24
|
+
/** Layout orientation. @default 'horizontal' */
|
|
25
|
+
orientation?: Value<NumberStepperOrientation>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A quantity selector with compact +/- buttons and a displayed value.
|
|
29
|
+
*
|
|
30
|
+
* Unlike {@link NumberInput}, this component does not include a text field —
|
|
31
|
+
* it shows the current value between decrement and increment buttons. Ideal
|
|
32
|
+
* for cart quantities, counters, and other discrete value adjustments.
|
|
33
|
+
*
|
|
34
|
+
* Supports both horizontal (default) and vertical orientation.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Configuration for the number stepper
|
|
37
|
+
* @returns A number stepper element
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { prop } from '@tempots/dom'
|
|
42
|
+
* import { NumberStepper } from '@tempots/beatui'
|
|
43
|
+
*
|
|
44
|
+
* const qty = prop(1)
|
|
45
|
+
* NumberStepper({
|
|
46
|
+
* value: qty,
|
|
47
|
+
* onChange: v => qty.set(v),
|
|
48
|
+
* min: 0,
|
|
49
|
+
* max: 99,
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function NumberStepper(options: NumberStepperOptions): TNode;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type TNode, Value, type Merge } from '@tempots/dom';
|
|
2
|
+
import { CommonInputOptions } from './input-options';
|
|
3
|
+
import type { PlainDate } from '../../../temporal/types';
|
|
4
|
+
import { ThemeColorName } from '../../../tokens';
|
|
5
|
+
/**
|
|
6
|
+
* An open date range where either or both dates may be null/undefined.
|
|
7
|
+
*/
|
|
8
|
+
export type OpenDateRange = [
|
|
9
|
+
PlainDate | null | undefined,
|
|
10
|
+
PlainDate | null | undefined
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for the {@link OpenDateRangeSelect} component.
|
|
14
|
+
*
|
|
15
|
+
* Either or both dates can be null/undefined, allowing open-ended ranges
|
|
16
|
+
* like "from X onwards" or "up to Y".
|
|
17
|
+
*/
|
|
18
|
+
export type OpenDateRangeSelectOptions = Merge<CommonInputOptions, {
|
|
19
|
+
/** The selected date range as `[start, end]`. Either value may be null/undefined. */
|
|
20
|
+
value: Value<OpenDateRange>;
|
|
21
|
+
/** Callback invoked when the range changes. */
|
|
22
|
+
onChange?: (range: OpenDateRange) => void;
|
|
23
|
+
/** Callback invoked on blur. */
|
|
24
|
+
onBlur?: () => void;
|
|
25
|
+
/** Predicate returning true if a date should be disabled. */
|
|
26
|
+
isDateDisabled?: (date: PlainDate) => boolean;
|
|
27
|
+
/** Theme color. @default 'primary' */
|
|
28
|
+
color?: Value<ThemeColorName>;
|
|
29
|
+
/** The day the week starts on (0=Sun, 1=Mon). @default 0 */
|
|
30
|
+
weekStartsOn?: Value<number>;
|
|
31
|
+
/** Format a PlainDate for display. Defaults to ISO string. */
|
|
32
|
+
formatDate?: (date: PlainDate) => string;
|
|
33
|
+
/** Label for the start picker. @default i18n dateRangeStart */
|
|
34
|
+
startLabel?: string;
|
|
35
|
+
/** Label for the end picker. @default i18n dateRangeEnd */
|
|
36
|
+
endLabel?: string;
|
|
37
|
+
/** Placeholder when no date is selected. @default i18n dateRangeNoLimit */
|
|
38
|
+
emptyPlaceholder?: string;
|
|
39
|
+
/** Content to render before the display text. */
|
|
40
|
+
before?: TNode;
|
|
41
|
+
/** Content to render after the display text. */
|
|
42
|
+
after?: TNode;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* A date range selector that allows open-ended ranges.
|
|
46
|
+
*
|
|
47
|
+
* Displays the selected range in a styled trigger button. Clicking opens a
|
|
48
|
+
* flyout panel with two side-by-side {@link DatePicker} components for
|
|
49
|
+
* selecting start and end dates independently. Either or both dates can be
|
|
50
|
+
* null/undefined, enabling "from X onwards" or "up to Y" ranges.
|
|
51
|
+
*
|
|
52
|
+
* Use {@link DateRangeSelect} when both dates are always required.
|
|
53
|
+
*
|
|
54
|
+
* @param options - Configuration for the open date range selector
|
|
55
|
+
* @returns An open date range selector element
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { prop } from '@tempots/dom'
|
|
60
|
+
* import { OpenDateRangeSelect } from '@tempots/beatui'
|
|
61
|
+
* import { Temporal } from '@js-temporal/polyfill'
|
|
62
|
+
*
|
|
63
|
+
* // Open-ended range: from a date onwards
|
|
64
|
+
* const range = prop<OpenDateRange>([
|
|
65
|
+
* Temporal.PlainDate.from('2026-01-01'),
|
|
66
|
+
* null,
|
|
67
|
+
* ])
|
|
68
|
+
* OpenDateRangeSelect({
|
|
69
|
+
* value: range,
|
|
70
|
+
* onChange: v => range.set(v),
|
|
71
|
+
* emptyPlaceholder: 'No limit',
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function OpenDateRangeSelect(options: OpenDateRangeSelectOptions): TNode;
|
|
@@ -55,7 +55,7 @@ export interface OtpInputOptions {
|
|
|
55
55
|
* const code = prop('')
|
|
56
56
|
* OtpInput({
|
|
57
57
|
* value: code,
|
|
58
|
-
* onChange: code.set,
|
|
58
|
+
* onChange: v => code.set(v),
|
|
59
59
|
* onComplete: (v) => console.log('Code entered:', v),
|
|
60
60
|
* length: 6,
|
|
61
61
|
* })
|
|
@@ -74,4 +74,4 @@ export interface OtpInputOptions {
|
|
|
74
74
|
* })
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
export declare function OtpInput({ length, value, onChange, onComplete, disabled, mask, type, size, color, placeholder, autoFocus, }?: OtpInputOptions): import("@tempots/dom").
|
|
77
|
+
export declare function OtpInput({ length, value, onChange, onComplete, disabled, mask, type, size, color, placeholder, autoFocus, }?: OtpInputOptions): 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
|
|
@@ -129,7 +146,7 @@ export interface RangeSliderOptions {
|
|
|
129
146
|
* // Simple single-value slider
|
|
130
147
|
* const vol = prop(50)
|
|
131
148
|
* RangeSlider({
|
|
132
|
-
* value: vol, onChange: vol.set,
|
|
149
|
+
* value: vol, onChange: v => vol.set(v),
|
|
133
150
|
* min: 0, max: 100,
|
|
134
151
|
* showValue: true,
|
|
135
152
|
* })
|
|
@@ -140,7 +157,7 @@ export interface RangeSliderOptions {
|
|
|
140
157
|
* // Dual-thumb range selector
|
|
141
158
|
* const priceRange = prop<[number, number]>([20, 80])
|
|
142
159
|
* RangeSlider({
|
|
143
|
-
* range: priceRange, onRangeChange: priceRange.set,
|
|
160
|
+
* range: priceRange, onRangeChange: v => priceRange.set(v),
|
|
144
161
|
* min: 0, max: 100,
|
|
145
162
|
* showValue: true,
|
|
146
163
|
* formatValue: v => `$${v}`,
|
|
@@ -152,7 +169,7 @@ export interface RangeSliderOptions {
|
|
|
152
169
|
* // Multi-point slider
|
|
153
170
|
* const pts = prop([10, 40, 70])
|
|
154
171
|
* RangeSlider({
|
|
155
|
-
* points: pts, onPointsChange: pts.set,
|
|
172
|
+
* points: pts, onPointsChange: v => pts.set(v),
|
|
156
173
|
* min: 0, max: 100,
|
|
157
174
|
* showValue: true,
|
|
158
175
|
* })
|
|
@@ -165,11 +182,11 @@ export interface RangeSliderOptions {
|
|
|
165
182
|
* html.div(
|
|
166
183
|
* attr.style('height: 200px'),
|
|
167
184
|
* RangeSlider({
|
|
168
|
-
* value: vol, onChange: vol.set,
|
|
185
|
+
* value: vol, onChange: v => vol.set(v),
|
|
169
186
|
* min: 0, max: 100,
|
|
170
187
|
* orientation: 'vertical',
|
|
171
188
|
* })
|
|
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;
|
|
@@ -29,6 +29,10 @@ export interface SegmentedInputOptions<T extends Record<string, TNode>, K extend
|
|
|
29
29
|
* When not set, uses the default white indicator with primary-tinted active text.
|
|
30
30
|
*/
|
|
31
31
|
color?: Value<ThemeColorName>;
|
|
32
|
+
/**
|
|
33
|
+
* Subset of keys to display. If not provided, all keys are displayed.
|
|
34
|
+
*/
|
|
35
|
+
subset?: Value<K[]>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* A segmented control input that allows selecting one of several mutually exclusive options.
|
|
@@ -58,7 +62,7 @@ export interface SegmentedInputOptions<T extends Record<string, TNode>, K extend
|
|
|
58
62
|
* table: 'Table',
|
|
59
63
|
* },
|
|
60
64
|
* value: view,
|
|
61
|
-
* onChange: view.set,
|
|
65
|
+
* onChange: v => view.set(v),
|
|
62
66
|
* size: 'md',
|
|
63
67
|
* })
|
|
64
68
|
* ```
|
|
@@ -76,4 +80,4 @@ export interface SegmentedInputOptions<T extends Record<string, TNode>, K extend
|
|
|
76
80
|
* })
|
|
77
81
|
* ```
|
|
78
82
|
*/
|
|
79
|
-
export declare function SegmentedInput<T extends Record<string, TNode>>({ options, value, onChange, size, disabled, variant, color, }: SegmentedInputOptions<T, keyof T>, ...children: TNode[]): import("@tempots/dom").Renderable;
|
|
83
|
+
export declare function SegmentedInput<T extends Record<string, TNode>>({ options, value, onChange, size, disabled, variant, color, subset, }: SegmentedInputOptions<T, keyof T>, ...children: TNode[]): import("@tempots/dom").Renderable;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { ControlSize } from '../../theme';
|
|
3
|
+
import { ThemeColorName } from '../../../tokens';
|
|
4
|
+
import { SelectOption } from './option';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the {@link SegmentedSelect} component.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the selectable option values
|
|
9
|
+
*/
|
|
10
|
+
export interface SegmentedSelectOptions<T> {
|
|
11
|
+
/** The list of selectable options. Groups are flattened and breaks are ignored. */
|
|
12
|
+
options: Value<SelectOption<T>[]>;
|
|
13
|
+
/** The currently selected value */
|
|
14
|
+
value: Value<T>;
|
|
15
|
+
/** Callback invoked when a different option is selected */
|
|
16
|
+
onChange?: (value: T) => void;
|
|
17
|
+
/** Custom equality function for comparing option values. @default strict equality (===) */
|
|
18
|
+
equality?: (a: T, b: T) => boolean;
|
|
19
|
+
/** Visual size of the segmented control. @default 'md' */
|
|
20
|
+
size?: Value<ControlSize>;
|
|
21
|
+
/** Whether the segmented control is disabled. @default false */
|
|
22
|
+
disabled?: Value<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Shape variant. `'pill'` uses fully rounded corners, `'squared'` uses control-like
|
|
25
|
+
* border-radius and taller padding to match the height of regular inputs like TextInput.
|
|
26
|
+
* @default 'squared'
|
|
27
|
+
*/
|
|
28
|
+
variant?: Value<'pill' | 'squared'>;
|
|
29
|
+
/**
|
|
30
|
+
* Theme color for the active segment indicator and text, using solid button-style coloring.
|
|
31
|
+
* When not set, uses the default white indicator with primary-tinted active text.
|
|
32
|
+
*/
|
|
33
|
+
color?: Value<ThemeColorName>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A segmented control that allows selecting one value from a list of typed options.
|
|
37
|
+
*
|
|
38
|
+
* Renders a horizontal row of clickable segments with a sliding indicator, similar to
|
|
39
|
+
* {@link SegmentedInput}, but accepts {@link SelectOption} arrays with typed values
|
|
40
|
+
* instead of a static key-label record. This makes it suitable for use with the same
|
|
41
|
+
* option data used by {@link NativeSelect} or {@link DropdownInput}.
|
|
42
|
+
*
|
|
43
|
+
* Groups are flattened and breaks are ignored since segments are rendered as a flat row.
|
|
44
|
+
* Disabled individual options are respected.
|
|
45
|
+
*
|
|
46
|
+
* @template T - The type of the selectable option values
|
|
47
|
+
* @param options - Configuration options for the segmented select
|
|
48
|
+
* @param children - Additional child nodes to render after the control
|
|
49
|
+
* @returns A styled segmented control element with animated indicator
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { prop } from '@tempots/dom'
|
|
54
|
+
* import { SegmentedSelect, Option } from '@tempots/beatui'
|
|
55
|
+
*
|
|
56
|
+
* const selected = prop('list')
|
|
57
|
+
* SegmentedSelect({
|
|
58
|
+
* options: [
|
|
59
|
+
* Option.value('list', 'List'),
|
|
60
|
+
* Option.value('grid', 'Grid'),
|
|
61
|
+
* Option.value('table', 'Table'),
|
|
62
|
+
* ],
|
|
63
|
+
* value: selected,
|
|
64
|
+
* onChange: v => selected.set(v),
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // With typed enum values
|
|
71
|
+
* type Status = 'active' | 'inactive' | 'archived'
|
|
72
|
+
* const status = prop<Status>('active')
|
|
73
|
+
* SegmentedSelect<Status>({
|
|
74
|
+
* options: [
|
|
75
|
+
* Option.value('active', 'Active'),
|
|
76
|
+
* Option.value('inactive', 'Inactive'),
|
|
77
|
+
* Option.value('archived', 'Archived', { disabled: true }),
|
|
78
|
+
* ],
|
|
79
|
+
* value: status,
|
|
80
|
+
* onChange: v => status.set(v),
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function SegmentedSelect<T>({ options, value, onChange, equality, size, disabled, variant, color, }: SegmentedSelectOptions<T>, ...children: TNode[]): 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>;
|
|
@@ -42,7 +42,7 @@ export type SliderInputOptions = Merge<InputOptions<number>, {
|
|
|
42
42
|
* const volume = prop(50)
|
|
43
43
|
* SliderInput({
|
|
44
44
|
* value: volume,
|
|
45
|
-
* onChange: volume.set,
|
|
45
|
+
* onChange: v => volume.set(v),
|
|
46
46
|
* min: 0,
|
|
47
47
|
* max: 100,
|
|
48
48
|
* step: 1,
|
|
@@ -105,7 +105,7 @@ export type NullableSliderInputOptions = Merge<InputOptions<number | null>, {
|
|
|
105
105
|
* const brightness = prop<number | null>(null)
|
|
106
106
|
* NullableSliderInput({
|
|
107
107
|
* value: brightness,
|
|
108
|
-
* onChange: brightness.set,
|
|
108
|
+
* onChange: v => brightness.set(v),
|
|
109
109
|
* min: 0,
|
|
110
110
|
* max: 100,
|
|
111
111
|
* step: 5,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TNode, Value } from '@tempots/dom';
|
|
2
|
+
import { ControlSize } from '../../theme';
|
|
3
|
+
/** Visual variant for the sortable list items. */
|
|
4
|
+
export type SortableListVariant = 'bordered' | 'card' | 'plain';
|
|
5
|
+
/** Configuration options for the {@link SortableList} component. */
|
|
6
|
+
export interface SortableListOptions<T> {
|
|
7
|
+
/** The ordered list of items. */
|
|
8
|
+
items: Value<T[]>;
|
|
9
|
+
/** Callback invoked with the reordered list after a drag-and-drop or keyboard reorder. */
|
|
10
|
+
onChange: (items: T[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Render function for each item. The `handle` TNode is a drag grip
|
|
13
|
+
* that should be placed inside the returned element to serve as the
|
|
14
|
+
* drag handle. Only the handle initiates drag — the rest of the item
|
|
15
|
+
* content remains interactive.
|
|
16
|
+
*/
|
|
17
|
+
renderItem: (item: T, handle: TNode) => TNode;
|
|
18
|
+
/** Extract a unique key from an item (used for identity). */
|
|
19
|
+
keyOf: (item: T) => string;
|
|
20
|
+
/** Whether drag-and-drop is disabled. @default false */
|
|
21
|
+
disabled?: Value<boolean>;
|
|
22
|
+
/** Size variant. @default 'md' */
|
|
23
|
+
size?: Value<ControlSize>;
|
|
24
|
+
/** Additional CSS class(es) applied to the list container. */
|
|
25
|
+
class?: Value<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Visual variant for items.
|
|
28
|
+
* - `'bordered'` — border around each item (default)
|
|
29
|
+
* - `'card'` — elevated card with shadow, no border
|
|
30
|
+
* - `'plain'` — no border, no background — items blend into the page
|
|
31
|
+
* @default 'bordered'
|
|
32
|
+
*/
|
|
33
|
+
variant?: Value<SortableListVariant>;
|
|
34
|
+
/** Gap between items. Mapped to CSS spacing tokens. @default 'md' */
|
|
35
|
+
gap?: Value<ControlSize>;
|
|
36
|
+
/**
|
|
37
|
+
* Iconify icon identifier for the drag handle.
|
|
38
|
+
* @default 'lucide:grip-vertical'
|
|
39
|
+
*/
|
|
40
|
+
handleIcon?: Value<string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A drag-and-drop reorderable list.
|
|
44
|
+
*
|
|
45
|
+
* Each item receives a drag handle TNode that the consumer places inside
|
|
46
|
+
* their render function. Dragging initiates only from the handle. Items
|
|
47
|
+
* can also be reordered via keyboard using Alt+ArrowUp / Alt+ArrowDown.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam T - The item type
|
|
50
|
+
* @param options - Configuration for the sortable list
|
|
51
|
+
* @returns A sortable list element
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { prop } from '@tempots/dom'
|
|
56
|
+
* import { SortableList } from '@tempots/beatui'
|
|
57
|
+
*
|
|
58
|
+
* const items = prop(['Apple', 'Banana', 'Cherry'])
|
|
59
|
+
* SortableList({
|
|
60
|
+
* items,
|
|
61
|
+
* onChange: v => items.set(v),
|
|
62
|
+
* renderItem: (item, handle) =>
|
|
63
|
+
* html.div(attr.class('flex items-center gap-2'), handle, item),
|
|
64
|
+
* keyOf: item => item,
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function SortableList<T>(options: SortableListOptions<T>): TNode;
|