@dloizides/ui-feedback 1.16.1 → 1.17.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/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createContext, useMemo, useContext, useCallback, useState, useEffect, useSyncExternalStore, Component, useRef } from 'react';
|
|
1
|
+
import { createContext, useMemo, useContext, useCallback, useId, useState, useEffect, useSyncExternalStore, Component, useRef } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { StyleSheet, Platform, TouchableOpacity, Text, View, ActivityIndicator, Modal, useWindowDimensions, Animated, Pressable } from 'react-native';
|
|
4
4
|
import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
|
|
5
5
|
import { Skeleton } from '@dloizides/ui-motion';
|
|
6
|
+
import { Z_INDEX, resolveOnBrand } from '@dloizides/design-tokens';
|
|
6
7
|
import { createPortal } from 'react-dom';
|
|
7
|
-
import { Z_INDEX } from '@dloizides/design-tokens';
|
|
8
8
|
|
|
9
9
|
// src/context/FeedbackUiContext.tsx
|
|
10
10
|
var DEFAULT_FEEDBACK_VALUE = {
|
|
@@ -62,6 +62,7 @@ var FEEDBACK_TEST_IDS = {
|
|
|
62
62
|
errorBoundary: "error-boundary",
|
|
63
63
|
progressBar: "progress-bar"
|
|
64
64
|
};
|
|
65
|
+
var MIN_TOUCH_TARGET = 44;
|
|
65
66
|
var WELL_SIZE = 56;
|
|
66
67
|
var WELL_MARGIN_BOTTOM = 16;
|
|
67
68
|
var WELL_TINT_OPACITY = 0.12;
|
|
@@ -427,6 +428,12 @@ var AsyncSurface = ({
|
|
|
427
428
|
if (loading) return /* @__PURE__ */ jsx(PageSkeleton, { showHeader: true, rows: skeletonRows, variant });
|
|
428
429
|
return children;
|
|
429
430
|
};
|
|
431
|
+
function confirmFill(theme, destructive) {
|
|
432
|
+
return destructive ? theme.semantic.error["500"] : theme.palette.primary["500"];
|
|
433
|
+
}
|
|
434
|
+
function confirmInk(theme, destructive) {
|
|
435
|
+
return resolveOnBrand(confirmFill(theme, destructive));
|
|
436
|
+
}
|
|
430
437
|
var DIALOG_MAX_WIDTH = 400;
|
|
431
438
|
var styles6 = StyleSheet.create({
|
|
432
439
|
overlay: {
|
|
@@ -464,6 +471,7 @@ var styles6 = StyleSheet.create({
|
|
|
464
471
|
paddingHorizontal: 20,
|
|
465
472
|
borderRadius: 6,
|
|
466
473
|
minWidth: 80,
|
|
474
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
467
475
|
alignItems: "center",
|
|
468
476
|
justifyContent: "center"
|
|
469
477
|
},
|
|
@@ -492,6 +500,8 @@ var ConfirmDialog = ({
|
|
|
492
500
|
destructive = false
|
|
493
501
|
}) => {
|
|
494
502
|
const { theme, t } = useFeedbackUi();
|
|
503
|
+
const titleId = useId();
|
|
504
|
+
const innerDialogRole = Platform.OS === "web" ? void 0 : "dialog";
|
|
495
505
|
const colorStyles = useMemo(
|
|
496
506
|
() => ({
|
|
497
507
|
dialog: { backgroundColor: theme.colors.surfaceElevated },
|
|
@@ -499,10 +509,8 @@ var ConfirmDialog = ({
|
|
|
499
509
|
message: { color: theme.colors.textSecondary },
|
|
500
510
|
cancelButton: { borderColor: theme.colors.border },
|
|
501
511
|
cancelButtonText: { color: theme.colors.text },
|
|
502
|
-
confirmButton: {
|
|
503
|
-
|
|
504
|
-
},
|
|
505
|
-
confirmButtonText: { color: theme.colors.surfaceElevated }
|
|
512
|
+
confirmButton: { backgroundColor: confirmFill(theme, destructive) },
|
|
513
|
+
confirmButtonText: { color: confirmInk(theme, destructive) }
|
|
506
514
|
}),
|
|
507
515
|
[theme, destructive]
|
|
508
516
|
);
|
|
@@ -515,6 +523,7 @@ var ConfirmDialog = ({
|
|
|
515
523
|
Modal,
|
|
516
524
|
{
|
|
517
525
|
transparent: true,
|
|
526
|
+
"aria-labelledby": titleId,
|
|
518
527
|
animationType: "fade",
|
|
519
528
|
visible,
|
|
520
529
|
onRequestClose: onCancel,
|
|
@@ -522,11 +531,11 @@ var ConfirmDialog = ({
|
|
|
522
531
|
View,
|
|
523
532
|
{
|
|
524
533
|
accessibilityViewIsModal: true,
|
|
525
|
-
"aria-label": title,
|
|
526
|
-
role:
|
|
534
|
+
"aria-label": innerDialogRole === void 0 ? void 0 : title,
|
|
535
|
+
role: innerDialogRole,
|
|
527
536
|
style: [styles6.dialog, colorStyles.dialog],
|
|
528
537
|
children: [
|
|
529
|
-
/* @__PURE__ */ jsx(Text, { style: [styles6.title, colorStyles.title], children: title }),
|
|
538
|
+
/* @__PURE__ */ jsx(Text, { nativeID: titleId, style: [styles6.title, colorStyles.title], children: title }),
|
|
530
539
|
/* @__PURE__ */ jsx(Text, { style: [styles6.message, colorStyles.message], children: message }),
|
|
531
540
|
/* @__PURE__ */ jsxs(View, { style: styles6.buttonRow, children: [
|
|
532
541
|
/* @__PURE__ */ jsx(
|
|
@@ -564,7 +573,7 @@ var ConfirmDialog = ({
|
|
|
564
573
|
children: loading ? /* @__PURE__ */ jsx(
|
|
565
574
|
ActivityIndicator,
|
|
566
575
|
{
|
|
567
|
-
color: theme
|
|
576
|
+
color: confirmInk(theme, destructive),
|
|
568
577
|
size: "small",
|
|
569
578
|
testID: "confirm-loading"
|
|
570
579
|
}
|