tyrell-react 1.0.0-RC13 → 1.0.0-RC15
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/TyButton.d.ts +1 -1
- package/dist/components/TyButton.d.ts.map +1 -1
- package/dist/components/TyCalendar.d.ts +4 -3
- package/dist/components/TyCalendar.d.ts.map +1 -1
- package/dist/components/TyCalendar.js +4 -12
- package/dist/components/TyCalendar.js.map +1 -1
- package/dist/components/TyCalendarMonth.d.ts +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 +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 +4 -2
- package/dist/components/TyCopy.d.ts.map +1 -1
- package/dist/components/TyCopy.js +4 -7
- package/dist/components/TyCopy.js.map +1 -1
- package/dist/components/TyDatePicker.d.ts +7 -3
- package/dist/components/TyDatePicker.d.ts.map +1 -1
- package/dist/components/TyDatePicker.js +6 -12
- 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 +4 -4
- 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 +16 -2
- package/dist/components/TyModal.d.ts.map +1 -1
- package/dist/components/TyModal.js +17 -17
- package/dist/components/TyModal.js.map +1 -1
- package/dist/components/TyOption.d.ts +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 +4 -2
- package/dist/components/TyPopup.d.ts.map +1 -1
- package/dist/components/TyPopup.js +2 -9
- package/dist/components/TyPopup.js.map +1 -1
- package/dist/components/TyRadio.d.ts +1 -1
- package/dist/components/TyRadio.d.ts.map +1 -1
- package/dist/components/TyRadioGroup.d.ts +1 -1
- package/dist/components/TyRadioGroup.d.ts.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 +13 -11
- package/dist/components/TySelect.d.ts.map +1 -1
- package/dist/components/TySelect.js +5 -12
- 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/TySwitch.d.ts +1 -1
- package/dist/components/TySwitch.d.ts.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 +2 -0
- package/dist/components/TyTabs.d.ts.map +1 -1
- package/dist/components/TyTabs.js +4 -6
- package/dist/components/TyTabs.js.map +1 -1
- package/dist/components/TyTag.d.ts +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 +4 -3
- 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/TyButton.tsx +1 -1
- package/src/components/TyCalendar.tsx +7 -15
- package/src/components/TyCalendarMonth.tsx +1 -7
- package/src/components/TyCalendarNavigation.tsx +0 -6
- package/src/components/TyCheckbox.tsx +1 -10
- package/src/components/TyCopy.tsx +8 -9
- package/src/components/TyDatePicker.tsx +20 -16
- package/src/components/TyFileUpload.tsx +0 -2
- package/src/components/TyIcon.tsx +0 -5
- package/src/components/TyInput.tsx +4 -16
- package/src/components/TyModal.tsx +36 -21
- package/src/components/TyOption.tsx +1 -4
- package/src/components/TyPopup.tsx +10 -13
- package/src/components/TyRadio.tsx +1 -1
- package/src/components/TyRadioGroup.tsx +1 -1
- package/src/components/TyResizeObserver.tsx +0 -5
- package/src/components/TyScrollContainer.tsx +0 -8
- package/src/components/TySelect.tsx +22 -24
- package/src/components/TyStep.tsx +0 -6
- package/src/components/TySwitch.tsx +1 -1
- package/src/components/TyTab.tsx +0 -7
- package/src/components/TyTabs.tsx +6 -6
- package/src/components/TyTag.tsx +1 -4
- package/src/components/TyTextarea.tsx +0 -8
- package/src/components/TyTooltip.tsx +8 -8
- package/src/components/TyWizard.tsx +0 -6
- package/src/components/index.ts +2 -97
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"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"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
// Generated from package.json by scripts/generate-version.js
|
|
3
3
|
// Run 'npm run generate:version' to regenerate.
|
|
4
4
|
/** Current version of tyrell-react. Synced with package.json on build. */
|
|
5
|
-
export const VERSION = '1.0.0-
|
|
5
|
+
export const VERSION = '1.0.0-RC15';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ 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 BuiltinFlavor = 'primary' | '
|
|
5
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
6
6
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
7
7
|
type ButtonAppearance = 'solid' | 'outlined' | 'ghost';
|
|
8
8
|
|
|
@@ -3,10 +3,9 @@ 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
|
-
type BuiltinFlavor = 'primary' | '
|
|
6
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
7
7
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
8
8
|
|
|
9
|
-
// Type definitions for Ty Calendar component
|
|
10
9
|
export interface TyCalendarChangeEventDetail {
|
|
11
10
|
/** Selected month (1-12) */
|
|
12
11
|
month: number;
|
|
@@ -43,8 +42,9 @@ export interface TyCalendarProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
43
42
|
/** Selected day (1-31) */
|
|
44
43
|
day?: number | string;
|
|
45
44
|
|
|
46
|
-
/**
|
|
47
|
-
|
|
45
|
+
/** Hide the month/year navigation bar. Shown by default — this is the
|
|
46
|
+
* opt-out, for when you drive the displayed month yourself. */
|
|
47
|
+
hideNavigation?: boolean;
|
|
48
48
|
|
|
49
49
|
/** Stateless mode - no internal state management */
|
|
50
50
|
stateless?: boolean;
|
|
@@ -98,13 +98,12 @@ export interface TyCalendarProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
98
98
|
onDayClick?: (event: CustomEvent) => void;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
// React wrapper for ty-calendar web component
|
|
102
101
|
export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
103
102
|
({
|
|
104
103
|
year,
|
|
105
104
|
month,
|
|
106
105
|
day,
|
|
107
|
-
|
|
106
|
+
hideNavigation,
|
|
108
107
|
stateless,
|
|
109
108
|
size,
|
|
110
109
|
flavor,
|
|
@@ -126,7 +125,6 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
126
125
|
}, ref) => {
|
|
127
126
|
const elementRef = useRef<HTMLElement>(null);
|
|
128
127
|
|
|
129
|
-
// Handle ref forwarding
|
|
130
128
|
useEffect(() => {
|
|
131
129
|
if (ref && elementRef.current) {
|
|
132
130
|
if (typeof ref === 'function') {
|
|
@@ -137,7 +135,6 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
137
135
|
}
|
|
138
136
|
}, [ref]);
|
|
139
137
|
|
|
140
|
-
// Handle change events (date selection)
|
|
141
138
|
const handleChange = useCallback((event: Event) => {
|
|
142
139
|
const customEvent = event as CustomEvent<TyCalendarChangeEventDetail>;
|
|
143
140
|
if (onChange) {
|
|
@@ -145,7 +142,6 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
145
142
|
}
|
|
146
143
|
}, [onChange]);
|
|
147
144
|
|
|
148
|
-
// Handle navigate events (month/year navigation)
|
|
149
145
|
const handleNavigate = useCallback((event: Event) => {
|
|
150
146
|
const customEvent = event as CustomEvent<TyCalendarNavigateEventDetail>;
|
|
151
147
|
if (onNavigate) {
|
|
@@ -157,7 +153,6 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
157
153
|
if (onDayClick) onDayClick(event as CustomEvent);
|
|
158
154
|
}, [onDayClick]);
|
|
159
155
|
|
|
160
|
-
// Set up event listeners
|
|
161
156
|
useEffect(() => {
|
|
162
157
|
const element = elementRef.current;
|
|
163
158
|
if (!element) return;
|
|
@@ -208,7 +203,6 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
208
203
|
(element as any).dayClassesFn = null;
|
|
209
204
|
}
|
|
210
205
|
|
|
211
|
-
// Custom CSS property
|
|
212
206
|
if (customCSS) {
|
|
213
207
|
(element as any).customCSS = customCSS;
|
|
214
208
|
} else {
|
|
@@ -216,13 +210,11 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
216
210
|
}
|
|
217
211
|
}, [dayContentFn, dayClassesFn, customCSS]);
|
|
218
212
|
|
|
219
|
-
// Convert React props to web component attributes
|
|
220
213
|
const webComponentProps: Record<string, any> = {
|
|
221
214
|
...hostProps(props),
|
|
222
215
|
ref: elementRef,
|
|
223
216
|
};
|
|
224
217
|
|
|
225
|
-
// Add optional attributes only if they have values
|
|
226
218
|
if (year !== undefined) {
|
|
227
219
|
webComponentProps.year = year.toString();
|
|
228
220
|
}
|
|
@@ -235,10 +227,10 @@ export const TyCalendar = React.forwardRef<HTMLElement, TyCalendarProps>(
|
|
|
235
227
|
webComponentProps.day = day.toString();
|
|
236
228
|
}
|
|
237
229
|
|
|
238
|
-
const
|
|
230
|
+
const isHideNavigation = useBooleanProperty(elementRef, 'hideNavigation', hideNavigation);
|
|
239
231
|
const isStateless = useBooleanProperty(elementRef, 'stateless', stateless);
|
|
240
232
|
|
|
241
|
-
if (
|
|
233
|
+
if (isHideNavigation) webComponentProps['hide-navigation'] = '';
|
|
242
234
|
if (isStateless) webComponentProps.stateless = '';
|
|
243
235
|
|
|
244
236
|
if (size) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { hostProps } from '../utils/host-props';
|
|
3
3
|
|
|
4
|
-
type BuiltinFlavor = 'primary' | '
|
|
4
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
5
5
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
6
6
|
|
|
7
|
-
// Type definitions for Ty Calendar Month component
|
|
8
7
|
export interface TyCalendarMonthProps extends React.HTMLAttributes<HTMLElement> {
|
|
9
8
|
/** Display year */
|
|
10
9
|
displayYear?: number;
|
|
@@ -52,7 +51,6 @@ export interface DayClickDetail {
|
|
|
52
51
|
isOtherMonth: boolean;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
// React wrapper for ty-calendar-month web component
|
|
56
54
|
export const TyCalendarMonth = React.forwardRef<HTMLElement, TyCalendarMonthProps>(
|
|
57
55
|
({
|
|
58
56
|
displayYear,
|
|
@@ -70,7 +68,6 @@ export const TyCalendarMonth = React.forwardRef<HTMLElement, TyCalendarMonthProp
|
|
|
70
68
|
}, ref) => {
|
|
71
69
|
const elementRef = useRef<HTMLElement>(null);
|
|
72
70
|
|
|
73
|
-
// Handle day click events
|
|
74
71
|
useEffect(() => {
|
|
75
72
|
const element = elementRef.current;
|
|
76
73
|
if (!element) return;
|
|
@@ -88,7 +85,6 @@ export const TyCalendarMonth = React.forwardRef<HTMLElement, TyCalendarMonthProp
|
|
|
88
85
|
};
|
|
89
86
|
}, [onDayClick]);
|
|
90
87
|
|
|
91
|
-
// Combine refs if needed
|
|
92
88
|
useEffect(() => {
|
|
93
89
|
if (ref && elementRef.current) {
|
|
94
90
|
if (typeof ref === 'function') {
|
|
@@ -99,13 +95,11 @@ export const TyCalendarMonth = React.forwardRef<HTMLElement, TyCalendarMonthProp
|
|
|
99
95
|
}
|
|
100
96
|
}, [ref]);
|
|
101
97
|
|
|
102
|
-
// Convert React props to web component attributes
|
|
103
98
|
const webComponentProps: Record<string, any> = {
|
|
104
99
|
...hostProps(props),
|
|
105
100
|
ref: elementRef,
|
|
106
101
|
};
|
|
107
102
|
|
|
108
|
-
// Add attributes
|
|
109
103
|
if (displayYear !== undefined) webComponentProps['display-year'] = displayYear;
|
|
110
104
|
if (displayMonth !== undefined) webComponentProps['display-month'] = displayMonth;
|
|
111
105
|
if (locale) webComponentProps.locale = locale;
|
|
@@ -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 Calendar Navigation component
|
|
5
4
|
export interface TyCalendarNavigationProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
6
5
|
/** Display month (1-12) */
|
|
7
6
|
displayMonth?: number;
|
|
@@ -33,7 +32,6 @@ export interface NavigationChangeDetail {
|
|
|
33
32
|
year: number; // e.g., 2025
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
// React wrapper for ty-calendar-navigation web component
|
|
37
35
|
export const TyCalendarNavigation = React.forwardRef<HTMLElement, TyCalendarNavigationProps>(
|
|
38
36
|
({
|
|
39
37
|
displayMonth,
|
|
@@ -48,7 +46,6 @@ export const TyCalendarNavigation = React.forwardRef<HTMLElement, TyCalendarNavi
|
|
|
48
46
|
}, ref) => {
|
|
49
47
|
const elementRef = useRef<HTMLElement>(null);
|
|
50
48
|
|
|
51
|
-
// Handle change events
|
|
52
49
|
useEffect(() => {
|
|
53
50
|
const element = elementRef.current;
|
|
54
51
|
if (!element) return;
|
|
@@ -66,7 +63,6 @@ export const TyCalendarNavigation = React.forwardRef<HTMLElement, TyCalendarNavi
|
|
|
66
63
|
};
|
|
67
64
|
}, [onChange]);
|
|
68
65
|
|
|
69
|
-
// Combine refs if needed
|
|
70
66
|
useEffect(() => {
|
|
71
67
|
if (ref && elementRef.current) {
|
|
72
68
|
if (typeof ref === 'function') {
|
|
@@ -77,13 +73,11 @@ export const TyCalendarNavigation = React.forwardRef<HTMLElement, TyCalendarNavi
|
|
|
77
73
|
}
|
|
78
74
|
}, [ref]);
|
|
79
75
|
|
|
80
|
-
// Convert React props to web component attributes
|
|
81
76
|
const webComponentProps: Record<string, any> = {
|
|
82
77
|
...hostProps(props),
|
|
83
78
|
ref: elementRef,
|
|
84
79
|
};
|
|
85
80
|
|
|
86
|
-
// Add attributes
|
|
87
81
|
if (displayMonth !== undefined) webComponentProps['display-month'] = displayMonth;
|
|
88
82
|
if (displayYear !== undefined) webComponentProps['display-year'] = displayYear;
|
|
89
83
|
if (locale) webComponentProps.locale = locale;
|
|
@@ -2,10 +2,9 @@ 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 BuiltinFlavor = 'primary' | '
|
|
5
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
6
6
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
7
7
|
|
|
8
|
-
// Type definitions for Ty Checkbox component
|
|
9
8
|
export interface TyCheckboxProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onInput'> {
|
|
10
9
|
/** Checked state */
|
|
11
10
|
checked?: boolean;
|
|
@@ -57,7 +56,6 @@ export interface TyCheckboxEventDetail {
|
|
|
57
56
|
originalEvent: Event;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
// React wrapper for ty-checkbox web component
|
|
61
59
|
export const TyCheckbox = React.forwardRef<HTMLElement, TyCheckboxProps>(
|
|
62
60
|
({
|
|
63
61
|
children,
|
|
@@ -76,7 +74,6 @@ export const TyCheckbox = React.forwardRef<HTMLElement, TyCheckboxProps>(
|
|
|
76
74
|
}, ref) => {
|
|
77
75
|
const elementRef = useRef<HTMLElement>(null);
|
|
78
76
|
|
|
79
|
-
// Handle change events
|
|
80
77
|
useEffect(() => {
|
|
81
78
|
const element = elementRef.current;
|
|
82
79
|
if (!element) return;
|
|
@@ -95,10 +92,8 @@ export const TyCheckbox = React.forwardRef<HTMLElement, TyCheckboxProps>(
|
|
|
95
92
|
}
|
|
96
93
|
};
|
|
97
94
|
|
|
98
|
-
// Map onChange → input event (React convention)
|
|
99
95
|
element.addEventListener('input', handleInput);
|
|
100
96
|
|
|
101
|
-
// Map onChangeCommit → change event (blur behavior)
|
|
102
97
|
element.addEventListener('change', handleChangeCommit);
|
|
103
98
|
|
|
104
99
|
return () => {
|
|
@@ -107,7 +102,6 @@ export const TyCheckbox = React.forwardRef<HTMLElement, TyCheckboxProps>(
|
|
|
107
102
|
};
|
|
108
103
|
}, [onChange, onChangeCommit]);
|
|
109
104
|
|
|
110
|
-
// Combine refs if needed
|
|
111
105
|
useEffect(() => {
|
|
112
106
|
if (ref && elementRef.current) {
|
|
113
107
|
if (typeof ref === 'function') {
|
|
@@ -127,19 +121,16 @@ export const TyCheckbox = React.forwardRef<HTMLElement, TyCheckboxProps>(
|
|
|
127
121
|
const isDisabled = useBooleanProperty(elementRef, 'disabled', disabled);
|
|
128
122
|
const isRequired = useBooleanProperty(elementRef, 'required', required);
|
|
129
123
|
|
|
130
|
-
// Convert React props to web component attributes
|
|
131
124
|
const webComponentProps: Record<string, any> = {
|
|
132
125
|
...hostProps(props),
|
|
133
126
|
ref: elementRef,
|
|
134
127
|
};
|
|
135
128
|
|
|
136
|
-
// Add boolean attributes
|
|
137
129
|
if (isChecked) webComponentProps.checked = '';
|
|
138
130
|
if (isIndeterminate) webComponentProps.indeterminate = '';
|
|
139
131
|
if (isDisabled) webComponentProps.disabled = '';
|
|
140
132
|
if (isRequired) webComponentProps.required = '';
|
|
141
133
|
|
|
142
|
-
// Add string attributes
|
|
143
134
|
if (value) webComponentProps.value = value;
|
|
144
135
|
if (name) webComponentProps.name = name;
|
|
145
136
|
if (error) webComponentProps.error = error;
|
|
@@ -2,10 +2,9 @@ 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 BuiltinFlavor = 'primary' | '
|
|
5
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
6
6
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
7
7
|
|
|
8
|
-
// Type definitions for Ty Copy component
|
|
9
8
|
export interface TyCopyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
10
9
|
/** Text to copy */
|
|
11
10
|
value?: string;
|
|
@@ -22,8 +21,11 @@ export interface TyCopyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
22
21
|
/** Display format */
|
|
23
22
|
format?: 'text' | 'code';
|
|
24
23
|
|
|
25
|
-
/**
|
|
24
|
+
/** Wrap and show the full value instead of one ellipsized line */
|
|
26
25
|
multiline?: boolean;
|
|
26
|
+
|
|
27
|
+
/** Scroll long content sideways instead of clipping with an ellipsis */
|
|
28
|
+
horizontalScroll?: boolean;
|
|
27
29
|
|
|
28
30
|
/** Disable the field */
|
|
29
31
|
disabled?: boolean;
|
|
@@ -38,7 +40,6 @@ export interface TyCopyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
38
40
|
onCopyError?: (event: CustomEvent) => void;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
// React wrapper for ty-copy web component
|
|
42
43
|
export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
|
|
43
44
|
({
|
|
44
45
|
value,
|
|
@@ -47,6 +48,7 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
|
|
|
47
48
|
flavor,
|
|
48
49
|
format,
|
|
49
50
|
multiline,
|
|
51
|
+
horizontalScroll,
|
|
50
52
|
disabled,
|
|
51
53
|
required,
|
|
52
54
|
onCopySuccess,
|
|
@@ -55,7 +57,6 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
|
|
|
55
57
|
}, ref) => {
|
|
56
58
|
const elementRef = useRef<HTMLElement>(null);
|
|
57
59
|
|
|
58
|
-
// Handle ref forwarding
|
|
59
60
|
useEffect(() => {
|
|
60
61
|
if (ref && elementRef.current) {
|
|
61
62
|
if (typeof ref === 'function') {
|
|
@@ -66,7 +67,6 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
|
|
|
66
67
|
}
|
|
67
68
|
}, [ref]);
|
|
68
69
|
|
|
69
|
-
// Custom events → React callbacks
|
|
70
70
|
useEffect(() => {
|
|
71
71
|
const el = elementRef.current;
|
|
72
72
|
if (!el) return;
|
|
@@ -83,24 +83,23 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
|
|
|
83
83
|
}, [onCopySuccess, onCopyError]);
|
|
84
84
|
|
|
85
85
|
const isMultiline = useBooleanProperty(elementRef, 'multiline', multiline);
|
|
86
|
+
const isHorizontalScroll = useBooleanProperty(elementRef, 'horizontalScroll', horizontalScroll);
|
|
86
87
|
const isDisabled = useBooleanProperty(elementRef, 'disabled', disabled);
|
|
87
88
|
const isRequired = useBooleanProperty(elementRef, 'required', required);
|
|
88
89
|
|
|
89
|
-
// Convert React props to web component attributes
|
|
90
90
|
const webComponentProps: Record<string, any> = {
|
|
91
91
|
...hostProps(props),
|
|
92
92
|
ref: elementRef,
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
// Add string attributes
|
|
96
95
|
if (value) webComponentProps.value = value;
|
|
97
96
|
if (label) webComponentProps.label = label;
|
|
98
97
|
if (size) webComponentProps.size = size;
|
|
99
98
|
if (flavor) webComponentProps.flavor = flavor;
|
|
100
99
|
if (format) webComponentProps.format = format;
|
|
101
100
|
|
|
102
|
-
// Add boolean attributes
|
|
103
101
|
if (isMultiline) webComponentProps.multiline = '';
|
|
102
|
+
if (isHorizontalScroll) webComponentProps['horizontal-scroll'] = '';
|
|
104
103
|
if (isDisabled) webComponentProps.disabled = '';
|
|
105
104
|
if (isRequired) webComponentProps.required = '';
|
|
106
105
|
|
|
@@ -3,10 +3,14 @@ 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
|
-
type BuiltinFlavor = 'primary' | '
|
|
6
|
+
type BuiltinFlavor = 'primary' | 'success' | 'danger' | 'warning' | 'neutral';
|
|
7
7
|
type ShadedFlavor = BuiltinFlavor | `${BuiltinFlavor}+` | `${BuiltinFlavor}-`;
|
|
8
|
+
type Placement =
|
|
9
|
+
| 'top-start' | 'top' | 'top-end'
|
|
10
|
+
| 'right-start' | 'right' | 'right-end'
|
|
11
|
+
| 'bottom-start' | 'bottom' | 'bottom-end'
|
|
12
|
+
| 'left-start' | 'left' | 'left-end';
|
|
8
13
|
|
|
9
|
-
// Type definitions for Ty DatePicker component
|
|
10
14
|
export interface TyDatePickerEventDetail {
|
|
11
15
|
/** The selected date value (ISO string or formatted string based on format) */
|
|
12
16
|
value: string | null;
|
|
@@ -22,8 +26,9 @@ export interface TyDatePickerProps extends Omit<React.HTMLAttributes<HTMLElement
|
|
|
22
26
|
/** The selected date value (ISO string or formatted string) */
|
|
23
27
|
value?: string;
|
|
24
28
|
|
|
25
|
-
/** Field size —
|
|
26
|
-
size
|
|
29
|
+
/** Field size — the ladder shared by every field component
|
|
30
|
+
* (styles/field-size.ts). Defaults to 'sm'. */
|
|
31
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
27
32
|
|
|
28
33
|
/** Visual flavor — built-in semantic, +/- shade, or a custom flavor backed by --ty-*-X tokens. Also tints the popup calendar's selected/today day. */
|
|
29
34
|
flavor?: 'default' | ShadedFlavor | (string & {});
|
|
@@ -60,7 +65,10 @@ export interface TyDatePickerProps extends Omit<React.HTMLAttributes<HTMLElement
|
|
|
60
65
|
|
|
61
66
|
/** Latest selectable date (ISO "YYYY-MM-DD") */
|
|
62
67
|
max?: string;
|
|
63
|
-
|
|
68
|
+
|
|
69
|
+
/** Calendar popup placement, same vocabulary as ty-popup/ty-tooltip/ty-select: a side plus an optional cross-axis alignment (e.g. "bottom-start"). The calendar only lives above or below the field, so left/right degrade to auto-side with the alignment kept. Empty/unset = auto (below when it fits). */
|
|
70
|
+
placement?: Placement;
|
|
71
|
+
|
|
64
72
|
/** Callback when the date value changes */
|
|
65
73
|
onChange?: (event: CustomEvent<TyDatePickerEventDetail>) => void;
|
|
66
74
|
|
|
@@ -76,7 +84,6 @@ export interface TyDatePickerElement extends HTMLElement {
|
|
|
76
84
|
clear(): void;
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
// React wrapper for ty-date-picker web component
|
|
80
87
|
export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerProps>(
|
|
81
88
|
({
|
|
82
89
|
value,
|
|
@@ -93,6 +100,7 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
93
100
|
withTime,
|
|
94
101
|
min,
|
|
95
102
|
max,
|
|
103
|
+
placement,
|
|
96
104
|
onChange,
|
|
97
105
|
onOpen,
|
|
98
106
|
onClose,
|
|
@@ -100,7 +108,6 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
100
108
|
}, ref) => {
|
|
101
109
|
const elementRef = useRef<TyDatePickerElement>(null);
|
|
102
110
|
|
|
103
|
-
// Handle ref forwarding
|
|
104
111
|
useEffect(() => {
|
|
105
112
|
if (ref && elementRef.current) {
|
|
106
113
|
if (typeof ref === 'function') {
|
|
@@ -118,12 +125,10 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
118
125
|
if (!needsPropertyBridge) return;
|
|
119
126
|
const element = elementRef.current;
|
|
120
127
|
if (element && value !== undefined) {
|
|
121
|
-
// Set the value property directly on the element
|
|
122
128
|
(element as any).value = value || '';
|
|
123
129
|
}
|
|
124
130
|
}, [value]);
|
|
125
131
|
|
|
126
|
-
// Handle change events
|
|
127
132
|
const handleChange = useCallback((event: Event) => {
|
|
128
133
|
const customEvent = event as CustomEvent<TyDatePickerEventDetail>;
|
|
129
134
|
if (onChange) {
|
|
@@ -131,10 +136,8 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
131
136
|
}
|
|
132
137
|
}, [onChange]);
|
|
133
138
|
|
|
134
|
-
// Handle open/close events.
|
|
135
|
-
//
|
|
136
|
-
// (rare for a date-picker, but defensive — same fix as TyModal/TyPopup)
|
|
137
|
-
// don't fire the consumer's onOpen/onClose.
|
|
139
|
+
// Handle open/close events. See TyModal.tsx for why the
|
|
140
|
+
// `event.target === element` guard is still here.
|
|
138
141
|
const handleOpen = useCallback((event: Event) => {
|
|
139
142
|
if (event.target !== elementRef.current) return;
|
|
140
143
|
if (onOpen) onOpen(event as CustomEvent<{}>);
|
|
@@ -145,7 +148,6 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
145
148
|
if (onClose) onClose(event as CustomEvent<{}>);
|
|
146
149
|
}, [onClose]);
|
|
147
150
|
|
|
148
|
-
// Set up event listeners
|
|
149
151
|
useEffect(() => {
|
|
150
152
|
const element = elementRef.current;
|
|
151
153
|
if (!element) return;
|
|
@@ -174,13 +176,11 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
174
176
|
};
|
|
175
177
|
}, [handleChange, handleOpen, handleClose, onChange, onOpen, onClose]);
|
|
176
178
|
|
|
177
|
-
// Convert React props to web component attributes
|
|
178
179
|
const webComponentProps: Record<string, any> = {
|
|
179
180
|
...hostProps(props),
|
|
180
181
|
ref: elementRef,
|
|
181
182
|
};
|
|
182
183
|
|
|
183
|
-
// Add optional attributes only if they have values
|
|
184
184
|
if (value !== undefined) {
|
|
185
185
|
webComponentProps.value = value;
|
|
186
186
|
}
|
|
@@ -233,6 +233,10 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
|
|
|
233
233
|
webComponentProps.max = max;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
if (placement) {
|
|
237
|
+
webComponentProps.placement = placement;
|
|
238
|
+
}
|
|
239
|
+
|
|
236
240
|
return React.createElement('ty-date-picker', webComponentProps);
|
|
237
241
|
}
|
|
238
242
|
);
|
|
@@ -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 File Upload component
|
|
6
5
|
export interface TyFileUploadProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
7
6
|
/** Form field name — used as the FormData key */
|
|
8
7
|
name?: string;
|
|
@@ -41,7 +40,6 @@ export interface TyFileUploadEventDetail {
|
|
|
41
40
|
names: string[];
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
// React wrapper for ty-file-upload web component
|
|
45
43
|
export const TyFileUpload = React.forwardRef<HTMLElement, TyFileUploadProps>(
|
|
46
44
|
({
|
|
47
45
|
name,
|
|
@@ -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
|
}
|
|
@@ -3,10 +3,9 @@ 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
|
-
type BuiltinFlavor = 'primary' | '
|
|
6
|
+
type BuiltinFlavor = 'primary' | '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 */
|
|
@@ -37,9 +35,9 @@ export interface TyInputProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
37
35
|
/** Semantic styling variant */
|
|
38
36
|
flavor?: ShadedFlavor | (string & {});
|
|
39
37
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
size?: 'sm' | 'md' | 'lg';
|
|
38
|
+
/** Field size — the ladder shared by every field component
|
|
39
|
+
* (styles/field-size.ts). Defaults to 'sm'. */
|
|
40
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
43
41
|
|
|
44
42
|
/** Input value */
|
|
45
43
|
value?: string;
|
|
@@ -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(
|