@dloizides/ui-feedback 1.26.1 → 1.28.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 +11 -0
- package/dist/index.d.mts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +153 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback, useId, useSyncExternalStore, Component } from 'react';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { Platform, StyleSheet, TouchableOpacity, Text, View, ActivityIndicator, Modal, useWindowDimensions,
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { Platform, StyleSheet, TouchableOpacity, Text, View, ActivityIndicator, Modal, useWindowDimensions, Pressable, Animated } from 'react-native';
|
|
4
4
|
import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
|
|
5
5
|
import { Skeleton } from '@dloizides/ui-motion';
|
|
6
6
|
import { Z_INDEX, isFocusVisible, resolveFocusRingColor, resolveOnBrand, UI_DEEP_STEP, UI_MAIN_STEP, focusRingOutline, isHexColor, canCarryAccessibleInk } from '@dloizides/design-tokens';
|
|
@@ -1817,23 +1817,23 @@ var LocalModelGate = ({
|
|
|
1817
1817
|
const consent = useCallback(() => {
|
|
1818
1818
|
model.consent().catch(() => void 0);
|
|
1819
1819
|
}, [model]);
|
|
1820
|
-
const { Card, Text:
|
|
1820
|
+
const { Card, Text: Text19, Button } = slots;
|
|
1821
1821
|
switch (phase) {
|
|
1822
1822
|
case LocalModelPhase.Checking:
|
|
1823
1823
|
return null;
|
|
1824
1824
|
case LocalModelPhase.Blocked:
|
|
1825
|
-
return /* @__PURE__ */ jsx(Card, { testID: testIds.blocked, children: /* @__PURE__ */ jsx(
|
|
1825
|
+
return /* @__PURE__ */ jsx(Card, { testID: testIds.blocked, children: /* @__PURE__ */ jsx(Text19, { children: labels.blocked(block) }) });
|
|
1826
1826
|
case LocalModelPhase.Offer:
|
|
1827
1827
|
return /* @__PURE__ */ jsxs(Card, { testID: testIds.offer, children: [
|
|
1828
|
-
/* @__PURE__ */ jsx(
|
|
1829
|
-
/* @__PURE__ */ jsx(
|
|
1828
|
+
/* @__PURE__ */ jsx(Text19, { heading: true, children: labels.title }),
|
|
1829
|
+
/* @__PURE__ */ jsx(Text19, { children: labels.offerBody }),
|
|
1830
1830
|
/* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.consent, testID: testIds.consent, onPress: consent })
|
|
1831
1831
|
] });
|
|
1832
1832
|
case LocalModelPhase.Loading:
|
|
1833
|
-
return /* @__PURE__ */ jsx(Card, { testID: testIds.loading, children: /* @__PURE__ */ jsx(
|
|
1833
|
+
return /* @__PURE__ */ jsx(Card, { testID: testIds.loading, children: /* @__PURE__ */ jsx(Text19, { children: labels.loading(String(Math.round(progress * PERCENT2))) }) });
|
|
1834
1834
|
case LocalModelPhase.Failed:
|
|
1835
1835
|
return /* @__PURE__ */ jsxs(Card, { testID: testIds.failed, children: [
|
|
1836
|
-
/* @__PURE__ */ jsx(
|
|
1836
|
+
/* @__PURE__ */ jsx(Text19, { children: labels.failed }),
|
|
1837
1837
|
/* @__PURE__ */ jsx(Button, { hint: labels.consentHint, label: labels.retry, testID: testIds.consent, onPress: consent })
|
|
1838
1838
|
] });
|
|
1839
1839
|
case LocalModelPhase.Ready:
|
|
@@ -1841,7 +1841,145 @@ var LocalModelGate = ({
|
|
|
1841
1841
|
return children;
|
|
1842
1842
|
}
|
|
1843
1843
|
};
|
|
1844
|
+
var RADIUS2 = 8;
|
|
1845
|
+
var PAD = 12;
|
|
1846
|
+
var GAP = 8;
|
|
1847
|
+
var MIN_HIT = 44;
|
|
1848
|
+
var TITLE_FONT = 14;
|
|
1849
|
+
var DETAIL_FONT = 12;
|
|
1850
|
+
var styles19 = StyleSheet.create({
|
|
1851
|
+
detail: { fontSize: DETAIL_FONT },
|
|
1852
|
+
row: { alignItems: "center", flexDirection: "row", justifyContent: "space-between" },
|
|
1853
|
+
statusUnder: { alignSelf: "flex-start" },
|
|
1854
|
+
tile: { flexBasis: 0, flexGrow: 1, minWidth: 0 },
|
|
1855
|
+
title: { fontSize: TITLE_FONT, fontWeight: "600" },
|
|
1856
|
+
words: { flexShrink: 1, gap: 2 },
|
|
1857
|
+
wrap: { borderRadius: RADIUS2, borderWidth: 1, gap: GAP, minHeight: MIN_HIT, padding: PAD }
|
|
1858
|
+
});
|
|
1859
|
+
var CheckStatus = (props) => {
|
|
1860
|
+
const { title, detail, status, variant = "tile", statusUnderTitleEnabled = false, onPress, accessibilityLabel, accessibilityHint, testID } = props;
|
|
1861
|
+
const { theme } = useFeedbackUi();
|
|
1862
|
+
const style = [styles19.wrap, variant === "tile" ? styles19.tile : styles19.row, { backgroundColor: theme.colors.surface, borderColor: theme.colors.border }];
|
|
1863
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1864
|
+
/* @__PURE__ */ jsxs(View, { style: styles19.words, children: [
|
|
1865
|
+
/* @__PURE__ */ jsx(Text, { style: [styles19.title, { color: theme.colors.text }], children: title }),
|
|
1866
|
+
statusUnderTitleEnabled ? /* @__PURE__ */ jsx(View, { style: styles19.statusUnder, children: status }) : null,
|
|
1867
|
+
detail === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles19.detail, { color: theme.colors.textSecondary }], children: detail })
|
|
1868
|
+
] }),
|
|
1869
|
+
statusUnderTitleEnabled ? null : status
|
|
1870
|
+
] });
|
|
1871
|
+
if (onPress === void 0) {
|
|
1872
|
+
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, style, testID, children: body });
|
|
1873
|
+
}
|
|
1874
|
+
return /* @__PURE__ */ jsx(Pressable, { accessibilityHint, accessibilityLabel, accessibilityRole: "button", style, testID, onPress, children: body });
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
// src/CheckStatus/pipelineVariant.ts
|
|
1878
|
+
var PIPELINE_COLLAPSE_BREAKPOINT = 768;
|
|
1879
|
+
function pipelineVariant(width, breakpoint = PIPELINE_COLLAPSE_BREAKPOINT) {
|
|
1880
|
+
return width >= breakpoint ? "tile" : "row";
|
|
1881
|
+
}
|
|
1882
|
+
function pipelineItemVariant(width, breakpoint = PIPELINE_COLLAPSE_BREAKPOINT, phoneColumns = 1) {
|
|
1883
|
+
const variant = pipelineVariant(width, breakpoint);
|
|
1884
|
+
return variant === "row" && phoneColumns > 1 ? "tile" : variant;
|
|
1885
|
+
}
|
|
1886
|
+
var GRID_GAP_SHARE = 2;
|
|
1887
|
+
var styles20 = StyleSheet.create({
|
|
1888
|
+
grid: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
1889
|
+
list: { gap: 8 },
|
|
1890
|
+
row: { flexDirection: "row", gap: 12 }
|
|
1891
|
+
});
|
|
1892
|
+
var CheckPipeline = ({ items, breakpoint, accessibilityLabel, accessibilityHint, testID, phoneColumns = 1, statusUnderTitleEnabled }) => {
|
|
1893
|
+
const width = useWindowDimensions().width;
|
|
1894
|
+
const variant = pipelineVariant(width, breakpoint);
|
|
1895
|
+
const itemVariant = pipelineItemVariant(width, breakpoint, phoneColumns);
|
|
1896
|
+
const grid = variant !== itemVariant;
|
|
1897
|
+
const cell = { flexBasis: `${Math.floor(100 / phoneColumns) - GRID_GAP_SHARE}%`, flexGrow: 1 };
|
|
1898
|
+
const containerStyle = variant === "tile" ? styles20.row : grid ? styles20.grid : styles20.list;
|
|
1899
|
+
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, accessibilityRole: "summary", style: containerStyle, testID, children: items.map(({ id, ...item }) => {
|
|
1900
|
+
const check = /* @__PURE__ */ jsx(CheckStatus, { ...item, statusUnderTitleEnabled, variant: itemVariant }, id);
|
|
1901
|
+
return grid ? /* @__PURE__ */ jsx(View, { style: cell, children: check }, id) : check;
|
|
1902
|
+
}) });
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
// src/CheckStatus/semanticScale.ts
|
|
1906
|
+
function semanticScale(theme, name) {
|
|
1907
|
+
const found = theme.semantic[name];
|
|
1908
|
+
return found?.["500"];
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// src/ThresholdMeter/meterScale.ts
|
|
1912
|
+
var PERCENT3 = 100;
|
|
1913
|
+
function meterPercent(value, max) {
|
|
1914
|
+
return max > 0 ? clampPercent(value / max * PERCENT3) : 0;
|
|
1915
|
+
}
|
|
1916
|
+
function meetsThreshold(value, threshold, lowerPasses) {
|
|
1917
|
+
return lowerPasses ? value <= threshold : value >= threshold;
|
|
1918
|
+
}
|
|
1919
|
+
var TRACK_HEIGHT = 8;
|
|
1920
|
+
var MARKER_WIDTH = 2;
|
|
1921
|
+
var MARKER_HEIGHT = 16;
|
|
1922
|
+
var MARKER_TOP = -4;
|
|
1923
|
+
var RADIUS3 = 999;
|
|
1924
|
+
var FONT = 12;
|
|
1925
|
+
var styles21 = StyleSheet.create({
|
|
1926
|
+
fill: { borderRadius: RADIUS3, height: "100%" },
|
|
1927
|
+
head: { flexDirection: "row", flexWrap: "wrap", gap: 8, justifyContent: "space-between" },
|
|
1928
|
+
marker: { height: MARKER_HEIGHT, marginLeft: -MARKER_WIDTH / 2, position: "absolute", top: MARKER_TOP, width: MARKER_WIDTH },
|
|
1929
|
+
text: { fontSize: FONT, fontVariant: ["tabular-nums"] },
|
|
1930
|
+
track: { borderRadius: RADIUS3, height: TRACK_HEIGHT },
|
|
1931
|
+
wrap: { gap: 6 }
|
|
1932
|
+
});
|
|
1933
|
+
function partId(testID, part) {
|
|
1934
|
+
return testID === void 0 ? void 0 : `${testID}-${part}`;
|
|
1935
|
+
}
|
|
1936
|
+
var ThresholdMeter = (props) => {
|
|
1937
|
+
const { value, threshold, max = 1, lowerPasses = false, label, valueText, accessibilityHint, testID } = props;
|
|
1938
|
+
const { theme } = useFeedbackUi();
|
|
1939
|
+
const passes = meetsThreshold(value, threshold, lowerPasses);
|
|
1940
|
+
const fill = passes ? semanticScale(theme, "success") ?? theme.palette.primary["500"] : theme.semantic.error["500"];
|
|
1941
|
+
return /* @__PURE__ */ jsxs(View, { accessibilityHint, accessibilityLabel: label, "aria-valuemax": max, "aria-valuemin": 0, "aria-valuenow": value, "aria-valuetext": valueText, role: "meter", style: styles21.wrap, testID, children: [
|
|
1942
|
+
/* @__PURE__ */ jsxs(View, { style: styles21.head, children: [
|
|
1943
|
+
/* @__PURE__ */ jsx(Text, { style: [styles21.text, { color: theme.colors.textSecondary }], children: label }),
|
|
1944
|
+
/* @__PURE__ */ jsx(Text, { style: [styles21.text, { color: theme.colors.text }], children: valueText })
|
|
1945
|
+
] }),
|
|
1946
|
+
/* @__PURE__ */ jsxs(View, { style: [styles21.track, { backgroundColor: theme.colors.border }], children: [
|
|
1947
|
+
/* @__PURE__ */ jsx(View, { style: [styles21.fill, { backgroundColor: fill, width: `${meterPercent(value, max)}%` }], testID: partId(testID, "fill") }),
|
|
1948
|
+
/* @__PURE__ */ jsx(View, { style: [styles21.marker, { backgroundColor: theme.colors.text, left: `${meterPercent(threshold, max)}%` }], testID: partId(testID, "threshold") })
|
|
1949
|
+
] })
|
|
1950
|
+
] });
|
|
1951
|
+
};
|
|
1952
|
+
var RADIUS4 = 12;
|
|
1953
|
+
var PAD2 = 16;
|
|
1954
|
+
var GAP2 = 8;
|
|
1955
|
+
var STACK_GAP = 12;
|
|
1956
|
+
var TITLE_FONT2 = 15;
|
|
1957
|
+
var HEADING_FONT = 16;
|
|
1958
|
+
var MESSAGE_FONT = 14;
|
|
1959
|
+
var styles22 = StyleSheet.create({
|
|
1960
|
+
card: { borderRadius: RADIUS4, borderWidth: 1, gap: GAP2, minWidth: 0, padding: PAD2 },
|
|
1961
|
+
head: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP2, justifyContent: "space-between" },
|
|
1962
|
+
heading: { flexShrink: 1, fontSize: HEADING_FONT, fontWeight: "700" },
|
|
1963
|
+
message: { fontSize: MESSAGE_FONT },
|
|
1964
|
+
stack: { gap: STACK_GAP },
|
|
1965
|
+
title: { fontSize: TITLE_FONT2, fontWeight: "700" }
|
|
1966
|
+
});
|
|
1967
|
+
var AttentionCard = ({ title, heading, status, message, evidence, action, testID }) => {
|
|
1968
|
+
const { theme } = useFeedbackUi();
|
|
1969
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles22.card, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }], testID, children: [
|
|
1970
|
+
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles22.title, { color: theme.colors.text }], children: title }),
|
|
1971
|
+
/* @__PURE__ */ jsxs(View, { style: styles22.stack, children: [
|
|
1972
|
+
heading === void 0 ? null : /* @__PURE__ */ jsxs(View, { style: styles22.head, testID: testID === void 0 ? void 0 : `${testID}-head`, children: [
|
|
1973
|
+
/* @__PURE__ */ jsx(Text, { style: [styles22.heading, { color: theme.colors.text }], children: heading }),
|
|
1974
|
+
status
|
|
1975
|
+
] }),
|
|
1976
|
+
/* @__PURE__ */ jsx(Text, { style: [styles22.message, { color: theme.colors.textSecondary }], children: message }),
|
|
1977
|
+
evidence,
|
|
1978
|
+
action
|
|
1979
|
+
] })
|
|
1980
|
+
] });
|
|
1981
|
+
};
|
|
1844
1982
|
|
|
1845
|
-
export { AppErrorBoundary, AsyncSurface, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorNotice, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, LocalModelGate, MODAL_OVERLAY_COLOR, PageSkeleton, ProgressBar, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useLocalModel, useFeedbackUi as useUi };
|
|
1983
|
+
export { AppErrorBoundary, AsyncSurface, AttentionCard, COPY_FEEDBACK_MS, CheckPipeline, CheckStatus, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorNotice, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, LocalModelGate, MODAL_OVERLAY_COLOR, PIPELINE_COLLAPSE_BREAKPOINT, PageSkeleton, ProgressBar, ThresholdMeter, ToastHost, FeedbackUiProvider as UiProvider, UiThemeOverride, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, meetsThreshold, mergeRunSteps, meterPercent, notifyWarming, pipelineItemVariant, pipelineVariant, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useLocalModel, useFeedbackUi as useUi };
|
|
1846
1984
|
//# sourceMappingURL=index.mjs.map
|
|
1847
1985
|
//# sourceMappingURL=index.mjs.map
|