tyrell-react 1.0.0-TC44 → 1.0.0-TC46
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/components/TyCalendar.d.ts.map +1 -1
- package/dist/components/TyCalendar.js +0 -8
- package/dist/components/TyCalendar.js.map +1 -1
- package/dist/components/TyCalendarMonth.d.ts.map +1 -1
- package/dist/components/TyCalendarMonth.js +0 -5
- package/dist/components/TyCalendarMonth.js.map +1 -1
- package/dist/components/TyCalendarNavigation.d.ts.map +1 -1
- package/dist/components/TyCalendarNavigation.js +0 -5
- package/dist/components/TyCalendarNavigation.js.map +1 -1
- package/dist/components/TyCheckbox.d.ts.map +1 -1
- package/dist/components/TyCheckbox.js +0 -8
- package/dist/components/TyCheckbox.js.map +1 -1
- package/dist/components/TyCopy.d.ts.map +1 -1
- package/dist/components/TyCopy.js +0 -6
- package/dist/components/TyCopy.js.map +1 -1
- package/dist/components/TyDatePicker.d.ts +5 -1
- package/dist/components/TyDatePicker.d.ts.map +1 -1
- package/dist/components/TyDatePicker.js +0 -7
- package/dist/components/TyDatePicker.js.map +1 -1
- package/dist/components/TyFileUpload.d.ts.map +1 -1
- package/dist/components/TyFileUpload.js +0 -1
- package/dist/components/TyFileUpload.js.map +1 -1
- package/dist/components/TyIcon.d.ts.map +1 -1
- package/dist/components/TyIcon.js +0 -4
- package/dist/components/TyIcon.js.map +1 -1
- package/dist/components/TyInput.d.ts.map +1 -1
- package/dist/components/TyInput.js +0 -10
- package/dist/components/TyInput.js.map +1 -1
- package/dist/components/TyModal.d.ts.map +1 -1
- package/dist/components/TyModal.js +0 -6
- package/dist/components/TyModal.js.map +1 -1
- package/dist/components/TyOption.d.ts.map +1 -1
- package/dist/components/TyOption.js +0 -2
- package/dist/components/TyOption.js.map +1 -1
- package/dist/components/TyPopup.d.ts.map +1 -1
- package/dist/components/TyPopup.js +0 -4
- package/dist/components/TyPopup.js.map +1 -1
- package/dist/components/TyResizeObserver.d.ts.map +1 -1
- package/dist/components/TyResizeObserver.js +0 -4
- package/dist/components/TyResizeObserver.js.map +1 -1
- package/dist/components/TyScrollContainer.d.ts.map +1 -1
- package/dist/components/TyScrollContainer.js +0 -6
- package/dist/components/TyScrollContainer.js.map +1 -1
- package/dist/components/TySelect.d.ts +10 -2
- package/dist/components/TySelect.d.ts.map +1 -1
- package/dist/components/TySelect.js +6 -7
- package/dist/components/TySelect.js.map +1 -1
- package/dist/components/TyStep.d.ts.map +1 -1
- package/dist/components/TyStep.js +0 -5
- package/dist/components/TyStep.js.map +1 -1
- package/dist/components/TyTab.d.ts.map +1 -1
- package/dist/components/TyTab.js +0 -6
- package/dist/components/TyTab.js.map +1 -1
- package/dist/components/TyTabs.d.ts.map +1 -1
- package/dist/components/TyTabs.js +0 -5
- package/dist/components/TyTabs.js.map +1 -1
- package/dist/components/TyTag.d.ts.map +1 -1
- package/dist/components/TyTag.js +0 -2
- package/dist/components/TyTag.js.map +1 -1
- package/dist/components/TyTextarea.d.ts.map +1 -1
- package/dist/components/TyTextarea.js +0 -6
- package/dist/components/TyTextarea.js.map +1 -1
- package/dist/components/TyTooltip.d.ts.map +1 -1
- package/dist/components/TyTooltip.js +0 -4
- package/dist/components/TyTooltip.js.map +1 -1
- package/dist/components/TyWizard.d.ts.map +1 -1
- package/dist/components/TyWizard.js +0 -5
- package/dist/components/TyWizard.js.map +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -62
- package/dist/components/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/components/TyCalendar.tsx +0 -9
- package/src/components/TyCalendarMonth.tsx +0 -6
- package/src/components/TyCalendarNavigation.tsx +0 -6
- package/src/components/TyCheckbox.tsx +0 -9
- package/src/components/TyCopy.tsx +0 -7
- package/src/components/TyDatePicker.tsx +7 -10
- package/src/components/TyFileUpload.tsx +0 -2
- package/src/components/TyIcon.tsx +0 -5
- package/src/components/TyInput.tsx +0 -12
- package/src/components/TyModal.tsx +0 -9
- package/src/components/TyOption.tsx +0 -3
- package/src/components/TyPopup.tsx +0 -6
- package/src/components/TyResizeObserver.tsx +0 -5
- package/src/components/TyScrollContainer.tsx +0 -8
- package/src/components/TySelect.tsx +19 -12
- package/src/components/TyStep.tsx +0 -6
- package/src/components/TyTab.tsx +0 -7
- package/src/components/TyTabs.tsx +0 -6
- package/src/components/TyTag.tsx +0 -3
- package/src/components/TyTextarea.tsx +0 -8
- package/src/components/TyTooltip.tsx +0 -5
- package/src/components/TyWizard.tsx +0 -6
- package/src/components/index.ts +2 -97
- package/src/version.ts +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
3
3
|
|
|
4
|
-
// Type definitions for Ty Icon component
|
|
5
4
|
export interface TyIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
5
|
/** Icon name from the icon registry (e.g., 'home', 'star', 'settings') */
|
|
7
6
|
name: string;
|
|
@@ -22,12 +21,10 @@ export interface TyIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
21
|
className?: string;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// React wrapper for ty-icon web component
|
|
26
24
|
export const TyIcon = React.forwardRef<HTMLElement, TyIconProps>(
|
|
27
25
|
({ name, size, spin, pulse, tempo, className, ...props }, ref) => {
|
|
28
26
|
const elementRef = useRef<HTMLElement>(null);
|
|
29
27
|
|
|
30
|
-
// Handle ref forwarding
|
|
31
28
|
useEffect(() => {
|
|
32
29
|
if (ref && elementRef.current) {
|
|
33
30
|
if (typeof ref === 'function') {
|
|
@@ -41,14 +38,12 @@ export const TyIcon = React.forwardRef<HTMLElement, TyIconProps>(
|
|
|
41
38
|
const isSpin = useBooleanProperty(elementRef, 'spin', spin);
|
|
42
39
|
const isPulse = useBooleanProperty(elementRef, 'pulse', pulse);
|
|
43
40
|
|
|
44
|
-
// Convert React props to web component attributes
|
|
45
41
|
const webComponentProps: Record<string, any> = {
|
|
46
42
|
...props,
|
|
47
43
|
name,
|
|
48
44
|
ref: elementRef,
|
|
49
45
|
};
|
|
50
46
|
|
|
51
|
-
// Add optional attributes only if they have values
|
|
52
47
|
if (size) {
|
|
53
48
|
webComponentProps.size = size;
|
|
54
49
|
}
|
|
@@ -6,7 +6,6 @@ import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
|
6
6
|
type BuiltinFlavor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
7
7
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
8
8
|
|
|
9
|
-
// Event detail structure for ty-input events
|
|
10
9
|
export interface TyInputEventDetail {
|
|
11
10
|
value: any; // shadow value (processed/parsed)
|
|
12
11
|
formattedValue: string; // user-visible formatted value
|
|
@@ -27,7 +26,6 @@ export interface TyInputCSSProperties extends React.CSSProperties {
|
|
|
27
26
|
'--input-disabled-color'?: string;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
// Type definitions for Ty Input component
|
|
31
29
|
export interface TyInputProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onFocus' | 'onBlur' | 'style'> {
|
|
32
30
|
style?: TyInputCSSProperties;
|
|
33
31
|
/** Input type */
|
|
@@ -96,7 +94,6 @@ export interface TyInputProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
96
94
|
// One-time global warning flags so we don't spam the console.
|
|
97
95
|
let _warnedOnInputProp = false;
|
|
98
96
|
|
|
99
|
-
// React wrapper for ty-input web component
|
|
100
97
|
export const TyInput = React.forwardRef<HTMLElement, TyInputProps>(
|
|
101
98
|
({ onChange, onChangeCommit, onFocus, onBlur, disabled, required, name, checked, debounce, ...props }, ref) => {
|
|
102
99
|
const elementRef = useRef<HTMLElement>(null);
|
|
@@ -150,18 +147,14 @@ export const TyInput = React.forwardRef<HTMLElement, TyInputProps>(
|
|
|
150
147
|
const element = elementRef.current;
|
|
151
148
|
if (!element) return;
|
|
152
149
|
|
|
153
|
-
// Listen for custom input/change events from ty-input
|
|
154
|
-
// Map onChange → input event (React convention)
|
|
155
150
|
if (onChange) {
|
|
156
151
|
element.addEventListener('input', handleInput as EventListener);
|
|
157
152
|
}
|
|
158
153
|
|
|
159
|
-
// Map onChangeCommit → change event (blur behavior)
|
|
160
154
|
if (onChangeCommit) {
|
|
161
155
|
element.addEventListener('change', handleChangeCommit as EventListener);
|
|
162
156
|
}
|
|
163
157
|
|
|
164
|
-
// Listen for standard focus/blur events
|
|
165
158
|
if (onFocus) {
|
|
166
159
|
element.addEventListener('focus', handleFocus as EventListener);
|
|
167
160
|
}
|
|
@@ -186,7 +179,6 @@ export const TyInput = React.forwardRef<HTMLElement, TyInputProps>(
|
|
|
186
179
|
};
|
|
187
180
|
}, [handleInput, handleChangeCommit, handleFocus, handleBlur, onChange, onChangeCommit, onFocus, onBlur]);
|
|
188
181
|
|
|
189
|
-
// Handle ref forwarding
|
|
190
182
|
useEffect(() => {
|
|
191
183
|
if (ref && elementRef.current) {
|
|
192
184
|
if (typeof ref === 'function') {
|
|
@@ -217,21 +209,17 @@ export const TyInput = React.forwardRef<HTMLElement, TyInputProps>(
|
|
|
217
209
|
const isRequired = useBooleanProperty(elementRef, 'required', required);
|
|
218
210
|
const isChecked = useBooleanProperty(elementRef, 'checked', checked);
|
|
219
211
|
|
|
220
|
-
// Convert React props to web component attributes
|
|
221
212
|
const webComponentProps: Record<string, any> = {
|
|
222
213
|
...hostProps(props),
|
|
223
214
|
ref: elementRef,
|
|
224
215
|
};
|
|
225
216
|
|
|
226
|
-
// Add conditional attributes
|
|
227
217
|
if (isDisabled) webComponentProps.disabled = '';
|
|
228
218
|
if (isRequired) webComponentProps.required = '';
|
|
229
219
|
if (isChecked) webComponentProps.checked = '';
|
|
230
220
|
|
|
231
|
-
// Add string attributes
|
|
232
221
|
if (name) webComponentProps.name = name;
|
|
233
222
|
|
|
234
|
-
// Add debounce attribute
|
|
235
223
|
if (debounce !== undefined) webComponentProps.debounce = debounce;
|
|
236
224
|
|
|
237
225
|
return React.createElement(
|
|
@@ -3,7 +3,6 @@ import { hostProps } from '../utils/host-props';
|
|
|
3
3
|
import { useBooleanProperty, coerceBool } from '../utils/use-boolean-prop';
|
|
4
4
|
import { needsPropertyBridge } from '../utils/react-version';
|
|
5
5
|
|
|
6
|
-
// Event detail structure for modal events
|
|
7
6
|
export interface TyModalEventDetail {
|
|
8
7
|
reason?: 'programmatic' | 'native' | 'backdrop' | 'escape' | 'close-button';
|
|
9
8
|
returnValue?: string;
|
|
@@ -19,7 +18,6 @@ export interface TyModalBeforeCloseDetail {
|
|
|
19
18
|
reason: 'programmatic' | 'backdrop' | 'escape' | 'close-button' | 'native';
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
// Type definitions for Ty Modal component
|
|
23
21
|
export interface TyModalProps extends React.HTMLAttributes<HTMLElement> {
|
|
24
22
|
/** Controls modal visibility */
|
|
25
23
|
open?: boolean;
|
|
@@ -52,7 +50,6 @@ export interface TyModalProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
52
50
|
children?: React.ReactNode;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
// Ref interface for imperative methods
|
|
56
53
|
export interface TyModalRef {
|
|
57
54
|
show: () => void;
|
|
58
55
|
/**
|
|
@@ -64,7 +61,6 @@ export interface TyModalRef {
|
|
|
64
61
|
element: HTMLElement | null;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
// React wrapper for ty-modal web component
|
|
68
64
|
export const TyModal = React.forwardRef<TyModalRef, TyModalProps>(
|
|
69
65
|
({
|
|
70
66
|
open,
|
|
@@ -80,7 +76,6 @@ export const TyModal = React.forwardRef<TyModalRef, TyModalProps>(
|
|
|
80
76
|
}, ref) => {
|
|
81
77
|
const elementRef = useRef<HTMLElement>(null);
|
|
82
78
|
|
|
83
|
-
// Expose imperative methods through ref
|
|
84
79
|
useImperativeHandle(ref, () => ({
|
|
85
80
|
show: () => {
|
|
86
81
|
if (elementRef.current && typeof (elementRef.current as any).show === 'function') {
|
|
@@ -95,8 +90,6 @@ export const TyModal = React.forwardRef<TyModalRef, TyModalProps>(
|
|
|
95
90
|
element: elementRef.current,
|
|
96
91
|
}), []);
|
|
97
92
|
|
|
98
|
-
// Handle modal events.
|
|
99
|
-
//
|
|
100
93
|
// ty-dropdown, ty-multiselect, ty-date-picker etc. dispatch their own
|
|
101
94
|
// `open`/`close` custom events with `bubbles: true, composed: true` when
|
|
102
95
|
// their internal popups toggle. Those events bubble up through the
|
|
@@ -125,7 +118,6 @@ export const TyModal = React.forwardRef<TyModalRef, TyModalProps>(
|
|
|
125
118
|
if (onBeforeClose) onBeforeClose(event);
|
|
126
119
|
};
|
|
127
120
|
|
|
128
|
-
// Listen for custom modal events
|
|
129
121
|
if (onOpen) {
|
|
130
122
|
element.addEventListener('open', handleOpen as EventListener);
|
|
131
123
|
}
|
|
@@ -172,7 +164,6 @@ export const TyModal = React.forwardRef<TyModalRef, TyModalProps>(
|
|
|
172
164
|
setIf('closeOnEscape', closeOnEscape);
|
|
173
165
|
}, [backdrop, closeOnOutsideClick, closeOnEscape]);
|
|
174
166
|
|
|
175
|
-
// Convert React props to web component attributes
|
|
176
167
|
const webComponentProps: Record<string, any> = {
|
|
177
168
|
...hostProps(props),
|
|
178
169
|
ref: elementRef,
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
4
4
|
|
|
5
|
-
// Type definitions for Ty Option component
|
|
6
5
|
export interface TyOptionProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
6
|
value?: string;
|
|
8
7
|
|
|
@@ -22,12 +21,10 @@ export interface TyOptionProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
21
|
children?: React.ReactNode;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// React wrapper for ty-option web component
|
|
26
24
|
export const TyOption = React.forwardRef<HTMLElement, TyOptionProps>(
|
|
27
25
|
({ children, label, flavor, disabled, selected, hidden, ...props }, ref) => {
|
|
28
26
|
const elementRef = useRef<HTMLElement>(null);
|
|
29
27
|
|
|
30
|
-
// Handle ref forwarding
|
|
31
28
|
useEffect(() => {
|
|
32
29
|
if (ref && elementRef.current) {
|
|
33
30
|
if (typeof ref === 'function') {
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
4
4
|
|
|
5
|
-
// Type definitions for Ty Popup component
|
|
6
5
|
export interface TyPopupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClose'> {
|
|
7
6
|
/** Preferred placement of the popup relative to anchor parent: "top" | "bottom" | "left" | "right" */
|
|
8
7
|
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -26,14 +25,12 @@ export interface TyPopupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
26
25
|
children?: React.ReactNode;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
// Programmatic API for popup control
|
|
30
28
|
export interface TyPopupElement extends HTMLElement {
|
|
31
29
|
openPopup(): void;
|
|
32
30
|
closePopup(): void;
|
|
33
31
|
togglePopup(): void;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
// React wrapper for ty-popup web component
|
|
37
34
|
export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
38
35
|
({
|
|
39
36
|
placement,
|
|
@@ -47,7 +44,6 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
|
47
44
|
}, ref) => {
|
|
48
45
|
const elementRef = useRef<TyPopupElement>(null);
|
|
49
46
|
|
|
50
|
-
// Handle ref forwarding
|
|
51
47
|
useEffect(() => {
|
|
52
48
|
if (ref && elementRef.current) {
|
|
53
49
|
if (typeof ref === 'function') {
|
|
@@ -85,13 +81,11 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
|
85
81
|
};
|
|
86
82
|
}, [onOpen, onClose]);
|
|
87
83
|
|
|
88
|
-
// Convert React props to web component attributes
|
|
89
84
|
const webComponentProps: Record<string, any> = {
|
|
90
85
|
...hostProps(props),
|
|
91
86
|
ref: elementRef,
|
|
92
87
|
};
|
|
93
88
|
|
|
94
|
-
// Add optional attributes only if they have values
|
|
95
89
|
if (placement) {
|
|
96
90
|
webComponentProps.placement = placement;
|
|
97
91
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
|
|
4
|
-
// Type definitions for Ty ResizeObserver component
|
|
5
4
|
export interface TyResizeObserverProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
5
|
/** Required unique identifier for size registry */
|
|
7
6
|
id: string;
|
|
@@ -13,7 +12,6 @@ export interface TyResizeObserverProps extends React.HTMLAttributes<HTMLElement>
|
|
|
13
12
|
children?: React.ReactNode;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
// React wrapper for ty-resize-observer web component
|
|
17
15
|
export const TyResizeObserver = React.forwardRef<HTMLElement, TyResizeObserverProps>(
|
|
18
16
|
({
|
|
19
17
|
children,
|
|
@@ -23,7 +21,6 @@ export const TyResizeObserver = React.forwardRef<HTMLElement, TyResizeObserverPr
|
|
|
23
21
|
}, ref) => {
|
|
24
22
|
const elementRef = useRef<HTMLElement>(null);
|
|
25
23
|
|
|
26
|
-
// Combine refs if needed
|
|
27
24
|
useEffect(() => {
|
|
28
25
|
if (ref && elementRef.current) {
|
|
29
26
|
if (typeof ref === 'function') {
|
|
@@ -34,14 +31,12 @@ export const TyResizeObserver = React.forwardRef<HTMLElement, TyResizeObserverPr
|
|
|
34
31
|
}
|
|
35
32
|
}, [ref]);
|
|
36
33
|
|
|
37
|
-
// Convert React props to web component attributes
|
|
38
34
|
const webComponentProps: Record<string, any> = {
|
|
39
35
|
...hostProps(props),
|
|
40
36
|
ref: elementRef,
|
|
41
37
|
id,
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
// Add number attributes
|
|
45
40
|
if (debounce !== undefined) webComponentProps.debounce = debounce;
|
|
46
41
|
|
|
47
42
|
return React.createElement(
|
|
@@ -11,7 +11,6 @@ export interface TyScrollNearEdgeDetail {
|
|
|
11
11
|
clientHeight: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// Type definitions for Ty ScrollContainer component
|
|
15
14
|
export interface TyScrollContainerProps extends React.HTMLAttributes<HTMLElement> {
|
|
16
15
|
/** Maximum height of the scroll container */
|
|
17
16
|
maxHeight?: string;
|
|
@@ -44,7 +43,6 @@ export interface TyScrollContainerProps extends React.HTMLAttributes<HTMLElement
|
|
|
44
43
|
children?: React.ReactNode;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
// Ref interface for imperative methods
|
|
48
46
|
export interface TyScrollContainerRef {
|
|
49
47
|
/** Force update shadows (useful after dynamic content changes) */
|
|
50
48
|
updateShadows: () => void;
|
|
@@ -64,7 +62,6 @@ export interface TyScrollContainerRef {
|
|
|
64
62
|
element: HTMLElement | null;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
// React wrapper for ty-scroll-container web component
|
|
68
65
|
export const TyScrollContainer = React.forwardRef<TyScrollContainerRef, TyScrollContainerProps>(
|
|
69
66
|
({
|
|
70
67
|
children,
|
|
@@ -81,7 +78,6 @@ export const TyScrollContainer = React.forwardRef<TyScrollContainerRef, TyScroll
|
|
|
81
78
|
}, ref) => {
|
|
82
79
|
const elementRef = useRef<HTMLElement>(null);
|
|
83
80
|
|
|
84
|
-
// Expose imperative methods via ref
|
|
85
81
|
useImperativeHandle(ref, () => ({
|
|
86
82
|
updateShadows: () => { (elementRef.current as any)?.updateShadows?.(); },
|
|
87
83
|
scrollToTop: (smooth = true) => { (elementRef.current as any)?.scrollToTop?.(smooth); },
|
|
@@ -109,7 +105,6 @@ export const TyScrollContainer = React.forwardRef<TyScrollContainerRef, TyScroll
|
|
|
109
105
|
const isOverflowX = useBooleanProperty(elementRef, 'overflowX', overflowX);
|
|
110
106
|
const isScrollAnchoring = useBooleanProperty(elementRef, 'scrollAnchoring', scrollAnchoring);
|
|
111
107
|
|
|
112
|
-
// Custom events → React callbacks
|
|
113
108
|
useEffect(() => {
|
|
114
109
|
const el = elementRef.current;
|
|
115
110
|
if (!el) return;
|
|
@@ -125,17 +120,14 @@ export const TyScrollContainer = React.forwardRef<TyScrollContainerRef, TyScroll
|
|
|
125
120
|
return () => bound.forEach(([n, h]) => el.removeEventListener(n, h));
|
|
126
121
|
}, [onNearEnd, onNearStart]);
|
|
127
122
|
|
|
128
|
-
// Convert React props to web component attributes
|
|
129
123
|
const webComponentProps: Record<string, any> = {
|
|
130
124
|
...hostProps(props),
|
|
131
125
|
ref: elementRef,
|
|
132
126
|
};
|
|
133
127
|
|
|
134
|
-
// String attributes
|
|
135
128
|
if (maxHeight) webComponentProps['max-height'] = maxHeight;
|
|
136
129
|
if (nearEdgeThreshold != null) webComponentProps['near-edge-threshold'] = String(nearEdgeThreshold);
|
|
137
130
|
|
|
138
|
-
// Boolean attributes
|
|
139
131
|
if (shadow !== undefined && !coerceBool(shadow)) webComponentProps.shadow = 'false';
|
|
140
132
|
if (isHideScrollbar) webComponentProps['hide-scrollbar'] = '';
|
|
141
133
|
if (isCustomScrollbar) webComponentProps['custom-scrollbar'] = '';
|
|
@@ -6,7 +6,6 @@ import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
|
6
6
|
type BuiltinFlavor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
7
7
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
8
8
|
|
|
9
|
-
// Type definitions for Ty Select component
|
|
10
9
|
export interface TySelectItem {
|
|
11
10
|
value: string;
|
|
12
11
|
label: string;
|
|
@@ -21,7 +20,7 @@ export interface TySelectEventDetail {
|
|
|
21
20
|
/** Rich info per selected value — enough to render chips out-of-band */
|
|
22
21
|
items: TySelectItem[];
|
|
23
22
|
/** Action that triggered the change */
|
|
24
|
-
action: 'add' | 'remove' | 'clear' | 'set';
|
|
23
|
+
action: 'add' | 'remove' | 'clear' | 'set' | 'create';
|
|
25
24
|
/** The specific value that changed */
|
|
26
25
|
item: string | null;
|
|
27
26
|
}
|
|
@@ -93,6 +92,12 @@ export interface TySelectProps extends Omit<React.HTMLAttributes<HTMLElement>, '
|
|
|
93
92
|
/** Field size — fields come in exactly three; legacy xs/xl map to sm/lg */
|
|
94
93
|
size?: 'sm' | 'md' | 'lg';
|
|
95
94
|
|
|
95
|
+
/** Horizontal popup anchor: "start" (default, trigger's left edge) or "end" (trigger's right edge) — clamped into the viewport either way. Useful with a custom slot="trigger" element. */
|
|
96
|
+
align?: 'start' | 'end';
|
|
97
|
+
|
|
98
|
+
/** Built-in x clear button in the default/compact trigger, shown once something is selected. Default true. Not shown with slot="trigger" — use the ref's clear() method there instead. */
|
|
99
|
+
clearable?: boolean;
|
|
100
|
+
|
|
96
101
|
/** Visual flavor for the field border — built-in semantic, +/- shade, or a custom flavor backed by --ty-*-X tokens */
|
|
97
102
|
flavor?: ShadedFlavor | (string & {});
|
|
98
103
|
|
|
@@ -115,8 +120,12 @@ export interface TySelectProps extends Omit<React.HTMLAttributes<HTMLElement>, '
|
|
|
115
120
|
children?: React.ReactNode;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
export
|
|
123
|
+
/** The underlying custom element, typed with its imperative clear() method — useful with a ref, e.g. for slot="trigger" custom triggers that call it directly instead of relying on the built-in clear button. */
|
|
124
|
+
export interface TySelectElement extends HTMLElement {
|
|
125
|
+
clear(): void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
120
129
|
({
|
|
121
130
|
value,
|
|
122
131
|
multiple,
|
|
@@ -134,6 +143,8 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
134
143
|
createTransform,
|
|
135
144
|
loading,
|
|
136
145
|
size,
|
|
146
|
+
align,
|
|
147
|
+
clearable,
|
|
137
148
|
flavor,
|
|
138
149
|
onChange,
|
|
139
150
|
onSearch,
|
|
@@ -143,9 +154,8 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
143
154
|
children,
|
|
144
155
|
...props
|
|
145
156
|
}, ref) => {
|
|
146
|
-
const elementRef = useRef<
|
|
157
|
+
const elementRef = useRef<TySelectElement>(null);
|
|
147
158
|
|
|
148
|
-
// Handle ref forwarding
|
|
149
159
|
useEffect(() => {
|
|
150
160
|
if (ref && elementRef.current) {
|
|
151
161
|
if (typeof ref === 'function') {
|
|
@@ -168,7 +178,6 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
168
178
|
}
|
|
169
179
|
}, [value]);
|
|
170
180
|
|
|
171
|
-
// Handle events
|
|
172
181
|
const handleChange = useCallback((event: Event) => {
|
|
173
182
|
if (onChange) onChange(event as CustomEvent<TySelectEventDetail>);
|
|
174
183
|
}, [onChange]);
|
|
@@ -183,7 +192,6 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
183
192
|
if (onCreate) onCreate(event as CustomEvent<{ value: string; label: string }>);
|
|
184
193
|
}, [onCreate]);
|
|
185
194
|
|
|
186
|
-
// Set up event listeners
|
|
187
195
|
useEffect(() => {
|
|
188
196
|
const element = elementRef.current;
|
|
189
197
|
if (!element) return;
|
|
@@ -212,14 +220,13 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
212
220
|
const isLoading = useBooleanProperty(elementRef, 'loading', loading);
|
|
213
221
|
const isExternalSearch = useBooleanProperty(elementRef, 'externalSearch', externalSearch);
|
|
214
222
|
const isAllowCreate = useBooleanProperty(elementRef, 'allowCreate', allowCreate);
|
|
223
|
+
const isClearable = useBooleanProperty(elementRef, 'clearable', clearable);
|
|
215
224
|
|
|
216
|
-
// Convert React props to web component attributes
|
|
217
225
|
const webComponentProps: Record<string, any> = {
|
|
218
226
|
...hostProps(props),
|
|
219
227
|
ref: elementRef,
|
|
220
228
|
};
|
|
221
229
|
|
|
222
|
-
// Handle value conversion (array to comma-separated string)
|
|
223
230
|
if (value !== undefined) {
|
|
224
231
|
webComponentProps.value = Array.isArray(value) ? value.join(',') : value;
|
|
225
232
|
}
|
|
@@ -237,6 +244,8 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
237
244
|
if (label) webComponentProps.label = label;
|
|
238
245
|
if (name) webComponentProps.name = name;
|
|
239
246
|
if (size) webComponentProps.size = size;
|
|
247
|
+
if (align) webComponentProps.align = align;
|
|
248
|
+
if (isClearable) webComponentProps.clearable = '';
|
|
240
249
|
if (flavor) webComponentProps.flavor = flavor;
|
|
241
250
|
if (debounce !== undefined) webComponentProps.debounce = debounce.toString();
|
|
242
251
|
if (createTransform) webComponentProps['create-transform'] = createTransform;
|
|
@@ -250,11 +259,9 @@ export const TySelect = React.forwardRef<HTMLElement, TySelectProps>(
|
|
|
250
259
|
|
|
251
260
|
TySelect.displayName = 'TySelect';
|
|
252
261
|
|
|
253
|
-
// ============================================================================
|
|
254
262
|
// TySelectedOptions — out-of-band chip display for a TySelect
|
|
255
263
|
// (ty-selected-tags below is the same element under its original tag name,
|
|
256
264
|
// kept for backward compatibility.)
|
|
257
|
-
// ============================================================================
|
|
258
265
|
|
|
259
266
|
export interface TySelectedTagsProps extends React.HTMLAttributes<HTMLElement> {
|
|
260
267
|
/** id of the ty-select to display. Falls back to the previous element sibling. */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
|
|
4
|
-
// Type definitions for Ty Step component
|
|
5
4
|
export interface TyStepProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
5
|
/** Required unique identifier for the step */
|
|
7
6
|
id: string;
|
|
@@ -22,7 +21,6 @@ export interface TyStepProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
21
|
children?: React.ReactNode;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// React wrapper for ty-step web component
|
|
26
24
|
export const TyStep = React.forwardRef<HTMLElement, TyStepProps>(
|
|
27
25
|
({
|
|
28
26
|
children,
|
|
@@ -35,7 +33,6 @@ export const TyStep = React.forwardRef<HTMLElement, TyStepProps>(
|
|
|
35
33
|
}, ref) => {
|
|
36
34
|
const elementRef = useRef<HTMLElement>(null);
|
|
37
35
|
|
|
38
|
-
// Combine refs if needed
|
|
39
36
|
useEffect(() => {
|
|
40
37
|
if (ref && elementRef.current) {
|
|
41
38
|
if (typeof ref === 'function') {
|
|
@@ -46,19 +43,16 @@ export const TyStep = React.forwardRef<HTMLElement, TyStepProps>(
|
|
|
46
43
|
}
|
|
47
44
|
}, [ref]);
|
|
48
45
|
|
|
49
|
-
// Convert React props to web component attributes
|
|
50
46
|
const webComponentProps: Record<string, any> = {
|
|
51
47
|
...hostProps(props),
|
|
52
48
|
ref: elementRef,
|
|
53
49
|
id,
|
|
54
50
|
};
|
|
55
51
|
|
|
56
|
-
// Add string attributes
|
|
57
52
|
if (label) webComponentProps.label = label;
|
|
58
53
|
if (description) webComponentProps.description = description;
|
|
59
54
|
if (status) webComponentProps.status = status;
|
|
60
55
|
|
|
61
|
-
// Add boolean attributes
|
|
62
56
|
if (disabled) webComponentProps.disabled = true;
|
|
63
57
|
|
|
64
58
|
return React.createElement(
|
package/src/components/TyTab.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
4
4
|
|
|
5
|
-
// Type definitions for Ty Tab component
|
|
6
5
|
export interface TyTabProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
6
|
/** Required unique identifier */
|
|
8
7
|
id: string;
|
|
@@ -17,7 +16,6 @@ export interface TyTabProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
17
16
|
children?: React.ReactNode;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
// React wrapper for ty-tab web component
|
|
21
19
|
export const TyTab = React.forwardRef<HTMLElement, TyTabProps>(
|
|
22
20
|
({
|
|
23
21
|
children,
|
|
@@ -28,7 +26,6 @@ export const TyTab = React.forwardRef<HTMLElement, TyTabProps>(
|
|
|
28
26
|
}, ref) => {
|
|
29
27
|
const elementRef = useRef<HTMLElement>(null);
|
|
30
28
|
|
|
31
|
-
// Combine refs if needed
|
|
32
29
|
useEffect(() => {
|
|
33
30
|
if (ref && elementRef.current) {
|
|
34
31
|
if (typeof ref === 'function') {
|
|
@@ -39,20 +36,16 @@ export const TyTab = React.forwardRef<HTMLElement, TyTabProps>(
|
|
|
39
36
|
}
|
|
40
37
|
}, [ref]);
|
|
41
38
|
|
|
42
|
-
// Convert React props to web component attributes
|
|
43
39
|
const webComponentProps: Record<string, any> = {
|
|
44
40
|
...hostProps(props),
|
|
45
41
|
ref: elementRef,
|
|
46
42
|
};
|
|
47
43
|
|
|
48
|
-
// Add required attribute
|
|
49
44
|
webComponentProps.id = id;
|
|
50
45
|
|
|
51
|
-
// Add boolean attributes
|
|
52
46
|
const isDisabled = useBooleanProperty(elementRef, 'disabled', disabled);
|
|
53
47
|
if (isDisabled) webComponentProps.disabled = '';
|
|
54
48
|
|
|
55
|
-
// Add string attributes
|
|
56
49
|
if (label) webComponentProps.label = label;
|
|
57
50
|
|
|
58
51
|
return React.createElement(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
|
|
4
|
-
// Type definitions for Ty Tabs component
|
|
5
4
|
export interface TyTabsProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
6
5
|
/** Content area width (accepts px or %) */
|
|
7
6
|
width?: string;
|
|
@@ -29,7 +28,6 @@ export interface TabChangeDetail {
|
|
|
29
28
|
previousIndex: number | null;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
// React wrapper for ty-tabs web component
|
|
33
31
|
export const TyTabs = React.forwardRef<HTMLElement, TyTabsProps>(
|
|
34
32
|
({
|
|
35
33
|
children,
|
|
@@ -42,7 +40,6 @@ export const TyTabs = React.forwardRef<HTMLElement, TyTabsProps>(
|
|
|
42
40
|
}, ref) => {
|
|
43
41
|
const elementRef = useRef<HTMLElement>(null);
|
|
44
42
|
|
|
45
|
-
// Handle change events
|
|
46
43
|
useEffect(() => {
|
|
47
44
|
const element = elementRef.current;
|
|
48
45
|
if (!element) return;
|
|
@@ -60,7 +57,6 @@ export const TyTabs = React.forwardRef<HTMLElement, TyTabsProps>(
|
|
|
60
57
|
};
|
|
61
58
|
}, [onChange]);
|
|
62
59
|
|
|
63
|
-
// Combine refs if needed
|
|
64
60
|
useEffect(() => {
|
|
65
61
|
if (ref && elementRef.current) {
|
|
66
62
|
if (typeof ref === 'function') {
|
|
@@ -71,13 +67,11 @@ export const TyTabs = React.forwardRef<HTMLElement, TyTabsProps>(
|
|
|
71
67
|
}
|
|
72
68
|
}, [ref]);
|
|
73
69
|
|
|
74
|
-
// Convert React props to web component attributes
|
|
75
70
|
const webComponentProps: Record<string, any> = {
|
|
76
71
|
...hostProps(props),
|
|
77
72
|
ref: elementRef,
|
|
78
73
|
};
|
|
79
74
|
|
|
80
|
-
// Add string attributes
|
|
81
75
|
if (width) webComponentProps.width = width;
|
|
82
76
|
if (height) webComponentProps.height = height;
|
|
83
77
|
if (active) webComponentProps.active = active;
|
package/src/components/TyTag.tsx
CHANGED
|
@@ -12,7 +12,6 @@ export interface TyTagCSSProperties extends React.CSSProperties {
|
|
|
12
12
|
'--tag-border-color'?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// Type definitions for Ty Tag component
|
|
16
15
|
export interface TyTagProps extends Omit<React.HTMLAttributes<HTMLElement>, 'style' | 'onClick'> {
|
|
17
16
|
flavor?: ShadedFlavor | (string & {});
|
|
18
17
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -29,7 +28,6 @@ export interface TyTagProps extends Omit<React.HTMLAttributes<HTMLElement>, 'sty
|
|
|
29
28
|
children?: React.ReactNode;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
// React wrapper for ty-tag web component
|
|
33
31
|
export const TyTag = React.forwardRef<HTMLElement, TyTagProps>(
|
|
34
32
|
({ children, onClick, onTagDismiss, notPill, clickable, dismissible, disabled, selected, ...props }, ref) => {
|
|
35
33
|
const elementRef = useRef<HTMLElement>(null);
|
|
@@ -51,7 +49,6 @@ export const TyTag = React.forwardRef<HTMLElement, TyTagProps>(
|
|
|
51
49
|
};
|
|
52
50
|
}, [handleDismiss, onTagDismiss]);
|
|
53
51
|
|
|
54
|
-
// Handle ref forwarding
|
|
55
52
|
useEffect(() => {
|
|
56
53
|
if (ref && elementRef.current) {
|
|
57
54
|
if (typeof ref === 'function') {
|
|
@@ -3,13 +3,11 @@ import { hostProps } from '../utils/host-props';
|
|
|
3
3
|
import { needsPropertyBridge } from '../utils/react-version';
|
|
4
4
|
import { useBooleanProperty } from '../utils/use-boolean-prop';
|
|
5
5
|
|
|
6
|
-
// Event detail structure for ty-textarea events
|
|
7
6
|
export interface TyTextareaEventDetail {
|
|
8
7
|
value: string; // textarea value
|
|
9
8
|
originalEvent: Event; // original DOM event
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
// Type definitions for Ty Textarea component
|
|
13
11
|
export interface TyTextareaProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'style'> {
|
|
14
12
|
style?: import('./TyInput').TyInputCSSProperties;
|
|
15
13
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -51,7 +49,6 @@ export interface TyTextareaProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
51
49
|
// One-time warning flag.
|
|
52
50
|
let _warnedOnInputProp = false;
|
|
53
51
|
|
|
54
|
-
// React wrapper for ty-textarea web component
|
|
55
52
|
export const TyTextarea = React.forwardRef<HTMLElement, TyTextareaProps>(
|
|
56
53
|
({ onChange, onChangeCommit, onFocus, onBlur, disabled, required, minHeight, maxHeight, ...props }, ref) => {
|
|
57
54
|
const elementRef = useRef<HTMLElement>(null);
|
|
@@ -102,18 +99,14 @@ export const TyTextarea = React.forwardRef<HTMLElement, TyTextareaProps>(
|
|
|
102
99
|
const element = elementRef.current;
|
|
103
100
|
if (!element) return;
|
|
104
101
|
|
|
105
|
-
// Listen for custom input/change events from ty-textarea
|
|
106
|
-
// Map onChange → input event (React convention)
|
|
107
102
|
if (onChange) {
|
|
108
103
|
element.addEventListener('input', handleInput as EventListener);
|
|
109
104
|
}
|
|
110
105
|
|
|
111
|
-
// Map onChangeCommit → change event (blur behavior)
|
|
112
106
|
if (onChangeCommit) {
|
|
113
107
|
element.addEventListener('change', handleChangeCommit as EventListener);
|
|
114
108
|
}
|
|
115
109
|
|
|
116
|
-
// Listen for standard focus/blur events
|
|
117
110
|
if (onFocus) {
|
|
118
111
|
element.addEventListener('focus', handleFocus as EventListener);
|
|
119
112
|
}
|
|
@@ -138,7 +131,6 @@ export const TyTextarea = React.forwardRef<HTMLElement, TyTextareaProps>(
|
|
|
138
131
|
};
|
|
139
132
|
}, [handleInput, handleChangeCommit, handleFocus, handleBlur, onChange, onChangeCommit, onFocus, onBlur]);
|
|
140
133
|
|
|
141
|
-
// Handle ref forwarding
|
|
142
134
|
useEffect(() => {
|
|
143
135
|
if (ref && elementRef.current) {
|
|
144
136
|
if (typeof ref === 'function') {
|