tyrell-react 1.0.0-RC10

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +410 -0
  3. package/dist/components/TyButton.d.ts +52 -0
  4. package/dist/components/TyButton.d.ts.map +1 -0
  5. package/dist/components/TyButton.js +76 -0
  6. package/dist/components/TyButton.js.map +1 -0
  7. package/dist/components/TyCalendar.d.ts +63 -0
  8. package/dist/components/TyCalendar.d.ts.map +1 -0
  9. package/dist/components/TyCalendar.js +128 -0
  10. package/dist/components/TyCalendar.js.map +1 -0
  11. package/dist/components/TyCalendarMonth.d.ts +32 -0
  12. package/dist/components/TyCalendarMonth.d.ts.map +1 -0
  13. package/dist/components/TyCalendarMonth.js +54 -0
  14. package/dist/components/TyCalendarMonth.js.map +1 -0
  15. package/dist/components/TyCalendarNavigation.d.ts +21 -0
  16. package/dist/components/TyCalendarNavigation.d.ts.map +1 -0
  17. package/dist/components/TyCalendarNavigation.js +50 -0
  18. package/dist/components/TyCalendarNavigation.js.map +1 -0
  19. package/dist/components/TyCheckbox.d.ts +39 -0
  20. package/dist/components/TyCheckbox.d.ts.map +1 -0
  21. package/dist/components/TyCheckbox.js +76 -0
  22. package/dist/components/TyCheckbox.js.map +1 -0
  23. package/dist/components/TyCopy.d.ts +21 -0
  24. package/dist/components/TyCopy.d.ts.map +1 -0
  25. package/dist/components/TyCopy.js +46 -0
  26. package/dist/components/TyCopy.js.map +1 -0
  27. package/dist/components/TyDatePicker.d.ts +45 -0
  28. package/dist/components/TyDatePicker.d.ts.map +1 -0
  29. package/dist/components/TyDatePicker.js +122 -0
  30. package/dist/components/TyDatePicker.js.map +1 -0
  31. package/dist/components/TyDropdown.d.ts +62 -0
  32. package/dist/components/TyDropdown.d.ts.map +1 -0
  33. package/dist/components/TyDropdown.js +124 -0
  34. package/dist/components/TyDropdown.js.map +1 -0
  35. package/dist/components/TyFileUpload.d.ts +31 -0
  36. package/dist/components/TyFileUpload.d.ts.map +1 -0
  37. package/dist/components/TyFileUpload.js +56 -0
  38. package/dist/components/TyFileUpload.js.map +1 -0
  39. package/dist/components/TyIcon.d.ts +17 -0
  40. package/dist/components/TyIcon.d.ts.map +1 -0
  41. package/dist/components/TyIcon.js +42 -0
  42. package/dist/components/TyIcon.js.map +1 -0
  43. package/dist/components/TyInput.d.ts +65 -0
  44. package/dist/components/TyInput.d.ts.map +1 -0
  45. package/dist/components/TyInput.js +134 -0
  46. package/dist/components/TyInput.js.map +1 -0
  47. package/dist/components/TyModal.d.ts +48 -0
  48. package/dist/components/TyModal.d.ts.map +1 -0
  49. package/dist/components/TyModal.js +120 -0
  50. package/dist/components/TyModal.js.map +1 -0
  51. package/dist/components/TyMultiselect.d.ts +57 -0
  52. package/dist/components/TyMultiselect.d.ts.map +1 -0
  53. package/dist/components/TyMultiselect.js +111 -0
  54. package/dist/components/TyMultiselect.js.map +1 -0
  55. package/dist/components/TyOption.d.ts +10 -0
  56. package/dist/components/TyOption.d.ts.map +1 -0
  57. package/dist/components/TyOption.js +29 -0
  58. package/dist/components/TyOption.js.map +1 -0
  59. package/dist/components/TyPopup.d.ts +24 -0
  60. package/dist/components/TyPopup.d.ts.map +1 -0
  61. package/dist/components/TyPopup.js +70 -0
  62. package/dist/components/TyPopup.js.map +1 -0
  63. package/dist/components/TyRadio.d.ts +20 -0
  64. package/dist/components/TyRadio.d.ts.map +1 -0
  65. package/dist/components/TyRadio.js +35 -0
  66. package/dist/components/TyRadio.js.map +1 -0
  67. package/dist/components/TyRadioGroup.d.ts +40 -0
  68. package/dist/components/TyRadioGroup.d.ts.map +1 -0
  69. package/dist/components/TyRadioGroup.js +61 -0
  70. package/dist/components/TyRadioGroup.js.map +1 -0
  71. package/dist/components/TyResizeObserver.d.ts +11 -0
  72. package/dist/components/TyResizeObserver.d.ts.map +1 -0
  73. package/dist/components/TyResizeObserver.js +28 -0
  74. package/dist/components/TyResizeObserver.js.map +1 -0
  75. package/dist/components/TyScrollContainer.d.ts +25 -0
  76. package/dist/components/TyScrollContainer.d.ts.map +1 -0
  77. package/dist/components/TyScrollContainer.js +61 -0
  78. package/dist/components/TyScrollContainer.js.map +1 -0
  79. package/dist/components/TyStep.d.ts +17 -0
  80. package/dist/components/TyStep.d.ts.map +1 -0
  81. package/dist/components/TyStep.js +35 -0
  82. package/dist/components/TyStep.js.map +1 -0
  83. package/dist/components/TySwitch.d.ts +35 -0
  84. package/dist/components/TySwitch.d.ts.map +1 -0
  85. package/dist/components/TySwitch.js +59 -0
  86. package/dist/components/TySwitch.js.map +1 -0
  87. package/dist/components/TyTab.d.ts +13 -0
  88. package/dist/components/TyTab.d.ts.map +1 -0
  89. package/dist/components/TyTab.js +34 -0
  90. package/dist/components/TyTab.js.map +1 -0
  91. package/dist/components/TyTabs.d.ts +23 -0
  92. package/dist/components/TyTabs.d.ts.map +1 -0
  93. package/dist/components/TyTabs.js +48 -0
  94. package/dist/components/TyTabs.js.map +1 -0
  95. package/dist/components/TyTag.d.ts +22 -0
  96. package/dist/components/TyTag.d.ts.map +1 -0
  97. package/dist/components/TyTag.js +51 -0
  98. package/dist/components/TyTag.js.map +1 -0
  99. package/dist/components/TyTextarea.d.ts +37 -0
  100. package/dist/components/TyTextarea.d.ts.map +1 -0
  101. package/dist/components/TyTextarea.js +116 -0
  102. package/dist/components/TyTextarea.js.map +1 -0
  103. package/dist/components/TyTooltip.d.ts +17 -0
  104. package/dist/components/TyTooltip.d.ts.map +1 -0
  105. package/dist/components/TyTooltip.js +41 -0
  106. package/dist/components/TyTooltip.js.map +1 -0
  107. package/dist/components/TyWizard.d.ts +26 -0
  108. package/dist/components/TyWizard.d.ts.map +1 -0
  109. package/dist/components/TyWizard.js +50 -0
  110. package/dist/components/TyWizard.js.map +1 -0
  111. package/dist/components/index.d.ts +112 -0
  112. package/dist/components/index.d.ts.map +1 -0
  113. package/dist/components/index.js +127 -0
  114. package/dist/components/index.js.map +1 -0
  115. package/dist/utils/react-version.d.ts +2 -0
  116. package/dist/utils/react-version.d.ts.map +1 -0
  117. package/dist/utils/react-version.js +8 -0
  118. package/dist/utils/react-version.js.map +1 -0
  119. package/dist/utils/use-boolean-prop.d.ts +36 -0
  120. package/dist/utils/use-boolean-prop.d.ts.map +1 -0
  121. package/dist/utils/use-boolean-prop.js +62 -0
  122. package/dist/utils/use-boolean-prop.js.map +1 -0
  123. package/dist/version.d.ts +3 -0
  124. package/dist/version.d.ts.map +1 -0
  125. package/dist/version.js +6 -0
  126. package/dist/version.js.map +1 -0
  127. package/package.json +47 -0
  128. package/src/components/EventConventionTest.tsx +155 -0
  129. package/src/components/TyButton.tsx +157 -0
  130. package/src/components/TyCalendar.tsx +247 -0
  131. package/src/components/TyCalendarMonth.tsx +108 -0
  132. package/src/components/TyCalendarNavigation.tsx +91 -0
  133. package/src/components/TyCheckbox.tsx +147 -0
  134. package/src/components/TyCopy.tsx +83 -0
  135. package/src/components/TyDatePicker.tsx +215 -0
  136. package/src/components/TyDropdown.tsx +240 -0
  137. package/src/components/TyFileUpload.tsx +108 -0
  138. package/src/components/TyIcon.tsx +71 -0
  139. package/src/components/TyInput.tsx +239 -0
  140. package/src/components/TyModal.tsx +195 -0
  141. package/src/components/TyMultiselect.tsx +208 -0
  142. package/src/components/TyOption.tsx +47 -0
  143. package/src/components/TyPopup.tsx +116 -0
  144. package/src/components/TyRadio.tsx +61 -0
  145. package/src/components/TyRadioGroup.tsx +125 -0
  146. package/src/components/TyResizeObserver.tsx +54 -0
  147. package/src/components/TyScrollContainer.tsx +102 -0
  148. package/src/components/TyStep.tsx +71 -0
  149. package/src/components/TySwitch.tsx +114 -0
  150. package/src/components/TyTab.tsx +65 -0
  151. package/src/components/TyTabs.tsx +93 -0
  152. package/src/components/TyTag.tsx +86 -0
  153. package/src/components/TyTextarea.tsx +181 -0
  154. package/src/components/TyTooltip.tsx +83 -0
  155. package/src/components/TyWizard.tsx +99 -0
  156. package/src/components/index.ts +279 -0
  157. package/src/utils/react-version.ts +8 -0
  158. package/src/utils/use-boolean-prop.ts +62 -0
  159. package/src/version.ts +6 -0
