@applicaster/zapp-react-native-ui-components 16.0.0-alpha.4004661200 → 16.0.0-alpha.4065452341
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/Components/Cell/Cell.tsx +3 -6
- package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +64 -0
- package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
- package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +18 -0
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
- package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +4 -2
- package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
- package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +5 -2
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +4 -1
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +16 -26
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +1 -36
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +1 -26
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +144 -36
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +7 -2
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +113 -0
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +0 -2
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +248 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +205 -18
- package/Components/ModalComponent/BottomSheetModalContent.tsx +92 -51
- package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
- package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
- package/Components/ModalComponent/SortableList.tsx +38 -23
- package/Components/ModalComponent/SortableList.web.tsx +2 -70
- package/Components/ModalComponent/TextInputContent.tsx +15 -3
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +17 -0
- package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +36 -0
- package/Components/ModalComponent/index.tsx +7 -9
- package/Components/ModalComponent/presets/__tests__/getCell.test.ts +24 -0
- package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +1 -1
- package/Components/ModalComponent/presets/selectableCell.tsx +1 -1
- package/Components/ModalComponent/utils.ts +6 -1
- package/Components/OfflineHandler/hooks.ts +0 -12
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -21
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +4 -123
- package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -59
- package/Components/River/River.tsx +4 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -75
- package/Components/River/__tests__/componentsMap.test.js +8 -3
- package/Components/River/__tests__/resultCallback.test.tsx +47 -0
- package/Components/Screen/navigationHandler.ts +8 -8
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
- package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +20 -3
- package/Components/VideoModal/VideoModal.tsx +14 -13
- package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
- package/Contexts/ModalNavigationContext/index.tsx +2 -2
- package/package.json +5 -5
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -314
- package/Components/VideoModal/__tests__/VideoModal.test.tsx +0 -180
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
|
|
2
2
|
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
3
3
|
import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
|
|
4
|
+
import {
|
|
5
|
+
looksLikeSkipExpression,
|
|
6
|
+
parseSkipExpression,
|
|
7
|
+
evaluateSkipExpression,
|
|
8
|
+
} from "./skipExpression";
|
|
4
9
|
import { log_error, log_info } from "./logger";
|
|
5
10
|
|
|
6
11
|
type ParseKey = { key: string; namespace?: string };
|
|
@@ -23,6 +28,12 @@ export const getKeyToSkipHook = async (key: string, namespace?: string) => {
|
|
|
23
28
|
return await localStorage.getItem(key, namespace);
|
|
24
29
|
};
|
|
25
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Decides whether the hook should be skipped, from the `skip_hook_storage_key`
|
|
33
|
+
* rule. The value is either a comma-separated key list — skip when ANY of them
|
|
34
|
+
* exists — or, packed into the same string, a JSON boolean expression over
|
|
35
|
+
* storage keys. See `skipExpression.ts` for the expression format.
|
|
36
|
+
*/
|
|
26
37
|
export const shouldSkipHook = async (
|
|
27
38
|
skipHookIfKeysExist?: string
|
|
28
39
|
): Promise<boolean> => {
|
|
@@ -32,6 +43,13 @@ export const shouldSkipHook = async (
|
|
|
32
43
|
return false;
|
|
33
44
|
}
|
|
34
45
|
|
|
46
|
+
if (looksLikeSkipExpression(skipHookIfKeysExist)) {
|
|
47
|
+
return await evaluateSkipExpression(
|
|
48
|
+
parseSkipExpression(skipHookIfKeysExist),
|
|
49
|
+
getKeyToSkipHook
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
const keyEntries = parseKeyEntries(skipHookIfKeysExist);
|
|
36
54
|
|
|
37
55
|
if (keyEntries.length === 0) {
|
|
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect } from "react";
|
|
|
2
2
|
import { TouchableOpacity, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
|
+
import { useUIComponentContext } from "@applicaster/zapp-react-native-ui-components/Contexts/UIComponentContext";
|
|
5
6
|
|
|
6
7
|
import Image from "./Image";
|
|
7
8
|
type Props = {
|
|
@@ -57,6 +58,7 @@ export const ActionButton = React.memo(function ActionButtonComponent(
|
|
|
57
58
|
) {
|
|
58
59
|
const { item, action, asset, flavour = "flavour_1", cellUUID } = props;
|
|
59
60
|
const actionContext = useActions(action?.identifier);
|
|
61
|
+
const component = useUIComponentContext();
|
|
60
62
|
|
|
61
63
|
// TODO: add subscription API for action availability
|
|
62
64
|
const actionDisabled =
|
|
@@ -81,8 +83,9 @@ export const ActionButton = React.memo(function ActionButtonComponent(
|
|
|
81
83
|
updateState: (state) => {
|
|
82
84
|
setActionState(state);
|
|
83
85
|
},
|
|
86
|
+
...(component ? { component } : {}),
|
|
84
87
|
});
|
|
85
|
-
}, [actionState, actionContext?.state, item
|
|
88
|
+
}, [actionState, actionContext?.state, item, component]);
|
|
86
89
|
|
|
87
90
|
useEffect(() => {
|
|
88
91
|
if (typeof actionContext?.addListener === "function") {
|
|
@@ -105,6 +108,7 @@ export const ActionButton = React.memo(function ActionButtonComponent(
|
|
|
105
108
|
testID={props?.testID || `${item?.id}`}
|
|
106
109
|
accessibilityLabel={props?.accessibilityLabel || `${item?.id}`}
|
|
107
110
|
accessibilityHint={props?.accessibilityHint}
|
|
111
|
+
accessibilityRole="button"
|
|
108
112
|
accessible={!!(props?.testID || props?.accessibilityLabel)}
|
|
109
113
|
style={props?.style}
|
|
110
114
|
>
|
|
@@ -6,6 +6,7 @@ import React, {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
8
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
9
|
+
import { useUIComponentContext } from "@applicaster/zapp-react-native-ui-components/Contexts/UIComponentContext";
|
|
9
10
|
|
|
10
11
|
type ActionDefinition = {
|
|
11
12
|
identifier?: string;
|
|
@@ -61,6 +62,7 @@ export function ActionButtonController({
|
|
|
61
62
|
const resolvedEntry = entry;
|
|
62
63
|
const resolvedIdentifier = action?.identifier || pluginIdentifier || "";
|
|
63
64
|
const actionContext = useActions(resolvedIdentifier);
|
|
65
|
+
const component = useUIComponentContext();
|
|
64
66
|
|
|
65
67
|
const actionDisabled =
|
|
66
68
|
typeof actionContext?.isActionAvailable === "function" &&
|
|
@@ -128,20 +130,33 @@ export function ActionButtonController({
|
|
|
128
130
|
return;
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
const invokeOptions: InvokeArgsOptions = {
|
|
134
|
+
...(component ? { component } : {}),
|
|
135
|
+
};
|
|
136
|
+
|
|
131
137
|
if (supportsEntryState) {
|
|
132
138
|
return actionContext.invokeAction?.(resolvedEntry, {
|
|
139
|
+
...invokeOptions,
|
|
133
140
|
updateState: setActionState,
|
|
134
141
|
});
|
|
135
142
|
}
|
|
136
143
|
|
|
144
|
+
if (typeof actionContext.invokeAction === "function") {
|
|
145
|
+
return actionContext.invokeAction(resolvedEntry, invokeOptions);
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
const favouritesAction = legacySelected
|
|
138
149
|
? actionContext.removeFavourite
|
|
139
150
|
: actionContext.addFavourite;
|
|
140
151
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
152
|
+
return favouritesAction?.(resolvedEntry);
|
|
153
|
+
}, [
|
|
154
|
+
actionContext,
|
|
155
|
+
supportsEntryState,
|
|
156
|
+
resolvedEntry,
|
|
157
|
+
legacySelected,
|
|
158
|
+
component,
|
|
159
|
+
]);
|
|
145
160
|
|
|
146
161
|
if (!actionContext || actionDisabled) {
|
|
147
162
|
if (!actionContext) {
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Text } from "react-native";
|
|
3
3
|
import { render, fireEvent } from "@testing-library/react-native";
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
|
+
import { UIComponentContext } from "@applicaster/zapp-react-native-ui-components/Contexts/UIComponentContext";
|
|
5
6
|
|
|
6
7
|
import { ActionButtonController } from "../ActionButtonController";
|
|
7
8
|
|
|
@@ -89,6 +90,47 @@ describe("ActionButtonController", () => {
|
|
|
89
90
|
);
|
|
90
91
|
});
|
|
91
92
|
|
|
93
|
+
it("passes the List UIComponentContext into invokeAction so the sheet can refresh it", () => {
|
|
94
|
+
const listComponent = {
|
|
95
|
+
id: "list-1",
|
|
96
|
+
data: { source: "https://example.com/user/collections/abc" },
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const actionContext = {
|
|
100
|
+
isActionAvailable: jest.fn(() => true),
|
|
101
|
+
initialEntryState: jest.fn(() => ({ active: false })),
|
|
102
|
+
invokeAction: jest.fn(),
|
|
103
|
+
addListener: jest.fn(() => jest.fn()),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
mockUseActions.mockReturnValue(actionContext);
|
|
107
|
+
|
|
108
|
+
const { getByTestId } = render(
|
|
109
|
+
<UIComponentContext.Provider value={listComponent}>
|
|
110
|
+
<ActionButtonController
|
|
111
|
+
action={{ identifier: "open-modal-bottom-sheet-cell-action" }}
|
|
112
|
+
entry={entry}
|
|
113
|
+
>
|
|
114
|
+
{({ onPress }) => (
|
|
115
|
+
<Text testID="content" onPress={onPress}>
|
|
116
|
+
press
|
|
117
|
+
</Text>
|
|
118
|
+
)}
|
|
119
|
+
</ActionButtonController>
|
|
120
|
+
</UIComponentContext.Provider>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
fireEvent.press(getByTestId("content"));
|
|
124
|
+
|
|
125
|
+
expect(actionContext.invokeAction).toHaveBeenCalledWith(
|
|
126
|
+
entry,
|
|
127
|
+
expect.objectContaining({
|
|
128
|
+
updateState: expect.any(Function),
|
|
129
|
+
component: listComponent,
|
|
130
|
+
})
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
|
|
92
134
|
it("updates state from addListener", () => {
|
|
93
135
|
let listener;
|
|
94
136
|
|
|
@@ -328,7 +370,7 @@ describe("ActionButtonController", () => {
|
|
|
328
370
|
|
|
329
371
|
fireEvent.press(getByTestId("content"));
|
|
330
372
|
|
|
331
|
-
expect(invokeAction).toHaveBeenCalledWith(entry);
|
|
373
|
+
expect(invokeAction).toHaveBeenCalledWith(entry, {});
|
|
332
374
|
expect(addFavourite).not.toHaveBeenCalled();
|
|
333
375
|
expect(removeFavourite).not.toHaveBeenCalled();
|
|
334
376
|
});
|
|
@@ -91,6 +91,7 @@ function ButtonComponent(props: Props) {
|
|
|
91
91
|
onPress={onPress}
|
|
92
92
|
testID={props?.testID || `${item?.id}`}
|
|
93
93
|
accessibilityLabel={props?.accessibilityLabel || `${item?.id}`}
|
|
94
|
+
accessibilityRole="button"
|
|
94
95
|
accessible={!!(props?.testID || props?.accessibilityLabel)}
|
|
95
96
|
style={props?.style}
|
|
96
97
|
>
|
|
@@ -12,6 +12,7 @@ export type ActionButtonProps = {
|
|
|
12
12
|
item: RegisteredAction;
|
|
13
13
|
configuration: any;
|
|
14
14
|
width: number;
|
|
15
|
+
component?: ZappUIComponent & { parent?: ZappUIComponent };
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
type Props = ActionButtonProps & {
|
|
@@ -27,7 +28,7 @@ type Props = ActionButtonProps & {
|
|
|
27
28
|
* (backed by the action's observable / `addListener`).
|
|
28
29
|
*/
|
|
29
30
|
export function ActionButton(props: Props) {
|
|
30
|
-
const { item, entry, onPress: onItemPress } = props;
|
|
31
|
+
const { item, entry, onPress: onItemPress, component } = props;
|
|
31
32
|
|
|
32
33
|
const action = item?.action;
|
|
33
34
|
|
|
@@ -38,9 +39,10 @@ export function ActionButton(props: Props) {
|
|
|
38
39
|
invokeAction({
|
|
39
40
|
context: "toast",
|
|
40
41
|
dismiss: () => onItemPress?.(item),
|
|
42
|
+
...(component ? { component } : {}),
|
|
41
43
|
});
|
|
42
44
|
},
|
|
43
|
-
[invokeAction, item, onItemPress]
|
|
45
|
+
[invokeAction, item, onItemPress, component]
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
if (!isActionAvailableFor(action, entry as ZappEntry)) return null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
|
|
2
|
+
import { boundActionButton } from "../boundActionButton";
|
|
3
|
+
import { openActionsBottomSheet } from "../openActionsBottomSheet";
|
|
4
|
+
|
|
5
|
+
jest.mock("@applicaster/zapp-react-native-utils/modalState", () => ({
|
|
6
|
+
openBottomSheetModal: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
jest.mock("../boundActionButton", () => ({
|
|
10
|
+
boundActionButton: jest.fn(() => jest.fn()),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
describe("openActionsBottomSheet", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("binds the List component into the sheet row button", () => {
|
|
19
|
+
const entry = { id: "entry-1" } as ZappEntry;
|
|
20
|
+
|
|
21
|
+
const component = {
|
|
22
|
+
data: { source: "https://example.com/user/collections/abc" },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const actions = [
|
|
26
|
+
{ identifier: "entry_action_0", action: { invokeAction: jest.fn() } },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
openActionsBottomSheet({
|
|
30
|
+
entry,
|
|
31
|
+
actions: actions as any,
|
|
32
|
+
component: component as any,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(boundActionButton).toHaveBeenCalledWith(entry, component);
|
|
36
|
+
expect(openBottomSheetModal).toHaveBeenCalledTimes(1);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -8,9 +8,12 @@ import { ActionButton, ActionButtonProps } from "./ActionButton";
|
|
|
8
8
|
* `BottomSheetModalContent` renders `buttonComponent` per item and does not
|
|
9
9
|
* know about entries, so the entry is closed over here instead.
|
|
10
10
|
*/
|
|
11
|
-
export const boundActionButton = (
|
|
11
|
+
export const boundActionButton = (
|
|
12
|
+
entry: ZappEntry | ZappFeed,
|
|
13
|
+
component?: ZappUIComponent & { parent?: ZappUIComponent }
|
|
14
|
+
) => {
|
|
12
15
|
const ActionButtonWithEntry = (props: ActionButtonProps) => (
|
|
13
|
-
<ActionButton {...props} entry={entry as ZappEntry} />
|
|
16
|
+
<ActionButton {...props} entry={entry as ZappEntry} component={component} />
|
|
14
17
|
);
|
|
15
18
|
|
|
16
19
|
ActionButtonWithEntry.displayName = "ActionButtonWithEntry";
|
|
@@ -17,6 +17,8 @@ export type OpenActionsBottomSheetArgs = {
|
|
|
17
17
|
actions: RegisteredAction[];
|
|
18
18
|
title?: string;
|
|
19
19
|
summary?: string;
|
|
20
|
+
/** List that opened the sheet; forwarded into row invokeAction context. */
|
|
21
|
+
component?: ZappUIComponent & { parent?: ZappUIComponent };
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -32,6 +34,7 @@ export function openActionsBottomSheet({
|
|
|
32
34
|
actions,
|
|
33
35
|
title,
|
|
34
36
|
summary,
|
|
37
|
+
component,
|
|
35
38
|
}: OpenActionsBottomSheetArgs): void {
|
|
36
39
|
if (!actions?.length) {
|
|
37
40
|
// Every action resolved away - unavailable for this entry, or not
|
|
@@ -50,7 +53,7 @@ export function openActionsBottomSheet({
|
|
|
50
53
|
// BottomSheetModalContent still requires an onPress.
|
|
51
54
|
onPress: noop,
|
|
52
55
|
items: actions,
|
|
53
|
-
buttonComponent: boundActionButton(entry),
|
|
56
|
+
buttonComponent: boundActionButton(entry, component),
|
|
54
57
|
title,
|
|
55
58
|
summary,
|
|
56
59
|
},
|
|
@@ -81,6 +81,8 @@ export type LeadingIconConfiguration = {
|
|
|
81
81
|
enabled: boolean;
|
|
82
82
|
/** Decides which icon will be displayed when enabled */
|
|
83
83
|
actionType?: ButtonActionType;
|
|
84
|
+
/** Optional Studio / modal-blocks asset URI (overrides actionType mapping) */
|
|
85
|
+
asset?: string;
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export type IconsConfiguration = {
|
|
@@ -170,7 +172,9 @@ function getTextTransformStyle(
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
function shouldShowLeadingIcon(leadingIcon: LeadingIconConfiguration) {
|
|
173
|
-
return
|
|
175
|
+
return (
|
|
176
|
+
leadingIcon.enabled && (!!leadingIcon.actionType || !!leadingIcon.asset)
|
|
177
|
+
);
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
// ---------------------------------------------------------------------------
|
|
@@ -268,7 +272,7 @@ function ButtonTitle({
|
|
|
268
272
|
}
|
|
269
273
|
|
|
270
274
|
type ButtonLeadingIconProps = {
|
|
271
|
-
actionType
|
|
275
|
+
actionType?: ButtonActionType;
|
|
272
276
|
configuration: IconsConfiguration;
|
|
273
277
|
};
|
|
274
278
|
|
|
@@ -276,9 +280,17 @@ function ButtonLeadingIcon({
|
|
|
276
280
|
actionType,
|
|
277
281
|
configuration,
|
|
278
282
|
}: ButtonLeadingIconProps) {
|
|
283
|
+
const asset =
|
|
284
|
+
configuration.leadingIcon.asset ||
|
|
285
|
+
(actionType ? ACTION_ICON_ASSETS[actionType] : undefined);
|
|
286
|
+
|
|
287
|
+
if (!asset) {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
|
|
279
291
|
return (
|
|
280
292
|
<Image
|
|
281
|
-
source={{ uri:
|
|
293
|
+
source={{ uri: asset }}
|
|
282
294
|
style={{
|
|
283
295
|
width: configuration.width,
|
|
284
296
|
height: configuration.height,
|
|
@@ -351,7 +363,7 @@ export function AudioPlayerButton({
|
|
|
351
363
|
}
|
|
352
364
|
|
|
353
365
|
// ---------------------------------------------------------------------------
|
|
354
|
-
//
|
|
366
|
+
// Variant configurations
|
|
355
367
|
// ---------------------------------------------------------------------------
|
|
356
368
|
|
|
357
369
|
export const VARIANT_TEXT_ONLY: ButtonConfiguration = {
|
|
@@ -371,25 +383,3 @@ export const VARIANT_WITH_ICON: ButtonConfiguration = {
|
|
|
371
383
|
},
|
|
372
384
|
},
|
|
373
385
|
};
|
|
374
|
-
|
|
375
|
-
export const VARIANT_UPPERCASE_TITLE: ButtonConfiguration = {
|
|
376
|
-
background: DEFAULT_BACKGROUND_CONFIGURATION,
|
|
377
|
-
title: {
|
|
378
|
-
...DEFAULT_TITLE_CONFIGURATION,
|
|
379
|
-
textTransform: "uppercase",
|
|
380
|
-
},
|
|
381
|
-
icons: DEFAULT_ICONS_CONFIGURATION,
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
export const VARIANT_LARGE_ICON: ButtonConfiguration = {
|
|
385
|
-
background: DEFAULT_BACKGROUND_CONFIGURATION,
|
|
386
|
-
title: DEFAULT_TITLE_CONFIGURATION,
|
|
387
|
-
icons: {
|
|
388
|
-
width: 32,
|
|
389
|
-
height: 32,
|
|
390
|
-
leadingIcon: {
|
|
391
|
-
enabled: true,
|
|
392
|
-
actionType: "addToQueue",
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
};
|
|
@@ -63,11 +63,7 @@ export type TextTransform =
|
|
|
63
63
|
export type TitleAlignment = "left" | "center";
|
|
64
64
|
|
|
65
65
|
/** Selects hardcoded container + action layout (white fields). */
|
|
66
|
-
export type HeaderVariant =
|
|
67
|
-
| "singleLine"
|
|
68
|
-
| "headerWithActions"
|
|
69
|
-
| "headerWithActionsCancelOnly"
|
|
70
|
-
| "section";
|
|
66
|
+
export type HeaderVariant = "singleLine" | "headerWithActions" | "section";
|
|
71
67
|
|
|
72
68
|
export type TitleConfiguration = {
|
|
73
69
|
fontColor: string;
|
|
@@ -198,13 +194,6 @@ const CONTAINER_SPEC: Record<HeaderVariant, ContainerSpec> = {
|
|
|
198
194
|
paddingBottom: 8,
|
|
199
195
|
paddingLeft: 20,
|
|
200
196
|
},
|
|
201
|
-
headerWithActionsCancelOnly: {
|
|
202
|
-
horizontalGutter: 12,
|
|
203
|
-
paddingTop: 0,
|
|
204
|
-
paddingRight: 20,
|
|
205
|
-
paddingBottom: 8,
|
|
206
|
-
paddingLeft: 20,
|
|
207
|
-
},
|
|
208
197
|
section: {
|
|
209
198
|
horizontalGutter: 12,
|
|
210
199
|
paddingTop: 0,
|
|
@@ -228,11 +217,6 @@ const ACTION_BUTTONS_BEHAVIOR: Record<
|
|
|
228
217
|
leading: { enabled: true, actionType: "cancel" },
|
|
229
218
|
trailing: { enabled: true, actionType: "done" },
|
|
230
219
|
},
|
|
231
|
-
headerWithActionsCancelOnly: {
|
|
232
|
-
sectionEnabled: true,
|
|
233
|
-
leading: { enabled: true, actionType: "cancel" },
|
|
234
|
-
trailing: { enabled: false },
|
|
235
|
-
},
|
|
236
220
|
section: {
|
|
237
221
|
sectionEnabled: true,
|
|
238
222
|
leading: { enabled: false },
|
|
@@ -725,25 +709,6 @@ export const VARIANT_HEADER_WITH_ACTIONS: HeaderConfiguration = {
|
|
|
725
709
|
paddingTop: 16,
|
|
726
710
|
};
|
|
727
711
|
|
|
728
|
-
/** Variant 2 — single side action (layout rule demo) */
|
|
729
|
-
export const VARIANT_HEADER_WITH_CANCEL_ONLY: HeaderConfiguration = {
|
|
730
|
-
variant: "headerWithActionsCancelOnly",
|
|
731
|
-
title: {
|
|
732
|
-
fontColor: "#FFFFFF",
|
|
733
|
-
iosFontFamily: "SFProText-Bold",
|
|
734
|
-
androidFontFamily: "Roboto-Bold",
|
|
735
|
-
fontSize: 22,
|
|
736
|
-
lineHeight: 28,
|
|
737
|
-
iosLetterSpacing: -0.6,
|
|
738
|
-
androidLetterSpacing: 0,
|
|
739
|
-
textTransform: "default",
|
|
740
|
-
alignment: "center",
|
|
741
|
-
},
|
|
742
|
-
closeButton: { enabled: false },
|
|
743
|
-
actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
|
|
744
|
-
paddingTop: 16,
|
|
745
|
-
};
|
|
746
|
-
|
|
747
712
|
/** Variant 3 — Section Header */
|
|
748
713
|
export const VARIANT_SECTION_HEADER: HeaderConfiguration = {
|
|
749
714
|
variant: "section",
|
|
@@ -565,7 +565,7 @@ export function AudioPlayerInput({
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
// ---------------------------------------------------------------------------
|
|
568
|
-
// Variant
|
|
568
|
+
// Variant configurations
|
|
569
569
|
// ---------------------------------------------------------------------------
|
|
570
570
|
|
|
571
571
|
/** Search pill — leading icon + clear button */
|
|
@@ -626,28 +626,3 @@ export const VARIANT_NAME_PLAYLIST_INPUT: InputConfiguration = {
|
|
|
626
626
|
},
|
|
627
627
|
},
|
|
628
628
|
};
|
|
629
|
-
|
|
630
|
-
/** Text only search pill — no leading icon */
|
|
631
|
-
export const VARIANT_TEXT_ONLY_INPUT: InputConfiguration = {
|
|
632
|
-
background: DEFAULT_BACKGROUND_CONFIGURATION,
|
|
633
|
-
label: DEFAULT_LABEL_CONFIGURATION,
|
|
634
|
-
text: DEFAULT_TEXT_CONFIGURATION,
|
|
635
|
-
icons: {
|
|
636
|
-
...DEFAULT_ICONS_CONFIGURATION,
|
|
637
|
-
leadingIcon: { enabled: false },
|
|
638
|
-
},
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
/** Search without clear button */
|
|
642
|
-
export const VARIANT_SEARCH_WITHOUT_CLEAR: InputConfiguration = {
|
|
643
|
-
background: DEFAULT_BACKGROUND_CONFIGURATION,
|
|
644
|
-
label: DEFAULT_LABEL_CONFIGURATION,
|
|
645
|
-
text: DEFAULT_TEXT_CONFIGURATION,
|
|
646
|
-
icons: {
|
|
647
|
-
...DEFAULT_ICONS_CONFIGURATION,
|
|
648
|
-
trailingIcon: {
|
|
649
|
-
...DEFAULT_ICONS_CONFIGURATION.trailingIcon,
|
|
650
|
-
enabled: false,
|
|
651
|
-
},
|
|
652
|
-
},
|
|
653
|
-
};
|