@rockshin/tao-ui 0.0.42 → 0.0.44

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 (107) hide show
  1. package/README.md +8 -2
  2. package/component-manifest.json +37 -18
  3. package/dist/components/alert/alert.css +1 -0
  4. package/dist/components/avatar/avatar.js +1 -1
  5. package/dist/components/calendar/calendar.css +10 -60
  6. package/dist/components/calendar/calendar.js +46 -43
  7. package/dist/components/card/card.css +1 -1
  8. package/dist/components/carousel/carousel.css +1 -0
  9. package/dist/components/carousel/carousel.js +62 -7
  10. package/dist/components/collapse/collapse-panels.d.ts +4 -0
  11. package/dist/components/collapse/collapse-panels.js +413 -0
  12. package/dist/components/collapse/collapse.css +199 -0
  13. package/dist/components/collapse/collapse.d.ts +77 -0
  14. package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
  15. package/dist/components/color-picker/color-picker.css +8 -42
  16. package/dist/components/color-picker/color-picker.js +220 -145
  17. package/dist/components/date-picker/date-picker.css +18 -56
  18. package/dist/components/date-picker/date-picker.d.ts +2 -0
  19. package/dist/components/date-picker/date-picker.js +11 -6
  20. package/dist/components/date-picker/presets.js +5 -2
  21. package/dist/components/date-picker/range-picker.d.ts +2 -0
  22. package/dist/components/date-picker/range-picker.js +3 -1
  23. package/dist/components/form/field-control.d.ts +6 -0
  24. package/dist/components/form/field-control.js +42 -0
  25. package/dist/components/form/form-context.d.ts +3 -0
  26. package/dist/components/form/form-item.d.ts +2 -1
  27. package/dist/components/form/form-item.js +56 -42
  28. package/dist/components/form/form.css +15 -0
  29. package/dist/components/form/form.d.ts +5 -5
  30. package/dist/components/form/form.js +87 -68
  31. package/dist/components/form/index.d.ts +1 -0
  32. package/dist/components/form/use-form.d.ts +16 -0
  33. package/dist/components/form/use-form.js +69 -0
  34. package/dist/components/form-field/form-field-view.d.ts +6 -2
  35. package/dist/components/form-field/form-field-view.js +116 -84
  36. package/dist/components/input/base-input.d.ts +25 -0
  37. package/dist/components/input/base-input.js +104 -0
  38. package/dist/components/input/input-shared.css +75 -0
  39. package/dist/components/input/input-shared.d.ts +59 -0
  40. package/dist/components/input/input-shared.js +152 -0
  41. package/dist/components/input/input.css +99 -4
  42. package/dist/components/input/input.d.ts +12 -16
  43. package/dist/components/input/input.js +11 -154
  44. package/dist/components/input/otp.d.ts +29 -0
  45. package/dist/components/input/otp.js +335 -0
  46. package/dist/components/input/password.d.ts +12 -0
  47. package/dist/components/input/password.js +117 -0
  48. package/dist/components/input/search.d.ts +16 -0
  49. package/dist/components/input/search.js +99 -0
  50. package/dist/components/input-number/input-number.d.ts +2 -2
  51. package/dist/components/input-number/input-number.js +2 -2
  52. package/dist/components/list/list-pagination.css +5 -5
  53. package/dist/components/list/list-pagination.js +1 -0
  54. package/dist/components/mentions/mentions.css +7 -0
  55. package/dist/components/modal/modal.css +1 -0
  56. package/dist/components/radio/radio.d.ts +1 -1
  57. package/dist/components/radio/radio.js +78 -73
  58. package/dist/components/select/mobile-select.css +1 -16
  59. package/dist/components/select/mobile-select.d.ts +2 -1
  60. package/dist/components/select/mobile-select.js +68 -63
  61. package/dist/components/select/select-types.d.ts +2 -0
  62. package/dist/components/select/select.css +19 -0
  63. package/dist/components/select/select.js +31 -17
  64. package/dist/components/spinner/spinner.css +1 -1
  65. package/dist/components/steps/steps.css +53 -3
  66. package/dist/components/table/table.css +0 -5
  67. package/dist/components/table/table.js +21 -22
  68. package/dist/components/textarea/textarea.css +20 -0
  69. package/dist/components/textarea/textarea.d.ts +12 -6
  70. package/dist/components/textarea/textarea.js +120 -219
  71. package/dist/components/time-picker/time-picker.css +7 -0
  72. package/dist/components/tree/tree-check.d.ts +1 -0
  73. package/dist/components/tree/tree-check.js +36 -0
  74. package/dist/components/tree/tree.css +13 -18
  75. package/dist/components/tree/tree.js +2 -3
  76. package/dist/components/tree-select/select-engine.css +7 -0
  77. package/dist/components/tree-select/tree-select.js +2 -3
  78. package/dist/components/upload/upload.css +0 -11
  79. package/dist/components/upload/upload.js +13 -3
  80. package/dist/docs/component-docs.js +2 -2
  81. package/dist/docs/components/{collapsible.doc.d.ts → collapse.doc.d.ts} +1 -1
  82. package/dist/docs/components/collapse.doc.js +47 -0
  83. package/dist/docs/components/form.doc.js +3 -1
  84. package/dist/docs/components/input.doc.js +11 -4
  85. package/dist/docs/components/textarea.doc.js +4 -2
  86. package/dist/entries/collapse.d.ts +3 -0
  87. package/dist/entries/{collapsible.js → collapse.js} +1 -1
  88. package/dist/entries/form.d.ts +2 -2
  89. package/dist/entries/input.d.ts +1 -1
  90. package/dist/entries/textarea.d.ts +1 -1
  91. package/dist/index.d.ts +5 -5
  92. package/dist/index.js +1 -1
  93. package/dist/provider/locale.d.ts +6 -0
  94. package/dist/provider/locale.js +10 -0
  95. package/dist/provider/tao-provider.js +1 -0
  96. package/dist/theme/control.css +2 -2
  97. package/dist/theme/theme.css +3 -1
  98. package/dist/theme/tokens.d.ts +2 -2
  99. package/dist/theme/tokens.js +1 -0
  100. package/dist/utils/field-label.d.ts +4 -0
  101. package/dist/utils/field-label.js +7 -0
  102. package/llms.txt +19 -16
  103. package/package.json +10 -5
  104. package/dist/components/collapsible/collapsible.css +0 -49
  105. package/dist/components/collapsible/collapsible.d.ts +0 -39
  106. package/dist/docs/components/collapsible.doc.js +0 -39
  107. package/dist/entries/collapsible.d.ts +0 -3