@@ -0,0 +1,279 @@
1
+ // ===================================================================
2
+ // VERSION
3
+ // ===================================================================
4
+
5
+ import { VERSION } from '../version';
6
+
7
+ /** Current version of tyrell-react (auto-synced with package.json on build). */
8
+ export { VERSION };
9
+
10
+ // One-time load banner so consumers can confirm which version of
11
+ // tyrell-react their page is actually running. Mirrors the banner in
12
+ // tyrell-components. Filter DevTools with "tyrell-react" if noisy.
13
+ if (typeof window !== 'undefined') {
14
+ (window as any).tyReactVersion = VERSION;
15
+ console.log(
16
+ `%c[tyrell-react]%c v${VERSION}`,
17
+ 'color:#a78bfa;font-weight:600',
18
+ 'color:inherit;font-weight:400'
19
+ );
20
+ }
21
+
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
+ // ===================================================================
34
+
35
+ export { TyButton } from './TyButton';
36
+ export type { TyButtonProps, TyButtonCSSProperties } from './TyButton';
37
+
38
+ export { TyTag } from './TyTag';
39
+ export type { TyTagProps, TyTagCSSProperties } from './TyTag';
40
+
41
+ export { TyInput } from './TyInput';
42
+ export type { TyInputProps, TyInputEventDetail, TyInputCSSProperties } from './TyInput';
43
+
44
+ export { TyTextarea } from './TyTextarea';
45
+ export type { TyTextareaProps, TyTextareaEventDetail } from './TyTextarea';
46
+
47
+ export { TyDropdown } from './TyDropdown';
48
+ export type { TyDropdownProps, TyDropdownEventDetail } from './TyDropdown';
49
+
50
+ export { TyOption } from './TyOption';
51
+ export type { TyOptionProps } from './TyOption';
52
+
53
+ export { TyIcon } from './TyIcon';
54
+ export type { TyIconProps } from './TyIcon';
55
+
56
+ export { TyModal } from './TyModal';
57
+ export type { TyModalProps, TyModalEventDetail, TyModalRef } from './TyModal';
58
+
59
+ export { TyTooltip } from './TyTooltip';
60
+ export type { TyTooltipProps } from './TyTooltip';
61
+
62
+ export { TyMultiselect } from './TyMultiselect';
63
+ export type { TyMultiselectProps, TyMultiselectEventDetail } from './TyMultiselect';
64
+
65
+ export { TyCalendar } from './TyCalendar';
66
+ export type { TyCalendarProps, TyCalendarChangeEventDetail, TyCalendarNavigateEventDetail } from './TyCalendar';
67
+
68
+ export { TyDatePicker } from './TyDatePicker';
69
+ export type { TyDatePickerProps, TyDatePickerEventDetail } from './TyDatePicker';
70
+
71
+ export { TyPopup } from './TyPopup';
72
+ export type { TyPopupProps, TyPopupElement } from './TyPopup';
73
+
74
+ export { TyCheckbox } from './TyCheckbox';
75
+ export type { TyCheckboxProps, TyCheckboxEventDetail } from './TyCheckbox';
76
+
77
+ export { TySwitch } from './TySwitch';
78
+ export type { TySwitchProps, TySwitchEventDetail } from './TySwitch';
79
+
80
+ export { TyRadio } from './TyRadio';
81
+ export type { TyRadioProps } from './TyRadio';
82
+
83
+ export { TyRadioGroup } from './TyRadioGroup';
84
+ export type { TyRadioGroupProps, TyRadioGroupEventDetail } from './TyRadioGroup';
85
+
86
+ export { TyCopy } from './TyCopy';
87
+ export type { TyCopyProps } from './TyCopy';
88
+
89
+ export { TyFileUpload } from './TyFileUpload';
90
+ export type { TyFileUploadProps, TyFileUploadEventDetail } from './TyFileUpload';
91
+
92
+ export { TyTabs } from './TyTabs';
93
+ export type { TyTabsProps, TabChangeDetail } from './TyTabs';
94
+
95
+ export { TyTab } from './TyTab';
96
+ export type { TyTabProps } from './TyTab';
97
+
98
+ export { TyCalendarMonth } from './TyCalendarMonth';
99
+ export type { TyCalendarMonthProps, DayClickDetail } from './TyCalendarMonth';
100
+
101
+ export { TyCalendarNavigation } from './TyCalendarNavigation';
102
+ export type { TyCalendarNavigationProps, NavigationChangeDetail } from './TyCalendarNavigation';
103
+
104
+ export { TyWizard } from './TyWizard';
105
+ export type { TyWizardProps, WizardStepChangeDetail } from './TyWizard';
106
+
107
+ export { TyStep } from './TyStep';
108
+ export type { TyStepProps } from './TyStep';
109
+
110
+ export { TyResizeObserver } from './TyResizeObserver';
111
+ export type { TyResizeObserverProps } from './TyResizeObserver';
112
+
113
+ export { TyScrollContainer } from './TyScrollContainer';
114
+ export type { TyScrollContainerProps, TyScrollContainerRef } from './TyScrollContainer';
115
+
116
+
117
+ // ===================================================================
118
+ // SHORT NAME EXPORTS (Clean Style - Developer Choice)
119
+ // ===================================================================
120
+
121
+ export { TyButton as Button } from './TyButton';
122
+ export { TyTag as Tag } from './TyTag';
123
+ export { TyInput as Input } from './TyInput';
124
+ export { TyTextarea as Textarea } from './TyTextarea';
125
+ export { TyDropdown as Dropdown } from './TyDropdown';
126
+ export { TyOption as Option } from './TyOption';
127
+ export { TyIcon as Icon } from './TyIcon';
128
+ export { TyModal as Modal } from './TyModal';
129
+ export { TyTooltip as Tooltip } from './TyTooltip';
130
+ export { TyMultiselect as Multiselect } from './TyMultiselect';
131
+ export { TyCalendar as Calendar } from './TyCalendar';
132
+ export { TyDatePicker as DatePicker } from './TyDatePicker';
133
+ export { TyPopup as Popup } from './TyPopup';
134
+ export { TyCheckbox as Checkbox } from './TyCheckbox';
135
+ export { TySwitch as Switch } from './TySwitch';
136
+ export { TyRadio as Radio } from './TyRadio';
137
+ export { TyRadioGroup as RadioGroup } from './TyRadioGroup';
138
+ export { TyCopy as Copy } from './TyCopy';
139
+ export { TyFileUpload as FileUpload } from './TyFileUpload';
140
+ export { TyTabs as Tabs } from './TyTabs';
141
+ export { TyTab as Tab } from './TyTab';
142
+ export { TyCalendarMonth as CalendarMonth } from './TyCalendarMonth';
143
+ export { TyCalendarNavigation as CalendarNavigation } from './TyCalendarNavigation';
144
+ export { TyWizard as Wizard } from './TyWizard';
145
+ export { TyStep as Step } from './TyStep';
146
+ export { TyResizeObserver as ResizeObserver } from './TyResizeObserver';
147
+ export { TyScrollContainer as ScrollContainer } from './TyScrollContainer';
148
+
149
+ // ===================================================================
150
+ // TYPE ALIASES (Both Styles Supported)
151
+ // ===================================================================
152
+
153
+ // Button types
154
+ export type { TyButtonProps as ButtonProps } from './TyButton';
155
+
156
+ // Tag types
157
+ export type { TyTagProps as TagProps } from './TyTag';
158
+
159
+ // Input types
160
+ export type { TyInputProps as InputProps, TyInputEventDetail as InputEventDetail } from './TyInput';
161
+
162
+ // Textarea types
163
+ export type { TyTextareaProps as TextareaProps, TyTextareaEventDetail as TextareaEventDetail } from './TyTextarea';
164
+
165
+ // Dropdown types
166
+ export type { TyDropdownProps as DropdownProps, TyDropdownEventDetail as DropdownEventDetail, OptionData } from './TyDropdown';
167
+
168
+ // Option types
169
+ export type { TyOptionProps as OptionProps } from './TyOption';
170
+
171
+ // Icon types
172
+ export type { TyIconProps as IconProps } from './TyIcon';
173
+
174
+ // Modal types
175
+ export type { TyModalProps as ModalProps, TyModalEventDetail as ModalEventDetail, TyModalRef as ModalRef } from './TyModal';
176
+
177
+ // Tooltip types
178
+ export type { TyTooltipProps as TooltipProps } from './TyTooltip';
179
+
180
+ // Multiselect types
181
+ export type { TyMultiselectProps as MultiselectProps, TyMultiselectEventDetail as MultiselectEventDetail } from './TyMultiselect';
182
+
183
+ // Calendar types
184
+ export type { TyCalendarProps as CalendarProps, TyCalendarChangeEventDetail as CalendarChangeEventDetail, TyCalendarNavigateEventDetail as CalendarNavigateEventDetail } from './TyCalendar';
185
+
186
+ // DatePicker types
187
+ export type { TyDatePickerProps as DatePickerProps, TyDatePickerEventDetail as DatePickerEventDetail } from './TyDatePicker';
188
+
189
+ // Popup types
190
+ export type { TyPopupProps as PopupProps, TyPopupElement as PopupElement } from './TyPopup';
191
+
192
+ // Checkbox types
193
+ export type { TyCheckboxProps as CheckboxProps, TyCheckboxEventDetail as CheckboxEventDetail } from './TyCheckbox';
194
+
195
+ // Switch types
196
+ export type { TySwitchProps as SwitchProps, TySwitchEventDetail as SwitchEventDetail } from './TySwitch';
197
+
198
+ // Radio types
199
+ export type { TyRadioProps as RadioProps } from './TyRadio';
200
+
201
+ // RadioGroup types
202
+ export type { TyRadioGroupProps as RadioGroupProps, TyRadioGroupEventDetail as RadioGroupEventDetail } from './TyRadioGroup';
203
+
204
+ // Copy types
205
+ export type { TyCopyProps as CopyProps } from './TyCopy';
206
+
207
+ // FileUpload types
208
+ export type { TyFileUploadProps as FileUploadProps, TyFileUploadEventDetail as FileUploadEventDetail } from './TyFileUpload';
209
+
210
+ // Tabs types
211
+ export type { TyTabsProps as TabsProps } from './TyTabs';
212
+
213
+ // Tab types
214
+ export type { TyTabProps as TabProps } from './TyTab';
215
+
216
+ // CalendarMonth types
217
+ export type { TyCalendarMonthProps as CalendarMonthProps } from './TyCalendarMonth';
218
+
219
+ // CalendarNavigation types
220
+ export type { TyCalendarNavigationProps as CalendarNavigationProps } from './TyCalendarNavigation';
221
+
222
+ // Wizard types
223
+ export type { TyWizardProps as WizardProps, WizardStepChangeDetail as StepChangeDetail } from './TyWizard';
224
+
225
+ // Step types
226
+ export type { TyStepProps as StepProps } from './TyStep';
227
+
228
+ // ResizeObserver types
229
+ export type { TyResizeObserverProps as ResizeObserverProps } from './TyResizeObserver';
230
+
231
+ // ScrollContainer types
232
+ export type { TyScrollContainerProps as ScrollContainerProps, TyScrollContainerRef as ScrollContainerRef } from './TyScrollContainer';
233
+
234
+ // ===================================================================
235
+ // USAGE EXAMPLES
236
+ // ===================================================================
237
+
238
+ /*
239
+
240
+ // STYLE 1: Ty-prefixed (Explicit and backward compatible)
241
+ import { TyButton, TyInput, TyModal } from 'tyrell-react';
242
+ import type { TyButtonProps, TyInputProps } from 'tyrell-react';
243
+
244
+ function MyComponent() {
245
+ return (
246
+ <TyModal>
247
+ <TyInput placeholder="Enter text..." />
248
+ <TyButton>Submit</TyButton>
249
+ </TyModal>
250
+ );
251
+ }
252
+
253
+ // STYLE 2: Short names (Clean and familiar)
254
+ import { Button, Input, Modal } from 'tyrell-react';
255
+ import type { ButtonProps, InputProps } from 'tyrell-react';
256
+
257
+ function MyComponent() {
258
+ return (
259
+ <Modal>
260
+ <Input placeholder="Enter text..." />
261
+ <Button>Submit</Button>
262
+ </Modal>
263
+ );
264
+ }
265
+
266
+ // STYLE 3: Mixed (Team preferences)
267
+ import { TyModal, Input, Button } from 'tyrell-react';
268
+ import type { TyModalProps, InputProps } from 'tyrell-react';
269
+
270
+ function MyComponent() {
271
+ return (
272
+ <TyModal>
273
+ <Input placeholder="Enter text..." />
274
+ <Button>Submit</Button>
275
+ </TyModal>
276
+ );
277
+ }
278
+
279
+ */
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+
3
+ // React 19 natively bridges props to custom-element properties (including
4
+ // empty strings, `false` booleans, functions, and objects). On React 18 we
5
+ // must imperatively assign these properties via useEffect. Wrappers gate
6
+ // their bridging effects on this flag so the workaround is dead code on
7
+ // React 19+ and removable when React 18 support is eventually dropped.
8
+ export const needsPropertyBridge = parseInt(React.version, 10) < 19;
@@ -0,0 +1,62 @@
1
+ import { useEffect, RefObject } from 'react';
2
+ import { needsPropertyBridge } from './react-version';
3
+
4
+ /**
5
+ * Coerce a value to a boolean using the same rules as the core property
6
+ * manager (packages/core/src/utils/property-manager.ts:142-152). This matters
7
+ * because consumers sometimes pass the string "false" through untyped call
8
+ * sites (JSON config, query params, server-rendered props) — and the JS
9
+ * `Boolean("false")` is surprisingly `true`.
10
+ *
11
+ * undefined | null | false | "false" | "0" → false
12
+ * "" → true (HTML boolean-attribute convention)
13
+ * any other truthy → true
14
+ */
15
+ export function coerceBool(value: unknown): boolean {
16
+ if (value === undefined || value === null || value === false) return false;
17
+ if (typeof value === 'string') {
18
+ if (value === '') return true;
19
+ const norm = value.toLowerCase().trim();
20
+ if (norm === 'false' || norm === '0') return false;
21
+ return true;
22
+ }
23
+ return Boolean(value);
24
+ }
25
+
26
+ /**
27
+ * Imperatively keep a boolean property on the underlying custom element in
28
+ * sync with its React prop.
29
+ *
30
+ * Why this exists: React 18 sets boolean attributes as empty strings on the
31
+ * first render to a custom element but does not reliably *remove* them when
32
+ * the prop flips back to `false`. Without this bridge, `<TyModal open>` →
33
+ * `<TyModal open={false}>` leaves the `open` attribute on the element and
34
+ * the modal stays open. Same class of bug affects `disabled`, `required`,
35
+ * `clearable`, `loading`, `readonly`, `protected`, etc.
36
+ *
37
+ * React 19+ bridges this natively — the effect short-circuits via
38
+ * `needsPropertyBridge`, so this is dead code on modern React.
39
+ *
40
+ * Pass the *camelCase JS property name* on the element (e.g. `externalSearch`
41
+ * for the `external-search` attribute). The core base class handles the
42
+ * attribute-side sync once the property changes.
43
+ *
44
+ * Returns the coerced boolean so the caller can also drive its conditional
45
+ * JSX attribute emission with a value that correctly handles "false".
46
+ */
47
+ export function useBooleanProperty(
48
+ ref: RefObject<HTMLElement | null>,
49
+ propName: string,
50
+ value: unknown
51
+ ): boolean {
52
+ const coerced = coerceBool(value);
53
+ useEffect(() => {
54
+ if (!needsPropertyBridge) return;
55
+ const el = ref.current as any;
56
+ if (!el) return;
57
+ if (Boolean(el[propName]) !== coerced) {
58
+ el[propName] = coerced;
59
+ }
60
+ }, [coerced, propName, ref]);
61
+ return coerced;
62
+ }
package/src/version.ts ADDED
@@ -0,0 +1,6 @@
1
+ // AUTO-GENERATED FILE - DO NOT EDIT
2
+ // Generated from package.json by scripts/generate-version.js
3
+ // Run 'npm run generate:version' to regenerate.
4
+
5
+ /** Current version of tyrell-react. Synced with package.json on build. */
6
+ export const VERSION = '1.0.0-RC10'