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
@@ -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 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' | '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 TySwitchProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'onInput'> {
@@ -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;
@@ -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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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' | 'secondary' | 'success' | 'danger' | 'warning' | 'neutral';
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?: 'top' | 'bottom' | 'left' | 'right';
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;
@@ -1,7 +1,3 @@
1
- // ===================================================================
2
- // VERSION
3
- // ===================================================================
4
-
5
1
  import { VERSION } from '../version';
6
2
 
7
3
  /** Current version of tyrell-react (auto-synced with package.json on build). */
@@ -19,18 +15,8 @@ if (typeof window !== 'undefined') {
19
15
  );
20
16
  }
21
17
 
22
- // ===================================================================
23
- // TYRELL REACT WRAPPER EXPORTS
24
- // ===================================================================
25
- // This file provides two export styles for maximum developer flexibility:
26
- // 1. Ty-prefixed exports (TyButton, TyInput) - explicit and backward compatible
27
- // 2. Short name exports (Button, Input) - clean and familiar to React developers
28
- //
29
- // Choose the style that fits your team's preferences!
30
-
31
- // ===================================================================
32
- // TY-PREFIXED EXPORTS (Explicit Style - Backward Compatible)
33
- // ===================================================================
18
+ // Every component is exported twice: Ty-prefixed (TyButton) and short
19
+ // (Button). Both names point at the same wrapper — pick one per project.
34
20
 
35
21
  export { TyButton } from './TyButton';
36
22
  export type { TyButtonProps, TyButtonCSSProperties } from './TyButton';
@@ -116,11 +102,6 @@ export type { TyResizeObserverProps } from './TyResizeObserver';
116
102
  export { TyScrollContainer } from './TyScrollContainer';
117
103
  export type { TyScrollContainerProps, TyScrollContainerRef } from './TyScrollContainer';
118
104
 
119
-
120
- // ===================================================================
121
- // SHORT NAME EXPORTS (Clean Style - Developer Choice)
122
- // ===================================================================
123
-
124
105
  export { TyButton as Button } from './TyButton';
125
106
  export { TyTag as Tag } from './TyTag';
126
107
  export { TyInput as Input } from './TyInput';
@@ -147,128 +128,52 @@ export { TyStep as Step } from './TyStep';
147
128
  export { TyResizeObserver as ResizeObserver } from './TyResizeObserver';
148
129
  export { TyScrollContainer as ScrollContainer } from './TyScrollContainer';
149
130
 
150
- // ===================================================================
151
- // TYPE ALIASES (Both Styles Supported)
152
- // ===================================================================
153
-
154
- // Button types
155
131
  export type { TyButtonProps as ButtonProps } from './TyButton';
156
132
 
157
- // Tag types
158
133
  export type { TyTagProps as TagProps } from './TyTag';
159
134
 
160
- // Input types
161
135
  export type { TyInputProps as InputProps, TyInputEventDetail as InputEventDetail } from './TyInput';
162
136
 
163
- // Textarea types
164
137
  export type { TyTextareaProps as TextareaProps, TyTextareaEventDetail as TextareaEventDetail } from './TyTextarea';
165
138
 
166
- // Option types
167
139
  export type { TyOptionProps as OptionProps } from './TyOption';
168
140
 
169
- // Icon types
170
141
  export type { TyIconProps as IconProps } from './TyIcon';
171
142
 
172
- // Modal types
173
143
  export type { TyModalProps as ModalProps, TyModalEventDetail as ModalEventDetail, TyModalRef as ModalRef } from './TyModal';
174
144
 
175
- // Tooltip types
176
145
  export type { TyTooltipProps as TooltipProps } from './TyTooltip';
177
146
 
178
- // Calendar types
179
147
  export type { TyCalendarProps as CalendarProps, TyCalendarChangeEventDetail as CalendarChangeEventDetail, TyCalendarNavigateEventDetail as CalendarNavigateEventDetail } from './TyCalendar';
180
148
 
181
- // DatePicker types
182
149
  export type { TyDatePickerProps as DatePickerProps, TyDatePickerEventDetail as DatePickerEventDetail } from './TyDatePicker';
