tyrell-react 1.0.0-RC13 → 1.0.0-RC14
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 +1 -1
- 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 +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 +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 +4 -1
- 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 +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 +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 +6 -3
- package/dist/components/TySelect.d.ts.map +1 -1
- package/dist/components/TySelect.js +3 -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/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.map +1 -1
- package/dist/components/TyTabs.js +0 -5
- 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 +1 -10
- 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 +1 -8
- package/src/components/TyDatePicker.tsx +17 -14
- package/src/components/TyFileUpload.tsx +0 -2
- package/src/components/TyIcon.tsx +0 -5
- package/src/components/TyInput.tsx +1 -13
- 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 +13 -12
- 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 +0 -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
|
@@ -2,10 +2,15 @@ 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
|
-
|
|
5
|
+
type Placement =
|
|
6
|
+
| 'top-start' | 'top' | 'top-end'
|
|
7
|
+
| 'right-start' | 'right' | 'right-end'
|
|
8
|
+
| 'bottom-start' | 'bottom' | 'bottom-end'
|
|
9
|
+
| 'left-start' | 'left' | 'left-end';
|
|
10
|
+
|
|
6
11
|
export interface TyPopupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClose'> {
|
|
7
|
-
/** Preferred placement of the popup relative to anchor parent:
|
|
8
|
-
placement?:
|
|
12
|
+
/** Preferred placement of the popup relative to anchor parent: a side plus an optional cross-axis alignment (e.g. "bottom-start") */
|
|
13
|
+
placement?: Placement;
|
|
9
14
|
|
|
10
15
|
/** Distance offset from the anchor in pixels (default: 8) */
|
|
11
16
|
offset?: number;
|
|
@@ -26,14 +31,12 @@ export interface TyPopupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
26
31
|
children?: React.ReactNode;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
// Programmatic API for popup control
|
|
30
34
|
export interface TyPopupElement extends HTMLElement {
|
|
31
35
|
openPopup(): void;
|
|
32
36
|
closePopup(): void;
|
|
33
37
|
togglePopup(): void;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
// React wrapper for ty-popup web component
|
|
37
40
|
export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
38
41
|
({
|
|
39
42
|
placement,
|
|
@@ -47,7 +50,6 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
|
47
50
|
}, ref) => {
|
|
48
51
|
const elementRef = useRef<TyPopupElement>(null);
|
|
49
52
|
|
|
50
|
-
// Handle ref forwarding
|
|
51
53
|
useEffect(() => {
|
|
52
54
|
if (ref && elementRef.current) {
|
|
53
55
|
if (typeof ref === 'function') {
|
|
@@ -58,11 +60,8 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
|
58
60
|
}
|
|
59
61
|
}, [ref]);
|
|
60
62
|
|
|
61
|
-
// Listen for popup open/close events.
|
|
62
|
-
//
|
|
63
|
-
// from popup-like descendants (ty-dropdown, ty-multiselect, ty-date-picker
|
|
64
|
-
// when slotted inside this popup) don't fire the consumer's onOpen/onClose.
|
|
65
|
-
// See TyModal.tsx for the same pattern + rationale.
|
|
63
|
+
// Listen for popup open/close events. See TyModal.tsx for why the
|
|
64
|
+
// `event.target === element` guard is still here.
|
|
66
65
|
useEffect(() => {
|
|
67
66
|
const element = elementRef.current;
|
|
68
67
|
if (!element) return;
|
|
@@ -85,13 +84,11 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
|
|
|
85
84
|
};
|
|
86
85
|
}, [onOpen, onClose]);
|
|
87
86
|
|
|
88
|
-
// Convert React props to web component attributes
|
|
89
87
|
const webComponentProps: Record<string, any> = {
|
|
90
88
|
...hostProps(props),
|
|
91
89
|
ref: elementRef,
|
|
92
90
|
};
|
|
93
91
|
|
|
94
|
-
// Add optional attributes only if they have values
|
|
95
92
|
if (placement) {
|
|
96
93
|
webComponentProps.placement = placement;
|
|
97
94
|
}
|
|
@@ -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
|
|
|
8
8
|
export interface TyRadioProps extends React.HTMLAttributes<HTMLElement> {
|
|
@@ -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
|
|
|
8
8
|
export interface TyRadioGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onInput'> {
|
|
@@ -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'] = '';
|
|
@@ -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 Select component
|
|
10
14
|
export interface TySelectItem {
|
|
11
15
|
value: string;
|
|
12
16
|
label: string;
|
|
@@ -93,8 +97,11 @@ export interface TySelectProps extends Omit<React.HTMLAttributes<HTMLElement>, '
|
|
|
93
97
|
/** Field size — fields come in exactly three; legacy xs/xl map to sm/lg */
|
|
94
98
|
size?: 'sm' | 'md' | 'lg';
|
|
95
99
|
|
|
96
|
-
/** 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. */
|
|
97
|
-
align?: 'start' | 'end';
|
|
100
|
+
/** Horizontal popup anchor: "start" (default, trigger's left edge), "center", or "end" (trigger's right edge) — clamped into the viewport either way. Useful with a custom slot="trigger" element. Ignored when `placement` is set. */
|
|
101
|
+
align?: 'start' | 'center' | 'end';
|
|
102
|
+
|
|
103
|
+
/** Full placement, same vocabulary as ty-popup/ty-tooltip: a side plus an optional cross-axis alignment (e.g. "bottom-end"). Takes precedence over `align` when set. */
|
|
104
|
+
placement?: Placement;
|
|
98
105
|
|
|
99
106
|
/** 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. */
|
|
100
107
|
clearable?: boolean;
|
|
@@ -126,7 +133,6 @@ export interface TySelectElement extends HTMLElement {
|
|
|
126
133
|
clear(): void;
|
|
127
134
|
}
|
|
128
135
|
|
|
129
|
-
// React wrapper for ty-select web component
|
|
130
136
|
export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
131
137
|
({
|
|
132
138
|
value,
|
|
@@ -146,6 +152,7 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
146
152
|
loading,
|
|
147
153
|
size,
|
|
148
154
|
align,
|
|
155
|
+
placement,
|
|
149
156
|
clearable,
|
|
150
157
|
flavor,
|
|
151
158
|
onChange,
|
|
@@ -158,7 +165,6 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
158
165
|
}, ref) => {
|
|
159
166
|
const elementRef = useRef<TySelectElement>(null);
|
|
160
167
|
|
|
161
|
-
// Handle ref forwarding
|
|
162
168
|
useEffect(() => {
|
|
163
169
|
if (ref && elementRef.current) {
|
|
164
170
|
if (typeof ref === 'function') {
|
|
@@ -181,7 +187,6 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
181
187
|
}
|
|
182
188
|
}, [value]);
|
|
183
189
|
|
|
184
|
-
// Handle events
|
|
185
190
|
const handleChange = useCallback((event: Event) => {
|
|
186
191
|
if (onChange) onChange(event as CustomEvent<TySelectEventDetail>);
|
|
187
192
|
}, [onChange]);
|
|
@@ -196,7 +201,6 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
196
201
|
if (onCreate) onCreate(event as CustomEvent<{ value: string; label: string }>);
|
|
197
202
|
}, [onCreate]);
|
|
198
203
|
|
|
199
|
-
// Set up event listeners
|
|
200
204
|
useEffect(() => {
|
|
201
205
|
const element = elementRef.current;
|
|
202
206
|
if (!element) return;
|
|
@@ -227,13 +231,11 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
227
231
|
const isAllowCreate = useBooleanProperty(elementRef, 'allowCreate', allowCreate);
|
|
228
232
|
const isClearable = useBooleanProperty(elementRef, 'clearable', clearable);
|
|
229
233
|
|
|
230
|
-
// Convert React props to web component attributes
|
|
231
234
|
const webComponentProps: Record<string, any> = {
|
|
232
235
|
...hostProps(props),
|
|
233
236
|
ref: elementRef,
|
|
234
237
|
};
|
|
235
238
|
|
|
236
|
-
// Handle value conversion (array to comma-separated string)
|
|
237
239
|
if (value !== undefined) {
|
|
238
240
|
webComponentProps.value = Array.isArray(value) ? value.join(',') : value;
|
|
239
241
|
}
|
|
@@ -252,6 +254,7 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
252
254
|
if (name) webComponentProps.name = name;
|
|
253
255
|
if (size) webComponentProps.size = size;
|
|
254
256
|
if (align) webComponentProps.align = align;
|
|
257
|
+
if (placement) webComponentProps.placement = placement;
|
|
255
258
|
if (isClearable) webComponentProps.clearable = '';
|
|
256
259
|
if (flavor) webComponentProps.flavor = flavor;
|
|
257
260
|
if (debounce !== undefined) webComponentProps.debounce = debounce.toString();
|
|
@@ -266,11 +269,9 @@ export const TySelect = React.forwardRef<TySelectElement, TySelectProps>(
|
|
|
266
269
|
|
|
267
270
|
TySelect.displayName = 'TySelect';
|
|
268
271
|
|
|
269
|
-
// ============================================================================
|
|
270
272
|
// TySelectedOptions — out-of-band chip display for a TySelect
|
|
271
273
|
// (ty-selected-tags below is the same element under its original tag name,
|
|
272
274
|
// kept for backward compatibility.)
|
|
273
|
-
// ============================================================================
|
|
274
275
|
|
|
275
276
|
export interface TySelectedTagsProps extends React.HTMLAttributes<HTMLElement> {
|
|
276
277
|
/** 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(
|
|
@@ -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
|
|
|
8
8
|
export interface TySwitchProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onInput'> {
|
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
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useCallback } 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
8
|
// CSS custom properties that cascade into the shadow DOM for full color control
|
|
@@ -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') {
|
|
@@ -2,13 +2,17 @@ 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
|
+
type Placement =
|
|
8
|
+
| 'top-start' | 'top' | 'top-end'
|
|
9
|
+
| 'right-start' | 'right' | 'right-end'
|
|
10
|
+
| 'bottom-start' | 'bottom' | 'bottom-end'
|
|
11
|
+
| 'left-start' | 'left' | 'left-end';
|
|
7
12
|
|
|
8
|
-
// Type definitions for Ty Tooltip component
|
|
9
13
|
export interface TyTooltipProps extends React.HTMLAttributes<HTMLElement> {
|
|
10
|
-
/** Tooltip positioning relative to the parent element */
|
|
11
|
-
placement?:
|
|
14
|
+
/** Tooltip positioning relative to the parent element: a side plus an optional cross-axis alignment (e.g. "bottom-start") */
|
|
15
|
+
placement?: Placement;
|
|
12
16
|
|
|
13
17
|
/** Distance in pixels from the anchor element (default: 8) */
|
|
14
18
|
offset?: number;
|
|
@@ -26,7 +30,6 @@ export interface TyTooltipProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
26
30
|
children?: React.ReactNode;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
// React wrapper for ty-tooltip web component
|
|
30
33
|
export const TyTooltip = React.forwardRef<HTMLElement, TyTooltipProps>(
|
|
31
34
|
({
|
|
32
35
|
placement,
|
|
@@ -39,7 +42,6 @@ export const TyTooltip = React.forwardRef<HTMLElement, TyTooltipProps>(
|
|
|
39
42
|
}, ref) => {
|
|
40
43
|
const elementRef = useRef<HTMLElement>(null);
|
|
41
44
|
|
|
42
|
-
// Handle ref forwarding
|
|
43
45
|
useEffect(() => {
|
|
44
46
|
if (ref && elementRef.current) {
|
|
45
47
|
if (typeof ref === 'function') {
|
|
@@ -50,13 +52,11 @@ export const TyTooltip = React.forwardRef<HTMLElement, TyTooltipProps>(
|
|
|
50
52
|
}
|
|
51
53
|
}, [ref]);
|
|
52
54
|
|
|
53
|
-
// Convert React props to web component attributes
|
|
54
55
|
const webComponentProps: Record<string, any> = {
|
|
55
56
|
...hostProps(props),
|
|
56
57
|
ref: elementRef,
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
// Add optional attributes only if they have values
|
|
60
60
|
if (placement) {
|
|
61
61
|
webComponentProps.placement = placement;
|
|
62
62
|
}
|
|
@@ -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 Wizard component
|
|
5
4
|
export interface TyWizardProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
6
5
|
/** Content area width (accepts px or %) */
|
|
7
6
|
width?: string;
|
|
@@ -33,7 +32,6 @@ export interface WizardStepChangeDetail {
|
|
|
33
32
|
direction: 'forward' | 'backward' | 'none';
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
// React wrapper for ty-wizard web component
|
|
37
35
|
export const TyWizard = React.forwardRef<HTMLElement, TyWizardProps>(
|
|
38
36
|
({
|
|
39
37
|
children,
|
|
@@ -47,7 +45,6 @@ export const TyWizard = React.forwardRef<HTMLElement, TyWizardProps>(
|
|
|
47
45
|
}, ref) => {
|
|
48
46
|
const elementRef = useRef<HTMLElement>(null);
|
|
49
47
|
|
|
50
|
-
// Handle step change events
|
|
51
48
|
useEffect(() => {
|
|
52
49
|
const element = elementRef.current;
|
|
53
50
|
if (!element) return;
|
|
@@ -65,7 +62,6 @@ export const TyWizard = React.forwardRef<HTMLElement, TyWizardProps>(
|
|
|
65
62
|
};
|
|
66
63
|
}, [onStepChange]);
|
|
67
64
|
|
|
68
|
-
// Combine refs if needed
|
|
69
65
|
useEffect(() => {
|
|
70
66
|
if (ref && elementRef.current) {
|
|
71
67
|
if (typeof ref === 'function') {
|
|
@@ -76,13 +72,11 @@ export const TyWizard = React.forwardRef<HTMLElement, TyWizardProps>(
|
|
|
76
72
|
}
|
|
77
73
|
}, [ref]);
|
|
78
74
|
|
|
79
|
-
// Convert React props to web component attributes
|
|
80
75
|
const webComponentProps: Record<string, any> = {
|
|
81
76
|
...hostProps(props),
|
|
82
77
|
ref: elementRef,
|
|
83
78
|
};
|
|
84
79
|
|
|
85
|
-
// Add string attributes
|
|
86
80
|
if (width) webComponentProps.width = width;
|
|
87
81
|
if (height) webComponentProps.height = height;
|
|
88
82
|
if (active) webComponentProps.active = active;
|