@rockshin/tao-ui 0.0.21 → 0.0.22

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 (105) hide show
  1. package/README.md +8 -1
  2. package/component-manifest.json +77 -48
  3. package/dist/components/button/button.css +11 -11
  4. package/dist/components/button/button.d.ts +3 -2
  5. package/dist/components/button/button.js +55 -47
  6. package/dist/components/checkbox/checkbox.d.ts +3 -2
  7. package/dist/components/checkbox/checkbox.js +91 -81
  8. package/dist/components/date-picker/calendar/calendar-grid.d.ts +7 -1
  9. package/dist/components/date-picker/calendar/calendar-grid.js +158 -160
  10. package/dist/components/date-picker/calendar/time-panel.js +64 -70
  11. package/dist/components/date-picker/date-picker.css +11 -5
  12. package/dist/components/date-picker/date-picker.d.ts +13 -5
  13. package/dist/components/date-picker/date-picker.js +389 -718
  14. package/dist/components/date-picker/range-picker.d.ts +12 -5
  15. package/dist/components/date-picker/range-picker.js +68 -12
  16. package/dist/components/date-picker/types.d.ts +5 -0
  17. package/dist/components/drawer/drawer.css +3 -1
  18. package/dist/components/form-field/form-field.d.ts +1 -1
  19. package/dist/components/form-field/form-field.js +106 -63
  20. package/dist/components/input/input.css +7 -1
  21. package/dist/components/input/input.d.ts +2 -1
  22. package/dist/components/input/input.js +76 -70
  23. package/dist/components/input-number/input-number.d.ts +5 -3
  24. package/dist/components/input-number/input-number.js +63 -47
  25. package/dist/components/modal/modal.css +2 -1
  26. package/dist/components/radio/radio.d.ts +3 -2
  27. package/dist/components/radio/radio.js +43 -39
  28. package/dist/components/select/mobile-select.d.ts +1 -1
  29. package/dist/components/select/mobile-select.js +1 -1
  30. package/dist/components/select/select-icons.d.ts +7 -0
  31. package/dist/components/select/select-icons.js +141 -0
  32. package/dist/components/select/select-model.d.ts +4 -0
  33. package/dist/components/select/select-model.js +22 -0
  34. package/dist/components/select/select-searchable-list.d.ts +22 -0
  35. package/dist/components/select/select-searchable-list.js +101 -0
  36. package/dist/components/select/select-tags.d.ts +15 -0
  37. package/dist/components/select/select-tags.js +152 -0
  38. package/dist/components/select/select-types.d.ts +82 -0
  39. package/dist/components/select/select-types.js +0 -0
  40. package/dist/components/select/select.css +2 -1
  41. package/dist/components/select/select.d.ts +2 -118
  42. package/dist/components/select/select.js +91 -404
  43. package/dist/components/select/use-is-mobile.js +2 -5
  44. package/dist/components/sonner/sonner.js +9 -3
  45. package/dist/components/spinner/spinner.css +1 -1
  46. package/dist/components/splitter/splitter.js +181 -133
  47. package/dist/components/switch/switch.css +17 -8
  48. package/dist/components/switch/switch.d.ts +3 -2
  49. package/dist/components/switch/switch.js +90 -79
  50. package/dist/components/table/table-filter.d.ts +6 -0
  51. package/dist/components/table/table-filter.js +123 -0
  52. package/dist/components/table/table-icons.d.ts +9 -0
  53. package/dist/components/table/table-icons.js +157 -0
  54. package/dist/components/table/table-model.d.ts +11 -0
  55. package/dist/components/table/table-model.js +33 -0
  56. package/dist/components/table/table-types.d.ts +87 -0
  57. package/dist/components/table/table-types.js +0 -0
  58. package/dist/components/table/table.css +14 -15
  59. package/dist/components/table/table.d.ts +3 -101
  60. package/dist/components/table/table.js +29 -329
  61. package/dist/components/tabs/tabs.css +5 -2
  62. package/dist/components/tabs/tabs.js +71 -62
  63. package/dist/components/textarea/textarea.d.ts +5 -3
  64. package/dist/components/textarea/textarea.js +102 -85
  65. package/dist/docs/component-docs.d.ts +1 -0
  66. package/dist/docs/components/breadcrumb.doc.js +3 -1
  67. package/dist/docs/components/checkbox.doc.js +2 -5
  68. package/dist/docs/components/context-menu.doc.js +7 -2
  69. package/dist/docs/components/drawer.doc.js +4 -2
  70. package/dist/docs/components/dropdown.doc.js +7 -3
  71. package/dist/docs/components/form-field.doc.js +0 -1
  72. package/dist/docs/components/form-layout.doc.d.ts +1 -0
  73. package/dist/docs/components/form-layout.doc.js +3 -0
  74. package/dist/docs/components/form-section.doc.js +1 -1
  75. package/dist/docs/components/input-number.doc.js +2 -3
  76. package/dist/docs/components/input.doc.js +1 -2
  77. package/dist/docs/components/modal.doc.js +1 -1
  78. package/dist/docs/components/pagination.doc.js +1 -3
  79. package/dist/docs/components/radio.doc.js +1 -4
  80. package/dist/docs/components/range-picker.doc.js +2 -2
  81. package/dist/docs/components/select.doc.js +19 -6
  82. package/dist/docs/components/spinner.doc.js +4 -1
  83. package/dist/docs/components/splitter.doc.js +1 -1
  84. package/dist/docs/components/stack.doc.d.ts +1 -0
  85. package/dist/docs/components/stack.doc.js +3 -0
  86. package/dist/docs/components/switch.doc.js +1 -2
  87. package/dist/docs/components/table.doc.js +9 -4
  88. package/dist/docs/components/tabs.doc.js +2 -1
  89. package/dist/docs/components/tag.doc.js +1 -0
  90. package/dist/docs/components/tao-provider.doc.js +1 -2
  91. package/dist/index.d.ts +7 -9
  92. package/dist/index.js +4 -5
  93. package/dist/layouts/form-layout/form-layout.d.ts +8 -2
  94. package/dist/layouts/form-layout/form-layout.js +33 -9
  95. package/dist/layouts/stack/stack.d.ts +8 -2
  96. package/dist/layouts/stack/stack.js +36 -12
  97. package/dist/provider/tao-provider.d.ts +3 -9
  98. package/dist/provider/tao-provider.js +99 -33
  99. package/dist/theme/theme.css +24 -14
  100. package/dist/theme/tokens.d.ts +2 -2
  101. package/dist/theme/tokens.js +4 -1
  102. package/dist/utils/refs.d.ts +2 -0
  103. package/dist/utils/refs.js +7 -0
  104. package/llms.txt +26 -24
  105. package/package.json +16 -4