183
150
 
184
- // Popup types
185
151
  export type { TyPopupProps as PopupProps, TyPopupElement as PopupElement } from './TyPopup';
186
152
 
187
- // Checkbox types
188
153
  export type { TyCheckboxProps as CheckboxProps, TyCheckboxEventDetail as CheckboxEventDetail } from './TyCheckbox';
189
154
 
190
- // Switch types
191
155
  export type { TySwitchProps as SwitchProps, TySwitchEventDetail as SwitchEventDetail } from './TySwitch';
192
156
 
193
- // Radio types
194
157
  export type { TyRadioProps as RadioProps } from './TyRadio';
195
158
 
196
- // RadioGroup types
197
159
  export type { TyRadioGroupProps as RadioGroupProps, TyRadioGroupEventDetail as RadioGroupEventDetail } from './TyRadioGroup';
198
160
 
199
- // Copy types
200
161
  export type { TyCopyProps as CopyProps } from './TyCopy';
201
162
 
202
- // FileUpload types
203
163
  export type { TyFileUploadProps as FileUploadProps, TyFileUploadEventDetail as FileUploadEventDetail } from './TyFileUpload';
204
164
 
205
- // Tabs types
206
165
  export type { TyTabsProps as TabsProps } from './TyTabs';
207
166
 
208
- // Tab types
209
167
  export type { TyTabProps as TabProps } from './TyTab';
210
168
 
211
- // CalendarMonth types
212
169
  export type { TyCalendarMonthProps as CalendarMonthProps } from './TyCalendarMonth';
213
170
 
214
- // CalendarNavigation types
215
171
  export type { TyCalendarNavigationProps as CalendarNavigationProps } from './TyCalendarNavigation';
216
172
 
217
- // Wizard types
218
173
  export type { TyWizardProps as WizardProps, WizardStepChangeDetail as StepChangeDetail } from './TyWizard';
219
174
 
220
- // Step types
221
175
  export type { TyStepProps as StepProps } from './TyStep';
222
176
 
223
- // ResizeObserver types
224
177
  export type { TyResizeObserverProps as ResizeObserverProps } from './TyResizeObserver';
225
178
 
226
- // ScrollContainer types
227
179
  export type { TyScrollContainerProps as ScrollContainerProps, TyScrollContainerRef as ScrollContainerRef } from './TyScrollContainer';
228
-
229
- // ===================================================================
230
- // USAGE EXAMPLES
231
- // ===================================================================
232
-
233
- /*
234
-
235
- // STYLE 1: Ty-prefixed (Explicit and backward compatible)
236
- import { TyButton, TyInput, TyModal } from 'tyrell-react';
237
- import type { TyButtonProps, TyInputProps } from 'tyrell-react';
238
-
239
- function MyComponent() {
240
- return (
241
- <TyModal>
242
- <TyInput placeholder="Enter text..." />
243
- <TyButton>Submit</TyButton>
244
- </TyModal>
245
- );
246
- }
247
-
248
- // STYLE 2: Short names (Clean and familiar)
249
- import { Button, Input, Modal } from 'tyrell-react';
250
- import type { ButtonProps, InputProps } from 'tyrell-react';
251
-
252
- function MyComponent() {
253
- return (
254
- <Modal>
255
- <Input placeholder="Enter text..." />
256
- <Button>Submit</Button>
257
- </Modal>
258
- );
259
- }
260
-
261
- // STYLE 3: Mixed (Team preferences)
262
- import { TyModal, Input, Button } from 'tyrell-react';
263
- import type { TyModalProps, InputProps } from 'tyrell-react';
264
-
265
- function MyComponent() {
266
- return (
267
- <TyModal>
268
- <Input placeholder="Enter text..." />
269
- <Button>Submit</Button>
270
- </TyModal>
271
- );
272
- }
273
-
274
- */
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  // Run 'npm run generate:version' to regenerate.
4
4
 
5
5
  /** Current version of tyrell-react. Synced with package.json on build. */
6
- export const VERSION = '1.0.0-TC45'
6
+ export const VERSION = '1.0.0-TC47'