@@ -0,0 +1,104 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useRef } from "react";
3
+ import { useTaoConfig } from "../../provider/tao-provider.js";
4
+ import { cx } from "../../utils/semantic.js";
5
+ import "./input.css";
6
+ import { InputClear, useTextControl, useTextControlRef } from "./input-shared.js";
7
+ const BaseInput = /*#__PURE__*/ forwardRef(function(props, ref) {
8
+ const { size, variant, prefix, suffix, error, status, disabled, className, style, classNames: customClassNames, styles: customStyles, allowClear, onClear, showCount, count, onPressEnter, addonBefore, addonAfter, onChange, onKeyDown, onCompositionStart, onCompositionEnd, value, defaultValue, ...rest } = props;
9
+ const classNames = 'function' == typeof customClassNames ? customClassNames({
10
+ props
11
+ }) : customClassNames;
12
+ const styles = 'function' == typeof customStyles ? customStyles({
13
+ props
14
+ }) : customStyles;
15
+ const innerRef = useRef(null);
16
+ const rootRef = useRef(null);
17
+ const field = useTextControl(props, innerRef);
18
+ useTextControlRef(ref, innerRef, rootRef);
19
+ const ctx = useTaoConfig();
20
+ const resolvedSize = size ?? ctx.size;
21
+ const resolvedVariant = variant ?? ctx.variant;
22
+ const resolvedDisabled = disabled ?? ctx.disabled;
23
+ return /*#__PURE__*/ jsxs("div", {
24
+ ref: rootRef,
25
+ className: cx(classNames?.root, className),
26
+ style: {
27
+ ...styles?.root,
28
+ ...style
29
+ },
30
+ "data-tao-control": "",
31
+ "data-tao-input": "",
32
+ "data-tao-size": resolvedSize,
33
+ "data-tao-variant": resolvedVariant,
34
+ "data-tao-error": 'error' === status || error || void 0,
35
+ "data-tao-warning": 'warning' === status || void 0,
36
+ "data-disabled": resolvedDisabled || void 0,
37
+ children: [
38
+ null != addonBefore && /*#__PURE__*/ jsx("span", {
39
+ "data-tao-input-addon": "",
40
+ className: classNames?.addonBefore,
41
+ style: styles?.addonBefore,
42
+ children: addonBefore
43
+ }),
44
+ null != prefix && /*#__PURE__*/ jsx("span", {
45
+ className: classNames?.prefix,
46
+ style: styles?.prefix,
47
+ "data-tao-prefix": "",
48
+ children: prefix
49
+ }),
50
+ /*#__PURE__*/ jsx("input", {
51
+ ...rest,
52
+ value: field.value,
53
+ ref: innerRef,
54
+ className: classNames?.input,
55
+ style: styles?.input,
56
+ disabled: resolvedDisabled,
57
+ "aria-invalid": 'error' === status || error ? true : rest['aria-invalid'],
58
+ onChange: field.change,
59
+ onKeyDown: (event)=>{
60
+ onKeyDown?.(event);
61
+ if ('Enter' === event.key && !event.defaultPrevented && !field.composing.current && !event.nativeEvent.isComposing && 229 !== event.keyCode) onPressEnter?.(event);
62
+ },
63
+ onCompositionStart: (event_0)=>{
64
+ field.composing.current = true;
65
+ onCompositionStart?.(event_0);
66
+ },
67
+ onCompositionEnd: (event_1)=>{
68
+ field.composing.current = false;
69
+ if (field.normalize(event_1.currentTarget.value) !== event_1.currentTarget.value) field.change({
70
+ ...event_1,
71
+ target: event_1.currentTarget
72
+ });
73
+ onCompositionEnd?.(event_1);
74
+ }
75
+ }),
76
+ allowClear && field.value && !resolvedDisabled && !rest.readOnly && /*#__PURE__*/ jsx(InputClear, {
77
+ config: allowClear,
78
+ onClick: field.clear,
79
+ className: classNames?.clear,
80
+ style: styles?.clear
81
+ }),
82
+ null != suffix && /*#__PURE__*/ jsx("span", {
83
+ className: classNames?.suffix,
84
+ style: styles?.suffix,
85
+ "data-tao-suffix": "",
86
+ children: suffix
87
+ }),
88
+ null != field.counter && /*#__PURE__*/ jsx("span", {
89
+ "data-tao-input-count": "",
90
+ "data-tao-exceeded": field.exceeded || void 0,
91
+ className: classNames?.count,
92
+ style: styles?.count,
93
+ children: field.counter
94
+ }),
95
+ null != addonAfter && /*#__PURE__*/ jsx("span", {
96
+ "data-tao-input-addon": "",
97
+ className: classNames?.addonAfter,
98
+ style: styles?.addonAfter,
99
+ children: addonAfter
100
+ })
101
+ ]
102
+ });
103
+ });
104
+ export { BaseInput };
@@ -0,0 +1,75 @@
1
+ [data-tao-input-action] {
2
+ padding: var(--tao-padding-xxs);
3
+ color: var(--tao-color-text-tertiary);
4
+ cursor: pointer;
5
+ border-radius: var(--tao-radius-sm);
6
+ background: none;
7
+ border: 0;
8
+ flex-shrink: 0;
9
+ justify-content: center;
10
+ align-items: center;
11
+ display: inline-flex;
12
+ }
13
+
14
+ [data-tao-input-action]:hover {
15
+ color: var(--tao-color-text);
16
+ }
17
+
18
+ [data-tao-input-action]:disabled {
19
+ color: var(--tao-color-text-disabled);
20
+ cursor: not-allowed;
21
+ }
22
+
23
+ [data-tao-input-action]:focus-visible {
24
+ outline: 2px solid var(--tao-primary);
25
+ outline-offset: -2px;
26
+ }
27
+
28
+ [data-tao-input-action] svg {
29
+ width: 16px;
30
+ height: 16px;
31
+ }
32
+
33
+ [data-tao-input-count] {
34
+ color: var(--tao-color-text-tertiary);
35
+ font-size: var(--tao-font-size-sm);
36
+ white-space: nowrap;
37
+ font-variant-numeric: tabular-nums;
38
+ }
39
+
40
+ [data-tao-input-count][data-tao-exceeded] {
41
+ color: var(--tao-error);
42
+ }
43
+
44
+ @media (hover: hover) and (pointer: fine) {
45
+ :is([data-tao-input], [data-tao-textarea]):not(:hover):not(:focus-within) [data-tao-input-clear] {
46
+ opacity: 0;
47
+ }
48
+ }
49
+
50
+ :is([data-tao-input], [data-tao-textarea])[data-tao-control][data-tao-variant="underlined"] {
51
+ border: var(--tao-line-width) solid transparent;
52
+ border-block-end-color: var(--tao-color-border);
53
+ background: none;
54
+ border-radius: 0;
55
+ }
56
+
57
+ :is([data-tao-input], [data-tao-textarea])[data-tao-variant="underlined"]:not([data-disabled]):is(:hover, :focus-within) {
58
+ border-block-end-color: var(--tao-input-underline-status, var(--tao-primary));
59
+ }
60
+
61
+ :is([data-tao-input], [data-tao-textarea])[data-tao-variant="underlined"][data-tao-warning] {
62
+ --tao-input-underline-status: var(--tao-warning);
63
+ border-block-end-color: var(--tao-warning);
64
+ }
65
+
66
+ :is([data-tao-input], [data-tao-textarea])[data-tao-variant="underlined"][data-tao-error] {
67
+ --tao-input-underline-status: var(--tao-error);
68
+ border-block-end-color: var(--tao-error);
69
+ }
70
+
71
+ :is([data-tao-input], [data-tao-textarea])[data-tao-variant="underlined"][data-disabled] {
72
+ color: var(--tao-color-text-disabled);
73
+ cursor: not-allowed;
74
+ }
75
+
@@ -0,0 +1,59 @@
1
+ import { type ChangeEvent, type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode, type Ref, type RefObject } from 'react';
2
+ import { type TaoVariant } from '../../provider/tao-provider.js';
3
+ import './input-shared.css';
4
+ export type InputVariant = TaoVariant | 'underlined';
5
+ export interface InputFocusOptions extends FocusOptions {
6
+ cursor?: 'start' | 'end' | 'all';
7
+ }
8
+ export interface CountConfig {
9
+ max?: number;
10
+ strategy?: (value: string) => number;
11
+ show?: boolean | ((info: CountInfo) => ReactNode);
12
+ exceedFormatter?: (value: string, config: {
13
+ max: number;
14
+ }) => string;
15
+ }
16
+ export interface CountInfo {
17
+ value: string;
18
+ count: number;
19
+ maxLength?: number;
20
+ }
21
+ export interface AllowClearConfig {
22
+ clearIcon?: ReactNode;
23
+ disabled?: boolean;
24
+ tabIndex?: number;
25
+ }
26
+ export interface TextControlProps<T extends HTMLInputElement | HTMLTextAreaElement> {
27
+ allowClear?: boolean | AllowClearConfig;
28
+ onClear?: () => void;
29
+ showCount?: boolean | {
30
+ formatter: (info: CountInfo) => ReactNode;
31
+ };
32
+ count?: CountConfig;
33
+ onPressEnter?: (event: KeyboardEvent<T>) => void;
34
+ }
35
+ export type InputSemanticValue<T, P> = T | ((info: {
36
+ props: P;
37
+ }) => T);
38
+ /** Keep native DOM refs compatible while adding the documented cursor options. */
39
+ export declare function useTextControlRef<T extends HTMLInputElement | HTMLTextAreaElement>(ref: Ref<T> | undefined, nodeRef: RefObject<T | null>, rootRef: RefObject<HTMLDivElement | null>): void;
40
+ export declare function useTextControl<T extends HTMLInputElement | HTMLTextAreaElement>(props: TextControlProps<T> & {
41
+ value?: string | number | readonly string[];
42
+ defaultValue?: string | number | readonly string[];
43
+ maxLength?: number;
44
+ onChange?: (event: ChangeEvent<T>) => void;
45
+ }, nodeRef: RefObject<T | null>): {
46
+ value: string;
47
+ composing: RefObject<boolean>;
48
+ change: (event: ChangeEvent<T>, next?: string) => void;
49
+ normalize: (next: string) => string;
50
+ clear: (event: MouseEvent<HTMLButtonElement>) => void;
51
+ counter: ReactNode;
52
+ exceeded: boolean;
53
+ };
54
+ export declare function InputClear({ config, onClick, className, style, }: {
55
+ config: boolean | AllowClearConfig;
56
+ onClick: (event: MouseEvent<HTMLButtonElement>) => void;
57
+ className?: string;
58
+ style?: CSSProperties;
59
+ }): import("react").JSX.Element;
@@ -0,0 +1,152 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react-compiler-runtime";
3
+ import { useEffect, useImperativeHandle, useRef, useState } from "react";
4
+ import { useTaoConfig } from "../../provider/tao-provider.js";
5
+ import { mergeRefs } from "../../utils/refs.js";
6
+ import { CloseIcon } from "../select/select-icons.js";
7
+ import "./input-shared.css";
8
+ function useTextControlRef(ref, nodeRef, rootRef) {
9
+ const $ = c(5);
10
+ let t0;
11
+ if ($[0] !== ref) {
12
+ t0 = mergeRefs(ref);
13
+ $[0] = ref;
14
+ $[1] = t0;
15
+ } else t0 = $[1];
16
+ let t1;
17
+ if ($[2] !== nodeRef || $[3] !== rootRef) {
18
+ t1 = ()=>{
19
+ const node = nodeRef.current;
20
+ const nativeFocus = Object.getPrototypeOf(node).focus ?? HTMLElement.prototype.focus;
21
+ return Object.assign(node, {
22
+ input: node,
23
+ textArea: node,
24
+ nativeElement: rootRef.current,
25
+ focus (options) {
26
+ nativeFocus.call(node, options);
27
+ if (options?.cursor && (node instanceof HTMLTextAreaElement || [
28
+ "text",
29
+ "search",
30
+ "password",
31
+ "tel",
32
+ "url"
33
+ ].includes(node.type))) {
34
+ const end = node.value.length;
35
+ node.setSelectionRange("end" === options.cursor ? end : 0, "start" === options.cursor ? 0 : end);
36
+ }
37
+ }
38
+ });
39
+ };
40
+ $[2] = nodeRef;
41
+ $[3] = rootRef;
42
+ $[4] = t1;
43
+ } else t1 = $[4];
44
+ useImperativeHandle(t0, t1);
45
+ }
46
+ function useTextControl(props, nodeRef) {
47
+ const [innerValue, setInnerValue] = useState(String(props.defaultValue ?? ''));
48
+ const value = void 0 !== props.value ? String(props.value ?? '') : innerValue;
49
+ const composing = useRef(false);
50
+ const count = props.count?.strategy?.(value) ?? value.length;
51
+ const max = props.count?.max ?? props.maxLength;
52
+ const show = props.count?.show ?? props.showCount;
53
+ const info = {
54
+ value,
55
+ count,
56
+ maxLength: max
57
+ };
58
+ const counter = 'function' == typeof show ? show(info) : 'object' == typeof show ? show.formatter(info) : void 0 === max ? count : `${count} / ${max}`;
59
+ const normalize = (next)=>{
60
+ const config = props.count;
61
+ return config?.exceedFormatter && void 0 !== max && (config.strategy?.(next) ?? next.length) > max ? config.exceedFormatter(next, {
62
+ max
63
+ }) : next;
64
+ };
65
+ const change = (event, next_0 = event.target.value)=>{
66
+ const normalized = composing.current ? next_0 : normalize(next_0);
67
+ event.target.value = normalized;
68
+ if (void 0 === props.value) setInnerValue(normalized);
69
+ props.onChange?.(event);
70
+ };
71
+ useEffect(()=>{
72
+ const form = nodeRef.current?.form;
73
+ const reset = (event_0)=>{
74
+ queueMicrotask(()=>{
75
+ if (!event_0.defaultPrevented && void 0 === props.value) setInnerValue(String(props.defaultValue ?? ''));
76
+ });
77
+ };
78
+ form?.addEventListener('reset', reset);
79
+ return ()=>form?.removeEventListener('reset', reset);
80
+ }, [
81
+ nodeRef,
82
+ props.value,
83
+ props.defaultValue
84
+ ]);
85
+ const clear = (event_1)=>{
86
+ const target = nodeRef.current.cloneNode(true);
87
+ target.value = '';
88
+ change({
89
+ ...event_1,
90
+ target,
91
+ currentTarget: target
92
+ }, '');
93
+ props.onClear?.();
94
+ nodeRef.current?.focus();
95
+ };
96
+ return {
97
+ value,
98
+ composing,
99
+ change,
100
+ normalize,
101
+ clear,
102
+ counter: show ? counter : null,
103
+ exceeded: void 0 !== max && count > max
104
+ };
105
+ }
106
+ function InputClear(t0) {
107
+ const $ = c(12);
108
+ const { config, onClick, className, style } = t0;
109
+ const { locale } = useTaoConfig();
110
+ let t1;
111
+ if ($[0] !== config) {
112
+ t1 = "object" == typeof config ? config : {};
113
+ $[0] = config;
114
+ $[1] = t1;
115
+ } else t1 = $[1];
116
+ const options = t1;
117
+ let t2;
118
+ if ($[2] !== options.clearIcon) {
119
+ t2 = options.clearIcon ?? /*#__PURE__*/ jsx(CloseIcon, {});
120
+ $[2] = options.clearIcon;
121
+ $[3] = t2;
122
+ } else t2 = $[3];
123
+ let t3;
124
+ if ($[4] !== className || $[5] !== locale.clear || $[6] !== onClick || $[7] !== options.disabled || $[8] !== options.tabIndex || $[9] !== style || $[10] !== t2) {
125
+ t3 = /*#__PURE__*/ jsx("button", {
126
+ type: "button",
127
+ "data-tao-input-clear": "",
128
+ "data-tao-input-action": "",
129
+ className: className,
130
+ style: style,
131
+ "aria-label": locale.clear,
132
+ disabled: options.disabled,
133
+ tabIndex: options.tabIndex,
134
+ onMouseDown: _temp,
135
+ onClick: onClick,
136
+ children: t2
137
+ });
138
+ $[4] = className;
139
+ $[5] = locale.clear;
140
+ $[6] = onClick;
141
+ $[7] = options.disabled;
142
+ $[8] = options.tabIndex;
143
+ $[9] = style;
144
+ $[10] = t2;
145
+ $[11] = t3;
146
+ } else t3 = $[11];
147
+ return t3;
148
+ }
149
+ function _temp(event) {
150
+ return event.preventDefault();
151
+ }
152
+ export { InputClear, useTextControl, useTextControlRef };
@@ -85,18 +85,18 @@
85
85
  cursor: not-allowed;
