@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.js
CHANGED
|
@@ -5,8 +5,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
var a11y = require('@dloizides/a11y');
|
|
7
7
|
var uiMotion = require('@dloizides/ui-motion');
|
|
8
|
-
var reactDom = require('react-dom');
|
|
9
8
|
var designTokens = require('@dloizides/design-tokens');
|
|
9
|
+
var reactDom = require('react-dom');
|
|
10
10
|
|
|
11
11
|
// src/context/FeedbackUiContext.tsx
|
|
12
12
|
var DEFAULT_FEEDBACK_VALUE = {
|
|
@@ -64,6 +64,7 @@ var FEEDBACK_TEST_IDS = {
|
|
|
64
64
|
errorBoundary: "error-boundary",
|
|
65
65
|
progressBar: "progress-bar"
|
|
66
66
|
};
|
|
67
|
+
var MIN_TOUCH_TARGET = 44;
|
|
67
68
|
var WELL_SIZE = 56;
|
|
68
69
|
var WELL_MARGIN_BOTTOM = 16;
|
|
69
70
|
var WELL_TINT_OPACITY = 0.12;
|
|
@@ -429,6 +430,12 @@ var AsyncSurface = ({
|
|
|
429
430
|
if (loading) return /* @__PURE__ */ jsxRuntime.jsx(PageSkeleton, { showHeader: true, rows: skeletonRows, variant });
|
|
430
431
|
return children;
|
|
431
432
|
};
|
|
433
|
+
function confirmFill(theme, destructive) {
|
|
434
|
+
return destructive ? theme.semantic.error["500"] : theme.palette.primary["500"];
|
|
435
|
+
}
|
|
436
|
+
function confirmInk(theme, destructive) {
|
|
437
|
+
return designTokens.resolveOnBrand(confirmFill(theme, destructive));
|
|
438
|
+
}
|
|
432
439
|
var DIALOG_MAX_WIDTH = 400;
|
|
433
440
|
var styles6 = reactNative.StyleSheet.create({
|
|
434
441
|
overlay: {
|
|
@@ -466,6 +473,7 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
466
473
|
paddingHorizontal: 20,
|
|
467
474
|
borderRadius: 6,
|
|
468
475
|
minWidth: 80,
|
|
476
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
469
477
|
alignItems: "center",
|
|
470
478
|
justifyContent: "center"
|
|
471
479
|
},
|
|
@@ -494,6 +502,8 @@ var ConfirmDialog = ({
|
|
|
494
502
|
destructive = false
|
|
495
503
|
}) => {
|
|
496
504
|
const { theme, t } = useFeedbackUi();
|
|
505
|
+
const titleId = react.useId();
|
|
506
|
+
const innerDialogRole = reactNative.Platform.OS === "web" ? void 0 : "dialog";
|
|
497
507
|
const colorStyles = react.useMemo(
|
|
498
508
|
() => ({
|
|
499
509
|
dialog: { backgroundColor: theme.colors.surfaceElevated },
|
|
@@ -501,10 +511,8 @@ var ConfirmDialog = ({
|
|
|
501
511
|
message: { color: theme.colors.textSecondary },
|
|
502
512
|
cancelButton: { borderColor: theme.colors.border },
|
|
503
513
|
cancelButtonText: { color: theme.colors.text },
|
|
504
|
-
confirmButton: {
|
|
505
|
-
|
|
506
|
-
},
|
|
507
|
-
confirmButtonText: { color: theme.colors.surfaceElevated }
|
|
514
|
+
confirmButton: { backgroundColor: confirmFill(theme, destructive) },
|
|
515
|
+
confirmButtonText: { color: confirmInk(theme, destructive) }
|
|
508
516
|
}),
|
|
509
517
|
[theme, destructive]
|
|
510
518
|
);
|
|
@@ -517,6 +525,7 @@ var ConfirmDialog = ({
|
|
|
517
525
|
reactNative.Modal,
|
|
518
526
|
{
|
|
519
527
|
transparent: true,
|
|
528
|
+
"aria-labelledby": titleId,
|
|
520
529
|
animationType: "fade",
|
|
521
530
|
visible,
|
|
522
531
|
onRequestClose: onCancel,
|
|
@@ -524,11 +533,11 @@ var ConfirmDialog = ({
|
|
|
524
533
|
reactNative.View,
|
|
525
534
|
{
|
|
526
535
|
accessibilityViewIsModal: true,
|
|
527
|
-
"aria-label": title,
|
|
528
|
-
role:
|
|
536
|
+
"aria-label": innerDialogRole === void 0 ? void 0 : title,
|
|
537
|
+
role: innerDialogRole,
|
|
529
538
|
style: [styles6.dialog, colorStyles.dialog],
|
|
530
539
|
children: [
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.title, colorStyles.title], children: title }),
|
|
540
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { nativeID: titleId, style: [styles6.title, colorStyles.title], children: title }),
|
|
532
541
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.message, colorStyles.message], children: message }),
|
|
533
542
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.buttonRow, children: [
|
|
534
543
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -566,7 +575,7 @@ var ConfirmDialog = ({
|
|
|
566
575
|
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
567
576
|
reactNative.ActivityIndicator,
|
|
568
577
|
{
|
|
569
|
-
color: theme
|
|
578
|
+
color: confirmInk(theme, destructive),
|
|
570
579
|
size: "small",
|
|
571
580
|
testID: "confirm-loading"
|
|
572
581
|
}
|