@llui/components 0.0.1

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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +143 -0
  3. package/dist/components/accordion.d.ts +115 -0
  4. package/dist/components/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion.js +138 -0
  6. package/dist/components/alert-dialog.d.ts +45 -0
  7. package/dist/components/alert-dialog.d.ts.map +1 -0
  8. package/dist/components/alert-dialog.js +12 -0
  9. package/dist/components/angle-slider.d.ts +121 -0
  10. package/dist/components/angle-slider.d.ts.map +1 -0
  11. package/dist/components/angle-slider.js +145 -0
  12. package/dist/components/async-list.d.ts +104 -0
  13. package/dist/components/async-list.d.ts.map +1 -0
  14. package/dist/components/async-list.js +117 -0
  15. package/dist/components/avatar.d.ts +58 -0
  16. package/dist/components/avatar.d.ts.map +1 -0
  17. package/dist/components/avatar.js +43 -0
  18. package/dist/components/carousel.d.ts +128 -0
  19. package/dist/components/carousel.d.ts.map +1 -0
  20. package/dist/components/carousel.js +131 -0
  21. package/dist/components/cascade-select.d.ts +95 -0
  22. package/dist/components/cascade-select.d.ts.map +1 -0
  23. package/dist/components/cascade-select.js +100 -0
  24. package/dist/components/checkbox.d.ts +74 -0
  25. package/dist/components/checkbox.d.ts.map +1 -0
  26. package/dist/components/checkbox.js +73 -0
  27. package/dist/components/clipboard.d.ts +72 -0
  28. package/dist/components/clipboard.d.ts.map +1 -0
  29. package/dist/components/clipboard.js +73 -0
  30. package/dist/components/collapsible.d.ts +64 -0
  31. package/dist/components/collapsible.d.ts.map +1 -0
  32. package/dist/components/collapsible.js +51 -0
  33. package/dist/components/color-picker.d.ts +125 -0
  34. package/dist/components/color-picker.d.ts.map +1 -0
  35. package/dist/components/color-picker.js +169 -0
  36. package/dist/components/combobox.d.ts +163 -0
  37. package/dist/components/combobox.d.ts.map +1 -0
  38. package/dist/components/combobox.js +345 -0
  39. package/dist/components/context-menu.d.ts +105 -0
  40. package/dist/components/context-menu.d.ts.map +1 -0
  41. package/dist/components/context-menu.js +177 -0
  42. package/dist/components/date-input.d.ts +117 -0
  43. package/dist/components/date-input.d.ts.map +1 -0
  44. package/dist/components/date-input.js +149 -0
  45. package/dist/components/date-picker.d.ts +142 -0
  46. package/dist/components/date-picker.d.ts.map +1 -0
  47. package/dist/components/date-picker.js +294 -0
  48. package/dist/components/dialog.d.ts +152 -0
  49. package/dist/components/dialog.d.ts.map +1 -0
  50. package/dist/components/dialog.js +140 -0
  51. package/dist/components/drawer.d.ts +106 -0
  52. package/dist/components/drawer.d.ts.map +1 -0
  53. package/dist/components/drawer.js +136 -0
  54. package/dist/components/editable.d.ts +92 -0
  55. package/dist/components/editable.d.ts.map +1 -0
  56. package/dist/components/editable.js +112 -0
  57. package/dist/components/file-upload.d.ts +251 -0
  58. package/dist/components/file-upload.d.ts.map +1 -0
  59. package/dist/components/file-upload.js +324 -0
  60. package/dist/components/floating-panel.d.ts +171 -0
  61. package/dist/components/floating-panel.d.ts.map +1 -0
  62. package/dist/components/floating-panel.js +198 -0
  63. package/dist/components/hover-card.d.ts +85 -0
  64. package/dist/components/hover-card.d.ts.map +1 -0
  65. package/dist/components/hover-card.js +128 -0
  66. package/dist/components/image-cropper.d.ts +129 -0
  67. package/dist/components/image-cropper.d.ts.map +1 -0
  68. package/dist/components/image-cropper.js +208 -0
  69. package/dist/components/index.d.ts +109 -0
  70. package/dist/components/index.d.ts.map +1 -0
  71. package/dist/components/index.js +54 -0
  72. package/dist/components/listbox.d.ts +98 -0
  73. package/dist/components/listbox.d.ts.map +1 -0
  74. package/dist/components/listbox.js +174 -0
  75. package/dist/components/marquee.d.ts +84 -0
  76. package/dist/components/marquee.d.ts.map +1 -0
  77. package/dist/components/marquee.js +73 -0
  78. package/dist/components/menu.d.ts +131 -0
  79. package/dist/components/menu.d.ts.map +1 -0
  80. package/dist/components/menu.js +262 -0
  81. package/dist/components/navigation-menu.d.ts +111 -0
  82. package/dist/components/navigation-menu.d.ts.map +1 -0
  83. package/dist/components/navigation-menu.js +102 -0
  84. package/dist/components/number-input.d.ts +106 -0
  85. package/dist/components/number-input.d.ts.map +1 -0
  86. package/dist/components/number-input.js +178 -0
  87. package/dist/components/pagination.d.ts +113 -0
  88. package/dist/components/pagination.d.ts.map +1 -0
  89. package/dist/components/pagination.js +135 -0
  90. package/dist/components/password-input.d.ts +64 -0
  91. package/dist/components/password-input.d.ts.map +1 -0
  92. package/dist/components/password-input.js +52 -0
  93. package/dist/components/pin-input.d.ts +89 -0
  94. package/dist/components/pin-input.d.ts.map +1 -0
  95. package/dist/components/pin-input.js +139 -0
  96. package/dist/components/popover.d.ts +116 -0
  97. package/dist/components/popover.d.ts.map +1 -0
  98. package/dist/components/popover.js +146 -0
  99. package/dist/components/presence.d.ts +71 -0
  100. package/dist/components/presence.d.ts.map +1 -0
  101. package/dist/components/presence.js +57 -0
  102. package/dist/components/progress.d.ts +74 -0
  103. package/dist/components/progress.d.ts.map +1 -0
  104. package/dist/components/progress.js +80 -0
  105. package/dist/components/qr-code.d.ts +114 -0
  106. package/dist/components/qr-code.d.ts.map +1 -0
  107. package/dist/components/qr-code.js +108 -0
  108. package/dist/components/radio-group.d.ts +89 -0
  109. package/dist/components/radio-group.d.ts.map +1 -0
  110. package/dist/components/radio-group.js +161 -0
  111. package/dist/components/rating-group.d.ts +88 -0
  112. package/dist/components/rating-group.d.ts.map +1 -0
  113. package/dist/components/rating-group.js +122 -0
  114. package/dist/components/scroll-area.d.ts +124 -0
  115. package/dist/components/scroll-area.d.ts.map +1 -0
  116. package/dist/components/scroll-area.js +152 -0
  117. package/dist/components/select.d.ts +161 -0
  118. package/dist/components/select.d.ts.map +1 -0
  119. package/dist/components/select.js +333 -0
  120. package/dist/components/signature-pad.d.ts +138 -0
  121. package/dist/components/signature-pad.d.ts.map +1 -0
  122. package/dist/components/signature-pad.js +142 -0
  123. package/dist/components/slider.d.ts +117 -0
  124. package/dist/components/slider.d.ts.map +1 -0
  125. package/dist/components/slider.js +210 -0
  126. package/dist/components/splitter.d.ts +87 -0
  127. package/dist/components/splitter.d.ts.map +1 -0
  128. package/dist/components/splitter.js +119 -0
  129. package/dist/components/steps.d.ts +104 -0
  130. package/dist/components/steps.d.ts.map +1 -0
  131. package/dist/components/steps.js +133 -0
  132. package/dist/components/switch.d.ts +66 -0
  133. package/dist/components/switch.d.ts.map +1 -0
  134. package/dist/components/switch.js +59 -0
  135. package/dist/components/tabs.d.ts +146 -0
  136. package/dist/components/tabs.d.ts.map +1 -0
  137. package/dist/components/tabs.js +244 -0
  138. package/dist/components/tags-input.d.ts +118 -0
  139. package/dist/components/tags-input.d.ts.map +1 -0
  140. package/dist/components/tags-input.js +168 -0
  141. package/dist/components/time-picker.d.ts +121 -0
  142. package/dist/components/time-picker.d.ts.map +1 -0
  143. package/dist/components/time-picker.js +147 -0
  144. package/dist/components/timer.d.ts +131 -0
  145. package/dist/components/timer.d.ts.map +1 -0
  146. package/dist/components/timer.js +117 -0
  147. package/dist/components/toast.d.ts +119 -0
  148. package/dist/components/toast.d.ts.map +1 -0
  149. package/dist/components/toast.js +102 -0
  150. package/dist/components/toc.d.ts +119 -0
  151. package/dist/components/toc.d.ts.map +1 -0
  152. package/dist/components/toc.js +107 -0
  153. package/dist/components/toggle-group.d.ts +80 -0
  154. package/dist/components/toggle-group.d.ts.map +1 -0
  155. package/dist/components/toggle-group.js +93 -0
  156. package/dist/components/toggle.d.ts +47 -0
  157. package/dist/components/toggle.d.ts.map +1 -0
  158. package/dist/components/toggle.js +41 -0
  159. package/dist/components/tooltip.d.ts +92 -0
  160. package/dist/components/tooltip.d.ts.map +1 -0
  161. package/dist/components/tooltip.js +147 -0
  162. package/dist/components/tour.d.ts +145 -0
  163. package/dist/components/tour.d.ts.map +1 -0
  164. package/dist/components/tour.js +133 -0
  165. package/dist/components/tree-view.d.ts +216 -0
  166. package/dist/components/tree-view.d.ts.map +1 -0
  167. package/dist/components/tree-view.js +293 -0
  168. package/dist/index.d.ts +3 -0
  169. package/dist/index.d.ts.map +1 -0
  170. package/dist/index.js +4 -0
  171. package/dist/patterns/confirm-dialog.d.ts +92 -0
  172. package/dist/patterns/confirm-dialog.d.ts.map +1 -0
  173. package/dist/patterns/confirm-dialog.js +92 -0
  174. package/dist/patterns/index.d.ts +3 -0
  175. package/dist/patterns/index.d.ts.map +1 -0
  176. package/dist/patterns/index.js +1 -0
  177. package/dist/utils/anatomy.d.ts +40 -0
  178. package/dist/utils/anatomy.d.ts.map +1 -0
  179. package/dist/utils/anatomy.js +41 -0
  180. package/dist/utils/aria-hidden.d.ts +12 -0
  181. package/dist/utils/aria-hidden.d.ts.map +1 -0
  182. package/dist/utils/aria-hidden.js +72 -0
  183. package/dist/utils/dismissable.d.ts +25 -0
  184. package/dist/utils/dismissable.d.ts.map +1 -0
  185. package/dist/utils/dismissable.js +65 -0
  186. package/dist/utils/dom.d.ts +8 -0
  187. package/dist/utils/dom.d.ts.map +1 -0
  188. package/dist/utils/dom.js +21 -0
  189. package/dist/utils/floating.d.ts +44 -0
  190. package/dist/utils/floating.d.ts.map +1 -0
  191. package/dist/utils/floating.js +44 -0
  192. package/dist/utils/focus-trap.d.ts +18 -0
  193. package/dist/utils/focus-trap.d.ts.map +1 -0
  194. package/dist/utils/focus-trap.js +85 -0
  195. package/dist/utils/focusables.d.ts +6 -0
  196. package/dist/utils/focusables.d.ts.map +1 -0
  197. package/dist/utils/focusables.js +65 -0
  198. package/dist/utils/index.d.ts +18 -0
  199. package/dist/utils/index.d.ts.map +1 -0
  200. package/dist/utils/index.js +10 -0
  201. package/dist/utils/interact-outside.d.ts +26 -0
  202. package/dist/utils/interact-outside.d.ts.map +1 -0
  203. package/dist/utils/interact-outside.js +46 -0
  204. package/dist/utils/remove-scroll.d.ts +8 -0
  205. package/dist/utils/remove-scroll.d.ts.map +1 -0
  206. package/dist/utils/remove-scroll.js +37 -0
  207. package/dist/utils/tree-collection.d.ts +61 -0
  208. package/dist/utils/tree-collection.d.ts.map +1 -0
  209. package/dist/utils/tree-collection.js +137 -0
  210. package/dist/utils/typeahead.d.ts +49 -0
  211. package/dist/utils/typeahead.d.ts.map +1 -0
  212. package/dist/utils/typeahead.js +81 -0
  213. package/package.json +282 -0
