tyrell-react 1.0.0-TC45 → 1.0.0-TC47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/components/TyButton.d.ts +1 -1
  2. package/dist/components/TyButton.d.ts.map +1 -1
  3. package/dist/components/TyCalendar.d.ts +1 -1
  4. package/dist/components/TyCalendar.d.ts.map +1 -1
  5. package/dist/components/TyCalendar.js +0 -8
  6. package/dist/components/TyCalendar.js.map +1 -1
  7. package/dist/components/TyCalendarMonth.d.ts +1 -1
  8. package/dist/components/TyCalendarMonth.d.ts.map +1 -1
  9. package/dist/components/TyCalendarMonth.js +0 -5
  10. package/dist/components/TyCalendarMonth.js.map +1 -1
  11. package/dist/components/TyCalendarNavigation.d.ts.map +1 -1
  12. package/dist/components/TyCalendarNavigation.js +0 -5
  13. package/dist/components/TyCalendarNavigation.js.map +1 -1
  14. package/dist/components/TyCheckbox.d.ts +1 -1
  15. package/dist/components/TyCheckbox.d.ts.map +1 -1
  16. package/dist/components/TyCheckbox.js +0 -8
  17. package/dist/components/TyCheckbox.js.map +1 -1
  18. package/dist/components/TyCopy.d.ts +1 -1
  19. package/dist/components/TyCopy.d.ts.map +1 -1
  20. package/dist/components/TyCopy.js +0 -6
  21. package/dist/components/TyCopy.js.map +1 -1
  22. package/dist/components/TyDatePicker.d.ts +4 -1
  23. package/dist/components/TyDatePicker.d.ts.map +1 -1
  24. package/dist/components/TyDatePicker.js +4 -8
  25. package/dist/components/TyDatePicker.js.map +1 -1
  26. package/dist/components/TyFileUpload.d.ts.map +1 -1
  27. package/dist/components/TyFileUpload.js +0 -1
  28. package/dist/components/TyFileUpload.js.map +1 -1
  29. package/dist/components/TyIcon.d.ts.map +1 -1
  30. package/dist/components/TyIcon.js +0 -4
  31. package/dist/components/TyIcon.js.map +1 -1
  32. package/dist/components/TyInput.d.ts +1 -1
  33. package/dist/components/TyInput.d.ts.map +1 -1
  34. package/dist/components/TyInput.js +0 -10
  35. package/dist/components/TyInput.js.map +1 -1
  36. package/dist/components/TyModal.d.ts.map +1 -1
  37. package/dist/components/TyModal.js +0 -6
  38. package/dist/components/TyModal.js.map +1 -1
  39. package/dist/components/TyOption.d.ts +1 -1
  40. package/dist/components/TyOption.d.ts.map +1 -1
  41. package/dist/components/TyOption.js +0 -2
  42. package/dist/components/TyOption.js.map +1 -1
  43. package/dist/components/TyPopup.d.ts +4 -2
  44. package/dist/components/TyPopup.d.ts.map +1 -1
  45. package/dist/components/TyPopup.js +0 -4
  46. package/dist/components/TyPopup.js.map +1 -1
  47. package/dist/components/TyRadio.d.ts +1 -1
  48. package/dist/components/TyRadio.d.ts.map +1 -1
  49. package/dist/components/TyRadioGroup.d.ts +1 -1
  50. package/dist/components/TyRadioGroup.d.ts.map +1 -1
  51. package/dist/components/TyResizeObserver.d.ts.map +1 -1
  52. package/dist/components/TyResizeObserver.js +0 -4
  53. package/dist/components/TyResizeObserver.js.map +1 -1
  54. package/dist/components/TyScrollContainer.d.ts.map +1 -1
  55. package/dist/components/TyScrollContainer.js +0 -6
  56. package/dist/components/TyScrollContainer.js.map +1 -1
  57. package/dist/components/TySelect.d.ts +6 -3
  58. package/dist/components/TySelect.d.ts.map +1 -1
  59. package/dist/components/TySelect.js +3 -7
  60. package/dist/components/TySelect.js.map +1 -1
  61. package/dist/components/TyStep.d.ts.map +1 -1
  62. package/dist/components/TyStep.js +0 -5
  63. package/dist/components/TyStep.js.map +1 -1
  64. package/dist/components/TySwitch.d.ts +1 -1
  65. package/dist/components/TySwitch.d.ts.map +1 -1
  66. package/dist/components/TyTab.d.ts.map +1 -1
  67. package/dist/components/TyTab.js +0 -6
  68. package/dist/components/TyTab.js.map +1 -1
  69. package/dist/components/TyTabs.d.ts.map +1 -1
  70. package/dist/components/TyTabs.js +0 -5
  71. package/dist/components/TyTabs.js.map +1 -1
  72. package/dist/components/TyTag.d.ts +1 -1
  73. package/dist/components/TyTag.d.ts.map +1 -1
  74. package/dist/components/TyTag.js +0 -2
  75. package/dist/components/TyTag.js.map +1 -1
  76. package/dist/components/TyTextarea.d.ts.map +1 -1
  77. package/dist/components/TyTextarea.js +0 -6
  78. package/dist/components/TyTextarea.js.map +1 -1
  79. package/dist/components/TyTooltip.d.ts +4 -3
  80. package/dist/components/TyTooltip.d.ts.map +1 -1
  81. package/dist/components/TyTooltip.js +0 -4
  82. package/dist/components/TyTooltip.js.map +1 -1
  83. package/dist/components/TyWizard.d.ts.map +1 -1
  84. package/dist/components/TyWizard.js +0 -5
  85. package/dist/components/TyWizard.js.map +1 -1
  86. package/dist/components/index.d.ts.map +1 -1
  87. package/dist/components/index.js +2 -62
  88. package/dist/components/index.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/package.json +1 -1
  92. package/src/components/TyButton.tsx +1 -1
  93. package/src/components/TyCalendar.tsx +1 -10
  94. package/src/components/TyCalendarMonth.tsx +1 -7
  95. package/src/components/TyCalendarNavigation.tsx +0 -6
  96. package/src/components/TyCheckbox.tsx +1 -10
  97. package/src/components/TyCopy.tsx +1 -8
  98. package/src/components/TyDatePicker.tsx +15 -10
  99. package/src/components/TyFileUpload.tsx +0 -2
  100. package/src/components/TyIcon.tsx +0 -5
  101. package/src/components/TyInput.tsx +1 -13
  102. package/src/components/TyModal.tsx +0 -9
  103. package/src/components/TyOption.tsx +1 -4
  104. package/src/components/TyPopup.tsx +8 -8
  105. package/src/components/TyRadio.tsx +1 -1
  106. package/src/components/TyRadioGroup.tsx +1 -1
  107. package/src/components/TyResizeObserver.tsx +0 -5
  108. package/src/components/TyScrollContainer.tsx +0 -8
  109. package/src/components/TySelect.tsx +13 -12
  110. package/src/components/TyStep.tsx +0 -6
  111. package/src/components/TySwitch.tsx +1 -1
  112. package/src/components/TyTab.tsx +0 -7
  113. package/src/components/TyTabs.tsx +0 -6
  114. package/src/components/TyTag.tsx +1 -4
  115. package/src/components/TyTextarea.tsx +0 -8
  116. package/src/components/TyTooltip.tsx +8 -8
  117. package/src/components/TyWizard.tsx +0 -6
  118. package/src/components/index.ts +2 -97
  119. package/src/version.ts +1 -1
