@webority-technologies/mobile-ui 0.0.1 → 0.0.3
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/README.md +2 -1
- package/lib/commonjs/components/AuthedImage/AuthedImage.js +225 -0
- package/lib/commonjs/components/AuthedImage/authedImageCache.js +253 -0
- package/lib/commonjs/components/AuthedImage/index.js +45 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +10 -4
- package/lib/commonjs/components/Drawer/Drawer.js +6 -3
- package/lib/commonjs/components/ErrorBoundary/ErrorBoundary.js +136 -0
- package/lib/commonjs/components/ErrorBoundary/index.js +27 -0
- package/lib/commonjs/components/ErrorBoundary/useErrorHandler.js +24 -0
- package/lib/commonjs/components/ErrorBoundary/withErrorBoundary.js +28 -0
- package/lib/commonjs/components/FilePicker/FilePicker.js +1 -1
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +14 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +13 -0
- package/lib/commonjs/components/InlineSelect/InlineSelect.js +1 -1
- package/lib/commonjs/components/Input/Input.js +6 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +62 -13
- package/lib/commonjs/components/LoaderOverlay/LoaderOverlay.js +203 -0
- package/lib/commonjs/components/LoaderOverlay/index.js +25 -0
- package/lib/commonjs/components/Markdown/Markdown.js +274 -0
- package/lib/commonjs/components/Markdown/index.js +13 -0
- package/lib/commonjs/components/Markdown/parse.js +229 -0
- package/lib/commonjs/components/OTPInput/OTPInput.js +5 -0
- package/lib/commonjs/components/OptionSheet/OptionSheet.js +3 -3
- package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/commonjs/components/Radio/Radio.js +9 -0
- package/lib/commonjs/components/Rating/Rating.js +5 -0
- package/lib/commonjs/components/RichTextEditor/RichTextEditor.js +311 -0
- package/lib/commonjs/components/RichTextEditor/index.js +20 -0
- package/lib/commonjs/components/RichTextEditor/markdownActions.js +213 -0
- package/lib/commonjs/components/SearchBar/SearchBar.js +7 -0
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/Skeleton/Skeleton.js +17 -36
- package/lib/commonjs/components/Slider/Slider.js +21 -5
- package/lib/commonjs/components/Swipeable/Swipeable.js +5 -2
- package/lib/commonjs/components/TimePicker/TimePicker.js +11 -0
- package/lib/commonjs/components/index.js +230 -141
- package/lib/commonjs/form/FormContext.js +13 -1
- package/lib/commonjs/form/useField.js +13 -1
- package/lib/commonjs/theme/Gradient.js +44 -41
- package/lib/commonjs/theme/index.js +24 -2
- package/lib/commonjs/utils/hapticUtils.js +38 -18
- package/lib/module/components/AuthedImage/AuthedImage.js +221 -0
- package/lib/module/components/AuthedImage/authedImageCache.js +239 -0
- package/lib/module/components/AuthedImage/index.js +5 -0
- package/lib/module/components/BottomSheet/BottomSheet.js +10 -4
- package/lib/module/components/Drawer/Drawer.js +6 -3
- package/lib/module/components/ErrorBoundary/ErrorBoundary.js +130 -0
- package/lib/module/components/ErrorBoundary/index.js +6 -0
- package/lib/module/components/ErrorBoundary/useErrorHandler.js +20 -0
- package/lib/module/components/ErrorBoundary/withErrorBoundary.js +23 -0
- package/lib/module/components/FilePicker/FilePicker.js +1 -1
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +14 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +13 -0
- package/lib/module/components/InlineSelect/InlineSelect.js +1 -1
- package/lib/module/components/Input/Input.js +6 -0
- package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +63 -14
- package/lib/module/components/LoaderOverlay/LoaderOverlay.js +196 -0
- package/lib/module/components/LoaderOverlay/index.js +4 -0
- package/lib/module/components/Markdown/Markdown.js +268 -0
- package/lib/module/components/Markdown/index.js +4 -0
- package/lib/module/components/Markdown/parse.js +223 -0
- package/lib/module/components/OTPInput/OTPInput.js +5 -0
- package/lib/module/components/OptionSheet/OptionSheet.js +3 -3
- package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/module/components/Radio/Radio.js +9 -0
- package/lib/module/components/Rating/Rating.js +5 -0
- package/lib/module/components/RichTextEditor/RichTextEditor.js +306 -0
- package/lib/module/components/RichTextEditor/index.js +5 -0
- package/lib/module/components/RichTextEditor/markdownActions.js +207 -0
- package/lib/module/components/SearchBar/SearchBar.js +7 -0
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/Skeleton/Skeleton.js +17 -36
- package/lib/module/components/Slider/Slider.js +21 -5
- package/lib/module/components/Swipeable/Swipeable.js +5 -2
- package/lib/module/components/TimePicker/TimePicker.js +11 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/form/FormContext.js +13 -1
- package/lib/module/form/useField.js +13 -1
- package/lib/module/theme/Gradient.js +41 -38
- package/lib/module/theme/index.js +17 -1
- package/lib/module/utils/hapticUtils.js +37 -18
- package/lib/typescript/commonjs/components/AuthedImage/AuthedImage.d.ts +22 -0
- package/lib/typescript/commonjs/components/AuthedImage/authedImageCache.d.ts +48 -0
- package/lib/typescript/commonjs/components/AuthedImage/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +1 -3
- package/lib/typescript/commonjs/components/Card/Card.d.ts +1 -2
- package/lib/typescript/commonjs/components/ErrorBoundary/ErrorBoundary.d.ts +38 -0
- package/lib/typescript/commonjs/components/ErrorBoundary/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/ErrorBoundary/useErrorHandler.d.ts +9 -0
- package/lib/typescript/commonjs/components/ErrorBoundary/withErrorBoundary.d.ts +9 -0
- package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +15 -0
- package/lib/typescript/commonjs/components/LoaderOverlay/LoaderOverlay.d.ts +25 -0
- package/lib/typescript/commonjs/components/LoaderOverlay/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Markdown/Markdown.d.ts +29 -0
- package/lib/typescript/commonjs/components/Markdown/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Markdown/parse.d.ts +58 -0
- package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +8 -1
- package/lib/typescript/commonjs/components/RichTextEditor/RichTextEditor.d.ts +48 -0
- package/lib/typescript/commonjs/components/RichTextEditor/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/RichTextEditor/markdownActions.d.ts +35 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +1 -1
- package/lib/typescript/commonjs/components/index.d.ts +10 -0
- package/lib/typescript/commonjs/form/FormContext.d.ts +13 -3
- package/lib/typescript/commonjs/theme/Gradient.d.ts +18 -3
- package/lib/typescript/commonjs/theme/index.d.ts +16 -1
- package/lib/typescript/commonjs/theme/types.d.ts +2 -2
- package/lib/typescript/commonjs/utils/hapticUtils.d.ts +4 -0
- package/lib/typescript/module/components/AuthedImage/AuthedImage.d.ts +22 -0
- package/lib/typescript/module/components/AuthedImage/authedImageCache.d.ts +48 -0
- package/lib/typescript/module/components/AuthedImage/index.d.ts +5 -0
- package/lib/typescript/module/components/Button/Button.d.ts +1 -3
- package/lib/typescript/module/components/Card/Card.d.ts +1 -2
- package/lib/typescript/module/components/ErrorBoundary/ErrorBoundary.d.ts +38 -0
- package/lib/typescript/module/components/ErrorBoundary/index.d.ts +5 -0
- package/lib/typescript/module/components/ErrorBoundary/useErrorHandler.d.ts +9 -0
- package/lib/typescript/module/components/ErrorBoundary/withErrorBoundary.d.ts +9 -0
- package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +15 -0
- package/lib/typescript/module/components/LoaderOverlay/LoaderOverlay.d.ts +25 -0
- package/lib/typescript/module/components/LoaderOverlay/index.d.ts +3 -0
- package/lib/typescript/module/components/Markdown/Markdown.d.ts +29 -0
- package/lib/typescript/module/components/Markdown/index.d.ts +3 -0
- package/lib/typescript/module/components/Markdown/parse.d.ts +58 -0
- package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +8 -1
- package/lib/typescript/module/components/RichTextEditor/RichTextEditor.d.ts +48 -0
- package/lib/typescript/module/components/RichTextEditor/index.d.ts +5 -0
- package/lib/typescript/module/components/RichTextEditor/markdownActions.d.ts +35 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +1 -1
- package/lib/typescript/module/components/index.d.ts +10 -0
- package/lib/typescript/module/form/FormContext.d.ts +13 -3
- package/lib/typescript/module/theme/Gradient.d.ts +18 -3
- package/lib/typescript/module/theme/index.d.ts +16 -1
- package/lib/typescript/module/theme/types.d.ts +2 -2
- package/lib/typescript/module/utils/hapticUtils.d.ts +4 -0
- package/package.json +20 -13
|
@@ -275,8 +275,13 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
const delta = event.nativeEvent.actionName === 'increment' ? step : -step;
|
|
278
|
+
// Round through `precision` (same guard the pan gesture uses) so repeated
|
|
279
|
+
// increments of a fractional step (e.g. 0.1) don't drift off the exact
|
|
280
|
+
// decimal via binary float addition (0.1+0.1+0.1 = 0.30000000000000004).
|
|
281
|
+
const roundedDelta = step > 0 ? Math.round(delta * precision) / precision : delta;
|
|
278
282
|
if (isRange) {
|
|
279
|
-
const
|
|
283
|
+
const rawLow = Math.round((lowVal.value + roundedDelta) * precision) / precision;
|
|
284
|
+
const nextLow = clamp(rawLow, min, highVal.value);
|
|
280
285
|
if (nextLow !== lowVal.value) {
|
|
281
286
|
lowVal.value = nextLow;
|
|
282
287
|
lowX.value = valueToPx(nextLow, trackWidth);
|
|
@@ -284,7 +289,8 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
284
289
|
fireChange(nextLow, highVal.value);
|
|
285
290
|
}
|
|
286
291
|
} else {
|
|
287
|
-
const
|
|
292
|
+
const rawNext = Math.round((lowVal.value + roundedDelta) * precision) / precision;
|
|
293
|
+
const next = clamp(rawNext, min, max);
|
|
288
294
|
if (next !== lowVal.value) {
|
|
289
295
|
lowVal.value = next;
|
|
290
296
|
lowX.value = valueToPx(next, trackWidth);
|
|
@@ -292,7 +298,7 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
292
298
|
fireChange(next, next);
|
|
293
299
|
}
|
|
294
300
|
}
|
|
295
|
-
}, [disabled, step, isRange, min, max, valueToPx, trackWidth, lowX, lowVal, highVal, fireChange, fireHaptic]);
|
|
301
|
+
}, [disabled, step, precision, isRange, min, max, valueToPx, trackWidth, lowX, lowVal, highVal, fireChange, fireHaptic]);
|
|
296
302
|
const thumbRadius = sizeCfg.thumbDiameter / 2;
|
|
297
303
|
|
|
298
304
|
// ───────── Animated styles ─────────
|
|
@@ -325,8 +331,18 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
325
331
|
}));
|
|
326
332
|
|
|
327
333
|
// Display values (from committed state) for labels + a11y.
|
|
328
|
-
|
|
329
|
-
|
|
334
|
+
//
|
|
335
|
+
// Clamped to [min, max]. A caller-supplied value outside the range is not
|
|
336
|
+
// rewritten — `onChange` is never fired from here and the caller's own state
|
|
337
|
+
// is untouched — but it must not be RENDERED as-is: valueToPx does not clamp,
|
|
338
|
+
// so value=150 on a 0..100 slider puts the thumb off the end of the track, and
|
|
339
|
+
// accessibilityValue would announce `now: 150` against `max: 100`, which is an
|
|
340
|
+
// invalid state for a screen reader. Any interaction re-clamps through
|
|
341
|
+
// clamp()/snapToStep() anyway, so this only aligns the first render with what
|
|
342
|
+
// every subsequent one already does.
|
|
343
|
+
const clampDisplay = v => clamp(v, min, max);
|
|
344
|
+
const lowDisplayValue = clampDisplay(isRange ? Math.min(...currentValue) : currentValue);
|
|
345
|
+
const highDisplayValue = clampDisplay(isRange ? Math.max(...currentValue) : currentValue);
|
|
330
346
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
331
347
|
ref: ref,
|
|
332
348
|
style: [styles.container, containerStyle, style],
|
|
@@ -123,6 +123,9 @@ const Swipeable = props => {
|
|
|
123
123
|
const fireFirstAction = (0, _react.useCallback)(side => {
|
|
124
124
|
const list = side === 'left' ? leftActions : rightActions;
|
|
125
125
|
const first = list?.[0];
|
|
126
|
+
// Structurally unreachable, not a bug guard: both call sites below are
|
|
127
|
+
// gated on allowLeft/allowRight (== hasLeft/hasRight), which is exactly
|
|
128
|
+
// "list has at least one element". Kept for type narrowing on `first`.
|
|
126
129
|
if (!first) {
|
|
127
130
|
return;
|
|
128
131
|
}
|
|
@@ -159,7 +162,7 @@ const Swipeable = props => {
|
|
|
159
162
|
const openThreshold = threshold;
|
|
160
163
|
const allowLeft = hasLeft;
|
|
161
164
|
const allowRight = hasRight;
|
|
162
|
-
return _reactNativeGestureHandler.Gesture.Pan().enabled(!disabled).activeOffsetX([-dragActivationOffset, dragActivationOffset]).failOffsetY([-failOffsetY, failOffsetY]).onStart(() => {
|
|
165
|
+
return _reactNativeGestureHandler.Gesture.Pan().enabled(!disabled).withTestId(testID ? `${testID}-gesture` : 'swipeable-gesture').activeOffsetX([-dragActivationOffset, dragActivationOffset]).failOffsetY([-failOffsetY, failOffsetY]).onStart(() => {
|
|
163
166
|
'worklet';
|
|
164
167
|
|
|
165
168
|
dragStartX.value = translateX.value;
|
|
@@ -217,7 +220,7 @@ const Swipeable = props => {
|
|
|
217
220
|
translateX.value = (0, _reactNativeReanimated.withSpring)(0, springConfig);
|
|
218
221
|
(0, _reactNativeReanimated.runOnJS)(notifyClose)();
|
|
219
222
|
});
|
|
220
|
-
}, [disabled, dragStartX, fireFirstAction, fullSwipeThreshold, hasLeft, hasRight, leftRevealWidth, notifyClose, notifyOpen, rightRevealWidth, screenWidth, threshold, translateX, dragActivationOffset, failOffsetY, rubberBandFactor, springConfig]);
|
|
223
|
+
}, [disabled, dragStartX, fireFirstAction, fullSwipeThreshold, hasLeft, hasRight, leftRevealWidth, notifyClose, notifyOpen, rightRevealWidth, screenWidth, threshold, translateX, dragActivationOffset, failOffsetY, rubberBandFactor, springConfig, testID]);
|
|
221
224
|
|
|
222
225
|
// ───────── Animated styles ─────────
|
|
223
226
|
const contentStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
@@ -337,6 +337,17 @@ const TimePicker = props => {
|
|
|
337
337
|
const [periodIndex, setPeriodIndex] = (0, _react.useState)(() => initial.period === 'PM' ? 1 : 0);
|
|
338
338
|
|
|
339
339
|
// Re-sync on open toggle / value change / format / step.
|
|
340
|
+
//
|
|
341
|
+
// The `!open` guard is a RENDER OPTIMISATION, not a correctness guard, and it
|
|
342
|
+
// is worth knowing which. `open` is itself a dependency, so the effect re-runs
|
|
343
|
+
// when the picker opens and reads a fresh `new Date()` either way — the state
|
|
344
|
+
// a user actually sees is identical with or without it. What it saves is three
|
|
345
|
+
// setState calls (and the extra commit they schedule) on every prop change
|
|
346
|
+
// while the picker is closed. Correctness while closed is handled by RN's
|
|
347
|
+
// Modal, which renders nothing at visible={false}.
|
|
348
|
+
//
|
|
349
|
+
// That is why its test counts render passes through React.Profiler rather than
|
|
350
|
+
// asserting on the tree: no DOM assertion can distinguish the two paths.
|
|
340
351
|
(0, _react.useEffect)(() => {
|
|
341
352
|
if (!open) {
|
|
342
353
|
return;
|