@@ -1,9 +1,11 @@
1
1
  import type { Dayjs } from 'dayjs';
2
- import { type ReactNode } from 'react';
3
- import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
2
+ import { type CSSProperties, type ReactNode, type Ref } from 'react';
3
+ import { type TaoSize, type TaoStatus, type TaoVariant } from '../../provider/tao-provider';
4
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
4
5
  import './date-picker.css';
5
- import { type RangePresetItem } from './types';
6
+ import { type PickerRef, type RangePresetItem } from './types';
6
7
  type RangeValue = [Dayjs | null, Dayjs | null] | null;
8
+ export type RangePickerSemanticPart = 'root' | 'input' | 'separator' | 'popup' | 'calendar' | 'cell';
7
9
  export interface RangePickerProps {
8
10
  value?: RangeValue;
9
11
  defaultValue?: [Dayjs | null, Dayjs | null];
@@ -21,10 +23,15 @@ export interface RangePickerProps {
21
23
  variant?: TaoVariant;
22
24
  disabled?: boolean | [boolean, boolean];
23
25
  allowClear?: boolean;
24
- status?: 'error' | 'warning';
26
+ status?: TaoStatus;
27
+ ref?: Ref<PickerRef>;
25
28
  mobile?: boolean;
26
29
  open?: boolean;
27
30
  onOpenChange?: (open: boolean) => void;
31
+ className?: string;
32
+ style?: CSSProperties;
33
+ classNames?: SemanticClassNames<RangePickerSemanticPart>;
34
+ styles?: SemanticStyles<RangePickerSemanticPart>;
28
35
  }
29
- export declare function RangePicker({ value, defaultValue, onChange, picker, showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder, separator, size, variant, disabled, allowClear, status, mobile, open: controlledOpen, onOpenChange, }: RangePickerProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function RangePicker({ value, defaultValue, onChange, picker, showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder, separator, size, variant, disabled, allowClear, status, mobile, open: controlledOpen, onOpenChange, className, style, classNames, styles, ref, }: RangePickerProps): import("react/jsx-runtime").JSX.Element;
30
37
  export {};
@@ -2,8 +2,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import dayjs from "dayjs";
4
4
  import customParseFormat from "dayjs/plugin/customParseFormat";
5
- import { useCallback, useEffect, useState } from "react";
5
+ import { useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
6
6
  import { TaoPortalScope, useTaoConfig } from "../../provider/tao-provider.js";
7
+ import { cx } from "../../utils/semantic.js";
7
8
  import { Drawer } from "../drawer/drawer.js";
8
9
  import { useIsMobile } from "../select/use-is-mobile.js";
9
10
  import { CalendarGrid } from "./calendar/calendar-grid.js";
@@ -15,7 +16,7 @@ dayjs.extend(customParseFormat);
15
16
  function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder = [
16
17
  'Start date',
17
18
  'End date'
18
- ], separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange }) {
19
+ ], separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange, className, style, classNames, styles, ref }) {
19
20
  const ctx = useTaoConfig();
20
21
  const resolvedSize = size ?? ctx.size;
21
22
  const resolvedVariant = variant ?? ctx.variant;
@@ -23,6 +24,22 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
23
24
  const resolvedDisabled = isDisabled ?? ctx.disabled;
24
25
  const autoMobile = useIsMobile();
25
26
  const isMobile = mobile ?? autoMobile;
27
+ const mobileTriggerRef = useRef(null);
28
+ const startInputRef = useRef(null);
29
+ const endInputRef = useRef(null);
30
+ useImperativeHandle(ref, ()=>({
31
+ focus: (position = 'start')=>(isMobile ? mobileTriggerRef.current : 'end' === position ? endInputRef.current : startInputRef.current)?.focus(),
32
+ blur: ()=>{
33
+ mobileTriggerRef.current?.blur();
34
+ startInputRef.current?.blur();
35
+ endInputRef.current?.blur();
36
+ },
37
+ get nativeElement () {
38
+ return isMobile ? mobileTriggerRef.current : startInputRef.current;
39
+ }
40
+ }), [
41
+ isMobile
42
+ ]);
26
43
  const fmt = formatProp ?? getDefaultFormat(picker, showTime);
27
44
  const isValueControlled = void 0 !== value;
28
45
  const [internalValue, setInternalValue] = useState(defaultValue ?? null);
@@ -115,18 +132,18 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
115
132
  useEffect(()=>setInputEnd(displayEnd), [
116
133
  displayEnd
117
134
  ]);
118
- const commitInputValue = useCallback((position)=>{
119
- const text = ('start' === position ? inputStart : inputEnd).trim();
120
- const currentValue = 'start' === position ? displayStart : displayEnd;
135
+ const commitInputValue = useCallback((position_0)=>{
136
+ const text = ('start' === position_0 ? inputStart : inputEnd).trim();
137
+ const currentValue = 'start' === position_0 ? displayStart : displayEnd;
121
138
  const parsed = text ? dayjs(text, fmt, true) : null;
122
- const isBlocked = null != parsed && (!parsed.isValid() || disabledDate?.(parsed) || null != minDate && parsed.isBefore(minDate, 'day') || null != maxDate && parsed.isAfter(maxDate, 'day') || 'start' === position && null != rangeEnd && parsed.isAfter(rangeEnd) || 'end' === position && null != rangeStart && parsed.isBefore(rangeStart));
139
+ const isBlocked = null != parsed && (!parsed.isValid() || disabledDate?.(parsed) || null != minDate && parsed.isBefore(minDate, 'day') || null != maxDate && parsed.isAfter(maxDate, 'day') || 'start' === position_0 && null != rangeEnd && parsed.isAfter(rangeEnd) || 'end' === position_0 && null != rangeStart && parsed.isBefore(rangeStart));
123
140
  if (isBlocked) {
124
- if ('start' === position) setInputStart(currentValue);
141
+ if ('start' === position_0) setInputStart(currentValue);
125
142
  else setInputEnd(currentValue);
126
143
  return;
127
144
  }
128
- const nextStart = 'start' === position ? parsed : rangeStart;
129
- const nextEnd = 'end' === position ? parsed : rangeEnd;
145
+ const nextStart = 'start' === position_0 ? parsed : rangeStart;
146
+ const nextEnd = 'end' === position_0 ? parsed : rangeEnd;
130
147
  const nextStrings = [
131
148
  nextStart?.format(fmt) ?? '',
132
149
  nextEnd?.format(fmt) ?? ''
@@ -137,7 +154,7 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
137
154
  ] : null, nextStrings);
138
155
  setPendingStart(null);
139
156
  if (parsed) setViewDateStart(parsed);
140
- if ('start' === position) setInputStart(nextStrings[0]);
157
+ if ('start' === position_0) setInputStart(nextStrings[0]);
141
158
  else setInputEnd(nextStrings[1]);
142
159
  if (nextStart && nextEnd) setOpen(false);
143
160
  }, [
@@ -157,6 +174,8 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
157
174
  const showClearBtn = allowClear && (rangeStart || rangeEnd) && !resolvedDisabled;
158
175
  const panelContent = /*#__PURE__*/ jsxs("div", {
159
176
  "data-tao-range-panel": "",
177
+ className: isMobile ? classNames?.popup : void 0,
178
+ style: isMobile ? styles?.popup : void 0,
160
179
  children: [
161
180
  /*#__PURE__*/ jsxs("div", {
162
181
  "data-tao-range-header": "",
@@ -227,10 +246,15 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
227
246
  rangeEnd: rangeEnd,
228
247
  hoverDate: hoverDate,
229
248
  onSelect: handleDateSelect,
249
+ onViewDateChange: setViewDateStart,
230
250
  onHover: setHoverDate,
231
251
  disabledDate: disabledDate,
232
252
  minDate: minDate,
233
- maxDate: maxDate
253
+ maxDate: maxDate,
254
+ className: classNames?.calendar,
255
+ style: styles?.calendar,
256
+ cellClassName: classNames?.cell,
257
+ cellStyle: styles?.cell
234
258
  })
235
259
  })
236
260
  }),
@@ -244,10 +268,15 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
244
268
  rangeEnd: rangeEnd,
245
269
  hoverDate: hoverDate,
246
270
  onSelect: handleDateSelect,
271
+ onViewDateChange: (date_0)=>setViewDateStart(date_0.subtract(1, 'month')),
247
272
  onHover: setHoverDate,
248
273
  disabledDate: disabledDate,
249
274
  minDate: minDate,
250
- maxDate: maxDate
275
+ maxDate: maxDate,
276
+ className: classNames?.calendar,
277
+ style: styles?.calendar,
278
+ cellClassName: classNames?.cell,
279
+ cellStyle: styles?.cell
251
280
  })
252
281
  })
