@ezpg/app-ui 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/module/blocks/action-grid/action-grid.js +1 -1
  3. package/lib/module/blocks/action-grid/action-grid.js.map +1 -1
  4. package/lib/module/blocks/bulk-ship-list/bulk-ship-list.js +33 -149
  5. package/lib/module/blocks/bulk-ship-list/bulk-ship-list.js.map +1 -1
  6. package/lib/module/blocks/index.js +4 -0
  7. package/lib/module/blocks/index.js.map +1 -1
  8. package/lib/module/blocks/photo-grid/index.js +4 -0
  9. package/lib/module/blocks/photo-grid/index.js.map +1 -0
  10. package/lib/module/blocks/photo-grid/photo-grid.js +99 -0
  11. package/lib/module/blocks/photo-grid/photo-grid.js.map +1 -0
  12. package/lib/module/blocks/quick-actions/quick-actions.js +1 -1
  13. package/lib/module/blocks/quick-actions/quick-actions.js.map +1 -1
  14. package/lib/module/blocks/request-card/index.js +4 -0
  15. package/lib/module/blocks/request-card/index.js.map +1 -0
  16. package/lib/module/blocks/request-card/request-card.js +96 -0
  17. package/lib/module/blocks/request-card/request-card.js.map +1 -0
  18. package/lib/module/blocks/scan-modal/index.js +4 -0
  19. package/lib/module/blocks/scan-modal/index.js.map +1 -0
  20. package/lib/module/blocks/scan-modal/scan-modal.js +67 -0
  21. package/lib/module/blocks/scan-modal/scan-modal.js.map +1 -0
  22. package/lib/module/blocks/summary-cards/index.js +4 -0
  23. package/lib/module/blocks/summary-cards/index.js.map +1 -0
  24. package/lib/module/blocks/summary-cards/summary-cards.js +468 -0
  25. package/lib/module/blocks/summary-cards/summary-cards.js.map +1 -0
  26. package/lib/module/components/dialog/dialog.js +23 -5
  27. package/lib/module/components/dialog/dialog.js.map +1 -1
  28. package/lib/module/components/field/field.js +12 -1
  29. package/lib/module/components/field/field.js.map +1 -1
  30. package/lib/module/components/list-row/list-row.js +45 -2
  31. package/lib/module/components/list-row/list-row.js.map +1 -1
  32. package/lib/module/components/progress-bar/progress-bar.js +2 -1
  33. package/lib/module/components/progress-bar/progress-bar.js.map +1 -1
  34. package/lib/module/components/status-badge/status-badge.js +1 -0
  35. package/lib/module/components/status-badge/status-badge.js.map +1 -1
  36. package/lib/module/components/stepper/index.js +4 -0
  37. package/lib/module/components/stepper/index.js.map +1 -0
  38. package/lib/module/components/stepper/stepper.js +93 -0
  39. package/lib/module/components/stepper/stepper.js.map +1 -0
  40. package/lib/module/index.js +2 -1
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/internal/glyphs.js +44 -0
  43. package/lib/module/internal/glyphs.js.map +1 -1
  44. package/lib/module/templates/index.js +2 -0
  45. package/lib/module/templates/index.js.map +1 -1
  46. package/lib/module/templates/parts.js +11 -0
  47. package/lib/module/templates/parts.js.map +1 -1
  48. package/lib/module/templates/preview-template.js +77 -0
  49. package/lib/module/templates/preview-template.js.map +1 -0
  50. package/lib/module/templates/selection-template.js +24 -0
  51. package/lib/module/templates/selection-template.js.map +1 -0
  52. package/lib/typescript/src/blocks/bulk-ship-list/bulk-ship-list.d.ts +0 -1
  53. package/lib/typescript/src/blocks/bulk-ship-list/bulk-ship-list.d.ts.map +1 -1
  54. package/lib/typescript/src/blocks/index.d.ts +4 -0
  55. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  56. package/lib/typescript/src/blocks/photo-grid/index.d.ts +2 -0
  57. package/lib/typescript/src/blocks/photo-grid/index.d.ts.map +1 -0
  58. package/lib/typescript/src/blocks/photo-grid/photo-grid.d.ts +14 -0
  59. package/lib/typescript/src/blocks/photo-grid/photo-grid.d.ts.map +1 -0
  60. package/lib/typescript/src/blocks/request-card/index.d.ts +2 -0
  61. package/lib/typescript/src/blocks/request-card/index.d.ts.map +1 -0
  62. package/lib/typescript/src/blocks/request-card/request-card.d.ts +15 -0
  63. package/lib/typescript/src/blocks/request-card/request-card.d.ts.map +1 -0
  64. package/lib/typescript/src/blocks/scan-modal/index.d.ts +2 -0
  65. package/lib/typescript/src/blocks/scan-modal/index.d.ts.map +1 -0
  66. package/lib/typescript/src/blocks/scan-modal/scan-modal.d.ts +14 -0
  67. package/lib/typescript/src/blocks/scan-modal/scan-modal.d.ts.map +1 -0
  68. package/lib/typescript/src/blocks/summary-cards/index.d.ts +2 -0
  69. package/lib/typescript/src/blocks/summary-cards/index.d.ts.map +1 -0
  70. package/lib/typescript/src/blocks/summary-cards/summary-cards.d.ts +93 -0
  71. package/lib/typescript/src/blocks/summary-cards/summary-cards.d.ts.map +1 -0
  72. package/lib/typescript/src/components/dialog/dialog.d.ts +2 -1
  73. package/lib/typescript/src/components/dialog/dialog.d.ts.map +1 -1
  74. package/lib/typescript/src/components/field/field.d.ts +3 -1
  75. package/lib/typescript/src/components/field/field.d.ts.map +1 -1
  76. package/lib/typescript/src/components/list-row/list-row.d.ts +4 -1
  77. package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
  78. package/lib/typescript/src/components/progress-bar/progress-bar.d.ts +2 -1
  79. package/lib/typescript/src/components/progress-bar/progress-bar.d.ts.map +1 -1
  80. package/lib/typescript/src/components/status-badge/status-badge.d.ts +1 -1
  81. package/lib/typescript/src/components/status-badge/status-badge.d.ts.map +1 -1
  82. package/lib/typescript/src/components/stepper/index.d.ts +2 -0
  83. package/lib/typescript/src/components/stepper/index.d.ts.map +1 -0
  84. package/lib/typescript/src/components/stepper/stepper.d.ts +13 -0
  85. package/lib/typescript/src/components/stepper/stepper.d.ts.map +1 -0
  86. package/lib/typescript/src/index.d.ts +2 -1
  87. package/lib/typescript/src/index.d.ts.map +1 -1
  88. package/lib/typescript/src/internal/glyphs.d.ts +1 -0
  89. package/lib/typescript/src/internal/glyphs.d.ts.map +1 -1
  90. package/lib/typescript/src/templates/index.d.ts +4 -0
  91. package/lib/typescript/src/templates/index.d.ts.map +1 -1
  92. package/lib/typescript/src/templates/parts.d.ts +2 -1
  93. package/lib/typescript/src/templates/parts.d.ts.map +1 -1
  94. package/lib/typescript/src/templates/preview-template.d.ts +18 -0
  95. package/lib/typescript/src/templates/preview-template.d.ts.map +1 -0
  96. package/lib/typescript/src/templates/selection-template.d.ts +7 -0
  97. package/lib/typescript/src/templates/selection-template.d.ts.map +1 -0
  98. package/package.json +1 -1
  99. package/src/blocks/action-grid/action-grid.tsx +1 -1
  100. package/src/blocks/bulk-ship-list/bulk-ship-list.tsx +30 -126
  101. package/src/blocks/index.tsx +4 -0
  102. package/src/blocks/photo-grid/index.ts +5 -0
  103. package/src/blocks/photo-grid/photo-grid.tsx +96 -0
  104. package/src/blocks/quick-actions/quick-actions.tsx +1 -1
  105. package/src/blocks/request-card/index.ts +1 -0
  106. package/src/blocks/request-card/request-card.tsx +94 -0
  107. package/src/blocks/scan-modal/index.ts +1 -0
  108. package/src/blocks/scan-modal/scan-modal.tsx +61 -0
  109. package/src/blocks/summary-cards/index.ts +1 -0
  110. package/src/blocks/summary-cards/summary-cards.tsx +484 -0
  111. package/src/components/dialog/dialog.tsx +27 -7
  112. package/src/components/field/field.tsx +14 -1
  113. package/src/components/list-row/list-row.tsx +53 -2
  114. package/src/components/progress-bar/progress-bar.tsx +23 -14
  115. package/src/components/status-badge/status-badge.tsx +2 -1
  116. package/src/components/stepper/index.ts +1 -0
  117. package/src/components/stepper/stepper.tsx +85 -0
  118. package/src/index.tsx +2 -0
  119. package/src/internal/glyphs.tsx +37 -0
  120. package/src/templates/index.ts +7 -0
  121. package/src/templates/parts.tsx +9 -0
  122. package/src/templates/preview-template.tsx +88 -0
  123. package/src/templates/selection-template.tsx +22 -0