@@ -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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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;
@@ -38,7 +37,6 @@ export interface TyCopyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
38
37
  onCopyError?: (event: CustomEvent) => void;
39
38
  }
40
39
 
41
- // React wrapper for ty-copy web component
42
40
  export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
43
41
  ({
44
42
  value,
@@ -55,7 +53,6 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
55
53
  }, ref) => {
56
54
  const elementRef = useRef<HTMLElement>(null);
57
55
 
58
- // Handle ref forwarding
59
56
  useEffect(() => {
60
57
  if (ref && elementRef.current) {
61
58
  if (typeof ref === 'function') {
@@ -66,7 +63,6 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
66
63
  }
67
64
  }, [ref]);
68
65
 
69
- // Custom events → React callbacks
70
66
  useEffect(() => {
71
67
  const el = elementRef.current;
72
68
  if (!el) return;
@@ -86,20 +82,17 @@ export const TyCopy = React.forwardRef<HTMLElement, TyCopyProps>(
86
82
  const isDisabled = useBooleanProperty(elementRef, 'disabled', disabled);
87
83
  const isRequired = useBooleanProperty(elementRef, 'required', required);
88
84
 
89
- // Convert React props to web component attributes
90
85
  const webComponentProps: Record<string, any> = {
91
86
  ...hostProps(props),
92
87
  ref: elementRef,
93
88
  };
94
89
 
95
- // Add string attributes
96
90
  if (value) webComponentProps.value = value;
97
91
  if (label) webComponentProps.label = label;
98
92
  if (size) webComponentProps.size = size;
99
93
  if (flavor) webComponentProps.flavor = flavor;
100
94
  if (format) webComponentProps.format = format;
101
95
 
102
- // Add boolean attributes
103
96
  if (isMultiline) webComponentProps.multiline = '';
104
97
  if (isDisabled) webComponentProps.disabled = '';
105
98
  if (isRequired) webComponentProps.required = '';
@@ -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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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;
@@ -60,7 +64,10 @@ export interface TyDatePickerProps extends Omit<React.HTMLAttributes<HTMLElement
60
64
 
61
65
  /** Latest selectable date (ISO "YYYY-MM-DD") */
62
66
  max?: string;
63
-
67
+
68
+ /** 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). */
69
+ placement?: Placement;
70
+
64
71
  /** Callback when the date value changes */
65
72
  onChange?: (event: CustomEvent<TyDatePickerEventDetail>) => void;
66
73
 
@@ -76,7 +83,6 @@ export interface TyDatePickerElement extends HTMLElement {
76
83
  clear(): void;
77
84
  }
78
85
 
79
- // React wrapper for ty-date-picker web component
80
86
  export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerProps>(
81
87
  ({
82
88
  value,
@@ -93,6 +99,7 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
93
99
  withTime,
94
100
  min,
95
101
  max,
102
+ placement,
96
103
  onChange,
97
104
  onOpen,
98
105
  onClose,
@@ -100,7 +107,6 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
100
107
  }, ref) => {
101
108
  const elementRef = useRef<TyDatePickerElement>(null);
102
109
 
103
- // Handle ref forwarding
104
110
  useEffect(() => {
105
111
  if (ref && elementRef.current) {
106
112
  if (typeof ref === 'function') {
@@ -118,12 +124,10 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
118
124
  if (!needsPropertyBridge) return;
119
125
  const element = elementRef.current;
120
126
  if (element && value !== undefined) {
121
- // Set the value property directly on the element
122
127
  (element as any).value = value || '';
123
128
  }
124
129
  }, [value]);
125
130
 
126
- // Handle change events
127
131
  const handleChange = useCallback((event: Event) => {
128
132
  const customEvent = event as CustomEvent<TyDatePickerEventDetail>;
129
133
  if (onChange) {
@@ -145,7 +149,6 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
145
149
  if (onClose) onClose(event as CustomEvent<{}>);
146
150
  }, [onClose]);
147
151
 
148
- // Set up event listeners
149
152
  useEffect(() => {
150
153
  const element = elementRef.current;
151
154
  if (!element) return;
@@ -174,13 +177,11 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
174
177
  };
175
178
  }, [handleChange, handleOpen, handleClose, onChange, onOpen, onClose]);
176
179
 
177
- // Convert React props to web component attributes
178
180
  const webComponentProps: Record<string, any> = {
179
181
  ...hostProps(props),
180
182
  ref: elementRef,
181
183
  };
182
184
 
183
- // Add optional attributes only if they have values
184
185
  if (value !== undefined) {
185
186
  webComponentProps.value = value;
186
187
  }
@@ -233,6 +234,10 @@ export const TyDatePicker = React.forwardRef<TyDatePickerElement, TyDatePickerPr
233
234
  webComponentProps.max = max;
234
235
  }
235
236
 
237
+ if (placement) {
238
+ webComponentProps.placement = placement;
239
+ }
240
+
236
241
  return React.createElement('ty-date-picker', webComponentProps);
237
242
  }
238
243
  );
@@ -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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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 */
@@ -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
 
@@ -14,7 +13,7 @@ export interface TyOptionProps extends React.HTMLAttributes<HTMLElement> {
14
13
  label?: string;
15
14
 
16
15
  /** Semantic flavor — carried onto ty-selected-options chips */
17
- flavor?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral' | 'info';
16
+ flavor?: 'primary' | 'success' | 'danger' | 'warning' | 'neutral' | 'info';
18
17
 
19
18
  disabled?: boolean;
20
19
  selected?: boolean;
@@ -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,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
- // Type definitions for Ty Popup component
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: "top" | "bottom" | "left" | "right" */
8
- placement?: 'top' | 'bottom' | 'left' | 'right';
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') {
@@ -85,13 +87,11 @@ export const TyPopup = React.forwardRef<TyPopupElement, TyPopupProps>(
85
87
  };
86
88
  }, [onOpen, onClose]);
87
89
 
88
- // Convert React props to web component attributes
89
90
  const webComponentProps: Record<string, any> = {
90
91
  ...hostProps(props),
91
92
  ref: elementRef,
92
93
  };
93
94
 
94
- // Add optional attributes only if they have values
95
95
  if (placement) {
96
96
  webComponentProps.placement = placement;
97
97
  }
@@ -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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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'] = '';