@@ -0,0 +1,118 @@
1
+ import type { Send } from '@llui/dom';
2
+ /**
3
+ * Tags input — text input that creates chips (tags) on commit keys
4
+ * (Enter, comma, blur). Backspace on empty input removes the last tag.
5
+ * Each tag is focusable via arrow keys.
6
+ */
7
+ export interface TagsInputState {
8
+ value: string[];
9
+ inputValue: string;
10
+ disabled: boolean;
11
+ /** Maximum tag count. 0 = unlimited. */
12
+ max: number;
13
+ /** Only allow unique values. */
14
+ unique: boolean;
15
+ /** Currently-focused tag index, or null. */
16
+ focusedIndex: number | null;
17
+ }
18
+ export type TagsInputMsg = {
19
+ type: 'setInput';
20
+ value: string;
21
+ } | {
22
+ type: 'addTag';
23
+ value?: string;
24
+ } | {
25
+ type: 'removeTag';
26
+ index: number;
27
+ } | {
28
+ type: 'removeLast';
29
+ } | {
30
+ type: 'setValue';
31
+ value: string[];
32
+ } | {
33
+ type: 'focusTag';
34
+ index: number | null;
35
+ } | {
36
+ type: 'focusTagNext';
37
+ } | {
38
+ type: 'focusTagPrev';
39
+ } | {
40
+ type: 'clearAll';
41
+ };
42
+ export interface TagsInputInit {
43
+ value?: string[];
44
+ inputValue?: string;
45
+ disabled?: boolean;
46
+ max?: number;
47
+ unique?: boolean;
48
+ }
49
+ export declare function init(opts?: TagsInputInit): TagsInputState;
50
+ export declare function update(state: TagsInputState, msg: TagsInputMsg): [TagsInputState, never[]];
51
+ export interface TagItemParts<S> {
52
+ root: {
53
+ role: 'button';
54
+ tabIndex: (s: S) => number;
55
+ 'data-scope': 'tags-input';
56
+ 'data-part': 'tag';
57
+ 'data-value': string;
58
+ 'data-index': string;
59
+ 'data-focused': (s: S) => '' | undefined;
60
+ onKeyDown: (e: KeyboardEvent) => void;
61
+ onFocus: (e: FocusEvent) => void;
62
+ };
63
+ remove: {
64
+ type: 'button';
65
+ 'aria-label': string;
66
+ tabIndex: -1;
67
+ 'data-scope': 'tags-input';
68
+ 'data-part': 'tag-remove';
69
+ onClick: (e: MouseEvent) => void;
70
+ };
71
+ }
72
+ export interface TagsInputParts<S> {
73
+ root: {
74
+ role: 'group';
75
+ 'aria-disabled': (s: S) => 'true' | undefined;
76
+ 'data-scope': 'tags-input';
77
+ 'data-part': 'root';
78
+ 'data-disabled': (s: S) => '' | undefined;
79
+ };
80
+ input: {
81
+ type: 'text';
82
+ autoComplete: 'off';
83
+ 'aria-label': string;
84
+ disabled: (s: S) => boolean;
85
+ value: (s: S) => string;
86
+ 'data-scope': 'tags-input';
87
+ 'data-part': 'input';
88
+ onInput: (e: Event) => void;
89
+ onKeyDown: (e: KeyboardEvent) => void;
90
+ onBlur: (e: FocusEvent) => void;
91
+ };
92
+ tag: (value: string, index: number) => TagItemParts<S>;
93
+ clearTrigger: {
94
+ type: 'button';
95
+ 'aria-label': string;
96
+ 'data-scope': 'tags-input';
97
+ 'data-part': 'clear-trigger';
98
+ onClick: (e: MouseEvent) => void;
99
+ };
100
+ }
101
+ export interface ConnectOptions {
102
+ inputLabel?: string;
103
+ removeLabel?: string;
104
+ clearLabel?: string;
105
+ /** Characters that commit the current input as a tag (default: [',']). */
106
+ delimiters?: string[];
107
+ /** Commit on blur (default: true). */
108
+ commitOnBlur?: boolean;
109
+ /** Validate a tag value before adding. Non-empty array blocks addTag. */
110
+ validate?: (value: string) => string[] | null;
111
+ }
112
+ export declare function connect<S>(get: (s: S) => TagsInputState, send: Send<TagsInputMsg>, opts?: ConnectOptions): TagsInputParts<S>;
113
+ export declare const tagsInput: {
114
+ init: typeof init;
115
+ update: typeof update;
116
+ connect: typeof connect;
117
+ };
118
+ //# sourceMappingURL=tags-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags-input.d.ts","sourceRoot":"","sources":["../../src/components/tags-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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M,SAAS;;;;CAA4B,CAAA"}
@@ -0,0 +1,168 @@
1
+ export function init(opts = {}) {
2
+ return {
3
+ value: opts.value ?? [],
4
+ inputValue: opts.inputValue ?? '',
5
+ disabled: opts.disabled ?? false,
6
+ max: opts.max ?? 0,
7
+ unique: opts.unique ?? true,
8
+ focusedIndex: null,
9
+ };
10
+ }
11
+ export function update(state, msg) {
12
+ if (state.disabled && msg.type !== 'setValue')
13
+ return [state, []];
14
+ switch (msg.type) {
15
+ case 'setInput':
16
+ return [{ ...state, inputValue: msg.value }, []];
17
+ case 'addTag': {
18
+ const candidate = (msg.value ?? state.inputValue).trim();
19
+ if (candidate === '')
20
+ return [{ ...state, inputValue: '' }, []];
21
+ if (state.unique && state.value.includes(candidate))
22
+ return [{ ...state, inputValue: '' }, []];
23
+ if (state.max > 0 && state.value.length >= state.max)
24
+ return [{ ...state, inputValue: '' }, []];
25
+ return [{ ...state, value: [...state.value, candidate], inputValue: '' }, []];
26
+ }
27
+ case 'removeTag': {
28
+ const value = state.value.filter((_, i) => i !== msg.index);
29
+ return [{ ...state, value, focusedIndex: null }, []];
30
+ }
31
+ case 'removeLast':
32
+ if (state.value.length === 0)
33
+ return [state, []];
34
+ return [{ ...state, value: state.value.slice(0, -1) }, []];
35
+ case 'setValue':
36
+ return [{ ...state, value: msg.value }, []];
37
+ case 'focusTag':
38
+ return [{ ...state, focusedIndex: msg.index }, []];
39
+ case 'focusTagNext': {
40
+ const len = state.value.length;
41
+ if (len === 0)
42
+ return [state, []];
43
+ if (state.focusedIndex === null)
44
+ return [state, []];
45
+ const next = state.focusedIndex + 1;
46
+ return [{ ...state, focusedIndex: next >= len ? null : next }, []];
47
+ }
48
+ case 'focusTagPrev': {
49
+ const len = state.value.length;
50
+ if (len === 0)
51
+ return [state, []];
52
+ if (state.focusedIndex === null)
53
+ return [{ ...state, focusedIndex: len - 1 }, []];
54
+ return [{ ...state, focusedIndex: Math.max(0, state.focusedIndex - 1) }, []];
55
+ }
56
+ case 'clearAll':
57
+ return [{ ...state, value: [], focusedIndex: null }, []];
58
+ }
59
+ }
60
+ export function connect(get, send, opts = {}) {
61
+ const inputLabel = opts.inputLabel ?? 'Add tag';
62
+ const removeLabel = opts.removeLabel ?? 'Remove tag';
63
+ const clearLabel = opts.clearLabel ?? 'Clear all tags';
64
+ const delimiters = opts.delimiters ?? [','];
65
+ const commitOnBlur = opts.commitOnBlur !== false;
66
+ const validate = opts.validate;
67
+ let currentInput = '';
68
+ const tryAddTag = () => {
69
+ const candidate = currentInput.trim();
70
+ if (validate && candidate !== '') {
71
+ const errors = validate(candidate);
72
+ if (errors && errors.length > 0)
73
+ return;
74
+ }
75
+ send({ type: 'addTag' });
76
+ };
77
+ return {
78
+ root: {
79
+ role: 'group',
80
+ 'aria-disabled': (s) => (get(s).disabled ? 'true' : undefined),
81
+ 'data-scope': 'tags-input',
82
+ 'data-part': 'root',
83
+ 'data-disabled': (s) => (get(s).disabled ? '' : undefined),
84
+ },
85
+ input: {
86
+ type: 'text',
87
+ autoComplete: 'off',
88
+ 'aria-label': inputLabel,
89
+ disabled: (s) => get(s).disabled,
90
+ value: (s) => get(s).inputValue,
91
+ 'data-scope': 'tags-input',
92
+ 'data-part': 'input',
93
+ onInput: (e) => {
94
+ currentInput = e.target.value;
95
+ send({ type: 'setInput', value: currentInput });
96
+ },
97
+ onKeyDown: (e) => {
98
+ if (e.key === 'Enter') {
99
+ e.preventDefault();
100
+ tryAddTag();
101
+ }
102
+ else if (delimiters.includes(e.key)) {
103
+ e.preventDefault();
104
+ tryAddTag();
105
+ }
106
+ else if (e.key === 'Backspace') {
107
+ const target = e.target;
108
+ if (target.value === '') {
109
+ send({ type: 'removeLast' });
110
+ }
111
+ }
112
+ else if (e.key === 'ArrowLeft') {
113
+ const target = e.target;
114
+ if (target.value === '') {
115
+ e.preventDefault();
116
+ send({ type: 'focusTagPrev' });
117
+ }
118
+ }
119
+ },
120
+ onBlur: () => {
121
+ if (commitOnBlur)
122
+ tryAddTag();
123
+ },
124
+ },
125
+ tag: (value, index) => ({
126
+ root: {
127
+ role: 'button',
128
+ tabIndex: (s) => (get(s).focusedIndex === index ? 0 : -1),
129
+ 'data-scope': 'tags-input',
130
+ 'data-part': 'tag',
131
+ 'data-value': value,
132
+ 'data-index': String(index),
133
+ 'data-focused': (s) => (get(s).focusedIndex === index ? '' : undefined),
134
+ onFocus: () => send({ type: 'focusTag', index }),
135
+ onKeyDown: (e) => {
136
+ if (e.key === 'ArrowLeft') {
137
+ e.preventDefault();
138
+ send({ type: 'focusTagPrev' });
139
+ }
140
+ else if (e.key === 'ArrowRight') {
141
+ e.preventDefault();
142
+ send({ type: 'focusTagNext' });
143
+ }
144
+ else if (e.key === 'Backspace' || e.key === 'Delete') {
145
+ e.preventDefault();
146
+ send({ type: 'removeTag', index });
147
+ }
148
+ },
149
+ },
150
+ remove: {
151
+ type: 'button',
152
+ 'aria-label': removeLabel,
153
+ tabIndex: -1,
154
+ 'data-scope': 'tags-input',
155
+ 'data-part': 'tag-remove',
156
+ onClick: () => send({ type: 'removeTag', index }),
157
+ },
158
+ }),
159
+ clearTrigger: {
160
+ type: 'button',
161
+ 'aria-label': clearLabel,
162
+ 'data-scope': 'tags-input',
163
+ 'data-part': 'clear-trigger',
164
+ onClick: () => send({ type: 'clearAll' }),
165
+ },
166
+ };
167
+ }
168
+ export const tagsInput = { init, update, connect };
@@ -0,0 +1,121 @@
1
+ import type { Send } from '@llui/dom';
2
+ /**
3
+ * Time picker — hours and minutes input with increment/decrement buttons.
4
+ * 12 or 24-hour format; optional seconds; step for minutes/seconds.
5
+ */
6
+ export type TimeFormat = '12' | '24';
7
+ export interface TimeValue {
8
+ hours: number;
9
+ minutes: number;
10
+ seconds: number;
11
+ }
12
+ export interface TimePickerState {
13
+ value: TimeValue;
14
+ format: TimeFormat;
15
+ minuteStep: number;
16
+ secondStep: number;
17
+ showSeconds: boolean;
18
+ disabled: boolean;
19
+ }
20
+ export type TimePickerMsg = {
21
+ type: 'setValue';
22
+ value: TimeValue;
23
+ } | {
24
+ type: 'setHours';
25
+ hours: number;
26
+ } | {
27
+ type: 'setMinutes';
28
+ minutes: number;
29
+ } | {
30
+ type: 'setSeconds';
31
+ seconds: number;
32
+ } | {
33
+ type: 'incrementHours';
34
+ } | {
35
+ type: 'decrementHours';
36
+ } | {
37
+ type: 'incrementMinutes';
38
+ } | {
39
+ type: 'decrementMinutes';
40
+ } | {
41
+ type: 'toggleAmPm';
42
+ };
43
+ export interface TimePickerInit {
44
+ value?: TimeValue;
45
+ format?: TimeFormat;
46
+ minuteStep?: number;
47
+ secondStep?: number;
48
+ showSeconds?: boolean;
49
+ disabled?: boolean;
50
+ }
51
+ export declare function init(opts?: TimePickerInit): TimePickerState;
52
+ export declare function update(state: TimePickerState, msg: TimePickerMsg): [TimePickerState, never[]];
53
+ /** Hours formatted for display (12-hr: 1..12, 24-hr: 0..23). */
54
+ export declare function displayHours(state: TimePickerState): number;
55
+ /** AM or PM for 12-hour format. */
56
+ export declare function period(state: TimePickerState): 'AM' | 'PM';
57
+ /** Format the full time string (HH:MM or HH:MM:SS). */
58
+ export declare function formatTime(state: TimePickerState): string;
59
+ export interface TimePickerParts<S> {
60
+ root: {
61
+ role: 'group';
62
+ 'aria-label': string;
63
+ 'data-scope': 'time-picker';
64
+ 'data-part': 'root';
65
+ 'data-format': (s: S) => TimeFormat;
66
+ };
67
+ hoursInput: {
68
+ type: 'number';
69
+ role: 'spinbutton';
70
+ 'aria-label': string;
71
+ 'aria-valuemin': (s: S) => number;
72
+ 'aria-valuemax': (s: S) => number;
73
+ 'aria-valuenow': (s: S) => number;
74
+ disabled: (s: S) => boolean;
75
+ value: (s: S) => string;
76
+ 'data-scope': 'time-picker';
77
+ 'data-part': 'hours-input';
78
+ onInput: (e: Event) => void;
79
+ onKeyDown: (e: KeyboardEvent) => void;
80
+ };
81
+ minutesInput: {
82
+ type: 'number';
83
+ role: 'spinbutton';
84
+ 'aria-label': string;
85
+ 'aria-valuemin': 0;
86
+ 'aria-valuemax': 59;
87
+ 'aria-valuenow': (s: S) => number;
88
+ disabled: (s: S) => boolean;
89
+ value: (s: S) => string;
90
+ 'data-scope': 'time-picker';
91
+ 'data-part': 'minutes-input';
92
+ onInput: (e: Event) => void;
93
+ onKeyDown: (e: KeyboardEvent) => void;
94
+ };
95
+ periodTrigger: {
96
+ type: 'button';
97
+ 'aria-label': string;
98
+ disabled: (s: S) => boolean;
99
+ 'data-scope': 'time-picker';
100
+ 'data-part': 'period-trigger';
101
+ 'data-period': (s: S) => 'AM' | 'PM';
102
+ onClick: (e: MouseEvent) => void;
103
+ hidden: (s: S) => boolean;
104
+ };
105
+ }
106
+ export interface ConnectOptions {
107
+ label?: string;
108
+ hoursLabel?: string;
109
+ minutesLabel?: string;
110
+ periodLabel?: string;
111
+ }
112
+ export declare function connect<S>(get: (s: S) => TimePickerState, send: Send<TimePickerMsg>, opts?: ConnectOptions): TimePickerParts<S>;
113
+ export declare const timePicker: {
114
+ init: typeof init;
115
+ update: typeof update;
116
+ connect: typeof connect;
117
+ displayHours: typeof displayHours;
118
+ period: typeof period;
119
+ formatTime: typeof formatTime;
120
+ };
121
+ //# sourceMappingURL=time-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-picker.d.ts","sourceRoot":"","sources":["../../src/components/time-picker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,UAAU,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,OAAO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QACvB,YAAY,EAAE,aAAa,CAAA;QAC3B,WAAW,EAAE,eAAe,CAAA;QAC5B,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;QAC3B,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAA;KACtC,CAAA;IACD,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ,CAAA;QACd,YAAY,EAAE,MAAM,CAAA;QACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAA;QAC3B,YAAY,EAAE,aAAa,CAAA;QAC3B,WAAW,EAAE,gBAAgB,CAAA;QAC7B,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAAA;QACpC,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;QAChC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAA;KAC1B,CAAA;CACF;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,OAAO,CAAC,CAAC,EACvB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,eAAe,EAC9B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EACzB,IAAI,GAAE,cAAmB,GACxB,eAAe,CAAC,CAAC,CAAC,CAsEpB;AAED,eAAO,MAAM,UAAU;;;;;;;CAA8D,CAAA"}
@@ -0,0 +1,147 @@
1
+ export function init(opts = {}) {
2
+ return {
3
+ value: opts.value ?? { hours: 0, minutes: 0, seconds: 0 },
4
+ format: opts.format ?? '24',
5
+ minuteStep: opts.minuteStep ?? 1,
6
+ secondStep: opts.secondStep ?? 1,
7
+ showSeconds: opts.showSeconds ?? false,
8
+ disabled: opts.disabled ?? false,
9
+ };
10
+ }
11
+ function mod(n, m) {
12
+ return ((n % m) + m) % m;
13
+ }
14
+ export function update(state, msg) {
15
+ if (state.disabled)
16
+ return [state, []];
17
+ switch (msg.type) {
18
+ case 'setValue':
19
+ return [{ ...state, value: msg.value }, []];
20
+ case 'setHours':
21
+ return [{ ...state, value: { ...state.value, hours: mod(msg.hours, 24) } }, []];
22
+ case 'setMinutes':
23
+ return [{ ...state, value: { ...state.value, minutes: mod(msg.minutes, 60) } }, []];
24
+ case 'setSeconds':
25
+ return [{ ...state, value: { ...state.value, seconds: mod(msg.seconds, 60) } }, []];
26
+ case 'incrementHours':
27
+ return [{ ...state, value: { ...state.value, hours: mod(state.value.hours + 1, 24) } }, []];
28
+ case 'decrementHours':
29
+ return [{ ...state, value: { ...state.value, hours: mod(state.value.hours - 1, 24) } }, []];
30
+ case 'incrementMinutes':
31
+ return [
32
+ {
33
+ ...state,
34
+ value: { ...state.value, minutes: mod(state.value.minutes + state.minuteStep, 60) },
35
+ },
36
+ [],
37
+ ];
38
+ case 'decrementMinutes':
39
+ return [
40
+ {
41
+ ...state,
42
+ value: { ...state.value, minutes: mod(state.value.minutes - state.minuteStep, 60) },
43
+ },
44
+ [],
45
+ ];
46
+ case 'toggleAmPm': {
47
+ const h = state.value.hours >= 12 ? state.value.hours - 12 : state.value.hours + 12;
48
+ return [{ ...state, value: { ...state.value, hours: h } }, []];
49
+ }
50
+ }
51
+ }
52
+ /** Hours formatted for display (12-hr: 1..12, 24-hr: 0..23). */
53
+ export function displayHours(state) {
54
+ if (state.format === '24')
55
+ return state.value.hours;
56
+ const h = state.value.hours % 12;
57
+ return h === 0 ? 12 : h;
58
+ }
59
+ /** AM or PM for 12-hour format. */
60
+ export function period(state) {
61
+ return state.value.hours >= 12 ? 'PM' : 'AM';
62
+ }
63
+ /** Format the full time string (HH:MM or HH:MM:SS). */
64
+ export function formatTime(state) {
65
+ const pad = (n) => n.toString().padStart(2, '0');
66
+ const h = pad(state.value.hours);
67
+ const m = pad(state.value.minutes);
68
+ if (state.showSeconds)
69
+ return `${h}:${m}:${pad(state.value.seconds)}`;
70
+ return `${h}:${m}`;
71
+ }
72
+ export function connect(get, send, opts = {}) {
73
+ return {
74
+ root: {
75
+ role: 'group',
76
+ 'aria-label': opts.label ?? 'Time',
77
+ 'data-scope': 'time-picker',
78
+ 'data-part': 'root',
79
+ 'data-format': (s) => get(s).format,
80
+ },
81
+ hoursInput: {
82
+ type: 'number',
83
+ role: 'spinbutton',
84
+ 'aria-label': opts.hoursLabel ?? 'Hours',
85
+ 'aria-valuemin': (s) => (get(s).format === '12' ? 1 : 0),
86
+ 'aria-valuemax': (s) => (get(s).format === '12' ? 12 : 23),
87
+ 'aria-valuenow': (s) => displayHours(get(s)),
88
+ disabled: (s) => get(s).disabled,
89
+ value: (s) => String(displayHours(get(s))).padStart(2, '0'),
90
+ 'data-scope': 'time-picker',
91
+ 'data-part': 'hours-input',
92
+ onInput: (e) => {
93
+ const n = parseInt(e.target.value, 10);
94
+ if (!isNaN(n))
95
+ send({ type: 'setHours', hours: n });
96
+ },
97
+ onKeyDown: (e) => {
98
+ if (e.key === 'ArrowUp') {
99
+ e.preventDefault();
100
+ send({ type: 'incrementHours' });
101
+ }
102
+ else if (e.key === 'ArrowDown') {
103
+ e.preventDefault();
104
+ send({ type: 'decrementHours' });
105
+ }
106
+ },
107
+ },
108
+ minutesInput: {
109
+ type: 'number',
110
+ role: 'spinbutton',
111
+ 'aria-label': opts.minutesLabel ?? 'Minutes',
112
+ 'aria-valuemin': 0,
113
+ 'aria-valuemax': 59,
114
+ 'aria-valuenow': (s) => get(s).value.minutes,
115
+ disabled: (s) => get(s).disabled,
116
+ value: (s) => String(get(s).value.minutes).padStart(2, '0'),
117
+ 'data-scope': 'time-picker',
118
+ 'data-part': 'minutes-input',
119
+ onInput: (e) => {
120
+ const n = parseInt(e.target.value, 10);
121
+ if (!isNaN(n))
122
+ send({ type: 'setMinutes', minutes: n });
123
+ },
124
+ onKeyDown: (e) => {
125
+ if (e.key === 'ArrowUp') {
126
+ e.preventDefault();
127
+ send({ type: 'incrementMinutes' });
128
+ }
129
+ else if (e.key === 'ArrowDown') {
130
+ e.preventDefault();
131
+ send({ type: 'decrementMinutes' });
132
+ }
133
+ },
134
+ },
135
+ periodTrigger: {
136
+ type: 'button',
137
+ 'aria-label': opts.periodLabel ?? 'Toggle AM/PM',
138
+ disabled: (s) => get(s).disabled,
139
+ 'data-scope': 'time-picker',
140
+ 'data-part': 'period-trigger',
141
+ 'data-period': (s) => period(get(s)),
142
+ onClick: () => send({ type: 'toggleAmPm' }),
143
+ hidden: (s) => get(s).format === '24',
144
+ },
145
+ };
146
+ }
147
+ export const timePicker = { init, update, connect, displayHours, period, formatTime };