@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
|
@@ -7,8 +7,14 @@ export {
|
|
|
7
7
|
type DetailCanvasProps,
|
|
8
8
|
type DetailCanvasResult,
|
|
9
9
|
} from './detail-canvas';
|
|
10
|
+
export type { DetailPart } from './focus-context';
|
|
10
11
|
export {
|
|
12
|
+
DETAIL_BACKGROUND_COLORS,
|
|
11
13
|
DETAIL_COLORS,
|
|
14
|
+
DETAIL_HEAD_SIZE,
|
|
15
|
+
DETAIL_TEXT_COLORS,
|
|
16
|
+
DETAIL_TITLE_SIZE,
|
|
17
|
+
detailIsTitle,
|
|
12
18
|
DETAIL_FONT_FAMILY,
|
|
13
19
|
DETAIL_LAYOUTS,
|
|
14
20
|
DETAIL_LIST_LAYOUTS,
|
|
@@ -36,4 +42,8 @@ export {
|
|
|
36
42
|
type StructureOption,
|
|
37
43
|
type StructurePickerProps,
|
|
38
44
|
} from './structure-picker';
|
|
39
|
-
export {
|
|
45
|
+
export {
|
|
46
|
+
DraftPreview,
|
|
47
|
+
draftPreviewFit,
|
|
48
|
+
type DraftPreviewProps,
|
|
49
|
+
} from './draft-preview';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const JOIN = '\u2060';
|
|
2
|
+
const STICK = '\u00A0';
|
|
3
|
+
const HANGUL =
|
|
4
|
+
/[\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF]/;
|
|
5
|
+
const SPACE = /\s/;
|
|
6
|
+
const DOT_BEFORE = / (?=[\u00B7\u2022\u318D](?:\s|$))/g;
|
|
7
|
+
const WORD_BEFORE_NUMBER = /([\uAC00-\uD7A3]) (?=[0-9])/g;
|
|
8
|
+
|
|
9
|
+
function joinWord(word: string): string {
|
|
10
|
+
const chars = Array.from(word);
|
|
11
|
+
let out = chars[0] ?? '';
|
|
12
|
+
for (let i = 1; i < chars.length; i += 1) {
|
|
13
|
+
const prev = chars[i - 1]!;
|
|
14
|
+
const next = chars[i]!;
|
|
15
|
+
out += HANGUL.test(prev) || HANGUL.test(next) ? JOIN + next : next;
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function keepWords(text: string): string {
|
|
21
|
+
if (!HANGUL.test(text)) return text;
|
|
22
|
+
const glued = text
|
|
23
|
+
.replace(DOT_BEFORE, STICK)
|
|
24
|
+
.replace(WORD_BEFORE_NUMBER, `$1${STICK}`);
|
|
25
|
+
let out = '';
|
|
26
|
+
let word = '';
|
|
27
|
+
for (const ch of glued) {
|
|
28
|
+
if (SPACE.test(ch) && ch !== STICK) {
|
|
29
|
+
out += joinWord(word) + ch;
|
|
30
|
+
word = '';
|
|
31
|
+
} else {
|
|
32
|
+
word += ch;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return out + joinWord(word);
|
|
36
|
+
}
|
|
@@ -10,9 +10,10 @@ export type LayoutPickerProps = {
|
|
|
10
10
|
onValueChange: (layout: DetailLayout) => void;
|
|
11
11
|
labels?: Partial<Record<DetailLayout, string>>;
|
|
12
12
|
items?: readonly DetailLayout[];
|
|
13
|
+
variant?: 'default' | 'soft';
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
const LABELS: Record<DetailLayout, string> = {
|
|
16
|
+
export const LABELS: Record<DetailLayout, string> = {
|
|
16
17
|
image_top: '사진 위 · 글 아래',
|
|
17
18
|
text_top: '글 위 · 사진 아래',
|
|
18
19
|
side: '나란히',
|
|
@@ -25,6 +26,10 @@ const LABELS: Record<DetailLayout, string> = {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const DIAGRAM_ROWS = [0, 1, 2];
|
|
29
|
+
const SOFT_TITLE = 6;
|
|
30
|
+
const SOFT_LINE = 4;
|
|
31
|
+
const SOFT_LABEL = 11;
|
|
32
|
+
const SOFT_LABEL_LINE = 1.35;
|
|
28
33
|
|
|
29
34
|
const useStyles = makeStyles((t) => ({
|
|
30
35
|
row: { gap: t.space[2], paddingHorizontal: t.space[3] },
|
|
@@ -93,8 +98,179 @@ const useStyles = makeStyles((t) => ({
|
|
|
93
98
|
padding: t.space[1],
|
|
94
99
|
gap: t.space[1],
|
|
95
100
|
},
|
|
101
|
+
softRow: { gap: t.space[2], paddingHorizontal: t.space[4] },
|
|
102
|
+
softItem: { width: t.space[16] + t.space[6], gap: t.space[2] },
|
|
103
|
+
softFrame: {
|
|
104
|
+
height: t.space[12] * 2,
|
|
105
|
+
overflow: 'hidden',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
gap: t.space[1],
|
|
109
|
+
paddingVertical: t.space[2],
|
|
110
|
+
paddingHorizontal: t.space[3],
|
|
111
|
+
borderRadius: t.radius.md,
|
|
112
|
+
backgroundColor: t.colors.background,
|
|
113
|
+
},
|
|
114
|
+
softLabel: {
|
|
115
|
+
textAlign: 'center',
|
|
116
|
+
color: t.colors.title,
|
|
117
|
+
fontSize: SOFT_LABEL,
|
|
118
|
+
lineHeight: SOFT_LABEL * SOFT_LABEL_LINE,
|
|
119
|
+
},
|
|
120
|
+
softTitle: {
|
|
121
|
+
width: '56%',
|
|
122
|
+
height: SOFT_TITLE,
|
|
123
|
+
borderRadius: t.radius.full,
|
|
124
|
+
backgroundColor: t.colors.input,
|
|
125
|
+
},
|
|
126
|
+
softLine: {
|
|
127
|
+
width: '70%',
|
|
128
|
+
height: SOFT_LINE,
|
|
129
|
+
borderRadius: t.radius.full,
|
|
130
|
+
backgroundColor: t.colors.border,
|
|
131
|
+
},
|
|
132
|
+
softPhoto: {
|
|
133
|
+
alignSelf: 'stretch',
|
|
134
|
+
flex: 1,
|
|
135
|
+
borderRadius: t.radius.sm,
|
|
136
|
+
backgroundColor: t.colors.border,
|
|
137
|
+
},
|
|
138
|
+
softFull: {
|
|
139
|
+
position: 'absolute',
|
|
140
|
+
top: 0,
|
|
141
|
+
right: 0,
|
|
142
|
+
bottom: 0,
|
|
143
|
+
left: 0,
|
|
144
|
+
backgroundColor: t.colors.border,
|
|
145
|
+
},
|
|
146
|
+
softSplit: {
|
|
147
|
+
alignSelf: 'stretch',
|
|
148
|
+
flex: 1,
|
|
149
|
+
flexDirection: 'row',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
gap: t.space[1],
|
|
152
|
+
},
|
|
153
|
+
softSide: { width: '44%', alignSelf: 'stretch' },
|
|
154
|
+
softSideText: { flex: 1, gap: t.space[1] },
|
|
155
|
+
softWide: { width: '100%' },
|
|
156
|
+
softCard: {
|
|
157
|
+
alignSelf: 'stretch',
|
|
158
|
+
flex: 1,
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
gap: t.space[1],
|
|
161
|
+
padding: t.space[1],
|
|
162
|
+
borderRadius: t.radius.sm,
|
|
163
|
+
backgroundColor: t.colors.surface,
|
|
164
|
+
},
|
|
165
|
+
softTableRow: {
|
|
166
|
+
alignSelf: 'stretch',
|
|
167
|
+
flexDirection: 'row',
|
|
168
|
+
gap: t.space[1],
|
|
169
|
+
paddingVertical: t.space[1],
|
|
170
|
+
borderTopWidth: 1,
|
|
171
|
+
borderColor: t.colors.border,
|
|
172
|
+
},
|
|
173
|
+
softDot: {
|
|
174
|
+
width: t.space[2],
|
|
175
|
+
height: t.space[2],
|
|
176
|
+
borderRadius: t.radius.full,
|
|
177
|
+
borderWidth: 1,
|
|
178
|
+
borderColor: t.colors.input,
|
|
179
|
+
},
|
|
96
180
|
}));
|
|
97
181
|
|
|
182
|
+
export function SoftDiagram({ layout }: { layout: DetailLayout }) {
|
|
183
|
+
const s = useStyles();
|
|
184
|
+
const title = <View style={s.softTitle} />;
|
|
185
|
+
const line = <View style={s.softLine} />;
|
|
186
|
+
const photo = <View style={s.softPhoto} />;
|
|
187
|
+
switch (layout) {
|
|
188
|
+
case 'image_top':
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
{photo}
|
|
192
|
+
{title}
|
|
193
|
+
{line}
|
|
194
|
+
</>
|
|
195
|
+
);
|
|
196
|
+
case 'text_top':
|
|
197
|
+
return (
|
|
198
|
+
<>
|
|
199
|
+
{title}
|
|
200
|
+
{line}
|
|
201
|
+
{photo}
|
|
202
|
+
</>
|
|
203
|
+
);
|
|
204
|
+
case 'side':
|
|
205
|
+
return (
|
|
206
|
+
<View style={s.softSplit}>
|
|
207
|
+
<View style={[s.softPhoto, s.softSide]} />
|
|
208
|
+
<View style={s.softSideText}>
|
|
209
|
+
<View style={[s.softTitle, s.softWide]} />
|
|
210
|
+
<View style={[s.softLine, s.softWide]} />
|
|
211
|
+
{line}
|
|
212
|
+
</View>
|
|
213
|
+
</View>
|
|
214
|
+
);
|
|
215
|
+
case 'image':
|
|
216
|
+
return <View style={s.softFull} />;
|
|
217
|
+
case 'two_images':
|
|
218
|
+
return (
|
|
219
|
+
<>
|
|
220
|
+
{title}
|
|
221
|
+
<View style={s.softSplit}>
|
|
222
|
+
{photo}
|
|
223
|
+
{photo}
|
|
224
|
+
</View>
|
|
225
|
+
</>
|
|
226
|
+
);
|
|
227
|
+
case 'card':
|
|
228
|
+
return (
|
|
229
|
+
<View style={s.softCard}>
|
|
230
|
+
{photo}
|
|
231
|
+
{title}
|
|
232
|
+
{line}
|
|
233
|
+
</View>
|
|
234
|
+
);
|
|
235
|
+
case 'text':
|
|
236
|
+
return (
|
|
237
|
+
<>
|
|
238
|
+
{title}
|
|
239
|
+
{line}
|
|
240
|
+
{line}
|
|
241
|
+
{line}
|
|
242
|
+
</>
|
|
243
|
+
);
|
|
244
|
+
case 'table':
|
|
245
|
+
return (
|
|
246
|
+
<>
|
|
247
|
+
{title}
|
|
248
|
+
{DIAGRAM_ROWS.map((row) => (
|
|
249
|
+
<View key={row} style={s.softTableRow}>
|
|
250
|
+
<View style={[s.softLine, s.cellShort]} />
|
|
251
|
+
<View style={[s.softLine, s.cellLong]} />
|
|
252
|
+
</View>
|
|
253
|
+
))}
|
|
254
|
+
</>
|
|
255
|
+
);
|
|
256
|
+
case 'steps':
|
|
257
|
+
return (
|
|
258
|
+
<>
|
|
259
|
+
{title}
|
|
260
|
+
<View style={s.steps}>
|
|
261
|
+
{DIAGRAM_ROWS.map((row) => (
|
|
262
|
+
<View key={row} style={s.step}>
|
|
263
|
+
<View style={s.softDot} />
|
|
264
|
+
</View>
|
|
265
|
+
))}
|
|
266
|
+
</View>
|
|
267
|
+
</>
|
|
268
|
+
);
|
|
269
|
+
default:
|
|
270
|
+
return photo;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
98
274
|
export function Diagram({ layout }: { layout: DetailLayout }) {
|
|
99
275
|
const t = useTheme();
|
|
100
276
|
const s = useStyles();
|
|
@@ -206,13 +382,15 @@ export function LayoutPicker({
|
|
|
206
382
|
onValueChange,
|
|
207
383
|
labels,
|
|
208
384
|
items = DETAIL_LAYOUTS,
|
|
385
|
+
variant = 'default',
|
|
209
386
|
}: LayoutPickerProps) {
|
|
210
387
|
const s = useStyles();
|
|
388
|
+
const soft = variant === 'soft';
|
|
211
389
|
return (
|
|
212
390
|
<ScrollView
|
|
213
391
|
horizontal
|
|
214
392
|
showsHorizontalScrollIndicator={false}
|
|
215
|
-
contentContainerStyle={s.row}
|
|
393
|
+
contentContainerStyle={soft ? s.softRow : s.row}
|
|
216
394
|
accessibilityRole="radiogroup"
|
|
217
395
|
>
|
|
218
396
|
{items.map((layout) => {
|
|
@@ -225,11 +403,15 @@ export function LayoutPicker({
|
|
|
225
403
|
accessibilityState={{ selected: on }}
|
|
226
404
|
accessibilityLabel={label}
|
|
227
405
|
onPress={() => onValueChange(layout)}
|
|
228
|
-
style={s.item}
|
|
406
|
+
style={soft ? s.softItem : s.item}
|
|
229
407
|
>
|
|
230
408
|
<View>
|
|
231
|
-
<View style={s.frame}>
|
|
232
|
-
|
|
409
|
+
<View style={soft ? s.softFrame : s.frame}>
|
|
410
|
+
{soft ? (
|
|
411
|
+
<SoftDiagram layout={layout} />
|
|
412
|
+
) : (
|
|
413
|
+
<Diagram layout={layout} />
|
|
414
|
+
)}
|
|
233
415
|
</View>
|
|
234
416
|
{on ? <View pointerEvents="none" style={s.on} /> : null}
|
|
235
417
|
</View>
|
|
@@ -238,7 +420,7 @@ export function LayoutPicker({
|
|
|
238
420
|
tone="muted"
|
|
239
421
|
weight={on ? 'semibold' : undefined}
|
|
240
422
|
numberOfLines={1}
|
|
241
|
-
style={on && s.onLabel}
|
|
423
|
+
style={[soft && s.softLabel, on && s.onLabel]}
|
|
242
424
|
>
|
|
243
425
|
{label}
|
|
244
426
|
</Text>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
type LayoutChangeEvent,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { Button, type ButtonProps } from '../../components/button/button';
|
|
9
|
+
import { Photo } from '../../components/photo/photo';
|
|
10
|
+
import { Text } from '../../components/text/text';
|
|
11
|
+
import { ImageGlyph, PlusGlyph } from '../../internal/glyphs';
|
|
12
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
13
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
14
|
+
import { withAlpha } from '../../utils/color';
|
|
15
|
+
import { makeStyles } from '../../utils/styles';
|
|
16
|
+
|
|
17
|
+
export type PhotoMosaicProps = {
|
|
18
|
+
images: readonly string[];
|
|
19
|
+
onPress?: () => void;
|
|
20
|
+
accessibilityLabel?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type FactRow = { label: string; value: string };
|
|
24
|
+
|
|
25
|
+
export type FactRowsProps = {
|
|
26
|
+
rows: readonly FactRow[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type AddThumbsProps = {
|
|
30
|
+
images: readonly string[];
|
|
31
|
+
onAdd: () => void;
|
|
32
|
+
addLabel: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type TintButtonProps = Omit<ButtonProps, 'variant' | 'point' | 'pill'>;
|
|
36
|
+
|
|
37
|
+
const SCRIM = 0.45;
|
|
38
|
+
|
|
39
|
+
const useStyles = makeStyles((t) => ({
|
|
40
|
+
mosaic: { flexDirection: 'row', gap: t.space[2] },
|
|
41
|
+
side: { gap: t.space[2] },
|
|
42
|
+
more: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
top: 0,
|
|
45
|
+
right: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
borderRadius: t.radius.md,
|
|
51
|
+
backgroundColor: withAlpha(t.colors.foreground, SCRIM),
|
|
52
|
+
},
|
|
53
|
+
moreLabel: { color: t.colors.surface },
|
|
54
|
+
facts: { borderTopWidth: 1, borderTopColor: t.colors.line },
|
|
55
|
+
fact: {
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
gap: t.space[4],
|
|
58
|
+
paddingVertical: t.space[3],
|
|
59
|
+
borderBottomWidth: 1,
|
|
60
|
+
borderBottomColor: t.colors.line,
|
|
61
|
+
},
|
|
62
|
+
factLabel: { width: t.space[16] },
|
|
63
|
+
factValue: { flex: 1 },
|
|
64
|
+
thumbs: { flexDirection: 'row', flexWrap: 'wrap', gap: t.space[2] },
|
|
65
|
+
add: {
|
|
66
|
+
width: t.space[16],
|
|
67
|
+
height: t.space[16],
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
borderRadius: t.radius.md,
|
|
71
|
+
borderWidth: 1,
|
|
72
|
+
borderStyle: 'dashed',
|
|
73
|
+
borderColor: t.colors.input,
|
|
74
|
+
},
|
|
75
|
+
thumb: { width: t.space[16] },
|
|
76
|
+
tint: {
|
|
77
|
+
paddingHorizontal: t.space[4],
|
|
78
|
+
backgroundColor: t.colors.primaryTint,
|
|
79
|
+
},
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
function Cell({ uri, style }: { uri?: string; style?: StyleProp<ViewStyle> }) {
|
|
83
|
+
const t = useTheme();
|
|
84
|
+
return (
|
|
85
|
+
<Photo
|
|
86
|
+
source={{ uri: uri ?? '' }}
|
|
87
|
+
radius={t.radius.md}
|
|
88
|
+
fallback={
|
|
89
|
+
<ImageGlyph color={t.colors.mutedForeground} size={t.iconSize.md} />
|
|
90
|
+
}
|
|
91
|
+
style={style}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function PhotoMosaic({
|
|
97
|
+
images,
|
|
98
|
+
onPress,
|
|
99
|
+
accessibilityLabel = '사진',
|
|
100
|
+
}: PhotoMosaicProps) {
|
|
101
|
+
const t = useTheme();
|
|
102
|
+
const s = useStyles();
|
|
103
|
+
const [width, setWidth] = useState(0);
|
|
104
|
+
const gap = t.space[2];
|
|
105
|
+
const small = Math.max(0, (width - gap * 2) / 3);
|
|
106
|
+
const big = small * 2 + gap;
|
|
107
|
+
const extra = images.length - 3;
|
|
108
|
+
return (
|
|
109
|
+
<View
|
|
110
|
+
onLayout={(event: LayoutChangeEvent) =>
|
|
111
|
+
setWidth(event.nativeEvent.layout.width)
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
{width > 0 ? (
|
|
115
|
+
<PressableBase
|
|
116
|
+
accessibilityRole="button"
|
|
117
|
+
accessibilityLabel={accessibilityLabel}
|
|
118
|
+
onPress={onPress}
|
|
119
|
+
feedback="small"
|
|
120
|
+
style={s.mosaic}
|
|
121
|
+
>
|
|
122
|
+
<Cell uri={images[0]} style={{ width: big }} />
|
|
123
|
+
<View style={[s.side, { width: small }]}>
|
|
124
|
+
<Cell uri={images[1]} />
|
|
125
|
+
<View>
|
|
126
|
+
<Cell uri={images[2]} />
|
|
127
|
+
{extra > 0 ? (
|
|
128
|
+
<View pointerEvents="none" style={s.more}>
|
|
129
|
+
<Text variant="label" weight="semibold" style={s.moreLabel}>
|
|
130
|
+
{`+${extra}`}
|
|
131
|
+
</Text>
|
|
132
|
+
</View>
|
|
133
|
+
) : null}
|
|
134
|
+
</View>
|
|
135
|
+
</View>
|
|
136
|
+
</PressableBase>
|
|
137
|
+
) : null}
|
|
138
|
+
</View>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function FactRows({ rows }: FactRowsProps) {
|
|
143
|
+
const s = useStyles();
|
|
144
|
+
if (!rows.length) return null;
|
|
145
|
+
return (
|
|
146
|
+
<View style={s.facts}>
|
|
147
|
+
{rows.map((row, index) => (
|
|
148
|
+
<View key={`${row.label}-${index}`} style={s.fact}>
|
|
149
|
+
<Text
|
|
150
|
+
variant="label"
|
|
151
|
+
tone="muted"
|
|
152
|
+
numberOfLines={1}
|
|
153
|
+
style={s.factLabel}
|
|
154
|
+
>
|
|
155
|
+
{row.label}
|
|
156
|
+
</Text>
|
|
157
|
+
<Text variant="label" numberOfLines={2} style={s.factValue}>
|
|
158
|
+
{row.value}
|
|
159
|
+
</Text>
|
|
160
|
+
</View>
|
|
161
|
+
))}
|
|
162
|
+
</View>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function AddThumbs({ images, onAdd, addLabel }: AddThumbsProps) {
|
|
167
|
+
const t = useTheme();
|
|
168
|
+
const s = useStyles();
|
|
169
|
+
return (
|
|
170
|
+
<View style={s.thumbs}>
|
|
171
|
+
<PressableBase
|
|
172
|
+
accessibilityRole="button"
|
|
173
|
+
accessibilityLabel={addLabel}
|
|
174
|
+
onPress={onAdd}
|
|
175
|
+
feedback="small"
|
|
176
|
+
style={s.add}
|
|
177
|
+
>
|
|
178
|
+
<PlusGlyph color={t.colors.mutedForeground} size={t.iconSize.md} />
|
|
179
|
+
</PressableBase>
|
|
180
|
+
{images.map((uri, index) => (
|
|
181
|
+
<PressableBase
|
|
182
|
+
key={`${uri}-${index}`}
|
|
183
|
+
accessibilityRole="imagebutton"
|
|
184
|
+
accessibilityLabel={`${addLabel} ${index + 1}`}
|
|
185
|
+
onPress={onAdd}
|
|
186
|
+
feedback="small"
|
|
187
|
+
>
|
|
188
|
+
<Photo source={{ uri }} radius={t.radius.md} style={s.thumb} />
|
|
189
|
+
</PressableBase>
|
|
190
|
+
))}
|
|
191
|
+
</View>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function TintButton({ style, ...rest }: TintButtonProps) {
|
|
196
|
+
const s = useStyles();
|
|
197
|
+
return <Button {...rest} variant="secondary" point style={[s.tint, style]} />;
|
|
198
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ScrollView, Text as RNText, type ViewStyle } from 'react-native';
|
|
2
|
+
import { haptic } from '../../internal/haptics';
|
|
3
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
4
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
5
|
+
import { makeStyles } from '../../utils/styles';
|
|
6
|
+
|
|
7
|
+
export type ActionChipsProps<T extends string> = {
|
|
8
|
+
items: readonly { value: T; label: string }[];
|
|
9
|
+
onPick: (value: T) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
inset?: ViewStyle;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles((t) => ({
|
|
15
|
+
scroll: { flexGrow: 0 },
|
|
16
|
+
track: { flexDirection: 'row', alignItems: 'center', gap: t.space[2] },
|
|
17
|
+
chip: {
|
|
18
|
+
height: t.space[8] + t.space[1],
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
paddingHorizontal: t.space[3],
|
|
21
|
+
borderRadius: t.radius.md,
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: t.colors.border,
|
|
24
|
+
backgroundColor: t.colors.surface,
|
|
25
|
+
},
|
|
26
|
+
label: {
|
|
27
|
+
fontFamily: t.fontFamily,
|
|
28
|
+
fontSize: t.typography.eyebrow.fontSize,
|
|
29
|
+
lineHeight: t.typography.eyebrow.lineHeight,
|
|
30
|
+
fontWeight: t.typography.body.fontWeight,
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export function ActionChips<T extends string>({
|
|
35
|
+
items,
|
|
36
|
+
onPick,
|
|
37
|
+
disabled,
|
|
38
|
+
inset,
|
|
39
|
+
}: ActionChipsProps<T>) {
|
|
40
|
+
const t = useTheme();
|
|
41
|
+
const s = useStyles();
|
|
42
|
+
const color = disabled ? t.colors.disabledForeground : t.colors.title;
|
|
43
|
+
return (
|
|
44
|
+
<ScrollView
|
|
45
|
+
horizontal
|
|
46
|
+
showsHorizontalScrollIndicator={false}
|
|
47
|
+
keyboardShouldPersistTaps="handled"
|
|
48
|
+
style={s.scroll}
|
|
49
|
+
contentContainerStyle={[s.track, inset]}
|
|
50
|
+
>
|
|
51
|
+
{items.map((item) => (
|
|
52
|
+
<PressableBase
|
|
53
|
+
key={item.value}
|
|
54
|
+
onPress={() => {
|
|
55
|
+
haptic('select');
|
|
56
|
+
onPick(item.value);
|
|
57
|
+
}}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
disabledStyle={{}}
|
|
60
|
+
feedback="small"
|
|
61
|
+
accessibilityRole="button"
|
|
62
|
+
accessibilityLabel={item.label}
|
|
63
|
+
touchHeight={t.space[8] + t.space[1]}
|
|
64
|
+
style={s.chip}
|
|
65
|
+
>
|
|
66
|
+
<RNText
|
|
67
|
+
numberOfLines={1}
|
|
68
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
69
|
+
style={[s.label, { color }]}
|
|
70
|
+
>
|
|
71
|
+
{item.label}
|
|
72
|
+
</RNText>
|
|
73
|
+
</PressableBase>
|
|
74
|
+
))}
|
|
75
|
+
</ScrollView>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -31,7 +31,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
31
31
|
height: t.space[16] + t.space[2],
|
|
32
32
|
alignItems: 'center',
|
|
33
33
|
justifyContent: 'center',
|
|
34
|
-
borderRadius: t.radius.
|
|
34
|
+
borderRadius: t.radius.md * 2,
|
|
35
35
|
backgroundColor: t.colors.background,
|
|
36
36
|
},
|
|
37
37
|
cost: { position: 'absolute', top: t.space[2], right: t.space[2] },
|
|
@@ -39,7 +39,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
39
39
|
fontFamily: t.fontFamily,
|
|
40
40
|
fontSize: t.typography.eyebrow.fontSize,
|
|
41
41
|
lineHeight: t.typography.eyebrow.lineHeight,
|
|
42
|
-
fontWeight: t.typography.
|
|
42
|
+
fontWeight: t.typography.body.fontWeight,
|
|
43
43
|
color: t.colors.title,
|
|
44
44
|
},
|
|
45
45
|
}));
|
|
@@ -66,7 +66,7 @@ export function AdjustTiles<T extends string>({
|
|
|
66
66
|
<View style={s.box}>
|
|
67
67
|
{renderIcon(item.icon, {
|
|
68
68
|
color: t.colors.title,
|
|
69
|
-
size: t.
|
|
69
|
+
size: t.space[6],
|
|
70
70
|
})}
|
|
71
71
|
{cost != null ? (
|
|
72
72
|
<View pointerEvents="none" style={s.cost}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
1
|
+
import { Fragment, useState } from 'react';
|
|
2
2
|
import { FlatList, Image, View, type ViewStyle } from 'react-native';
|
|
3
3
|
import { Skeleton } from '../../components/skeleton/skeleton';
|
|
4
4
|
import { CheckGlyph, PlusGlyph, SparklesGlyph } from '../../internal/glyphs';
|
|
@@ -6,6 +6,7 @@ import { PressableBase } from '../../internal/pressable-base';
|
|
|
6
6
|
import { useTheme } from '../../theme/theme-provider';
|
|
7
7
|
import { withAlpha } from '../../utils/color';
|
|
8
8
|
import { makeStyles } from '../../utils/styles';
|
|
9
|
+
import { EdgeFade, hasMore } from './edge-fade';
|
|
9
10
|
|
|
10
11
|
export type AssetGridItem = {
|
|
11
12
|
key: string;
|
|
@@ -112,6 +113,10 @@ export function AssetGrid({
|
|
|
112
113
|
const t = useTheme();
|
|
113
114
|
const s = useStyles();
|
|
114
115
|
const picking = !!onValueChange;
|
|
116
|
+
const [view, setView] = useState(0);
|
|
117
|
+
const [content, setContent] = useState(0);
|
|
118
|
+
const [offset, setOffset] = useState(0);
|
|
119
|
+
const more = hasMore(offset, view, content);
|
|
115
120
|
|
|
116
121
|
const cells: Cell[] = [
|
|
117
122
|
...(onAdd ? [{ kind: 'add', key: '__add' } as const] : []),
|
|
@@ -139,7 +144,7 @@ export function AssetGrid({
|
|
|
139
144
|
if (item.pending) {
|
|
140
145
|
return (
|
|
141
146
|
<View style={[s.cell, slot]}>
|
|
142
|
-
<Skeleton width="100%" height="100%" radius={t.radius.md} />
|
|
147
|
+
<Skeleton width="100%" height="100%" radius={t.radius.md} sheen />
|
|
143
148
|
</View>
|
|
144
149
|
);
|
|
145
150
|
}
|
|
@@ -220,19 +225,28 @@ export function AssetGrid({
|
|
|
220
225
|
) : undefined;
|
|
221
226
|
|
|
222
227
|
return (
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
<View style={s.root}>
|
|
229
|
+
<FlatList
|
|
230
|
+
data={cells}
|
|
231
|
+
keyExtractor={(cell) => cell.key}
|
|
232
|
+
numColumns={COLUMNS}
|
|
233
|
+
renderItem={({ item }) => render(item)}
|
|
234
|
+
accessibilityRole={picking ? 'radiogroup' : undefined}
|
|
235
|
+
style={s.root}
|
|
236
|
+
contentContainerStyle={s.list}
|
|
237
|
+
columnWrapperStyle={s.line}
|
|
238
|
+
showsVerticalScrollIndicator={false}
|
|
239
|
+
onEndReached={onEndReached}
|
|
240
|
+
onEndReachedThreshold={0.5}
|
|
241
|
+
ListFooterComponent={footer}
|
|
242
|
+
scrollEventThrottle={16}
|
|
243
|
+
onLayout={(e) => setView(e.nativeEvent.layout.height)}
|
|
244
|
+
onContentSizeChange={(_, h) => setContent(h)}
|
|
245
|
+
onScroll={(e) => setOffset(e.nativeEvent.contentOffset.y)}
|
|
246
|
+
/>
|
|
247
|
+
{more ? (
|
|
248
|
+
<EdgeFade side="bottom" size={t.space[12]} color={t.colors.surface} />
|
|
249
|
+
) : null}
|
|
250
|
+
</View>
|
|
237
251
|
);
|
|
238
252
|
}
|