@joinskips/brand 7.0.0-develop.132 → 7.0.0-develop.138
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/chat/components/Welcome.js +4 -3
- package/package.json +5 -1
- package/ui/ThemeToggle.d.ts +23 -0
- package/ui/ThemeToggle.js +12 -0
- package/ui/index.d.ts +2 -0
- package/ui/index.js +2 -0
- package/ui/theme.d.ts +6 -0
- package/ui/theme.js +12 -0
|
@@ -84,9 +84,10 @@ export function CodeStep({ words, length, noMatch, ranOut, resendAfterMs = RESEN
|
|
|
84
84
|
}, onBlur: () => {
|
|
85
85
|
setFocused(false);
|
|
86
86
|
}, accessibilityLabel: words.codeLabel, "aria-invalid": error !== null, ...describedBy(error === null ? undefined : errorId), inputMode: "numeric", autoComplete: "one-time-code", textContentType: "oneTimeCode", caretHidden: true,
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
|
|
87
|
+
// The boxes draw the digits and the focus. Clear on iOS, which hands no taps to a view under 0.01 alpha.
|
|
88
|
+
// Unseen elsewhere: Android would draw a long press's selection over the boxes, and a web checker would read
|
|
89
|
+
// clear text as text with no contrast.
|
|
90
|
+
className: "absolute inset-0 ios:text-transparent android:opacity-0 web:opacity-0" })] }), error ? (_jsx(Text, { nativeID: errorId, role: "alert", className: "text-center font-ui text-sm text-error-ink", children: error })) : null, _jsxs(View, { className: "flex-row flex-wrap items-center justify-center gap-2", children: [_jsx(Pill, { label: words.changeEmail, look: "flat", onPress: onChangeEmail }), _jsx(NewCode, { waitMs: resendAfterMs, words: words, onResend: onResend }), _jsx(Pill, { label: words.codeSubmit, disabled: code.length < length, onPress: () => {
|
|
90
91
|
onSubmit(code);
|
|
91
92
|
} })] })] }));
|
|
92
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joinskips/brand",
|
|
3
|
-
"version": "7.0.0-develop.
|
|
3
|
+
"version": "7.0.0-develop.138",
|
|
4
4
|
"description": "Skips design tokens, Onest, logos, favicons, interface icons, member pictures and app icons.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://brand.joinskips.com",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"types": "./chat/index.d.ts",
|
|
14
14
|
"default": "./chat/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./ui": {
|
|
17
|
+
"types": "./ui/index.d.ts",
|
|
18
|
+
"default": "./ui/index.js"
|
|
19
|
+
},
|
|
16
20
|
"./*": "./*"
|
|
17
21
|
},
|
|
18
22
|
"dependencies": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import { type Theme } from './theme.ts';
|
|
3
|
+
/** The icons the theme button draws, from the brand's interface icons, which each app already draws. */
|
|
4
|
+
export type ThemeIconName = 'sun' | 'moon' | 'monitor';
|
|
5
|
+
export interface ThemeIconProps {
|
|
6
|
+
name: ThemeIconName;
|
|
7
|
+
color: string;
|
|
8
|
+
size: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ThemeToggleProps {
|
|
11
|
+
/** The theme the app has now. */
|
|
12
|
+
choice: Theme;
|
|
13
|
+
/** What a press does with the next theme: the app stores and applies it. */
|
|
14
|
+
onChoose: (next: Theme) => void;
|
|
15
|
+
Icon: ComponentType<ThemeIconProps>;
|
|
16
|
+
/** The icons' colour, as the app's header draws its other icons. */
|
|
17
|
+
color: string;
|
|
18
|
+
/** The button's box, to fit the app's header. */
|
|
19
|
+
className?: string;
|
|
20
|
+
size?: number;
|
|
21
|
+
}
|
|
22
|
+
/** One icon that turns into the next as the choice moves on: the sun, the moon, the monitor. */
|
|
23
|
+
export declare function ThemeToggle({ choice, onChoose, Icon, color, className, size }: ThemeToggleProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
import { SWITCH_TO_LABEL, THEMES, nextTheme } from "./theme.js";
|
|
4
|
+
const ICONS = { light: 'sun', dark: 'moon', system: 'monitor' };
|
|
5
|
+
const ICON_SIZE = 24;
|
|
6
|
+
/** One icon that turns into the next as the choice moves on: the sun, the moon, the monitor. */
|
|
7
|
+
export function ThemeToggle({ choice, onChoose, Icon, color, className = '', size = ICON_SIZE }) {
|
|
8
|
+
const next = nextTheme(choice);
|
|
9
|
+
return (_jsx(Pressable, { role: "button", accessibilityLabel: SWITCH_TO_LABEL[next], hitSlop: 8, onPress: () => {
|
|
10
|
+
onChoose(next);
|
|
11
|
+
}, className: `items-center justify-center ${className}`, children: THEMES.map((theme) => (_jsx(View, { "aria-hidden": true, className: `absolute transition-[rotate,scale,opacity] duration-200 ease-standard ${theme === choice ? 'scale-100 rotate-0 opacity-100' : 'scale-50 rotate-90 opacity-0'}`, children: _jsx(Icon, { name: ICONS[theme], color: color, size: size }) }, theme))) }));
|
|
12
|
+
}
|
package/ui/index.d.ts
ADDED
package/ui/index.js
ADDED
package/ui/theme.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The theme a visitor picks: light, dark, or follow the system. Each app stores and applies it its own way. */
|
|
2
|
+
export type Theme = 'light' | 'dark' | 'system';
|
|
3
|
+
export declare const THEMES: readonly Theme[];
|
|
4
|
+
export declare function nextTheme(theme: Theme): Theme;
|
|
5
|
+
/** The theme button is named for what a press does next. */
|
|
6
|
+
export declare const SWITCH_TO_LABEL: Readonly<Record<Theme, string>>;
|
package/ui/theme.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const THEMES = ['light', 'dark', 'system'];
|
|
2
|
+
/** The theme button cycles light, then dark, then back to the system. */
|
|
3
|
+
const NEXT = { light: 'dark', dark: 'system', system: 'light' };
|
|
4
|
+
export function nextTheme(theme) {
|
|
5
|
+
return NEXT[theme];
|
|
6
|
+
}
|
|
7
|
+
/** The theme button is named for what a press does next. */
|
|
8
|
+
export const SWITCH_TO_LABEL = {
|
|
9
|
+
light: 'Switch to the light theme',
|
|
10
|
+
dark: 'Switch to the dark theme',
|
|
11
|
+
system: 'Follow the system theme',
|
|
12
|
+
};
|