@@ -6,6 +6,7 @@ export type ProgressBarProps = {
6
6
  done: number;
7
7
  total: number;
8
8
  label?: string;
9
+ plain?: boolean;
9
10
  style?: StyleProp<ViewStyle>;
10
11
  };
11
12
 
@@ -44,7 +45,13 @@ const useStyles = makeStyles((t) => ({
44
45
  },
45
46
  }));
46
47
 
47
- export function ProgressBar({ done, total, label, style }: ProgressBarProps) {
48
+ export function ProgressBar({
49
+ done,
50
+ total,
51
+ label,
52
+ plain = false,
53
+ style,
54
+ }: ProgressBarProps) {
48
55
  const t = useTheme();
49
56
  const s = useStyles();
50
57
  const max = Math.max(0, total);
@@ -58,20 +65,22 @@ export function ProgressBar({ done, total, label, style }: ProgressBarProps) {
58
65
  accessibilityValue={{ min: 0, max, now }}
59
66
  style={[s.root, style]}
60
67
  >
61
- <View style={s.head}>
62
- {label ? (
63
- <Text
64
- numberOfLines={2}
65
- maxFontSizeMultiplier={t.maxFontScale}
66
- style={s.label}
67
- >
68
- {label}
68
+ {plain ? null : (
69
+ <View style={s.head}>
70
+ {label ? (
71
+ <Text
72
+ numberOfLines={2}
73
+ maxFontSizeMultiplier={t.maxFontScale}
74
+ style={s.label}
75
+ >
76
+ {label}
77
+ </Text>
78
+ ) : null}
79
+ <Text maxFontSizeMultiplier={t.maxFontScale} style={s.count}>
80
+ <Text style={s.strong}>{now}</Text>/{max}
69
81
  </Text>
70
- ) : null}
71
- <Text maxFontSizeMultiplier={t.maxFontScale} style={s.count}>
72
- <Text style={s.strong}>{now}</Text>/{max}
73
- </Text>
74
- </View>
82
+ </View>
83
+ )}
75
84
  <View style={s.track}>
76
85
  <View style={[s.fill, { width: `${ratio * 100}%` }]} />
77
86
  </View>
@@ -3,7 +3,7 @@ import type { Tone } from '../../theme/contract';
3
3
  import { useTheme } from '../../theme/theme-provider';
4
4
  import { makeStyles } from '../../utils/styles';
5
5
 
6
- export type StatusBadgeTone = Exclude<Tone, 'primary'>;
6
+ export type StatusBadgeTone = Exclude<Tone, 'primary'> | 'point';
7
7
 
8
8
  export type StatusBadgeProps = {
9
9
  tone?: StatusBadgeTone;
@@ -34,6 +34,7 @@ export function StatusBadge({
34
34
  const s = useStyles();
35
35
  const [bg, fg] = {
36
36
  neutral: [t.colors.muted, t.colors.mutedForeground],
37
+ point: [t.colors.primaryTint, t.colors.point],
37
38
  info: [t.colors.info, t.colors.infoForeground],
38
39
  success: [t.colors.success, t.colors.successForeground],
39
40
  warning: [t.colors.warning, t.colors.warningForeground],
@@ -0,0 +1 @@
1
+ export * from './stepper';
@@ -0,0 +1,85 @@
1
+ import { View, type StyleProp, type ViewStyle } from 'react-native';
2
+ import { PressableBase } from '../../internal/pressable-base';
3
+ import { makeStyles } from '../../utils/styles';
4
+ import { Text } from '../text/text';
5
+
6
+ export type StepperProps = {
7
+ label: string;
8
+ value: number;
9
+ onValueChange: (value: number) => void;
10
+ min?: number;
11
+ max?: number;
12
+ step?: number;
13
+ suffix?: string;
14
+ style?: StyleProp<ViewStyle>;
15
+ };
16
+
17
+ const SIZE = 36;
18
+
19
+ const useStyles = makeStyles((t) => ({
20
+ root: {
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ justifyContent: 'space-between',
24
+ gap: t.space[3],
25
+ },
26
+ controls: { flexDirection: 'row', alignItems: 'center', gap: t.space[3] },
27
+ button: {
28
+ width: SIZE,
29
+ height: SIZE,
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ borderWidth: 1,
33
+ borderRadius: t.radius.md,
34
+ borderColor: t.colors.input,
35
+ backgroundColor: t.colors.surface,
36
+ },
37
+ pressed: { backgroundColor: t.colors.muted },
38
+ off: { opacity: t.opacity.disabled },
39
+ value: { minWidth: SIZE, textAlign: 'center' },
40
+ }));
41
+
42
+ export function Stepper({
43
+ label,
44
+ value,
45
+ onValueChange,
46
+ min = 0,
47
+ max = 999,
48
+ step = 1,
49
+ suffix = '',
50
+ style,
51
+ }: StepperProps) {
52
+ const s = useStyles();
53
+ const down = value - step >= min;
54
+ const up = value + step <= max;
55
+ return (
56
+ <View style={[s.root, style]}>
57
+ <Text variant="bodyLg">{label}</Text>
58
+ <View style={s.controls}>
59
+ <PressableBase
60
+ accessibilityRole="button"
61
+ accessibilityLabel={`${label} 줄이기`}
62
+ disabled={!down}
63
+ onPress={() => onValueChange(value - step)}
64
+ pressedStyle={s.pressed}
65
+ style={[s.button, !down && s.off]}
66
+ >
67
+ <Text variant="bodyLg">−</Text>
68
+ </PressableBase>
69
+ <Text variant="bodyLg" weight="bold" style={s.value}>
70
+ {`${value}${suffix}`}
71
+ </Text>
72
+ <PressableBase
73
+ accessibilityRole="button"
74
+ accessibilityLabel={`${label} 늘리기`}
75
+ disabled={!up}
76
+ onPress={() => onValueChange(value + step)}
77
+ pressedStyle={s.pressed}
78
+ style={[s.button, !up && s.off]}
79
+ >
80
+ <Text variant="bodyLg">+</Text>
81
+ </PressableBase>
82
+ </View>
83
+ </View>
84
+ );
85
+ }
package/src/index.tsx CHANGED
@@ -36,6 +36,7 @@ export {
36
36
  PlusGlyph,
37
37
  ReceiptGlyph,
38
38
  ReturnGlyph,
39
+ ScanGlyph,
39
40
  SearchGlyph,
40
41
  ShareGlyph,
41
42
  SparklesGlyph,
@@ -67,6 +68,7 @@ export * from './components/progress-bar';
67
68
  export * from './components/search-field';
68
69
  export * from './components/status-steps';
69
70
  export * from './components/step-slider';
71
+ export * from './components/stepper';
70
72
  export * from './components/progress-circle';
71
73
  export * from './components/result-mark';
72
74
  export * from './components/page-header';
@@ -31,6 +31,42 @@ import {
31
31
  } from './tab-icons';
32
32
  import type { IconRenderProps } from './icon';
33
33
 
34
+ export function ScanGlyph({ color, size }: IconRenderProps) {
35
+ const stroke = Math.max(1.5, size / 12);
36
+ const arm = size * 0.3;
37
+ const corner = (v: 'top' | 'bottom', h: 'left' | 'right') => ({
38
+ position: 'absolute' as const,
39
+ width: arm,
40
+ height: arm,
41
+ borderColor: color,
42
+ [v]: 0,
43
+ [h]: 0,
44
+ [v === 'top' ? 'borderTopWidth' : 'borderBottomWidth']: stroke,
45
+ [h === 'left' ? 'borderLeftWidth' : 'borderRightWidth']: stroke,
46
+ });
47
+ return (
48
+ <View style={{ width: size, height: size }}>
49
+ <View style={corner('top', 'left')} />
50
+ <View style={corner('top', 'right')} />
51
+ <View style={corner('bottom', 'left')} />
52
+ <View style={corner('bottom', 'right')} />
53
+ <View
54
+ style={[
55
+ styles.scanLine,
56
+ {
57
+ left: size * 0.12,
58
+ right: size * 0.12,
59
+ top: (size - stroke) / 2,
60
+ height: stroke,
61
+ borderRadius: stroke,
62
+ backgroundColor: color,
63
+ },
64
+ ]}
65
+ />
66
+ </View>
67
+ );
68
+ }
69
+
34
70
  export function SearchGlyph({ color, size }: IconRenderProps) {
35
71
  const ring = size * 0.62;
36
72
  const stroke = Math.max(1.5, size / 10);
@@ -102,6 +138,7 @@ export function CheckGlyph({ color, size }: IconRenderProps) {
102
138
  }
103
139
 
104
140
  const styles = StyleSheet.create({
141
+ scanLine: { position: 'absolute' },
105
142
  absolute: { position: 'absolute' },
106
143
  center: { alignItems: 'center', justifyContent: 'center' },
107
144
  });
@@ -32,3 +32,10 @@ export { ListSection } from './parts';
32
32
  export { Group } from './group';
33
33
  export type { GroupProps } from './group';
34
34
  export type { NoticeReason, TemplateAction, TemplateNotice } from './parts';
35
+ export { SelectionTemplate } from './selection-template';
36
+ export type { SelectionTemplateProps } from './selection-template';
37
+ export { PreviewTemplate } from './preview-template';
38
+ export type {
39
+ PreviewTemplateAction,
40
+ PreviewTemplateProps,
41
+ } from './preview-template';
@@ -127,15 +127,24 @@ export function ListSection({
127
127
  action,
128
128
  inset,
129
129
  card,
130
+ boxed,
130
131
  children,
131
132
  }: {
132
133
  title?: string;
133
134
  action?: ReactNode;
134
135
  inset?: boolean;
135
136
  card?: boolean;
137
+ boxed?: boolean;
136
138
  children: ReactNode;
137
139
  }) {
138
140
  const s = useStyles();
141
+ if (boxed) {
142
+ return (
143
+ <ListSection title={title} action={action}>
144
+ <ListSection card>{children}</ListSection>
145
+ </ListSection>
146
+ );
147
+ }
139
148
  if (card) {
140
149
  const rows = Children.toArray(children);
141
150
  return (
@@ -0,0 +1,88 @@
1
+ import type { ReactNode } from 'react';
2
+ import { View } from 'react-native';
3
+ import { Text } from '../components/text/text';
4
+ import { renderIcon, type IconSlot } from '../internal/icon';
5
+ import { PressableBase } from '../internal/pressable-base';
6
+ import { useTheme } from '../theme/theme-provider';
7
+ import { makeStyles } from '../utils/styles';
8
+ import { BottomBar, type TemplateAction } from './parts';
9
+
10
+ export type PreviewTemplateAction = {
11
+ key: string;
12
+ label: string;
13
+ icon: IconSlot;
14
+ onPress: () => void;
15
+ };
16
+
17
+ export type PreviewTemplateProps = {
18
+ preview: ReactNode;
19
+ head?: ReactNode;
20
+ actions: readonly PreviewTemplateAction[];
21
+ primaryAction?: TemplateAction;
22
+ bottomInset?: number;
23
+ };
24
+
25
+ const useStyles = makeStyles((t) => ({
26
+ root: { flex: 1, backgroundColor: t.colors.background },
27
+ stage: {
28
+ flex: 1,
29
+ margin: t.layout.groupGap,
30
+ overflow: 'hidden',
31
+ borderRadius: t.radius.lg,
32
+ backgroundColor: t.colors.surface,
33
+ },
34
+ actions: {
35
+ flexDirection: 'row',
36
+ gap: t.layout.itemGap,
37
+ paddingHorizontal: t.layout.groupGap,
38
+ },
39
+ action: {
40
+ flex: 1,
41
+ alignItems: 'center',
42
+ gap: t.space[1],
43
+ paddingVertical: t.space[3],
44
+ borderRadius: t.radius.lg,
45
+ backgroundColor: t.colors.surface,
46
+ },
47
+ pressed: { backgroundColor: t.colors.border },
48
+ }));
49
+
50
+ export function PreviewTemplate({
51
+ preview,
52
+ head,
53
+ actions,
54
+ primaryAction,
55
+ bottomInset = 0,
56
+ }: PreviewTemplateProps) {
57
+ const t = useTheme();
58
+ const s = useStyles();
59
+ return (
60
+ <View style={s.root}>
61
+ {head}
62
+ <View style={s.stage}>{preview}</View>
63
+ <View style={s.actions}>
64
+ {actions.map((item) => (
65
+ <PressableBase
66
+ key={item.key}
67
+ accessibilityRole="button"
68
+ accessibilityLabel={item.label}
69
+ onPress={item.onPress}
70
+ pressedStyle={s.pressed}
71
+ style={s.action}
72
+ >
73
+ {renderIcon(item.icon, {
74
+ color: t.colors.primary,
75
+ size: t.iconSize.md,
76
+ })}
77
+ <Text variant="caption" numberOfLines={1}>
78
+ {item.label}
79
+ </Text>
80
+ </PressableBase>
81
+ ))}
82
+ </View>
83
+ {primaryAction ? (
84
+ <BottomBar primaryAction={primaryAction} bottomInset={bottomInset} />
85
+ ) : null}
86
+ </View>
87
+ );
88
+ }
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ScrollView, View } from 'react-native';
3
+ import { makeStyles } from '../utils/styles';
4
+
5
+ export type SelectionTemplateProps = {
6
+ bar: ReactNode;
7
+ children: ReactNode;
8
+ };
9
+
10
+ const useStyles = makeStyles((t) => ({
11
+ root: { flex: 1, backgroundColor: t.colors.background },
12
+ }));
13
+
14
+ export function SelectionTemplate({ bar, children }: SelectionTemplateProps) {
15
+ const s = useStyles();
16
+ return (
17
+ <View style={s.root}>
18
+ <ScrollView>{children}</ScrollView>
19
+ {bar}
20
+ </View>
21
+ );
22
+ }