86
86
  }
87
87
 
88
- [data-tao-prefix], [data-tao-suffix] {
88
+ [data-tao-input] > [data-tao-prefix], [data-tao-input] > [data-tao-suffix] {
89
89
  color: var(--tao-color-text-tertiary);
90
90
  flex-shrink: 0;
91
91
  align-items: center;
92
92
  display: flex;
93
93
  }
94
94
 
95
- [data-tao-prefix], [data-tao-input] [data-tao-prefix] + input {
95
+ [data-tao-input] > [data-tao-prefix], [data-tao-input] [data-tao-prefix] + input {
96
96
  padding-inline-start: var(--tao-input-affix-padding);
97
97
  }
98
98
 
99
- [data-tao-prefix] svg, [data-tao-suffix] svg {
99
+ [data-tao-input] > [data-tao-prefix] svg, [data-tao-input] > [data-tao-suffix] svg {
100
100
  width: 16px;
101
101
  height: 16px;
102
102
  }
@@ -120,7 +120,102 @@
120
120
  var(--tao-input-affix-padding));
121
121
  }
122
122
 
123
- [data-tao-suffix] {
123
+ [data-tao-input] > [data-tao-suffix] {
124
124
  padding-inline-end: var(--tao-input-affix-padding);
125
125
  }
126
126
 
127
+ [data-tao-input-addon] {
128
+ padding-inline: var(--tao-padding-xs);
129
+ background: var(--tao-color-fill-quaternary);
130
+ font-size: var(--tao-font-size-base);
131
+ color: var(--tao-color-text);
132
+ align-self: stretch;
133
+ align-items: center;
134
+ display: inline-flex;
135
+ }
136
+
137
+ [data-tao-input-addon]:first-child {
138
+ border-inline-end: var(--tao-line-width) solid var(--tao-color-border);
139
+ }
140
+
141
+ [data-tao-input-addon]:last-child {
142
+ border-inline-start: var(--tao-line-width) solid var(--tao-color-border);
143
+ }
144
+
145
+ [data-tao-input]:has([data-tao-input-addon]) [data-tao-prefix] {
146
+ padding-inline-start: var(--tao-input-affix-padding);
147
+ position: static;
148
+ transform: none;
149
+ }
150
+
151
+ [data-tao-input]:has([data-tao-input-addon]) input {
152
+ padding-inline-start: var(--tao-input-affix-padding);
153
+ }
154
+
155
+ [data-tao-input] > [data-tao-input-count] {
156
+ padding-inline-end: var(--tao-input-affix-padding);
157
+ }
158
+
159
+ [data-tao-input] > [data-tao-input-action]:last-child {
160
+ margin-inline-end: var(--tao-padding-xxs);
161
+ }
162
+
163
+ [data-tao-input-search] {
164
+ align-items: stretch;
165
+ width: 100%;
166
+ min-width: 0;
167
+ display: flex;
168
+ }
169
+
170
+ [data-tao-input-search] > [data-tao-input] {
171
+ border-start-end-radius: 0;
172
+ border-end-end-radius: 0;
173
+ flex: 1;
174
+ min-width: 0;
175
+ }
176
+
177
+ [data-tao-input-search] > button {
178
+ border-start-start-radius: 0;
179
+ border-end-start-radius: 0;
180
+ flex-shrink: 0;
181
+ margin-inline-start: calc(-1 * var(--tao-line-width));
182
+ }
183
+
184
+ [data-tao-input-otp] {
185
+ gap: var(--tao-padding-xs);
186
+ align-items: center;
187
+ max-width: 100%;
188
+ display: inline-flex;
189
+ }
190
+
191
+ [data-tao-otp-cell] {
192
+ flex: 0 1 var(--tao-control-height-lg);
193
+ min-width: 0;
194
+ width: var(--tao-control-height-lg);
195
+ position: relative;
196
+ }
197
+
198
+ [data-tao-otp-cell] [data-tao-input] input {
199
+ text-align: center;
200
+ padding-inline: var(--tao-padding-xxs);
201
+ }
202
+
203
+ [data-tao-otp-masked] input {
204
+ color: #0000;
205
+ caret-color: var(--tao-color-text);
206
+ }
207
+
208
+ [data-tao-otp-mask] {
209
+ pointer-events: none;
210
+ color: var(--tao-color-text);
211
+ justify-content: center;
212
+ align-items: center;
213
+ display: flex;
214
+ position: absolute;
215
+ inset: 0;
216
+ }
217
+
218
+ [data-tao-otp-separator] {
219
+ color: var(--tao-color-text-secondary);
220
+ }
221
+
@@ -1,16 +1,12 @@
1
- import { type InputHTMLAttributes, type ReactNode } from 'react';
2
- import { type TaoSize, type TaoStatus, type TaoVariant } from '../../provider/tao-provider.js';
3
- import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
4
- import './input.css';
5
- export type InputSemanticPart = 'root' | 'input' | 'prefix' | 'suffix';
6
- export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
7
- size?: TaoSize;
8
- variant?: TaoVariant;
9
- prefix?: ReactNode;
10
- suffix?: ReactNode;
11
- error?: boolean;
12
- status?: TaoStatus;
13
- classNames?: SemanticClassNames<InputSemanticPart>;
14
- styles?: SemanticStyles<InputSemanticPart>;
15
- }
16
- export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
1
+ export type { TextareaProps as TextAreaProps, TextareaRef as TextAreaRef, } from '../textarea/textarea.js';
2
+ export type { InputProps, InputRef, InputSemanticPart } from './base-input.js';
3
+ export type { AllowClearConfig, CountConfig, CountInfo, InputFocusOptions, InputVariant, } from './input-shared.js';
4
+ export type { OTPProps, OTPRef, OTPSemanticPart } from './otp.js';
5
+ export type { PasswordProps, VisibilityToggle } from './password.js';
6
+ export type { SearchProps, SearchSemanticPart } from './search.js';
7
+ export declare const Input: import("react").ForwardRefExoticComponent<import("./base-input.js").InputProps & import("react").RefAttributes<HTMLInputElement>> & {
8
+ Password: import("react").ForwardRefExoticComponent<import("./password.js").PasswordProps & import("react").RefAttributes<HTMLInputElement>>;
9
+ Search: import("react").ForwardRefExoticComponent<import("./search.js").SearchProps & import("react").RefAttributes<HTMLInputElement>>;
10
+ TextArea: import("react").ForwardRefExoticComponent<Omit<import("./input.js").TextAreaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
11
+ OTP: import("react").ForwardRefExoticComponent<import("./otp.js").OTPProps & import("react").RefAttributes<import("./otp.js").OTPRef>>;
12
+ };