@ezpg/app-ui 0.21.0 → 0.22.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 +23 -0
- package/lib/module/adjust/adjust-template.js +1 -0
- package/lib/module/adjust/adjust-template.js.map +1 -1
- package/lib/module/adjust/axis-adjust.js +181 -0
- package/lib/module/adjust/axis-adjust.js.map +1 -0
- package/lib/module/adjust/axis-tabs.js +81 -0
- package/lib/module/adjust/axis-tabs.js.map +1 -0
- package/lib/module/adjust/axis-wheel.js +286 -0
- package/lib/module/adjust/axis-wheel.js.map +1 -0
- package/lib/module/adjust/index.js +4 -0
- package/lib/module/adjust/index.js.map +1 -1
- package/lib/module/adjust/store-sample.js +436 -0
- package/lib/module/adjust/store-sample.js.map +1 -0
- package/lib/module/blocks/color-swatch-picker/color-swatch-picker.js +1 -1
- package/lib/module/blocks/detail-editor/compare-slider.js +5 -2
- package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -1
- package/lib/module/blocks/detail-editor/detail-canvas.js +192 -61
- package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -1
- package/lib/module/blocks/detail-editor/detail-types.js +57 -0
- package/lib/module/blocks/detail-editor/detail-types.js.map +1 -1
- package/lib/module/blocks/detail-editor/draft-preview.js +22 -0
- package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -1
- package/lib/module/blocks/detail-editor/focus-context.js +1 -0
- package/lib/module/blocks/detail-editor/focus-context.js.map +1 -1
- package/lib/module/blocks/detail-editor/index.js +2 -2
- package/lib/module/blocks/detail-editor/index.js.map +1 -1
- package/lib/module/blocks/detail-editor/keep-words.js +34 -0
- package/lib/module/blocks/detail-editor/keep-words.js.map +1 -0
- package/lib/module/blocks/detail-editor/layout-picker.js +192 -8
- package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -1
- package/lib/module/blocks/detail-request/detail-request.js +213 -0
- package/lib/module/blocks/detail-request/detail-request.js.map +1 -0
- package/lib/module/blocks/detail-request/index.js +4 -0
- package/lib/module/blocks/detail-request/index.js.map +1 -0
- package/lib/module/blocks/detail-studio/action-chips.js +72 -0
- package/lib/module/blocks/detail-studio/action-chips.js.map +1 -0
- package/lib/module/blocks/detail-studio/adjust-tiles.js +3 -3
- package/lib/module/blocks/detail-studio/adjust-tiles.js.map +1 -1
- package/lib/module/blocks/detail-studio/asset-grid.js +33 -16
- package/lib/module/blocks/detail-studio/asset-grid.js.map +1 -1
- package/lib/module/blocks/detail-studio/confirm-row.js +3 -0
- package/lib/module/blocks/detail-studio/confirm-row.js.map +1 -1
- package/lib/module/blocks/detail-studio/detail-studio-template.js +2 -6
- package/lib/module/blocks/detail-studio/detail-studio-template.js.map +1 -1
- package/lib/module/blocks/detail-studio/edge-fade.js +74 -0
- package/lib/module/blocks/detail-studio/edge-fade.js.map +1 -0
- package/lib/module/blocks/detail-studio/image-prompt.js +8 -10
- package/lib/module/blocks/detail-studio/image-prompt.js.map +1 -1
- package/lib/module/blocks/detail-studio/index.js +7 -5
- package/lib/module/blocks/detail-studio/index.js.map +1 -1
- package/lib/module/blocks/detail-studio/rewrite-tray.js +17 -64
- package/lib/module/blocks/detail-studio/rewrite-tray.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-cover.js +41 -0
- package/lib/module/blocks/detail-studio/section-cover.js.map +1 -0
- package/lib/module/blocks/detail-studio/section-edit-template.js +103 -12
- package/lib/module/blocks/detail-studio/section-edit-template.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-kind-grid.js +2 -3
- package/lib/module/blocks/detail-studio/section-kind-grid.js.map +1 -1
- package/lib/module/blocks/detail-studio/section-settings.js +127 -61
- package/lib/module/blocks/detail-studio/section-settings.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-bar.js +46 -25
- package/lib/module/blocks/detail-studio/studio-bar.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-dock.js +21 -39
- package/lib/module/blocks/detail-studio/studio-dock.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-glyphs.js +92 -0
- package/lib/module/blocks/detail-studio/studio-glyphs.js.map +1 -0
- package/lib/module/blocks/detail-studio/studio-sheet.js +5 -3
- package/lib/module/blocks/detail-studio/studio-sheet.js.map +1 -1
- package/lib/module/blocks/detail-studio/studio-steps.js +60 -0
- package/lib/module/blocks/detail-studio/studio-steps.js.map +1 -0
- package/lib/module/blocks/detail-studio/studio-toggle.js +130 -0
- package/lib/module/blocks/detail-studio/studio-toggle.js.map +1 -0
- package/lib/module/blocks/detail-studio/{photo-tool-bar.js → studio-tools.js} +63 -42
- package/lib/module/blocks/detail-studio/studio-tools.js.map +1 -0
- package/lib/module/blocks/detail-studio/text-format-panel.js +16 -8
- package/lib/module/blocks/detail-studio/text-format-panel.js.map +1 -1
- package/lib/module/blocks/index.js +1 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/components/button/button.js +13 -5
- package/lib/module/components/button/button.js.map +1 -1
- package/lib/module/components/chip/chip.js +5 -1
- package/lib/module/components/chip/chip.js.map +1 -1
- package/lib/module/components/chip-group/chip-group.js +1 -0
- package/lib/module/components/chip-group/chip-group.js.map +1 -1
- package/lib/module/components/credit/credit.js +6 -2
- package/lib/module/components/credit/credit.js.map +1 -1
- package/lib/module/components/dropdown-menu/dropdown-menu.js +9 -4
- package/lib/module/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/lib/module/components/segmented-control/segmented-control.js +3 -1
- package/lib/module/components/segmented-control/segmented-control.js.map +1 -1
- package/lib/module/components/skeleton/skeleton.js +4 -2
- package/lib/module/components/skeleton/skeleton.js.map +1 -1
- package/lib/module/components/slider/slider.js +53 -16
- package/lib/module/components/slider/slider.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/glyphs.js +2 -1
- package/lib/module/internal/glyphs.js.map +1 -1
- package/lib/module/internal/line-icons.js +1 -0
- package/lib/module/internal/line-icons.js.map +1 -1
- package/lib/module/internal/retry-glyph.js +5 -2
- package/lib/module/internal/retry-glyph.js.map +1 -1
- package/lib/module/internal/undo-glyph.js +11 -8
- package/lib/module/internal/undo-glyph.js.map +1 -1
- package/lib/module/sortable/section-board.js +73 -89
- package/lib/module/sortable/section-board.js.map +1 -1
- package/lib/module/templates/design-pick-template.js +8 -1
- package/lib/module/templates/design-pick-template.js.map +1 -1
- package/lib/module/templates/intro-template.js +3 -3
- package/lib/module/templates/intro-template.js.map +1 -1
- package/lib/module/templates/result-template.js +2 -1
- package/lib/module/templates/result-template.js.map +1 -1
- package/lib/typescript/src/adjust/adjust-template.d.ts.map +1 -1
- package/lib/typescript/src/adjust/axis-adjust.d.ts +25 -0
- package/lib/typescript/src/adjust/axis-adjust.d.ts.map +1 -0
- package/lib/typescript/src/adjust/axis-tabs.d.ts +15 -0
- package/lib/typescript/src/adjust/axis-tabs.d.ts.map +1 -0
- package/lib/typescript/src/adjust/axis-wheel.d.ts +15 -0
- package/lib/typescript/src/adjust/axis-wheel.d.ts.map +1 -0
- package/lib/typescript/src/adjust/index.d.ts +4 -0
- package/lib/typescript/src/adjust/index.d.ts.map +1 -1
- package/lib/typescript/src/adjust/store-sample.d.ts +46 -0
- package/lib/typescript/src/adjust/store-sample.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +2 -1
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +3 -1
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +11 -0
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +4 -1
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +9 -0
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/index.d.ts +3 -2
- package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/keep-words.d.ts +2 -0
- package/lib/typescript/src/blocks/detail-editor/keep-words.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +6 -1
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-request/detail-request.d.ts +24 -0
- package/lib/typescript/src/blocks/detail-request/detail-request.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-request/index.d.ts +2 -0
- package/lib/typescript/src/blocks/detail-request/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/action-chips.d.ts +12 -0
- package/lib/typescript/src/blocks/detail-studio/action-chips.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/asset-grid.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/confirm-row.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/detail-studio-template.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/edge-fade.d.ts +10 -0
- package/lib/typescript/src/blocks/detail-studio/edge-fade.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/image-prompt.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/index.d.ts +7 -5
- package/lib/typescript/src/blocks/detail-studio/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/rewrite-tray.d.ts +3 -3
- package/lib/typescript/src/blocks/detail-studio/rewrite-tray.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-cover.d.ts +7 -0
- package/lib/typescript/src/blocks/detail-studio/section-cover.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/section-edit-template.d.ts +9 -0
- package/lib/typescript/src/blocks/detail-studio/section-edit-template.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-kind-grid.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/section-settings.d.ts +11 -13
- package/lib/typescript/src/blocks/detail-studio/section-settings.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-bar.d.ts +6 -2
- package/lib/typescript/src/blocks/detail-studio/studio-bar.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-dock.d.ts +0 -2
- package/lib/typescript/src/blocks/detail-studio/studio-dock.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-glyphs.d.ts +6 -0
- package/lib/typescript/src/blocks/detail-studio/studio-glyphs.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-sheet.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-studio/studio-steps.d.ts +11 -0
- package/lib/typescript/src/blocks/detail-studio/studio-steps.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-toggle.d.ts +14 -0
- package/lib/typescript/src/blocks/detail-studio/studio-toggle.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/studio-tools.d.ts +19 -0
- package/lib/typescript/src/blocks/detail-studio/studio-tools.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-studio/text-format-panel.d.ts +2 -1
- package/lib/typescript/src/blocks/detail-studio/text-format-panel.d.ts.map +1 -1
- package/lib/typescript/src/blocks/index.d.ts +1 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/button.d.ts +3 -1
- package/lib/typescript/src/components/button/button.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/chip.d.ts +2 -1
- package/lib/typescript/src/components/chip/chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip-group/chip-group.d.ts +1 -0
- package/lib/typescript/src/components/chip-group/chip-group.d.ts.map +1 -1
- package/lib/typescript/src/components/credit/credit.d.ts +1 -0
- package/lib/typescript/src/components/credit/credit.d.ts.map +1 -1
- package/lib/typescript/src/components/dropdown-menu/dropdown-menu.d.ts +2 -0
- package/lib/typescript/src/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/lib/typescript/src/components/segmented-control/segmented-control.d.ts +2 -0
- package/lib/typescript/src/components/segmented-control/segmented-control.d.ts.map +1 -1
- package/lib/typescript/src/components/skeleton/skeleton.d.ts +2 -1
- package/lib/typescript/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/slider.d.ts +2 -1
- package/lib/typescript/src/components/slider/slider.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/glyphs.d.ts +1 -0
- package/lib/typescript/src/internal/glyphs.d.ts.map +1 -1
- package/lib/typescript/src/internal/line-icons.d.ts +1 -0
- package/lib/typescript/src/internal/line-icons.d.ts.map +1 -1
- package/lib/typescript/src/internal/retry-glyph.d.ts.map +1 -1
- package/lib/typescript/src/internal/undo-glyph.d.ts.map +1 -1
- package/lib/typescript/src/sortable/section-board.d.ts.map +1 -1
- package/lib/typescript/src/templates/design-pick-template.d.ts.map +1 -1
- package/lib/typescript/src/templates/intro-template.d.ts.map +1 -1
- package/lib/typescript/src/templates/result-template.d.ts +2 -1
- package/lib/typescript/src/templates/result-template.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adjust/adjust-template.tsx +1 -0
- package/src/adjust/axis-adjust.tsx +206 -0
- package/src/adjust/axis-tabs.tsx +81 -0
- package/src/adjust/axis-wheel.tsx +309 -0
- package/src/adjust/index.ts +15 -0
- package/src/adjust/store-sample.tsx +519 -0
- package/src/blocks/color-swatch-picker/color-swatch-picker.tsx +1 -1
- package/src/blocks/detail-editor/compare-slider.tsx +3 -1
- package/src/blocks/detail-editor/detail-canvas.tsx +264 -69
- package/src/blocks/detail-editor/detail-types.ts +37 -0
- package/src/blocks/detail-editor/draft-preview.tsx +46 -2
- package/src/blocks/detail-editor/focus-context.ts +13 -0
- package/src/blocks/detail-editor/index.ts +11 -1
- package/src/blocks/detail-editor/keep-words.ts +36 -0
- package/src/blocks/detail-editor/layout-picker.tsx +188 -6
- package/src/blocks/detail-request/detail-request.tsx +198 -0
- package/src/blocks/detail-request/index.ts +11 -0
- package/src/blocks/detail-studio/action-chips.tsx +77 -0
- package/src/blocks/detail-studio/adjust-tiles.tsx +3 -3
- package/src/blocks/detail-studio/asset-grid.tsx +30 -16
- package/src/blocks/detail-studio/confirm-row.tsx +3 -0
- package/src/blocks/detail-studio/detail-studio-template.tsx +2 -6
- package/src/blocks/detail-studio/edge-fade.tsx +76 -0
- package/src/blocks/detail-studio/image-prompt.tsx +6 -9
- package/src/blocks/detail-studio/index.ts +19 -16
- package/src/blocks/detail-studio/rewrite-tray.tsx +16 -56
- package/src/blocks/detail-studio/section-cover.tsx +44 -0
- package/src/blocks/detail-studio/section-edit-template.tsx +138 -13
- package/src/blocks/detail-studio/section-kind-grid.tsx +2 -2
- package/src/blocks/detail-studio/section-settings.tsx +124 -69
- package/src/blocks/detail-studio/studio-bar.tsx +61 -41
- package/src/blocks/detail-studio/studio-dock.tsx +19 -37
- package/src/blocks/detail-studio/studio-glyphs.tsx +77 -0
- package/src/blocks/detail-studio/studio-sheet.tsx +7 -3
- package/src/blocks/detail-studio/studio-steps.tsx +58 -0
- package/src/blocks/detail-studio/studio-toggle.tsx +130 -0
- package/src/blocks/detail-studio/studio-tools.tsx +126 -0
- package/src/blocks/detail-studio/text-format-panel.tsx +26 -14
- package/src/blocks/index.tsx +1 -0
- package/src/components/button/button.tsx +12 -5
- package/src/components/chip/chip.tsx +9 -1
- package/src/components/chip-group/chip-group.tsx +2 -0
- package/src/components/credit/credit.tsx +9 -2
- package/src/components/dropdown-menu/dropdown-menu.tsx +18 -7
- package/src/components/segmented-control/segmented-control.tsx +10 -2
- package/src/components/skeleton/skeleton.tsx +5 -2
- package/src/components/slider/slider.tsx +66 -14
- package/src/index.tsx +1 -0
- package/src/internal/glyphs.tsx +2 -0
- package/src/internal/line-icons.ts +2 -0
- package/src/internal/retry-glyph.tsx +7 -2
- package/src/internal/undo-glyph.tsx +12 -11
- package/src/sortable/section-board.tsx +71 -76
- package/src/templates/design-pick-template.tsx +9 -1
- package/src/templates/intro-template.tsx +14 -12
- package/src/templates/result-template.tsx +3 -0
- package/lib/module/blocks/detail-studio/keyboard-bar.js +0 -67
- package/lib/module/blocks/detail-studio/keyboard-bar.js.map +0 -1
- package/lib/module/blocks/detail-studio/photo-tool-bar.js.map +0 -1
- package/lib/module/blocks/detail-studio/section-thumb.js +0 -49
- package/lib/module/blocks/detail-studio/section-thumb.js.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/keyboard-bar.d.ts +0 -18
- package/lib/typescript/src/blocks/detail-studio/keyboard-bar.d.ts.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/photo-tool-bar.d.ts +0 -19
- package/lib/typescript/src/blocks/detail-studio/photo-tool-bar.d.ts.map +0 -1
- package/lib/typescript/src/blocks/detail-studio/section-thumb.d.ts +0 -14
- package/lib/typescript/src/blocks/detail-studio/section-thumb.d.ts.map +0 -1
- package/src/blocks/detail-studio/keyboard-bar.tsx +0 -73
- package/src/blocks/detail-studio/photo-tool-bar.tsx +0 -100
- package/src/blocks/detail-studio/section-thumb.tsx +0 -41
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Text as RNText, View } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
interpolateColor,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
} from 'react-native-reanimated';
|
|
7
|
+
import { haptic } from '../../internal/haptics';
|
|
8
|
+
import { useSwitch } from '../../internal/motion';
|
|
9
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
10
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
11
|
+
import { makeStyles } from '../../utils/styles';
|
|
12
|
+
|
|
13
|
+
export type StudioToggleProps = {
|
|
14
|
+
label: string;
|
|
15
|
+
value: boolean;
|
|
16
|
+
onValueChange: (value: boolean) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type StudioToggleListProps = {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const TRACK = 26;
|
|
26
|
+
const KNOB = 22;
|
|
27
|
+
|
|
28
|
+
const useStyles = makeStyles((t) => {
|
|
29
|
+
const inset = (TRACK - KNOB) / 2;
|
|
30
|
+
return {
|
|
31
|
+
list: { marginHorizontal: -t.space[4] },
|
|
32
|
+
row: {
|
|
33
|
+
height: t.controlSize.lg,
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
gap: t.space[3],
|
|
37
|
+
paddingHorizontal: t.space[5],
|
|
38
|
+
},
|
|
39
|
+
label: {
|
|
40
|
+
...t.typography.body,
|
|
41
|
+
flex: 1,
|
|
42
|
+
fontFamily: t.fontFamily,
|
|
43
|
+
color: t.colors.title,
|
|
44
|
+
},
|
|
45
|
+
track: {
|
|
46
|
+
width: t.controlSize.sm,
|
|
47
|
+
height: TRACK,
|
|
48
|
+
borderRadius: t.radius.full,
|
|
49
|
+
},
|
|
50
|
+
thumb: {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: inset,
|
|
53
|
+
left: inset,
|
|
54
|
+
width: KNOB,
|
|
55
|
+
height: KNOB,
|
|
56
|
+
borderRadius: t.radius.full,
|
|
57
|
+
backgroundColor: t.colors.raised,
|
|
58
|
+
boxShadow: t.shadow.sm,
|
|
59
|
+
},
|
|
60
|
+
extra: {
|
|
61
|
+
paddingTop: t.space[1],
|
|
62
|
+
paddingBottom: t.space[3],
|
|
63
|
+
paddingHorizontal: t.space[5],
|
|
64
|
+
},
|
|
65
|
+
off: { opacity: t.opacity.disabled },
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function Knob({ on }: { on: boolean }) {
|
|
70
|
+
const t = useTheme();
|
|
71
|
+
const s = useStyles();
|
|
72
|
+
const travel = t.controlSize.sm - TRACK;
|
|
73
|
+
const off = t.colors.border;
|
|
74
|
+
const lit = t.colors.primary;
|
|
75
|
+
const progress = useSwitch(on, 'base');
|
|
76
|
+
const track = useAnimatedStyle(() => ({
|
|
77
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [off, lit]),
|
|
78
|
+
}));
|
|
79
|
+
const thumb = useAnimatedStyle(() => ({
|
|
80
|
+
transform: [{ translateX: travel * progress.value }],
|
|
81
|
+
}));
|
|
82
|
+
return (
|
|
83
|
+
<Animated.View testID="studio-switch" style={[s.track, track]}>
|
|
84
|
+
<Animated.View style={[s.thumb, thumb]} />
|
|
85
|
+
</Animated.View>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function StudioToggle({
|
|
90
|
+
label,
|
|
91
|
+
value,
|
|
92
|
+
onValueChange,
|
|
93
|
+
disabled,
|
|
94
|
+
children,
|
|
95
|
+
}: StudioToggleProps) {
|
|
96
|
+
const t = useTheme();
|
|
97
|
+
const s = useStyles();
|
|
98
|
+
return (
|
|
99
|
+
<View>
|
|
100
|
+
<PressableBase
|
|
101
|
+
feedback="row"
|
|
102
|
+
accessibilityRole="switch"
|
|
103
|
+
accessibilityLabel={label}
|
|
104
|
+
accessibilityState={{ checked: value, disabled }}
|
|
105
|
+
disabled={disabled}
|
|
106
|
+
disabledStyle={s.off}
|
|
107
|
+
onPress={() => {
|
|
108
|
+
haptic('select');
|
|
109
|
+
onValueChange(!value);
|
|
110
|
+
}}
|
|
111
|
+
style={s.row}
|
|
112
|
+
>
|
|
113
|
+
<RNText
|
|
114
|
+
numberOfLines={1}
|
|
115
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
116
|
+
style={s.label}
|
|
117
|
+
>
|
|
118
|
+
{label}
|
|
119
|
+
</RNText>
|
|
120
|
+
<Knob on={value} />
|
|
121
|
+
</PressableBase>
|
|
122
|
+
{children ? <View style={s.extra}>{children}</View> : null}
|
|
123
|
+
</View>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function StudioToggleList({ children }: StudioToggleListProps) {
|
|
128
|
+
const s = useStyles();
|
|
129
|
+
return <View style={s.list}>{children}</View>;
|
|
130
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { useRef, type ComponentRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { CreditCost } from '../../components/credit/credit';
|
|
4
|
+
import type { SectionAnchor } from '../../components/dropdown-menu/dropdown-menu';
|
|
5
|
+
import { Text } from '../../components/text/text';
|
|
6
|
+
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
7
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
8
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
9
|
+
import { makeStyles } from '../../utils/styles';
|
|
10
|
+
|
|
11
|
+
export type StudioToolItem = {
|
|
12
|
+
key: string;
|
|
13
|
+
icon: IconSlot;
|
|
14
|
+
label: string;
|
|
15
|
+
onPress: (anchor?: SectionAnchor) => void;
|
|
16
|
+
menu?: boolean;
|
|
17
|
+
active?: boolean;
|
|
18
|
+
accent?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
cost?: number | null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type StudioToolsProps = {
|
|
24
|
+
items: readonly StudioToolItem[];
|
|
25
|
+
docked?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const useStyles = makeStyles((t) => ({
|
|
29
|
+
bar: {
|
|
30
|
+
paddingVertical: t.space[2],
|
|
31
|
+
paddingHorizontal: t.space[2],
|
|
32
|
+
borderTopWidth: 1,
|
|
33
|
+
borderTopColor: t.colors.border,
|
|
34
|
+
backgroundColor: t.colors.surface,
|
|
35
|
+
},
|
|
36
|
+
row: { flexDirection: 'row', gap: t.space[1] },
|
|
37
|
+
inset: { paddingHorizontal: t.space[2] },
|
|
38
|
+
cell: { flex: 1 },
|
|
39
|
+
item: {
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap: t.space[1],
|
|
42
|
+
paddingVertical: t.space[1],
|
|
43
|
+
},
|
|
44
|
+
circle: {
|
|
45
|
+
width: t.minTouchSize,
|
|
46
|
+
height: t.minTouchSize,
|
|
47
|
+
borderRadius: t.radius.full,
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
backgroundColor: t.colors.background,
|
|
51
|
+
},
|
|
52
|
+
on: { backgroundColor: t.colors.primaryTint },
|
|
53
|
+
cost: { position: 'absolute', top: 0, right: 0 },
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
export function StudioTools({ items, docked = true }: StudioToolsProps) {
|
|
57
|
+
const t = useTheme();
|
|
58
|
+
const s = useStyles();
|
|
59
|
+
const cells = useRef<Record<string, ComponentRef<typeof View> | null>>({});
|
|
60
|
+
const press = (item: StudioToolItem) => {
|
|
61
|
+
const cell = item.menu ? cells.current[item.key] : null;
|
|
62
|
+
if (!cell) {
|
|
63
|
+
item.onPress();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
cell.measureInWindow((x, y, width, height) =>
|
|
67
|
+
item.onPress({ x, y, width, height })
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
return (
|
|
71
|
+
<View accessibilityRole="toolbar" style={[s.row, docked ? s.bar : s.inset]}>
|
|
72
|
+
{items.map((item) => {
|
|
73
|
+
const hot = !item.disabled && (item.active || item.accent);
|
|
74
|
+
const color = item.disabled
|
|
75
|
+
? t.colors.disabledForeground
|
|
76
|
+
: hot
|
|
77
|
+
? t.colors.selectForeground
|
|
78
|
+
: t.colors.title;
|
|
79
|
+
return (
|
|
80
|
+
<View
|
|
81
|
+
key={item.key}
|
|
82
|
+
ref={(node) => {
|
|
83
|
+
cells.current[item.key] = node;
|
|
84
|
+
}}
|
|
85
|
+
collapsable={false}
|
|
86
|
+
style={s.cell}
|
|
87
|
+
>
|
|
88
|
+
<PressableBase
|
|
89
|
+
onPress={() => press(item)}
|
|
90
|
+
disabled={item.disabled}
|
|
91
|
+
disabledStyle={{}}
|
|
92
|
+
feedback="small"
|
|
93
|
+
accessibilityLabel={item.label}
|
|
94
|
+
accessibilityState={
|
|
95
|
+
item.active === undefined
|
|
96
|
+
? undefined
|
|
97
|
+
: { selected: item.active }
|
|
98
|
+
}
|
|
99
|
+
style={s.item}
|
|
100
|
+
>
|
|
101
|
+
<View style={[s.circle, hot && s.on]}>
|
|
102
|
+
{renderIcon(item.icon, { color, size: t.iconSize.md })}
|
|
103
|
+
</View>
|
|
104
|
+
<Text
|
|
105
|
+
variant="caption"
|
|
106
|
+
numberOfLines={1}
|
|
107
|
+
weight={hot ? 'semibold' : undefined}
|
|
108
|
+
style={{ color }}
|
|
109
|
+
>
|
|
110
|
+
{item.label}
|
|
111
|
+
</Text>
|
|
112
|
+
{item.cost != null ? (
|
|
113
|
+
<View pointerEvents="none" style={s.cost}>
|
|
114
|
+
<CreditCost
|
|
115
|
+
value={item.cost}
|
|
116
|
+
tone={item.disabled ? 'disabled' : 'muted'}
|
|
117
|
+
/>
|
|
118
|
+
</View>
|
|
119
|
+
) : null}
|
|
120
|
+
</PressableBase>
|
|
121
|
+
</View>
|
|
122
|
+
);
|
|
123
|
+
})}
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text as RNText, View } from 'react-native';
|
|
1
|
+
import { Text as RNText, View, type TextStyle } from 'react-native';
|
|
2
2
|
import { SegmentedControl } from '../../components/segmented-control/segmented-control';
|
|
3
3
|
import { Slider } from '../../components/slider/slider';
|
|
4
4
|
import {
|
|
@@ -29,6 +29,7 @@ export type TextFormatPanelProps = {
|
|
|
29
29
|
onSlidingStart?: () => void;
|
|
30
30
|
tab: TextFormatTab;
|
|
31
31
|
onTabChange: (tab: TextFormatTab) => void;
|
|
32
|
+
tabs?: readonly TextFormatTab[];
|
|
32
33
|
sample?: string;
|
|
33
34
|
colors?: readonly ColorSwatch[];
|
|
34
35
|
bottomInset?: number;
|
|
@@ -45,10 +46,14 @@ const TABS: { value: TextFormatTab; label: string }[] = [
|
|
|
45
46
|
{ value: 'effect', label: '효과' },
|
|
46
47
|
];
|
|
47
48
|
|
|
48
|
-
const WEIGHTS: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const WEIGHTS: {
|
|
50
|
+
value: DetailWeight;
|
|
51
|
+
label: string;
|
|
52
|
+
weight: TextStyle['fontWeight'];
|
|
53
|
+
}[] = [
|
|
54
|
+
{ value: 'regular', label: '보통', weight: '400' },
|
|
55
|
+
{ value: 'bold', label: '굵게', weight: '600' },
|
|
56
|
+
{ value: 'heavy', label: '아주 굵게', weight: '700' },
|
|
52
57
|
];
|
|
53
58
|
|
|
54
59
|
const ALIGNS = [
|
|
@@ -72,8 +77,8 @@ const useStyles = makeStyles((t) => ({
|
|
|
72
77
|
},
|
|
73
78
|
swatches: { paddingTop: t.space[4], paddingHorizontal: t.space[1] },
|
|
74
79
|
large: {
|
|
75
|
-
fontSize: t.typography.
|
|
76
|
-
lineHeight: t.typography.
|
|
80
|
+
fontSize: t.typography.screenTitle.fontSize,
|
|
81
|
+
lineHeight: t.typography.screenTitle.lineHeight,
|
|
77
82
|
color: t.colors.title,
|
|
78
83
|
},
|
|
79
84
|
}));
|
|
@@ -86,6 +91,7 @@ export function TextFormatPanel({
|
|
|
86
91
|
onSlidingStart,
|
|
87
92
|
tab,
|
|
88
93
|
onTabChange,
|
|
94
|
+
tabs,
|
|
89
95
|
sample = '가나다',
|
|
90
96
|
colors,
|
|
91
97
|
bottomInset = 0,
|
|
@@ -95,6 +101,7 @@ export function TextFormatPanel({
|
|
|
95
101
|
const size = value.size ?? 5;
|
|
96
102
|
const line = value.line ?? 5;
|
|
97
103
|
const tracking = value.tracking ?? 0;
|
|
104
|
+
const shown = tabs ? TABS.filter((item) => tabs.includes(item.value)) : TABS;
|
|
98
105
|
|
|
99
106
|
const body = () => {
|
|
100
107
|
switch (tab) {
|
|
@@ -111,6 +118,7 @@ export function TextFormatPanel({
|
|
|
111
118
|
return (
|
|
112
119
|
<>
|
|
113
120
|
<Slider
|
|
121
|
+
size="sm"
|
|
114
122
|
value={size}
|
|
115
123
|
min={1}
|
|
116
124
|
max={10}
|
|
@@ -139,6 +147,7 @@ export function TextFormatPanel({
|
|
|
139
147
|
return (
|
|
140
148
|
<>
|
|
141
149
|
<Slider
|
|
150
|
+
size="sm"
|
|
142
151
|
value={line}
|
|
143
152
|
min={1}
|
|
144
153
|
max={10}
|
|
@@ -149,6 +158,7 @@ export function TextFormatPanel({
|
|
|
149
158
|
accessibilityLabel="줄 간격"
|
|
150
159
|
/>
|
|
151
160
|
<Slider
|
|
161
|
+
size="sm"
|
|
152
162
|
value={tracking}
|
|
153
163
|
min={-5}
|
|
154
164
|
max={10}
|
|
@@ -191,13 +201,15 @@ export function TextFormatPanel({
|
|
|
191
201
|
|
|
192
202
|
return (
|
|
193
203
|
<View style={[s.panel, { height: FORMAT_PANEL + bottomInset }]}>
|
|
194
|
-
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
{shown.length > 1 ? (
|
|
205
|
+
<View style={s.tabs}>
|
|
206
|
+
<SegmentedControl
|
|
207
|
+
items={shown}
|
|
208
|
+
value={tab}
|
|
209
|
+
onValueChange={onTabChange}
|
|
210
|
+
/>
|
|
211
|
+
</View>
|
|
212
|
+
) : null}
|
|
201
213
|
<View style={s.body}>{body()}</View>
|
|
202
214
|
</View>
|
|
203
215
|
);
|
package/src/blocks/index.tsx
CHANGED
|
@@ -38,6 +38,8 @@ export type ButtonProps = Omit<
|
|
|
38
38
|
leftIcon?: IconSlot;
|
|
39
39
|
rightIcon?: IconSlot;
|
|
40
40
|
point?: boolean;
|
|
41
|
+
pill?: boolean;
|
|
42
|
+
steady?: boolean;
|
|
41
43
|
cost?: number | null;
|
|
42
44
|
children: ReactNode;
|
|
43
45
|
};
|
|
@@ -84,11 +86,13 @@ const useStyles = makeStyles((t) => ({
|
|
|
84
86
|
},
|
|
85
87
|
primary: { backgroundColor: t.colors.primary },
|
|
86
88
|
off: { backgroundColor: t.colors.disabledSurface },
|
|
89
|
+
soft: { backgroundColor: t.colors.muted },
|
|
87
90
|
secondary: { backgroundColor: t.colors.muted },
|
|
88
91
|
bare: { paddingHorizontal: 0 },
|
|
89
92
|
ghost: { backgroundColor: 'transparent' },
|
|
90
93
|
danger: { backgroundColor: t.colors.danger },
|
|
91
94
|
success: { backgroundColor: t.colors.success },
|
|
95
|
+
pill: { borderRadius: t.radius.full },
|
|
92
96
|
label: { fontFamily: t.fontFamily, fontWeight: '600' },
|
|
93
97
|
quiet: { fontWeight: '500' },
|
|
94
98
|
smLabel: {
|
|
@@ -115,6 +119,8 @@ export function Button({
|
|
|
115
119
|
leftIcon,
|
|
116
120
|
rightIcon,
|
|
117
121
|
point = false,
|
|
122
|
+
pill = false,
|
|
123
|
+
steady = false,
|
|
118
124
|
cost,
|
|
119
125
|
children,
|
|
120
126
|
style,
|
|
@@ -126,7 +132,7 @@ export function Button({
|
|
|
126
132
|
const busy = loading || done;
|
|
127
133
|
const off = !!disabled && !busy;
|
|
128
134
|
const flat = (variant === 'primary' || variant === 'danger') && !point;
|
|
129
|
-
const still = off && flat;
|
|
135
|
+
const still = off && (flat || steady);
|
|
130
136
|
const color = {
|
|
131
137
|
primary: t.colors.primaryForeground,
|
|
132
138
|
secondary: t.colors.title,
|
|
@@ -142,7 +148,7 @@ export function Button({
|
|
|
142
148
|
color: ink,
|
|
143
149
|
size: size === 'sm' ? t.iconSize.sm : t.iconSize.md,
|
|
144
150
|
};
|
|
145
|
-
const radius = s[size].borderRadius;
|
|
151
|
+
const radius = pill ? t.radius.full : s[size].borderRadius;
|
|
146
152
|
|
|
147
153
|
const [spin, setSpin] = useState(false);
|
|
148
154
|
useEffect(() => {
|
|
@@ -182,8 +188,8 @@ export function Button({
|
|
|
182
188
|
{...rest}
|
|
183
189
|
disabled={off || busy}
|
|
184
190
|
onDisabledPress={off ? shake : undefined}
|
|
185
|
-
live={live}
|
|
186
|
-
dim={!flat}
|
|
191
|
+
live={steady ? undefined : live}
|
|
192
|
+
dim={!flat && !steady}
|
|
187
193
|
nudge={nudge}
|
|
188
194
|
touchHeight={t.controlSize[size]}
|
|
189
195
|
accessibilityState={{ ...accessibilityState, busy: loading }}
|
|
@@ -192,8 +198,9 @@ export function Button({
|
|
|
192
198
|
s.base,
|
|
193
199
|
s[size],
|
|
194
200
|
s[variant],
|
|
195
|
-
still && s.off,
|
|
201
|
+
still && (steady ? s.soft : s.off),
|
|
196
202
|
point && s.bare,
|
|
203
|
+
pill && s.pill,
|
|
197
204
|
style,
|
|
198
205
|
]}
|
|
199
206
|
>
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '../../internal/pressable-base';
|
|
13
13
|
import { useTheme } from '../../theme/theme-provider';
|
|
14
14
|
import { makeStyles } from '../../utils/styles';
|
|
15
|
+
import { CreditCost } from '../credit/credit';
|
|
15
16
|
|
|
16
17
|
export type ChipSize = 'sm' | 'md' | 'lg';
|
|
17
18
|
|
|
@@ -21,6 +22,7 @@ export type ChipProps = Omit<PressableBaseProps, 'children' | 'touchHeight'> & {
|
|
|
21
22
|
size?: ChipSize;
|
|
22
23
|
leftIcon?: IconSlot;
|
|
23
24
|
count?: number;
|
|
25
|
+
cost?: number | null;
|
|
24
26
|
children: string;
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -68,6 +70,7 @@ export function Chip({
|
|
|
68
70
|
size = 'sm',
|
|
69
71
|
leftIcon,
|
|
70
72
|
count,
|
|
73
|
+
cost,
|
|
71
74
|
children,
|
|
72
75
|
style,
|
|
73
76
|
accessibilityState,
|
|
@@ -101,7 +104,11 @@ export function Chip({
|
|
|
101
104
|
{...rest}
|
|
102
105
|
accessibilityLabel={
|
|
103
106
|
accessibilityLabel ??
|
|
104
|
-
(count
|
|
107
|
+
(count !== undefined
|
|
108
|
+
? `${children}, ${count}건`
|
|
109
|
+
: cost != null
|
|
110
|
+
? `${children}, 크레딧 ${cost}`
|
|
111
|
+
: undefined)
|
|
105
112
|
}
|
|
106
113
|
accessibilityState={accessibilityState ?? { selected }}
|
|
107
114
|
touchHeight={HEIGHT[size]}
|
|
@@ -140,6 +147,7 @@ export function Chip({
|
|
|
140
147
|
{count}
|
|
141
148
|
</Animated.Text>
|
|
142
149
|
)}
|
|
150
|
+
{cost == null ? null : <CreditCost value={cost} />}
|
|
143
151
|
</PressableBase>
|
|
144
152
|
);
|
|
145
153
|
}
|
|
@@ -8,6 +8,7 @@ export type ChipGroupItem<T extends string> = {
|
|
|
8
8
|
value: T;
|
|
9
9
|
label: string;
|
|
10
10
|
count?: number;
|
|
11
|
+
cost?: number | null;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -78,6 +79,7 @@ export function ChipGroup<T extends string>(props: ChipGroupProps<T>) {
|
|
|
78
79
|
check={check}
|
|
79
80
|
size={size}
|
|
80
81
|
count={item.count}
|
|
82
|
+
cost={item.cost}
|
|
81
83
|
disabled={item.disabled || (full && !selected)}
|
|
82
84
|
accessibilityRole={props.multiple ? 'checkbox' : 'radio'}
|
|
83
85
|
accessibilityState={{ checked: selected }}
|
|
@@ -15,6 +15,11 @@ export type CreditPillProps = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const INVERSE = 0.78;
|
|
18
|
+
const GROUP = /\B(?=(\d{3})+(?!\d))/g;
|
|
19
|
+
|
|
20
|
+
export function creditText(value: number): string {
|
|
21
|
+
return String(value).replace(GROUP, ',');
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
const useStyles = makeStyles((t) => ({
|
|
20
25
|
cost: { flexDirection: 'row', alignItems: 'center', gap: t.space[1] },
|
|
@@ -53,7 +58,7 @@ export function CreditCost({ value, tone = 'muted' }: CreditCostProps) {
|
|
|
53
58
|
maxFontSizeMultiplier={t.maxFontScale}
|
|
54
59
|
style={[s.value, { color }]}
|
|
55
60
|
>
|
|
56
|
-
{
|
|
61
|
+
{creditText(value)}
|
|
57
62
|
</RNText>
|
|
58
63
|
</View>
|
|
59
64
|
);
|
|
@@ -64,7 +69,9 @@ export function CreditPill({ balance, accessibilityLabel }: CreditPillProps) {
|
|
|
64
69
|
return (
|
|
65
70
|
<View
|
|
66
71
|
accessible
|
|
67
|
-
accessibilityLabel={
|
|
72
|
+
accessibilityLabel={
|
|
73
|
+
accessibilityLabel ?? `크레딧 잔액 ${creditText(balance)}`
|
|
74
|
+
}
|
|
68
75
|
style={s.pill}
|
|
69
76
|
>
|
|
70
77
|
<CreditCost value={balance} />
|
|
@@ -17,6 +17,8 @@ export type SectionAnchor = {
|
|
|
17
17
|
y: number;
|
|
18
18
|
width: number;
|
|
19
19
|
height: number;
|
|
20
|
+
fill?: boolean;
|
|
21
|
+
pitch?: number;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export type DropdownMenuItem = {
|
|
@@ -80,15 +82,24 @@ export function DropdownMenu({
|
|
|
80
82
|
const screen = useWindowDimensions();
|
|
81
83
|
if (!open || !anchor) return null;
|
|
82
84
|
const height = menuHeight(t, items);
|
|
83
|
-
const
|
|
85
|
+
const pitch = anchor.pitch ?? 0;
|
|
86
|
+
const lean =
|
|
87
|
+
pitch > 0
|
|
88
|
+
? (Math.max(1, Math.round(height / pitch)) * pitch - height) / 2
|
|
89
|
+
: 0;
|
|
90
|
+
const below = anchor.y + anchor.height + lean;
|
|
91
|
+
const above = anchor.y - lean - height;
|
|
84
92
|
const top =
|
|
85
93
|
below + height > screen.height - t.space[4]
|
|
86
|
-
? Math.max(t.space[4],
|
|
94
|
+
? Math.max(t.space[4], above)
|
|
87
95
|
: below;
|
|
88
|
-
const right =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
const right = anchor.fill
|
|
97
|
+
? screen.width - (anchor.x + anchor.width)
|
|
98
|
+
: Math.max(
|
|
99
|
+
t.space[2],
|
|
100
|
+
screen.width - (anchor.x + anchor.width) + t.space[2]
|
|
101
|
+
);
|
|
102
|
+
const width = anchor.fill ? anchor.width : WIDTH;
|
|
92
103
|
const close = () => onOpenChange(false);
|
|
93
104
|
return (
|
|
94
105
|
<Modal
|
|
@@ -105,7 +116,7 @@ export function DropdownMenu({
|
|
|
105
116
|
accessibilityRole="button"
|
|
106
117
|
accessibilityLabel={closeLabel}
|
|
107
118
|
/>
|
|
108
|
-
<View accessibilityRole="menu" style={[s.menu, { top, right }]}>
|
|
119
|
+
<View accessibilityRole="menu" style={[s.menu, { top, right, width }]}>
|
|
109
120
|
{items.map((item, i) => {
|
|
110
121
|
const color =
|
|
111
122
|
item.tone === 'danger' ? t.colors.danger : t.colors.title;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
1
|
+
import { View, type TextStyle } from 'react-native';
|
|
2
2
|
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
3
3
|
import { PressableBase } from '../../internal/pressable-base';
|
|
4
4
|
import { useTheme } from '../../theme/theme-provider';
|
|
@@ -9,6 +9,7 @@ export type SegmentedControlItem<T extends string> = {
|
|
|
9
9
|
value: T;
|
|
10
10
|
label: string;
|
|
11
11
|
icon?: IconSlot;
|
|
12
|
+
weight?: TextStyle['fontWeight'];
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export type SegmentedControlProps<T extends string> = {
|
|
@@ -70,7 +71,14 @@ export function SegmentedControl<T extends string>({
|
|
|
70
71
|
size: t.iconSize.md,
|
|
71
72
|
})
|
|
72
73
|
) : (
|
|
73
|
-
<Text
|
|
74
|
+
<Text
|
|
75
|
+
numberOfLines={1}
|
|
76
|
+
style={[
|
|
77
|
+
s.label,
|
|
78
|
+
on && s.labelOn,
|
|
79
|
+
item.weight ? { fontWeight: item.weight } : null,
|
|
80
|
+
]}
|
|
81
|
+
>
|
|
74
82
|
{item.label}
|
|
75
83
|
</Text>
|
|
76
84
|
)}
|
|
@@ -22,6 +22,7 @@ export type SkeletonProps = {
|
|
|
22
22
|
width?: DimensionValue;
|
|
23
23
|
height?: DimensionValue;
|
|
24
24
|
radius?: number;
|
|
25
|
+
sheen?: boolean;
|
|
25
26
|
style?: StyleProp<ViewStyle>;
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -36,6 +37,7 @@ export function Skeleton({
|
|
|
36
37
|
width = '100%',
|
|
37
38
|
height = 16,
|
|
38
39
|
radius,
|
|
40
|
+
sheen = false,
|
|
39
41
|
style,
|
|
40
42
|
}: SkeletonProps) {
|
|
41
43
|
const t = useTheme();
|
|
@@ -57,8 +59,9 @@ export function Skeleton({
|
|
|
57
59
|
return () => cancelAnimation(sweep);
|
|
58
60
|
}, [reduced, span, sweep]);
|
|
59
61
|
|
|
62
|
+
const resting = sheen && reduced;
|
|
60
63
|
const band = useAnimatedStyle(() => ({
|
|
61
|
-
transform: [{ translateX: -span + span * 2 * sweep.value }],
|
|
64
|
+
transform: [{ translateX: resting ? 0 : -span + span * 2 * sweep.value }],
|
|
62
65
|
}));
|
|
63
66
|
|
|
64
67
|
const measure = (event: LayoutChangeEvent) =>
|
|
@@ -82,7 +85,7 @@ export function Skeleton({
|
|
|
82
85
|
style,
|
|
83
86
|
]}
|
|
84
87
|
>
|
|
85
|
-
{reduced || span === 0 ? null : (
|
|
88
|
+
{(reduced && !sheen) || span === 0 ? null : (
|
|
86
89
|
<Animated.View
|
|
87
90
|
style={[
|
|
88
91
|
styles.band,
|