@hozo/primitives 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +24 -2
- package/dist/flat-list.native.d.ts +8 -8
- package/dist/flat-list.native.d.ts.map +1 -1
- package/dist/flat-list.native.js +55 -25
- package/dist/flat-list.native.js.map +1 -1
- package/dist/foundation.d.ts +7 -4
- package/dist/foundation.d.ts.map +1 -1
- package/dist/foundation.js +33 -16
- package/dist/foundation.js.map +1 -1
- package/dist/foundation.native.d.ts +16 -2
- package/dist/foundation.native.d.ts.map +1 -1
- package/dist/foundation.native.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -9
- package/dist/index.js.map +1 -1
- package/dist/index.native.d.ts +1 -0
- package/dist/index.native.d.ts.map +1 -1
- package/dist/index.native.js +1 -0
- package/dist/index.native.js.map +1 -1
- package/dist/link.native.d.ts +16 -7
- package/dist/link.native.d.ts.map +1 -1
- package/dist/link.native.js +9 -5
- package/dist/link.native.js.map +1 -1
- package/dist/presence-context.d.ts +15 -0
- package/dist/presence-context.d.ts.map +1 -0
- package/dist/presence-context.js +11 -0
- package/dist/presence-context.js.map +1 -0
- package/dist/presence.d.ts +12 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +45 -0
- package/dist/presence.js.map +1 -0
- package/dist/presence.native.d.ts +8 -0
- package/dist/presence.native.d.ts.map +1 -0
- package/dist/presence.native.js +66 -0
- package/dist/presence.native.js.map +1 -0
- package/dist/pressable.d.ts +9 -2
- package/dist/pressable.d.ts.map +1 -1
- package/dist/pressable.js +9 -6
- package/dist/pressable.js.map +1 -1
- package/dist/pressable.native.d.ts.map +1 -1
- package/dist/pressable.native.js +181 -195
- package/dist/pressable.native.js.map +1 -1
- package/dist/runtime-container.native.d.ts +11 -9
- package/dist/runtime-container.native.d.ts.map +1 -1
- package/dist/runtime-container.native.js +8 -6
- package/dist/runtime-container.native.js.map +1 -1
- package/dist/runtime-transition.native.d.ts +16 -1
- package/dist/runtime-transition.native.d.ts.map +1 -1
- package/dist/runtime-transition.native.js +34 -7
- package/dist/runtime-transition.native.js.map +1 -1
- package/dist/text-input.d.ts +319 -3
- package/dist/text-input.d.ts.map +1 -1
- package/dist/text-input.js +4 -3
- package/dist/text-input.js.map +1 -1
- package/dist/view.d.ts +11 -2
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +7 -6
- package/dist/view.js.map +1 -1
- package/package.json +4 -3
- package/src/flat-list.native.tsx +69 -47
- package/src/foundation.native.tsx +16 -1
- package/src/foundation.tsx +66 -25
- package/src/index.native.ts +2 -0
- package/src/index.ts +209 -219
- package/src/link.native.tsx +29 -18
- package/src/presence-context.ts +27 -0
- package/src/presence.native.tsx +81 -0
- package/src/presence.tsx +55 -0
- package/src/pressable.native.tsx +251 -243
- package/src/pressable.ts +92 -79
- package/src/runtime-container.native.tsx +30 -15
- package/src/runtime-transition.native.tsx +68 -7
- package/src/text-input.ts +74 -72
- package/src/view.ts +76 -61
package/src/view.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type HozoDomStyle,
|
|
3
3
|
hozoDomStyle,
|
|
4
|
+
hozoViewBase,
|
|
5
|
+
hozoViewClassName,
|
|
4
6
|
type ResponderProps,
|
|
5
7
|
useResponderDomProps,
|
|
6
8
|
} from '@hozo/engine'
|
|
7
9
|
import {
|
|
8
10
|
createElement,
|
|
9
|
-
|
|
11
|
+
Fragment,
|
|
10
12
|
type HTMLAttributes,
|
|
11
13
|
type ReactNode,
|
|
12
14
|
type Ref,
|
|
@@ -42,6 +44,15 @@ export interface HozoViewProps
|
|
|
42
44
|
onLayout?: (event: HozoLayoutEvent) => void
|
|
43
45
|
collapsable?: boolean
|
|
44
46
|
'data-hozo-disabled'?: string
|
|
47
|
+
/**
|
|
48
|
+
* Declared here rather than supplied by `forwardRef`'s return type.
|
|
49
|
+
*
|
|
50
|
+
* React 19 takes `ref` as an ordinary prop, so the component is a plain
|
|
51
|
+
* function and nothing adds `ref` to its props on the way out. A caller's
|
|
52
|
+
* `ref` is accepted because this line says so, which is also why it has to
|
|
53
|
+
* be destructured below: `...props` would otherwise carry it to the `div`.
|
|
54
|
+
*/
|
|
55
|
+
ref?: Ref<HTMLDivElement>
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
function assignRef<T>(ref: Ref<T> | undefined, value: T | null) {
|
|
@@ -50,40 +61,38 @@ function assignRef<T>(ref: Ref<T> | undefined, value: T | null) {
|
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
/** A measured/responder-aware View for the Web paths that cannot be a plain div. */
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
forwardedRef,
|
|
86
|
-
) {
|
|
64
|
+
export function HozoView({
|
|
65
|
+
ref: forwardedRef,
|
|
66
|
+
children,
|
|
67
|
+
style,
|
|
68
|
+
testID,
|
|
69
|
+
nativeID,
|
|
70
|
+
pointerEvents,
|
|
71
|
+
accessibilityLabel,
|
|
72
|
+
accessibilityHint,
|
|
73
|
+
accessibilityRole,
|
|
74
|
+
accessibilityState,
|
|
75
|
+
accessibilityValue,
|
|
76
|
+
accessibilityLiveRegion,
|
|
77
|
+
onLayout,
|
|
78
|
+
collapsable: _collapsable,
|
|
79
|
+
role,
|
|
80
|
+
'aria-disabled': ariaDisabled,
|
|
81
|
+
'data-hozo-disabled': dataHozoDisabled,
|
|
82
|
+
onStartShouldSetResponder,
|
|
83
|
+
onStartShouldSetResponderCapture,
|
|
84
|
+
onMoveShouldSetResponder,
|
|
85
|
+
onMoveShouldSetResponderCapture,
|
|
86
|
+
onResponderGrant,
|
|
87
|
+
onResponderStart,
|
|
88
|
+
onResponderMove,
|
|
89
|
+
onResponderEnd,
|
|
90
|
+
onResponderRelease,
|
|
91
|
+
onResponderReject,
|
|
92
|
+
onResponderTerminate,
|
|
93
|
+
onResponderTerminationRequest,
|
|
94
|
+
...props
|
|
95
|
+
}: HozoViewProps) {
|
|
87
96
|
const elementRef = useRef<HTMLDivElement>(null)
|
|
88
97
|
const layoutCallback = useRef(onLayout)
|
|
89
98
|
layoutCallback.current = onLayout
|
|
@@ -136,30 +145,36 @@ export const HozoView = forwardRef<HTMLDivElement, HozoViewProps>(function HozoV
|
|
|
136
145
|
const state = accessibilityState
|
|
137
146
|
const value = accessibilityValue
|
|
138
147
|
return createElement(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
Fragment,
|
|
149
|
+
null,
|
|
150
|
+
hozoViewBase(),
|
|
151
|
+
createElement(
|
|
152
|
+
'div',
|
|
153
|
+
{
|
|
154
|
+
...props,
|
|
155
|
+
className: hozoViewClassName(props.className),
|
|
156
|
+
...responder,
|
|
157
|
+
ref: setRef,
|
|
158
|
+
role: accessibilityRole ?? role,
|
|
159
|
+
style: hozoDomStyle(style),
|
|
160
|
+
'data-testid': testID,
|
|
161
|
+
id: nativeID,
|
|
162
|
+
'data-hozo-pointer-events': pointerEvents,
|
|
163
|
+
'data-hozo-disabled': state?.disabled ? '' : dataHozoDisabled,
|
|
164
|
+
'aria-disabled': state?.disabled ? true : ariaDisabled,
|
|
165
|
+
'aria-selected': state?.selected,
|
|
166
|
+
'aria-checked': state?.checked,
|
|
167
|
+
'aria-busy': state?.busy,
|
|
168
|
+
'aria-expanded': state?.expanded,
|
|
169
|
+
'aria-valuemin': value?.min,
|
|
170
|
+
'aria-valuemax': value?.max,
|
|
171
|
+
'aria-valuenow': value?.now,
|
|
172
|
+
'aria-valuetext': value?.text,
|
|
173
|
+
'aria-live': accessibilityLiveRegion === 'none' ? undefined : accessibilityLiveRegion,
|
|
174
|
+
'aria-label': accessibilityLabel,
|
|
175
|
+
'aria-description': accessibilityHint,
|
|
176
|
+
},
|
|
177
|
+
children,
|
|
178
|
+
),
|
|
164
179
|
)
|
|
165
|
-
}
|
|
180
|
+
}
|