@terreno/ui 57.11.0 → 57.13.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/AiSuggestionBox.js +9 -9
- package/dist/AiSuggestionBox.js.map +1 -1
- package/dist/Banner.js +1 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +36 -3
- package/dist/Box.js.map +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +7 -0
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +34 -4
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +50 -3
- package/dist/DataTable.js.map +1 -1
- package/dist/Image.d.ts.map +1 -1
- package/dist/Image.js +1 -1
- package/dist/Image.js.map +1 -1
- package/dist/MarkdownView.d.ts.map +1 -1
- package/dist/MarkdownView.js +67 -5
- package/dist/MarkdownView.js.map +1 -1
- package/dist/Modal.js +1 -1
- package/dist/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl.js +15 -11
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/SelectField.js +4 -1
- package/dist/SelectField.js.map +1 -1
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +145 -55
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +1 -1
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TerrenoProvider.d.ts +7 -3
- package/dist/TerrenoProvider.d.ts.map +1 -1
- package/dist/TerrenoProvider.js +2 -2
- package/dist/TerrenoProvider.js.map +1 -1
- package/dist/Theme.d.ts +19 -85
- package/dist/Theme.d.ts.map +1 -1
- package/dist/Theme.js +149 -33
- package/dist/Theme.js.map +1 -1
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +21 -12
- package/dist/Toast.js.map +1 -1
- package/dist/ToastNotifications.d.ts.map +1 -1
- package/dist/ToastNotifications.js +5 -2
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts +1 -0
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +84 -37
- package/dist/Tooltip.js.map +1 -1
- package/dist/blocks/BlocksView.d.ts.map +1 -1
- package/dist/blocks/BlocksView.js +5 -1
- package/dist/blocks/BlocksView.js.map +1 -1
- package/dist/blocks/blockRenderers.d.ts +10 -1
- package/dist/blocks/blockRenderers.d.ts.map +1 -1
- package/dist/blocks/blockRenderers.js +330 -9
- package/dist/blocks/blockRenderers.js.map +1 -1
- package/dist/blocks/useChecklistState.d.ts +18 -0
- package/dist/blocks/useChecklistState.d.ts.map +1 -0
- package/dist/blocks/useChecklistState.js +29 -0
- package/dist/blocks/useChecklistState.js.map +1 -0
- package/dist/blocks/useResolvedImages.d.ts.map +1 -1
- package/dist/blocks/useResolvedImages.js +16 -0
- package/dist/blocks/useResolvedImages.js.map +1 -1
- package/dist/colorContrast.d.ts +9 -0
- package/dist/colorContrast.d.ts.map +1 -0
- package/dist/colorContrast.js +47 -0
- package/dist/colorContrast.js.map +1 -0
- package/dist/icons/OfflineIcon.js +1 -1
- package/dist/table/TableDate.d.ts.map +1 -1
- package/dist/table/TableDate.js +3 -1
- package/dist/table/TableDate.js.map +1 -1
- package/package.json +2 -2
- package/src/AiSuggestionBox.tsx +10 -10
- package/src/Banner.tsx +1 -1
- package/src/Box.test.tsx +80 -0
- package/src/Box.tsx +52 -0
- package/src/Button.test.tsx +39 -1
- package/src/Button.tsx +9 -0
- package/src/Common.ts +35 -4
- package/src/DataTable.test.tsx +133 -1
- package/src/DataTable.tsx +78 -3
- package/src/Image.tsx +1 -0
- package/src/MarkdownView.test.tsx +165 -2
- package/src/MarkdownView.tsx +100 -5
- package/src/Modal.tsx +1 -1
- package/src/SegmentedControl.test.tsx +7 -0
- package/src/SegmentedControl.tsx +22 -11
- package/src/SelectField.tsx +4 -1
- package/src/SplitPage.native.tsx +1 -1
- package/src/SplitPage.test.tsx +473 -5
- package/src/SplitPage.tsx +266 -132
- package/src/TerrenoProvider.tsx +15 -5
- package/src/Theme.test.tsx +212 -3
- package/src/Theme.tsx +184 -39
- package/src/Toast.test.tsx +7 -0
- package/src/Toast.tsx +22 -12
- package/src/ToastNotifications.test.tsx +36 -0
- package/src/ToastNotifications.tsx +5 -2
- package/src/Tooltip.test.tsx +232 -1
- package/src/Tooltip.tsx +128 -67
- package/src/__snapshots__/AddressField.test.tsx.snap +7 -7
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +23 -23
- package/src/__snapshots__/Banner.test.tsx.snap +3 -0
- package/src/__snapshots__/BooleanField.test.tsx.snap +3 -3
- package/src/__snapshots__/Button.test.tsx.snap +16 -16
- package/src/__snapshots__/Card.test.tsx.snap +0 -1
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +23 -23
- package/src/__snapshots__/DataTable.test.tsx.snap +30 -30
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/DropdownPanel.test.tsx.snap +2 -2
- package/src/__snapshots__/EmailField.test.tsx.snap +2 -2
- package/src/__snapshots__/ErrorPage.test.tsx.snap +1 -1
- package/src/__snapshots__/Field.test.tsx.snap +37 -37
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +2 -1
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/HeightField.test.tsx.snap +8 -8
- package/src/__snapshots__/HeightFieldDesktop.test.tsx.snap +6 -6
- package/src/__snapshots__/InfoModalIcon.test.tsx.snap +2 -2
- package/src/__snapshots__/MarkdownView.test.tsx.snap +2 -2
- package/src/__snapshots__/MobileAddressAutoComplete.test.tsx.snap +1 -1
- package/src/__snapshots__/Modal.test.tsx.snap +10 -10
- package/src/__snapshots__/NumberField.test.tsx.snap +1 -1
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +2 -2
- package/src/__snapshots__/Page.test.tsx.snap +1 -1
- package/src/__snapshots__/PhoneNumberField.test.tsx.snap +4 -4
- package/src/__snapshots__/PickerSelect.test.tsx.snap +8 -8
- package/src/__snapshots__/SectionDivider.test.tsx.snap +2 -2
- package/src/__snapshots__/SegmentedControl.test.tsx.snap +183 -0
- package/src/__snapshots__/SelectBadge.test.tsx.snap +9 -9
- package/src/__snapshots__/SelectField.test.tsx.snap +19 -19
- package/src/__snapshots__/Signature.test.tsx.snap +1 -1
- package/src/__snapshots__/SignatureCaptureField.test.tsx.snap +2 -2
- package/src/__snapshots__/SignatureField.test.tsx.snap +2 -2
- package/src/__snapshots__/SplitPage.test.tsx.snap +165 -67
- package/src/__snapshots__/TapToEdit.test.tsx.snap +1 -1
- package/src/__snapshots__/TerrenoProvider.test.tsx.snap +20 -4
- package/src/__snapshots__/TextArea.test.tsx.snap +4 -4
- package/src/__snapshots__/TextField.test.tsx.snap +3 -3
- package/src/__snapshots__/TimezonePicker.test.tsx.snap +18 -18
- package/src/__snapshots__/Toast.test.tsx.snap +224 -154
- package/src/__snapshots__/TypedSignatureField.test.tsx.snap +3 -3
- package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +6 -6
- package/src/__snapshots__/WebAddressAutocomplete.test.tsx.snap +4 -4
- package/src/blocks/BlocksView.test.tsx +1101 -2
- package/src/blocks/BlocksView.tsx +5 -1
- package/src/blocks/blockRenderers.tsx +730 -22
- package/src/blocks/useChecklistState.ts +46 -0
- package/src/blocks/useResolvedImages.ts +16 -0
- package/src/bunSetup.ts +3 -0
- package/src/colorContrast.test.ts +27 -0
- package/src/colorContrast.ts +55 -0
- package/src/icons/OfflineIcon.tsx +2 -2
- package/src/icons/__snapshots__/OfflineIcon.test.tsx.snap +4 -4
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +7 -7
- package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +3 -3
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +7 -7
- package/src/table/TableDate.tsx +3 -1
- package/src/table/__snapshots__/Table.test.tsx.snap +5 -5
- package/src/table/__snapshots__/TableBadge.test.tsx.snap +3 -3
- package/src/table/__snapshots__/TableDate.test.tsx.snap +4 -0
- package/src/table/__snapshots__/TableHeader.test.tsx.snap +4 -4
- package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +7 -7
- package/src/table/__snapshots__/TableRow.test.tsx.snap +6 -6
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {Block} from "@terreno/blocks";
|
|
2
|
+
import {useCallback, useMemo, useState} from "react";
|
|
3
|
+
|
|
4
|
+
interface ChecklistTicks {
|
|
5
|
+
/** The override the ticks were made on. A different override for the id drops them. */
|
|
6
|
+
source: Block | undefined;
|
|
7
|
+
ticks: Record<string, boolean>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Local checklist ticks for one rendered document, keyed by checklist id and then item id.
|
|
12
|
+
* `checked` holds only ticks made on the block currently shown: when a host override for a
|
|
13
|
+
* checklist arrives or changes, its earlier local ticks are dropped and the override's
|
|
14
|
+
* `checked` values show. `checked[id]` is the shape `blockPlainText` takes as `checked`.
|
|
15
|
+
*/
|
|
16
|
+
export const useChecklistState = ({
|
|
17
|
+
overrides,
|
|
18
|
+
}: {
|
|
19
|
+
overrides?: Record<string, Block>;
|
|
20
|
+
}): {
|
|
21
|
+
checked: Record<string, Record<string, boolean>>;
|
|
22
|
+
setChecked: (target: {checked: boolean; checklistId: string; itemId: string}) => void;
|
|
23
|
+
} => {
|
|
24
|
+
const [state, setState] = useState<Record<string, ChecklistTicks>>({});
|
|
25
|
+
const setChecked = useCallback(
|
|
26
|
+
({checked, checklistId, itemId}: {checked: boolean; checklistId: string; itemId: string}) => {
|
|
27
|
+
const source = overrides?.[checklistId];
|
|
28
|
+
setState((current) => {
|
|
29
|
+
const prior = current[checklistId];
|
|
30
|
+
const ticks = prior !== undefined && prior.source === source ? prior.ticks : {};
|
|
31
|
+
return {...current, [checklistId]: {source, ticks: {...ticks, [itemId]: checked}}};
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
[overrides]
|
|
35
|
+
);
|
|
36
|
+
const checked = useMemo((): Record<string, Record<string, boolean>> => {
|
|
37
|
+
const result: Record<string, Record<string, boolean>> = {};
|
|
38
|
+
for (const [checklistId, entry] of Object.entries(state)) {
|
|
39
|
+
if (entry.source === overrides?.[checklistId]) {
|
|
40
|
+
result[checklistId] = entry.ticks;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}, [overrides, state]);
|
|
45
|
+
return {checked, setChecked};
|
|
46
|
+
};
|
|
@@ -21,6 +21,22 @@ const collectFileIds = (blocks: readonly Block[], ids: Set<string>): void => {
|
|
|
21
21
|
ids.add(id);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
if (block.type === "gallery") {
|
|
25
|
+
for (const image of block.images) {
|
|
26
|
+
const id = fileRefId(image.src);
|
|
27
|
+
if (id !== undefined) {
|
|
28
|
+
ids.add(id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (block.type === "list") {
|
|
33
|
+
for (const item of block.items) {
|
|
34
|
+
const id = item.image === undefined ? undefined : fileRefId(item.image.src);
|
|
35
|
+
if (id !== undefined) {
|
|
36
|
+
ids.add(id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
24
40
|
if (block.type === "columns" || block.type === "card") {
|
|
25
41
|
collectFileIds(block.children, ids);
|
|
26
42
|
}
|
package/src/bunSetup.ts
CHANGED
|
@@ -678,12 +678,14 @@ mock.module("expo-router", () => ({
|
|
|
678
678
|
navigate: mock(() => {}),
|
|
679
679
|
push: mock(() => {}),
|
|
680
680
|
replace: mock(() => {}),
|
|
681
|
+
setParams: mock(() => {}),
|
|
681
682
|
},
|
|
682
683
|
Slot: ({children, ...props}: MockComponentProps) => React.createElement("Slot", props, children),
|
|
683
684
|
Stack: ({children, ...props}: MockComponentProps) =>
|
|
684
685
|
React.createElement("Stack", props, children),
|
|
685
686
|
Tabs: ({children, ...props}: MockComponentProps) => React.createElement("Tabs", props, children),
|
|
686
687
|
useFocusEffect: mock(() => undefined),
|
|
688
|
+
useGlobalSearchParams: mock(() => ({})),
|
|
687
689
|
useLocalSearchParams: mock(() => ({})),
|
|
688
690
|
useNavigation: mock(() => ({
|
|
689
691
|
addListener: mock(() => () => undefined),
|
|
@@ -698,6 +700,7 @@ mock.module("expo-router", () => ({
|
|
|
698
700
|
navigate: mock(() => {}),
|
|
699
701
|
push: mock(() => {}),
|
|
700
702
|
replace: mock(() => {}),
|
|
703
|
+
setParams: mock(() => {}),
|
|
701
704
|
})),
|
|
702
705
|
useSearchParams: mock(() => ({})),
|
|
703
706
|
useSegments: mock(() => []),
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {describe, expect, it} from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {contrastRatio, readableTextColor} from "./colorContrast";
|
|
4
|
+
|
|
5
|
+
describe("contrastRatio", () => {
|
|
6
|
+
it("returns 21 for black on white", () => {
|
|
7
|
+
expect(Math.round(contrastRatio("#000000", "#ffffff"))).toBe(21);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("returns 1 for an unparsed color", () => {
|
|
11
|
+
expect(contrastRatio("transparent", "#ffffff")).toBe(1);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe("readableTextColor", () => {
|
|
16
|
+
it("keeps primary text when it already meets 4.5:1", () => {
|
|
17
|
+
expect(readableTextColor("#1C1C1C", "#FFFFFF", "#FFFFFF")).toBe("primary");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("uses inverted text on the dark-mode error fill", () => {
|
|
21
|
+
expect(readableTextColor("#FFFFFF", "#353535", "#EDA1A1")).toBe("inverted");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("uses inverted text on the light-mode error fill", () => {
|
|
25
|
+
expect(readableTextColor("#1C1C1C", "#FFFFFF", "#BD1111")).toBe("inverted");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const WCAG_NORMAL_TEXT_CONTRAST = 4.5;
|
|
2
|
+
|
|
3
|
+
const srgbChannel = (value: number): number => {
|
|
4
|
+
const srgb = value / 255;
|
|
5
|
+
return srgb <= 0.03928 ? srgb / 12.92 : ((srgb + 0.055) / 1.055) ** 2.4;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const parseHex = (hex: string): {b: number; g: number; r: number} | undefined => {
|
|
9
|
+
const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
10
|
+
const value = match?.[1];
|
|
11
|
+
if (!value) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
b: Number.parseInt(value.slice(4, 6), 16),
|
|
16
|
+
g: Number.parseInt(value.slice(2, 4), 16),
|
|
17
|
+
r: Number.parseInt(value.slice(0, 2), 16),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const luminance = (rgb: {b: number; g: number; r: number}): number => {
|
|
22
|
+
return 0.2126 * srgbChannel(rgb.r) + 0.7152 * srgbChannel(rgb.g) + 0.0722 * srgbChannel(rgb.b);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** WCAG contrast ratio, from 1 (identical) to 21 (black on white). Unparsed colors return 1. */
|
|
26
|
+
export const contrastRatio = (foreground: string, background: string): number => {
|
|
27
|
+
const fg = parseHex(foreground);
|
|
28
|
+
const bg = parseHex(background);
|
|
29
|
+
if (!fg || !bg) {
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
const lighter = Math.max(luminance(fg), luminance(bg));
|
|
33
|
+
const darker = Math.min(luminance(fg), luminance(bg));
|
|
34
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Text role that meets WCAG AA for normal text on `background`.
|
|
39
|
+
* Prefers `primary` so unchanged surfaces keep their current color.
|
|
40
|
+
*/
|
|
41
|
+
export const readableTextColor = (
|
|
42
|
+
primary: string,
|
|
43
|
+
inverted: string,
|
|
44
|
+
background: string
|
|
45
|
+
): "inverted" | "primary" => {
|
|
46
|
+
const primaryRatio = contrastRatio(primary, background);
|
|
47
|
+
if (primaryRatio >= WCAG_NORMAL_TEXT_CONTRAST) {
|
|
48
|
+
return "primary";
|
|
49
|
+
}
|
|
50
|
+
const invertedRatio = contrastRatio(inverted, background);
|
|
51
|
+
if (invertedRatio > primaryRatio) {
|
|
52
|
+
return "inverted";
|
|
53
|
+
}
|
|
54
|
+
return "primary";
|
|
55
|
+
};
|
|
@@ -12,7 +12,7 @@ export const OfflineIcon = ({doNotDisturb, ...props}: CustomSvgProps) => (
|
|
|
12
12
|
<Path
|
|
13
13
|
d="M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z"
|
|
14
14
|
fill="#fff"
|
|
15
|
-
stroke="#
|
|
15
|
+
stroke="#949494"
|
|
16
16
|
strokeWidth={5}
|
|
17
17
|
/>
|
|
18
18
|
{doNotDisturb && (
|
|
@@ -26,7 +26,7 @@ export const OfflineIcon = ({doNotDisturb, ...props}: CustomSvgProps) => (
|
|
|
26
26
|
/>
|
|
27
27
|
<Path
|
|
28
28
|
d="M18 4h8l-8 6.857h8"
|
|
29
|
-
stroke="#
|
|
29
|
+
stroke="#949494"
|
|
30
30
|
strokeLinecap="round"
|
|
31
31
|
strokeLinejoin="round"
|
|
32
32
|
strokeWidth={3}
|
|
@@ -21,7 +21,7 @@ exports[`OfflineIcon renders correctly 1`] = `
|
|
|
21
21
|
"props": {
|
|
22
22
|
"d": "M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z",
|
|
23
23
|
"fill": "#fff",
|
|
24
|
-
"stroke": "#
|
|
24
|
+
"stroke": "#949494",
|
|
25
25
|
"strokeWidth": 5,
|
|
26
26
|
},
|
|
27
27
|
"type": "Path",
|
|
@@ -57,7 +57,7 @@ exports[`OfflineIcon renders with doNotDisturb indicator 1`] = `
|
|
|
57
57
|
"props": {
|
|
58
58
|
"d": "M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z",
|
|
59
59
|
"fill": "#fff",
|
|
60
|
-
"stroke": "#
|
|
60
|
+
"stroke": "#949494",
|
|
61
61
|
"strokeWidth": 5,
|
|
62
62
|
},
|
|
63
63
|
"type": "Path",
|
|
@@ -79,7 +79,7 @@ exports[`OfflineIcon renders with doNotDisturb indicator 1`] = `
|
|
|
79
79
|
"children": null,
|
|
80
80
|
"props": {
|
|
81
81
|
"d": "M18 4h8l-8 6.857h8",
|
|
82
|
-
"stroke": "#
|
|
82
|
+
"stroke": "#949494",
|
|
83
83
|
"strokeLinecap": "round",
|
|
84
84
|
"strokeLinejoin": "round",
|
|
85
85
|
"strokeWidth": 3,
|
|
@@ -117,7 +117,7 @@ exports[`OfflineIcon accepts custom props 1`] = `
|
|
|
117
117
|
"props": {
|
|
118
118
|
"d": "M24.5 18a9.5 9.5 0 1 1-19 0 9.5 9.5 0 0 1 19 0Z",
|
|
119
119
|
"fill": "#fff",
|
|
120
|
-
"stroke": "#
|
|
120
|
+
"stroke": "#949494",
|
|
121
121
|
"strokeWidth": 5,
|
|
122
122
|
},
|
|
123
123
|
"type": "Path",
|
|
@@ -131,7 +131,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
131
131
|
],
|
|
132
132
|
"props": {
|
|
133
133
|
"style": {
|
|
134
|
-
"backgroundColor": "#
|
|
134
|
+
"backgroundColor": "#CDCDCD",
|
|
135
135
|
"borderColor": "#4E4E4E",
|
|
136
136
|
"borderRadius": 4,
|
|
137
137
|
"borderWidth": 1,
|
|
@@ -259,7 +259,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
259
259
|
],
|
|
260
260
|
"props": {
|
|
261
261
|
"style": {
|
|
262
|
-
"backgroundColor": "#
|
|
262
|
+
"backgroundColor": "#CDCDCD",
|
|
263
263
|
"borderColor": "#4E4E4E",
|
|
264
264
|
"borderRadius": 4,
|
|
265
265
|
"borderWidth": 1,
|
|
@@ -327,7 +327,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
327
327
|
],
|
|
328
328
|
"props": {
|
|
329
329
|
"style": {
|
|
330
|
-
"color": "#
|
|
330
|
+
"color": "#092E3A",
|
|
331
331
|
"fontSize": 16,
|
|
332
332
|
"fontWeight": "700",
|
|
333
333
|
},
|
|
@@ -350,7 +350,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
350
350
|
"$$typeof": Symbol(react.test.json),
|
|
351
351
|
"children": null,
|
|
352
352
|
"props": {
|
|
353
|
-
"color": "#
|
|
353
|
+
"color": "#092E3A",
|
|
354
354
|
"size": "small",
|
|
355
355
|
},
|
|
356
356
|
"type": "ActivityIndicator",
|
|
@@ -388,7 +388,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
388
388
|
"style": {
|
|
389
389
|
"alignItems": "center",
|
|
390
390
|
"alignSelf": "stretch",
|
|
391
|
-
"backgroundColor": "#
|
|
391
|
+
"backgroundColor": "#949494",
|
|
392
392
|
"borderColor": undefined,
|
|
393
393
|
"borderRadius": 360,
|
|
394
394
|
"borderWidth": undefined,
|
|
@@ -471,7 +471,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
471
471
|
"style": {
|
|
472
472
|
"alignItems": "center",
|
|
473
473
|
"alignSelf": "flex-start",
|
|
474
|
-
"backgroundColor": "#
|
|
474
|
+
"backgroundColor": "#949494",
|
|
475
475
|
"borderColor": undefined,
|
|
476
476
|
"borderRadius": 360,
|
|
477
477
|
"borderWidth": undefined,
|
|
@@ -555,7 +555,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
555
555
|
"style": {
|
|
556
556
|
"alignItems": "center",
|
|
557
557
|
"alignSelf": "stretch",
|
|
558
|
-
"backgroundColor": "#
|
|
558
|
+
"backgroundColor": "#949494",
|
|
559
559
|
"borderColor": undefined,
|
|
560
560
|
"borderRadius": 360,
|
|
561
561
|
"borderWidth": undefined,
|
|
@@ -98,7 +98,7 @@ exports[`OAuthButtons renders correctly with all props 1`] = `
|
|
|
98
98
|
"style": {
|
|
99
99
|
"alignItems": "center",
|
|
100
100
|
"alignSelf": "stretch",
|
|
101
|
-
"backgroundColor": "#
|
|
101
|
+
"backgroundColor": "#949494",
|
|
102
102
|
"borderColor": "#dadce0",
|
|
103
103
|
"borderRadius": 360,
|
|
104
104
|
"borderWidth": 1,
|
|
@@ -164,7 +164,7 @@ exports[`OAuthButtons renders correctly with all props 1`] = `
|
|
|
164
164
|
"style": {
|
|
165
165
|
"alignItems": "center",
|
|
166
166
|
"alignSelf": "stretch",
|
|
167
|
-
"backgroundColor": "#
|
|
167
|
+
"backgroundColor": "#949494",
|
|
168
168
|
"borderColor": "#24292e",
|
|
169
169
|
"borderRadius": 360,
|
|
170
170
|
"borderWidth": 1,
|
|
@@ -230,7 +230,7 @@ exports[`OAuthButtons renders correctly with all props 1`] = `
|
|
|
230
230
|
"style": {
|
|
231
231
|
"alignItems": "center",
|
|
232
232
|
"alignSelf": "stretch",
|
|
233
|
-
"backgroundColor": "#
|
|
233
|
+
"backgroundColor": "#949494",
|
|
234
234
|
"borderColor": "#000000",
|
|
235
235
|
"borderRadius": 360,
|
|
236
236
|
"borderWidth": 1,
|
|
@@ -131,7 +131,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
131
131
|
],
|
|
132
132
|
"props": {
|
|
133
133
|
"style": {
|
|
134
|
-
"backgroundColor": "#
|
|
134
|
+
"backgroundColor": "#CDCDCD",
|
|
135
135
|
"borderColor": "#4E4E4E",
|
|
136
136
|
"borderRadius": 4,
|
|
137
137
|
"borderWidth": 1,
|
|
@@ -237,7 +237,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
237
237
|
],
|
|
238
238
|
"props": {
|
|
239
239
|
"style": {
|
|
240
|
-
"backgroundColor": "#
|
|
240
|
+
"backgroundColor": "#CDCDCD",
|
|
241
241
|
"borderColor": "#4E4E4E",
|
|
242
242
|
"borderRadius": 4,
|
|
243
243
|
"borderWidth": 1,
|
|
@@ -365,7 +365,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
365
365
|
],
|
|
366
366
|
"props": {
|
|
367
367
|
"style": {
|
|
368
|
-
"backgroundColor": "#
|
|
368
|
+
"backgroundColor": "#CDCDCD",
|
|
369
369
|
"borderColor": "#4E4E4E",
|
|
370
370
|
"borderRadius": 4,
|
|
371
371
|
"borderWidth": 1,
|
|
@@ -660,7 +660,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
660
660
|
],
|
|
661
661
|
"props": {
|
|
662
662
|
"style": {
|
|
663
|
-
"color": "#
|
|
663
|
+
"color": "#092E3A",
|
|
664
664
|
"fontSize": 16,
|
|
665
665
|
"fontWeight": "700",
|
|
666
666
|
},
|
|
@@ -683,7 +683,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
683
683
|
"$$typeof": Symbol(react.test.json),
|
|
684
684
|
"children": null,
|
|
685
685
|
"props": {
|
|
686
|
-
"color": "#
|
|
686
|
+
"color": "#092E3A",
|
|
687
687
|
"size": "small",
|
|
688
688
|
},
|
|
689
689
|
"type": "ActivityIndicator",
|
|
@@ -721,7 +721,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
721
721
|
"style": {
|
|
722
722
|
"alignItems": "center",
|
|
723
723
|
"alignSelf": "stretch",
|
|
724
|
-
"backgroundColor": "#
|
|
724
|
+
"backgroundColor": "#949494",
|
|
725
725
|
"borderColor": undefined,
|
|
726
726
|
"borderRadius": 360,
|
|
727
727
|
"borderWidth": undefined,
|
|
@@ -804,7 +804,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
804
804
|
"style": {
|
|
805
805
|
"alignItems": "center",
|
|
806
806
|
"alignSelf": "stretch",
|
|
807
|
-
"backgroundColor": "#
|
|
807
|
+
"backgroundColor": "#949494",
|
|
808
808
|
"borderColor": undefined,
|
|
809
809
|
"borderRadius": 360,
|
|
810
810
|
"borderWidth": undefined,
|
package/src/table/TableDate.tsx
CHANGED
|
@@ -3,11 +3,13 @@ import {type FC, useState} from "react";
|
|
|
3
3
|
import {Text} from "react-native";
|
|
4
4
|
|
|
5
5
|
import type {TableDateProps} from "../Common";
|
|
6
|
+
import {useTheme} from "../Theme";
|
|
6
7
|
|
|
7
8
|
export const TableDate: FC<TableDateProps> = ({value, annotated = false}) => {
|
|
8
9
|
const initialDate =
|
|
9
10
|
typeof value === "string" ? DateTime.fromISO(value) : DateTime.fromJSDate(value);
|
|
10
11
|
const [dateVal] = useState(initialDate);
|
|
12
|
+
const {theme} = useTheme();
|
|
11
13
|
|
|
12
14
|
// TODO: Formatting date with annotations should be in DateUtilities and tested.
|
|
13
15
|
const formatDate = (date: DateTime) => {
|
|
@@ -29,7 +31,7 @@ export const TableDate: FC<TableDateProps> = ({value, annotated = false}) => {
|
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
|
-
<Text style={{fontSize: 16}}>
|
|
34
|
+
<Text style={{color: theme.text.primary, fontSize: 16}}>
|
|
33
35
|
{annotated ? formatDate(dateVal) : dateVal.toFormat("MM/dd/yyyy")}
|
|
34
36
|
</Text>
|
|
35
37
|
);
|
|
@@ -385,7 +385,7 @@ exports[`Table renders correctly with basic setup 1`] = `
|
|
|
385
385
|
"onPointerEnter": [Function: AsyncFunction],
|
|
386
386
|
"onPointerLeave": [Function: AsyncFunction],
|
|
387
387
|
"style": {
|
|
388
|
-
"backgroundColor": "#
|
|
388
|
+
"backgroundColor": "#CDCDCD",
|
|
389
389
|
"borderBottom": "1px solid #e0e0e0",
|
|
390
390
|
"width": "100%",
|
|
391
391
|
},
|
|
@@ -722,7 +722,7 @@ exports[`Table renders multiple rows 1`] = `
|
|
|
722
722
|
"onPointerEnter": [Function: AsyncFunction],
|
|
723
723
|
"onPointerLeave": [Function: AsyncFunction],
|
|
724
724
|
"style": {
|
|
725
|
-
"backgroundColor": "#
|
|
725
|
+
"backgroundColor": "#CDCDCD",
|
|
726
726
|
"borderBottom": "1px solid #e0e0e0",
|
|
727
727
|
"width": "100%",
|
|
728
728
|
},
|
|
@@ -1500,7 +1500,7 @@ exports[`Table renders with percentage-based columns 1`] = `
|
|
|
1500
1500
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1501
1501
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1502
1502
|
"style": {
|
|
1503
|
-
"backgroundColor": "#
|
|
1503
|
+
"backgroundColor": "#CDCDCD",
|
|
1504
1504
|
"borderBottom": "1px solid #e0e0e0",
|
|
1505
1505
|
"width": "100%",
|
|
1506
1506
|
},
|
|
@@ -1737,7 +1737,7 @@ exports[`Table renders with maxHeight 1`] = `
|
|
|
1737
1737
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1738
1738
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1739
1739
|
"style": {
|
|
1740
|
-
"backgroundColor": "#
|
|
1740
|
+
"backgroundColor": "#CDCDCD",
|
|
1741
1741
|
"borderBottom": "1px solid #e0e0e0",
|
|
1742
1742
|
"width": "100%",
|
|
1743
1743
|
},
|
|
@@ -1974,7 +1974,7 @@ exports[`Table renders without sticky header 1`] = `
|
|
|
1974
1974
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1975
1975
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1976
1976
|
"style": {
|
|
1977
|
-
"backgroundColor": "#
|
|
1977
|
+
"backgroundColor": "#CDCDCD",
|
|
1978
1978
|
"borderBottom": "1px solid #e0e0e0",
|
|
1979
1979
|
"width": "100%",
|
|
1980
1980
|
},
|
|
@@ -518,7 +518,7 @@ exports[`TableBadge renders select field when editing 1`] = `
|
|
|
518
518
|
"current": null,
|
|
519
519
|
},
|
|
520
520
|
"style": {
|
|
521
|
-
"borderColor": "#
|
|
521
|
+
"borderColor": "#949494",
|
|
522
522
|
"borderRadius": 4,
|
|
523
523
|
"borderWidth": 1,
|
|
524
524
|
"color": "#1C1C1C",
|
|
@@ -674,7 +674,7 @@ exports[`TableBadge renders select field when editing 1`] = `
|
|
|
674
674
|
"props": {
|
|
675
675
|
"style": {
|
|
676
676
|
"backgroundColor": "#FFFFFF",
|
|
677
|
-
"borderColor": "#
|
|
677
|
+
"borderColor": "#949494",
|
|
678
678
|
"borderRadius": 4,
|
|
679
679
|
"borderWidth": 1,
|
|
680
680
|
"boxShadow": "0px 2px 8px rgba(0, 0, 0, 0.15)",
|
|
@@ -719,7 +719,7 @@ exports[`TableBadge renders select field when editing 1`] = `
|
|
|
719
719
|
},
|
|
720
720
|
{
|
|
721
721
|
"backgroundColor": "#FFFFFF",
|
|
722
|
-
"borderColor": "#
|
|
722
|
+
"borderColor": "#949494",
|
|
723
723
|
},
|
|
724
724
|
false,
|
|
725
725
|
],
|
|
@@ -8,6 +8,7 @@ exports[`TableDate renders correctly with ISO string date 1`] = `
|
|
|
8
8
|
],
|
|
9
9
|
"props": {
|
|
10
10
|
"style": {
|
|
11
|
+
"color": "#1C1C1C",
|
|
11
12
|
"fontSize": 16,
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -23,6 +24,7 @@ exports[`TableDate renders correctly with Date object 1`] = `
|
|
|
23
24
|
],
|
|
24
25
|
"props": {
|
|
25
26
|
"style": {
|
|
27
|
+
"color": "#1C1C1C",
|
|
26
28
|
"fontSize": 16,
|
|
27
29
|
},
|
|
28
30
|
},
|
|
@@ -38,6 +40,7 @@ exports[`TableDate renders date in MM/dd/yyyy format by default 1`] = `
|
|
|
38
40
|
],
|
|
39
41
|
"props": {
|
|
40
42
|
"style": {
|
|
43
|
+
"color": "#1C1C1C",
|
|
41
44
|
"fontSize": 16,
|
|
42
45
|
},
|
|
43
46
|
},
|
|
@@ -53,6 +56,7 @@ exports[`TableDate renders annotated date with relative time 1`] = `
|
|
|
53
56
|
],
|
|
54
57
|
"props": {
|
|
55
58
|
"style": {
|
|
59
|
+
"color": "#1C1C1C",
|
|
56
60
|
"fontSize": 16,
|
|
57
61
|
},
|
|
58
62
|
},
|
|
@@ -285,7 +285,7 @@ exports[`TableHeader renders correctly with children 1`] = `
|
|
|
285
285
|
"onPointerEnter": [Function: AsyncFunction],
|
|
286
286
|
"onPointerLeave": [Function: AsyncFunction],
|
|
287
287
|
"style": {
|
|
288
|
-
"backgroundColor": "#
|
|
288
|
+
"backgroundColor": "#CDCDCD",
|
|
289
289
|
"borderBottom": "1px solid #e0e0e0",
|
|
290
290
|
"width": "100%",
|
|
291
291
|
},
|
|
@@ -522,7 +522,7 @@ exports[`TableHeader renders with tableHeaderGroup display (default) 1`] = `
|
|
|
522
522
|
"onPointerEnter": [Function: AsyncFunction],
|
|
523
523
|
"onPointerLeave": [Function: AsyncFunction],
|
|
524
524
|
"style": {
|
|
525
|
-
"backgroundColor": "#
|
|
525
|
+
"backgroundColor": "#CDCDCD",
|
|
526
526
|
"borderBottom": "1px solid #e0e0e0",
|
|
527
527
|
"width": "100%",
|
|
528
528
|
},
|
|
@@ -759,7 +759,7 @@ exports[`TableHeader renders with visuallyHidden display 1`] = `
|
|
|
759
759
|
"onPointerEnter": [Function: AsyncFunction],
|
|
760
760
|
"onPointerLeave": [Function: AsyncFunction],
|
|
761
761
|
"style": {
|
|
762
|
-
"backgroundColor": "#
|
|
762
|
+
"backgroundColor": "#CDCDCD",
|
|
763
763
|
"borderBottom": "1px solid #e0e0e0",
|
|
764
764
|
"width": "100%",
|
|
765
765
|
},
|
|
@@ -996,7 +996,7 @@ exports[`TableHeader renders with custom color 1`] = `
|
|
|
996
996
|
"onPointerEnter": [Function: AsyncFunction],
|
|
997
997
|
"onPointerLeave": [Function: AsyncFunction],
|
|
998
998
|
"style": {
|
|
999
|
-
"backgroundColor": "#
|
|
999
|
+
"backgroundColor": "#CDCDCD",
|
|
1000
1000
|
"borderBottom": "1px solid #e0e0e0",
|
|
1001
1001
|
"width": "100%",
|
|
1002
1002
|
},
|
|
@@ -185,7 +185,7 @@ exports[`TableHeaderCell renders correctly with title 1`] = `
|
|
|
185
185
|
"onPointerEnter": [Function: AsyncFunction],
|
|
186
186
|
"onPointerLeave": [Function: AsyncFunction],
|
|
187
187
|
"style": {
|
|
188
|
-
"backgroundColor": "#
|
|
188
|
+
"backgroundColor": "#CDCDCD",
|
|
189
189
|
"borderBottom": "1px solid #e0e0e0",
|
|
190
190
|
"width": "100%",
|
|
191
191
|
},
|
|
@@ -423,7 +423,7 @@ exports[`TableHeaderCell renders correctly with children 1`] = `
|
|
|
423
423
|
"onPointerEnter": [Function: AsyncFunction],
|
|
424
424
|
"onPointerLeave": [Function: AsyncFunction],
|
|
425
425
|
"style": {
|
|
426
|
-
"backgroundColor": "#
|
|
426
|
+
"backgroundColor": "#CDCDCD",
|
|
427
427
|
"borderBottom": "1px solid #e0e0e0",
|
|
428
428
|
"width": "100%",
|
|
429
429
|
},
|
|
@@ -660,7 +660,7 @@ exports[`TableHeaderCell renders with left alignment (default) 1`] = `
|
|
|
660
660
|
"onPointerEnter": [Function: AsyncFunction],
|
|
661
661
|
"onPointerLeave": [Function: AsyncFunction],
|
|
662
662
|
"style": {
|
|
663
|
-
"backgroundColor": "#
|
|
663
|
+
"backgroundColor": "#CDCDCD",
|
|
664
664
|
"borderBottom": "1px solid #e0e0e0",
|
|
665
665
|
"width": "100%",
|
|
666
666
|
},
|
|
@@ -897,7 +897,7 @@ exports[`TableHeaderCell renders with center alignment 1`] = `
|
|
|
897
897
|
"onPointerEnter": [Function: AsyncFunction],
|
|
898
898
|
"onPointerLeave": [Function: AsyncFunction],
|
|
899
899
|
"style": {
|
|
900
|
-
"backgroundColor": "#
|
|
900
|
+
"backgroundColor": "#CDCDCD",
|
|
901
901
|
"borderBottom": "1px solid #e0e0e0",
|
|
902
902
|
"width": "100%",
|
|
903
903
|
},
|
|
@@ -1134,7 +1134,7 @@ exports[`TableHeaderCell renders with right alignment 1`] = `
|
|
|
1134
1134
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1135
1135
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1136
1136
|
"style": {
|
|
1137
|
-
"backgroundColor": "#
|
|
1137
|
+
"backgroundColor": "#CDCDCD",
|
|
1138
1138
|
"borderBottom": "1px solid #e0e0e0",
|
|
1139
1139
|
"width": "100%",
|
|
1140
1140
|
},
|
|
@@ -1374,7 +1374,7 @@ exports[`TableHeaderCell renders sortable header 1`] = `
|
|
|
1374
1374
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1375
1375
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1376
1376
|
"style": {
|
|
1377
|
-
"backgroundColor": "#
|
|
1377
|
+
"backgroundColor": "#CDCDCD",
|
|
1378
1378
|
"borderBottom": "1px solid #e0e0e0",
|
|
1379
1379
|
"width": "100%",
|
|
1380
1380
|
},
|
|
@@ -1648,7 +1648,7 @@ exports[`TableHeaderCell renders sortable header with sort indicator when sorted
|
|
|
1648
1648
|
"onPointerEnter": [Function: AsyncFunction],
|
|
1649
1649
|
"onPointerLeave": [Function: AsyncFunction],
|
|
1650
1650
|
"style": {
|
|
1651
|
-
"backgroundColor": "#
|
|
1651
|
+
"backgroundColor": "#CDCDCD",
|
|
1652
1652
|
"borderBottom": "1px solid #e0e0e0",
|
|
1653
1653
|
"width": "100%",
|
|
1654
1654
|
},
|