253
282
  })
@@ -288,6 +317,7 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
288
317
  ]
289
318
  });
290
319
  const mobileTrigger = /*#__PURE__*/ jsxs("button", {
320
+ ref: mobileTriggerRef,
291
321
  type: "button",
292
322
  "data-tao-control": "",
293
323
  "data-tao-range-trigger": "",
@@ -296,10 +326,17 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
296
326
  "data-tao-error": 'error' === status || void 0,
297
327
  disabled: resolvedDisabled,
298
328
  onClick: ()=>setOpen(true),
329
+ className: cx(classNames?.root, className),
330
+ style: {
331
+ ...styles?.root,
332
+ ...style
333
+ },
299
334
  children: [
300
335
  /*#__PURE__*/ jsx("span", {
301
336
  "data-tao-range-input": "",
302
337
  "data-tao-active": 'start' === selecting && isOpen || void 0,
338
+ className: classNames?.input,
339
+ style: styles?.input,
303
340
  children: displayStart || /*#__PURE__*/ jsx("span", {
304
341
  "data-tao-picker-placeholder": "",
305
342
  children: placeholder[0]
@@ -307,11 +344,15 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
307
344
  }),
308
345
  /*#__PURE__*/ jsx("span", {
309
346
  "data-tao-range-separator": "",
347
+ className: classNames?.separator,
348
+ style: styles?.separator,
310
349
  children: separator
311
350
  }),
312
351
  /*#__PURE__*/ jsx("span", {
313
352
  "data-tao-range-input": "",
314
353
  "data-tao-active": 'end' === selecting && isOpen || void 0,
354
+ className: classNames?.input,
355
+ style: styles?.input,
315
356
  children: displayEnd || /*#__PURE__*/ jsx("span", {
316
357
  "data-tao-picker-placeholder": "",
317
358
  children: placeholder[1]
@@ -327,10 +368,18 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
327
368
  "data-tao-variant": resolvedVariant,
328
369
  "data-tao-error": 'error' === status || void 0,
329
370
  "data-disabled": resolvedDisabled || void 0,
371
+ className: cx(classNames?.root, className),
372
+ style: {
373
+ ...styles?.root,
374
+ ...style
375
+ },
330
376
  children: [
331
377
  /*#__PURE__*/ jsx("input", {
378
+ ref: startInputRef,
332
379
  "data-tao-range-input": "",
333
380
  "data-tao-active": 'start' === selecting && isOpen || void 0,
381
+ className: classNames?.input,
382
+ style: styles?.input,
334
383
  value: inputStart,
335
384
  placeholder: placeholder[0],
336
385
  disabled: resolvedDisabled,
@@ -352,11 +401,16 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
352
401
  }),
353
402
  /*#__PURE__*/ jsx("span", {
354
403
  "data-tao-range-separator": "",
404
+ className: classNames?.separator,
405
+ style: styles?.separator,
355
406
  children: separator
356
407
  }),
357
408
  /*#__PURE__*/ jsx("input", {
409
+ ref: endInputRef,
358
410
  "data-tao-range-input": "",
359
411
  "data-tao-active": 'end' === selecting && isOpen || void 0,
412
+ className: classNames?.input,
413
+ style: styles?.input,
360
414
  value: inputEnd,
361
415
  placeholder: placeholder[1],
362
416
  disabled: resolvedDisabled,
@@ -407,6 +461,8 @@ function RangePicker({ value, defaultValue, onChange, picker = 'date', showTime,
407
461
  "data-tao-picker-dropdown": "",
408
462
  sideOffset: 4,
409
463
  align: "start",
464
+ className: classNames?.popup,
465
+ style: styles?.popup,
410
466
  onOpenAutoFocus: (e_1)=>e_1.preventDefault(),
411
467
  children: panelContent
412
468
  })
@@ -1,4 +1,9 @@
1
1
  import type { Dayjs } from 'dayjs';
2
+ export interface PickerRef {
3
+ focus: (position?: 'start' | 'end') => void;
4
+ blur: () => void;
5
+ nativeElement: HTMLElement | null;
6
+ }
2
7
  import type { ReactNode } from 'react';
3
8
  import type { TaoSize, TaoVariant } from '../../provider/tao-provider';
4
9
  export type PickerMode = 'date' | 'month' | 'year';
@@ -30,6 +30,7 @@
30
30
  z-index: calc(var(--tao-z-index-drawer) + 1);
31
31
  background: var(--tao-color-bg-elevated);
32
32
  box-shadow: var(--tao-box-shadow-secondary);
33
+ max-width: 100vw;
33
34
  font-family: var(--tao-font-family);
34
35
  outline: none;
35
36
  flex-direction: column;
@@ -152,7 +153,8 @@ button[data-tao-drawer-close] {
152
153
  height: 32px;
153
154
  color: var(--tao-color-text-tertiary);
154
155
  cursor: pointer;
155
- transition: all var(--tao-motion-duration-fast) ease-out;
156
+ transition: background-color var(--tao-motion-duration-fast) ease-out,
157
+ color var(--tao-motion-duration-fast) ease-out;
156
158
  appearance: none;
157
159
  background: none;
158
160
  border: none;
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
3
  import './form.css';
4
4
  export type FormFieldSemanticPart = 'root' | 'label' | 'error' | 'description';
@@ -1,101 +1,144 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
+ import { cloneElement, isValidElement, useId } from "react";
3
4
  import { cx } from "../../utils/semantic.js";
4
5
  import "./form.css";
5
6
  function FormField(t0) {
6
- const $ = c(27);
7
+ const $ = c(40);
7
8
  const { label, htmlFor, required, error, description, children, className, style, classNames, styles } = t0;
8
- const t1 = classNames?.root;
9
+ const generatedId = useId();
10
+ const child = /*#__PURE__*/ isValidElement(children) ? children : null;
11
+ const childId = "string" == typeof child?.props.id ? child.props.id : void 0;
12
+ const controlId = htmlFor ?? childId ?? `${generatedId}-control`;
13
+ const descriptionId = `${generatedId}-description`;
14
+ const errorId = `${generatedId}-error`;
15
+ const childDescribedBy = "string" == typeof child?.props["aria-describedby"] ? child.props["aria-describedby"] : void 0;
16
+ const t1 = error ? errorId : description ? descriptionId : void 0;
9
17
  let t2;
10
- if ($[0] !== className || $[1] !== t1) {
11
- t2 = cx(t1, className);
12
- $[0] = className;
18
+ if ($[0] !== childDescribedBy || $[1] !== t1) {
19
+ t2 = [
20
+ childDescribedBy,
21
+ t1
22
+ ].filter(Boolean);
23
+ $[0] = childDescribedBy;
13
24
  $[1] = t1;
14
25
  $[2] = t2;
15
26
  } else t2 = $[2];
16
- const t3 = styles?.root;
17
- let t4;
18
- if ($[3] !== style || $[4] !== t3) {
19
- t4 = {
20
- ...t3,
27
+ const describedBy = t2.join(" ");
28
+ let t3;
29
+ if ($[3] !== child || $[4] !== children || $[5] !== controlId || $[6] !== describedBy || $[7] !== error || $[8] !== errorId || $[9] !== required) {
30
+ t3 = child ? /*#__PURE__*/ cloneElement(child, {
31
+ id: controlId,
32
+ "aria-describedby": describedBy || void 0,
33
+ "aria-errormessage": error ? errorId : void 0,
34
+ "aria-invalid": error ? true : child.props["aria-invalid"],
35
+ "aria-required": required ? true : child.props["aria-required"]
36
+ }) : children;
37
+ $[3] = child;
38
+ $[4] = children;
39
+ $[5] = controlId;
40
+ $[6] = describedBy;
41
+ $[7] = error;
42
+ $[8] = errorId;
43
+ $[9] = required;
44
+ $[10] = t3;
45
+ } else t3 = $[10];
46
+ const control = t3;
47
+ const t4 = classNames?.root;
48
+ let t5;
49
+ if ($[11] !== className || $[12] !== t4) {
50
+ t5 = cx(t4, className);
51
+ $[11] = className;
52
+ $[12] = t4;
53
+ $[13] = t5;
54
+ } else t5 = $[13];
55
+ const t6 = styles?.root;
56
+ let t7;
57
+ if ($[14] !== style || $[15] !== t6) {
58
+ t7 = {
59
+ ...t6,
21
60
  ...style
22
61
  };
23
- $[3] = style;
24
- $[4] = t3;
25
- $[5] = t4;
26
- } else t4 = $[5];
27
- const t5 = classNames?.label;
28
- const t6 = styles?.label;
29
- let t7;
30
- if ($[6] !== required) {
31
- t7 = required && /*#__PURE__*/ jsx("span", {
62
+ $[14] = style;
63
+ $[15] = t6;
64
+ $[16] = t7;
65
+ } else t7 = $[16];
66
+ const t8 = classNames?.label;
67
+ const t9 = styles?.label;
68
+ let t10;
69
+ if ($[17] !== required) {
70
+ t10 = required && /*#__PURE__*/ jsx("span", {
32
71
  "data-tao-required": "",
33
72
  "aria-hidden": "true",
34
73
  children: "*"
35
74
  });
36
- $[6] = required;
37
- $[7] = t7;
38
- } else t7 = $[7];
39
- let t8;
40
- if ($[8] !== htmlFor || $[9] !== label || $[10] !== t5 || $[11] !== t6 || $[12] !== t7) {
41
- t8 = /*#__PURE__*/ jsxs("label", {
42
- htmlFor: htmlFor,
43
- className: t5,
44
- style: t6,
75
+ $[17] = required;
76
+ $[18] = t10;
77
+ } else t10 = $[18];
78
+ let t11;
79
+ if ($[19] !== controlId || $[20] !== label || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
80
+ t11 = /*#__PURE__*/ jsxs("label", {
81
+ htmlFor: controlId,
82
+ className: t8,
83
+ style: t9,
45
84
  "data-tao-form-label": "",
46
85
  children: [
47
86
  label,
48
- t7
87
+ t10
49
88
  ]
50
89
  });
51
- $[8] = htmlFor;
52
- $[9] = label;
53
- $[10] = t5;
54
- $[11] = t6;
55
- $[12] = t7;
56
- $[13] = t8;
57
- } else t8 = $[13];
58
- let t9;
59
- if ($[14] !== classNames?.description || $[15] !== classNames?.error || $[16] !== description || $[17] !== error || $[18] !== styles?.description || $[19] !== styles?.error) {
60
- t9 = error ? /*#__PURE__*/ jsx("p", {
90
+ $[19] = controlId;
91
+ $[20] = label;
92
+ $[21] = t10;
93
+ $[22] = t8;
94
+ $[23] = t9;
95
+ $[24] = t11;
96
+ } else t11 = $[24];
97
+ let t12;
98
+ if ($[25] !== classNames?.description || $[26] !== classNames?.error || $[27] !== description || $[28] !== descriptionId || $[29] !== error || $[30] !== errorId || $[31] !== styles?.description || $[32] !== styles?.error) {
99
+ t12 = error ? /*#__PURE__*/ jsx("p", {
61
100
  className: classNames?.error,
62
101
  style: styles?.error,
63
102
  "data-tao-form-error": "",
103
+ id: errorId,
64
104
  role: "alert",
65
105
  children: error
66
106
  }) : description ? /*#__PURE__*/ jsx("p", {
67
107
  className: classNames?.description,
68
108
  style: styles?.description,
69
109
  "data-tao-form-description": "",
110
+ id: descriptionId,
70
111
  children: description
71
112
  }) : null;
72
- $[14] = classNames?.description;
73
- $[15] = classNames?.error;
74
- $[16] = description;
75
- $[17] = error;
76
- $[18] = styles?.description;
77
- $[19] = styles?.error;
78
- $[20] = t9;
79
- } else t9 = $[20];
80
- let t10;
81
- if ($[21] !== children || $[22] !== t2 || $[23] !== t4 || $[24] !== t8 || $[25] !== t9) {
82
- t10 = /*#__PURE__*/ jsxs("div", {
83
- className: t2,
84
- style: t4,
113
+ $[25] = classNames?.description;
114
+ $[26] = classNames?.error;
115
+ $[27] = description;
116
+ $[28] = descriptionId;
117
+ $[29] = error;
118
+ $[30] = errorId;
119
+ $[31] = styles?.description;
120
+ $[32] = styles?.error;
121
+ $[33] = t12;
122
+ } else t12 = $[33];
123
+ let t13;
124
+ if ($[34] !== control || $[35] !== t11 || $[36] !== t12 || $[37] !== t5 || $[38] !== t7) {
125
+ t13 = /*#__PURE__*/ jsxs("div", {
126
+ className: t5,
127
+ style: t7,
85
128
  "data-tao-form-field": "",
86
129
  children: [
87
- t8,
88
- children,
89
- t9
130
+ t11,
131
+ control,
132
+ t12
90
133
  ]
91
134
  });
92
- $[21] = children;
93
- $[22] = t2;
94
- $[23] = t4;
95
- $[24] = t8;
96
- $[25] = t9;
97
- $[26] = t10;
98
- } else t10 = $[26];
99
- return t10;
135
+ $[34] = control;
136
+ $[35] = t11;
137
+ $[36] = t12;
138
+ $[37] = t5;
139
+ $[38] = t7;
140
+ $[39] = t13;
141
+ } else t13 = $[39];
142
+ return t13;
100
143
  }
101
144
  export { FormField };
@@ -1,4 +1,5 @@
1
1
  [data-tao-input] {
2
+ --tao-input-line-height: var(--tao-line-height);
2
3
  width: 100%;
3
4
  font-family: var(--tao-font-family);
4
5
  align-items: center;
@@ -7,6 +8,7 @@
7
8
  }
8
9
 
9
10
  [data-tao-input][data-tao-size="small"] {
11
+ --tao-input-line-height: var(--tao-line-height-sm);
10
12
  height: var(--tao-control-height-sm);
11
13
  border-radius: var(--tao-radius-sm);
12
14
  }
@@ -27,6 +29,7 @@
27
29
  }
28
30
 
29
31
  [data-tao-input][data-tao-size="large"] {
32
+ --tao-input-line-height: var(--tao-line-height-lg);
30
33
  height: var(--tao-control-height-lg);
31
34
  border-radius: var(--tao-radius-md);
32
35
  }
@@ -41,14 +44,17 @@
41
44
  }
42
45
 
43
46
  [data-tao-input] input {
47
+ box-sizing: border-box;
44
48
  height: 100%;
49
+ font-family: inherit;
50
+ line-height: var(--tao-input-line-height);
45
51
  color: var(--tao-color-text);
46
52
  background: none;
47
53
  border: none;
48
54
  outline: none;
49
55
  flex: 1;
50
56
  min-width: 0;
51
- font-family: inherit;
57
+ padding-block: 0;
52
58
  }
53
59
 
54
60
  [data-tao-input] input::placeholder {
@@ -1,5 +1,5 @@
1
1
  import { type InputHTMLAttributes, type ReactNode } from 'react';
2
- import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
2
+ import { type TaoSize, type TaoStatus, type TaoVariant } from '../../provider/tao-provider';
3
3
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
4
4
  import './input.css';
5
5
  export type InputSemanticPart = 'root' | 'input' | 'prefix' | 'suffix';
@@ -9,6 +9,7 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
9
9
  prefix?: ReactNode;
10
10
  suffix?: ReactNode;
11
11
  error?: boolean;
12
+ status?: TaoStatus;
12
13
  classNames?: SemanticClassNames<InputSemanticPart>;
13
14
  styles?: SemanticStyles<InputSemanticPart>;
14
15
  }