@ezpg/app-ui 0.5.0 → 0.6.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 +6 -0
- package/lib/module/blocks/index.js +1 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/blocks/product-row/index.js +4 -0
- package/lib/module/blocks/product-row/index.js.map +1 -0
- package/lib/module/blocks/product-row/product-row.js +92 -0
- package/lib/module/blocks/product-row/product-row.js.map +1 -0
- 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/blocks/product-row/index.d.ts +2 -0
- package/lib/typescript/src/blocks/product-row/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/product-row/product-row.d.ts +19 -0
- package/lib/typescript/src/blocks/product-row/product-row.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/blocks/index.tsx +1 -0
- package/src/blocks/product-row/index.ts +5 -0
- package/src/blocks/product-row/product-row.tsx +99 -0
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./oauth-buttons/index.js";
|
|
|
13
13
|
export * from "./order-card/index.js";
|
|
14
14
|
export * from "./plan-card/index.js";
|
|
15
15
|
export * from "./product-list-empty/index.js";
|
|
16
|
+
export * from "./product-row/index.js";
|
|
16
17
|
export * from "./review-row/index.js";
|
|
17
18
|
export * from "./selection-bar/index.js";
|
|
18
19
|
export * from "./service-state-banner/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["formatDeadline","formatManwon"],"sourceRoot":"../../../src","sources":["blocks/index.tsx"],"mappings":";;AAAA,cAAc,+BAAsB;AACpC,cAAc,2BAAkB;AAChC,cAAc,sBAAa;AAC3B,cAAc,gCAAuB;AACrC,cAAc,gCAAuB;AACrC,cAAc,0BAAiB;AAC/B,cAAc,gCAAuB;AACrC,cAAc,wBAAe;AAC7B,cAAc,gCAAuB;AACrC,cAAc,0BAAiB;AAC/B,cAAc,uBAAc;AAC5B,cAAc,sBAAa;AAC3B,cAAc,+BAAsB;AACpC,cAAc,uBAAc;AAC5B,cAAc,0BAAiB;AAC/B,cAAc,iCAAwB;AACtC,cAAc,kCAAyB;AACvC,cAAc,+BAAsB;AACpC,cAAc,sBAAa;AAC3B,cAAc,wBAAe;AAC7B,cAAc,6BAAoB;AAClC,SAASA,cAAc,EAAEC,YAAY,QAAQ,sBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["formatDeadline","formatManwon"],"sourceRoot":"../../../src","sources":["blocks/index.tsx"],"mappings":";;AAAA,cAAc,+BAAsB;AACpC,cAAc,2BAAkB;AAChC,cAAc,sBAAa;AAC3B,cAAc,gCAAuB;AACrC,cAAc,gCAAuB;AACrC,cAAc,0BAAiB;AAC/B,cAAc,gCAAuB;AACrC,cAAc,wBAAe;AAC7B,cAAc,gCAAuB;AACrC,cAAc,0BAAiB;AAC/B,cAAc,uBAAc;AAC5B,cAAc,sBAAa;AAC3B,cAAc,+BAAsB;AACpC,cAAc,wBAAe;AAC7B,cAAc,uBAAc;AAC5B,cAAc,0BAAiB;AAC/B,cAAc,iCAAwB;AACtC,cAAc,kCAAyB;AACvC,cAAc,+BAAsB;AACpC,cAAc,sBAAa;AAC3B,cAAc,wBAAe;AAC7B,cAAc,6BAAoB;AAClC,SAASA,cAAc,EAAEC,YAAY,QAAQ,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ProductRow"],"sourceRoot":"../../../../src","sources":["blocks/product-row/index.ts"],"mappings":";;AAAA,SACEA,UAAU,QAGL,kBAAe","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Photo } from "../../components/photo/photo.js";
|
|
5
|
+
import { formatPrice, Price } from "../../components/price/price.js";
|
|
6
|
+
import { StatusBadge } from "../../components/status-badge/status-badge.js";
|
|
7
|
+
import { Text } from "../../components/text/text.js";
|
|
8
|
+
import { PressableBase } from "../../internal/pressable-base.js";
|
|
9
|
+
import { makeStyles } from "../../utils/styles.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
const useStyles = makeStyles(t => ({
|
|
12
|
+
row: {
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: t.space[3],
|
|
16
|
+
minHeight: t.listRow.threeLine,
|
|
17
|
+
paddingVertical: t.space[2],
|
|
18
|
+
paddingHorizontal: t.layout.screenX,
|
|
19
|
+
backgroundColor: t.colors.background
|
|
20
|
+
},
|
|
21
|
+
pressed: {
|
|
22
|
+
backgroundColor: t.colors.muted
|
|
23
|
+
},
|
|
24
|
+
thumb: {
|
|
25
|
+
width: t.listRow.oneLine
|
|
26
|
+
},
|
|
27
|
+
empty: {
|
|
28
|
+
width: t.listRow.oneLine,
|
|
29
|
+
height: t.listRow.oneLine,
|
|
30
|
+
borderRadius: t.radius.md,
|
|
31
|
+
backgroundColor: t.colors.muted
|
|
32
|
+
},
|
|
33
|
+
body: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
gap: t.space[1]
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
export function ProductRow({
|
|
39
|
+
title,
|
|
40
|
+
price,
|
|
41
|
+
originalPrice,
|
|
42
|
+
imageUri,
|
|
43
|
+
status,
|
|
44
|
+
trailing,
|
|
45
|
+
onPress,
|
|
46
|
+
style
|
|
47
|
+
}) {
|
|
48
|
+
const s = useStyles();
|
|
49
|
+
const label = [title, formatPrice(price), status?.label].filter(Boolean).join(', ');
|
|
50
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
52
|
+
style: s.thumb,
|
|
53
|
+
children: imageUri ? /*#__PURE__*/_jsx(Photo, {
|
|
54
|
+
source: {
|
|
55
|
+
uri: imageUri
|
|
56
|
+
},
|
|
57
|
+
accessible: false
|
|
58
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
59
|
+
style: s.empty
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
62
|
+
style: s.body,
|
|
63
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
64
|
+
variant: "bodyLg",
|
|
65
|
+
numberOfLines: 1,
|
|
66
|
+
children: title
|
|
67
|
+
}), /*#__PURE__*/_jsx(Price, {
|
|
68
|
+
value: price,
|
|
69
|
+
originalValue: originalPrice,
|
|
70
|
+
variant: "label"
|
|
71
|
+
}), status ? /*#__PURE__*/_jsx(StatusBadge, {
|
|
72
|
+
tone: status.tone,
|
|
73
|
+
children: status.label
|
|
74
|
+
}) : null]
|
|
75
|
+
}), trailing]
|
|
76
|
+
});
|
|
77
|
+
if (!onPress) {
|
|
78
|
+
return /*#__PURE__*/_jsx(View, {
|
|
79
|
+
style: [s.row, style],
|
|
80
|
+
accessibilityLabel: label,
|
|
81
|
+
children: content
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/_jsx(PressableBase, {
|
|
85
|
+
onPress: onPress,
|
|
86
|
+
accessibilityLabel: label,
|
|
87
|
+
pressedStyle: s.pressed,
|
|
88
|
+
style: [s.row, style],
|
|
89
|
+
children: content
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=product-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","Photo","formatPrice","Price","StatusBadge","Text","PressableBase","makeStyles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useStyles","t","row","flexDirection","alignItems","gap","space","minHeight","listRow","threeLine","paddingVertical","paddingHorizontal","layout","screenX","backgroundColor","colors","background","pressed","muted","thumb","width","oneLine","empty","height","borderRadius","radius","md","body","flex","ProductRow","title","price","originalPrice","imageUri","status","trailing","onPress","style","s","label","filter","Boolean","join","content","children","source","uri","accessible","variant","numberOfLines","value","originalValue","tone","accessibilityLabel","pressedStyle"],"sourceRoot":"../../../../src","sources":["blocks/product-row/product-row.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ export * from './oauth-buttons/index.js';
|
|
|
11
11
|
export * from './order-card/index.js';
|
|
12
12
|
export * from './plan-card/index.js';
|
|
13
13
|
export * from './product-list-empty/index.js';
|
|
14
|
+
export * from './product-row/index.js';
|
|
14
15
|
export * from './review-row/index.js';
|
|
15
16
|
export * from './selection-bar/index.js';
|
|
16
17
|
export * from './service-state-banner/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/index.tsx"],"names":[],"mappings":"AAAA,cAAc,+BAAsB,CAAC;AACrC,cAAc,2BAAkB,CAAC;AACjC,cAAc,sBAAa,CAAC;AAC5B,cAAc,gCAAuB,CAAC;AACtC,cAAc,gCAAuB,CAAC;AACtC,cAAc,0BAAiB,CAAC;AAChC,cAAc,gCAAuB,CAAC;AACtC,cAAc,wBAAe,CAAC;AAC9B,cAAc,gCAAuB,CAAC;AACtC,cAAc,0BAAiB,CAAC;AAChC,cAAc,uBAAc,CAAC;AAC7B,cAAc,sBAAa,CAAC;AAC5B,cAAc,+BAAsB,CAAC;AACrC,cAAc,uBAAc,CAAC;AAC7B,cAAc,0BAAiB,CAAC;AAChC,cAAc,iCAAwB,CAAC;AACvC,cAAc,kCAAyB,CAAC;AACxC,cAAc,+BAAsB,CAAC;AACrC,cAAc,sBAAa,CAAC;AAC5B,cAAc,wBAAe,CAAC;AAC9B,cAAc,6BAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/index.tsx"],"names":[],"mappings":"AAAA,cAAc,+BAAsB,CAAC;AACrC,cAAc,2BAAkB,CAAC;AACjC,cAAc,sBAAa,CAAC;AAC5B,cAAc,gCAAuB,CAAC;AACtC,cAAc,gCAAuB,CAAC;AACtC,cAAc,0BAAiB,CAAC;AAChC,cAAc,gCAAuB,CAAC;AACtC,cAAc,wBAAe,CAAC;AAC9B,cAAc,gCAAuB,CAAC;AACtC,cAAc,0BAAiB,CAAC;AAChC,cAAc,uBAAc,CAAC;AAC7B,cAAc,sBAAa,CAAC;AAC5B,cAAc,+BAAsB,CAAC;AACrC,cAAc,wBAAe,CAAC;AAC9B,cAAc,uBAAc,CAAC;AAC7B,cAAc,0BAAiB,CAAC;AAChC,cAAc,iCAAwB,CAAC;AACvC,cAAc,kCAAyB,CAAC;AACxC,cAAc,+BAAsB,CAAC;AACrC,cAAc,sBAAa,CAAC;AAC5B,cAAc,wBAAe,CAAC;AAC9B,cAAc,6BAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/product-row/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,kBAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type StatusBadgeTone } from '../../components/status-badge/status-badge.js';
|
|
4
|
+
export type ProductRowStatus = {
|
|
5
|
+
label: string;
|
|
6
|
+
tone?: StatusBadgeTone;
|
|
7
|
+
};
|
|
8
|
+
export type ProductRowProps = {
|
|
9
|
+
title: string;
|
|
10
|
+
price: number;
|
|
11
|
+
originalPrice?: number;
|
|
12
|
+
imageUri?: string | null;
|
|
13
|
+
status?: ProductRowStatus;
|
|
14
|
+
trailing?: ReactNode;
|
|
15
|
+
onPress?: () => void;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
};
|
|
18
|
+
export declare function ProductRow({ title, price, originalPrice, imageUri, status, trailing, onPress, style, }: ProductRowProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=product-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-row.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/product-row/product-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+CAA4C,CAAC;AAKpD,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAuBF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,eAAe,+BA2CjB"}
|
package/package.json
CHANGED
package/src/blocks/index.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export * from './oauth-buttons';
|
|
|
11
11
|
export * from './order-card';
|
|
12
12
|
export * from './plan-card';
|
|
13
13
|
export * from './product-list-empty';
|
|
14
|
+
export * from './product-row';
|
|
14
15
|
export * from './review-row';
|
|
15
16
|
export * from './selection-bar';
|
|
16
17
|
export * from './service-state-banner';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { Photo } from '../../components/photo/photo';
|
|
4
|
+
import { formatPrice, Price } from '../../components/price/price';
|
|
5
|
+
import {
|
|
6
|
+
StatusBadge,
|
|
7
|
+
type StatusBadgeTone,
|
|
8
|
+
} from '../../components/status-badge/status-badge';
|
|
9
|
+
import { Text } from '../../components/text/text';
|
|
10
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
11
|
+
import { makeStyles } from '../../utils/styles';
|
|
12
|
+
|
|
13
|
+
export type ProductRowStatus = { label: string; tone?: StatusBadgeTone };
|
|
14
|
+
|
|
15
|
+
export type ProductRowProps = {
|
|
16
|
+
title: string;
|
|
17
|
+
price: number;
|
|
18
|
+
originalPrice?: number;
|
|
19
|
+
imageUri?: string | null;
|
|
20
|
+
status?: ProductRowStatus;
|
|
21
|
+
trailing?: ReactNode;
|
|
22
|
+
onPress?: () => void;
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const useStyles = makeStyles((t) => ({
|
|
27
|
+
row: {
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
gap: t.space[3],
|
|
31
|
+
minHeight: t.listRow.threeLine,
|
|
32
|
+
paddingVertical: t.space[2],
|
|
33
|
+
paddingHorizontal: t.layout.screenX,
|
|
34
|
+
backgroundColor: t.colors.background,
|
|
35
|
+
},
|
|
36
|
+
pressed: { backgroundColor: t.colors.muted },
|
|
37
|
+
thumb: { width: t.listRow.oneLine },
|
|
38
|
+
empty: {
|
|
39
|
+
width: t.listRow.oneLine,
|
|
40
|
+
height: t.listRow.oneLine,
|
|
41
|
+
borderRadius: t.radius.md,
|
|
42
|
+
backgroundColor: t.colors.muted,
|
|
43
|
+
},
|
|
44
|
+
body: { flex: 1, gap: t.space[1] },
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
export function ProductRow({
|
|
48
|
+
title,
|
|
49
|
+
price,
|
|
50
|
+
originalPrice,
|
|
51
|
+
imageUri,
|
|
52
|
+
status,
|
|
53
|
+
trailing,
|
|
54
|
+
onPress,
|
|
55
|
+
style,
|
|
56
|
+
}: ProductRowProps) {
|
|
57
|
+
const s = useStyles();
|
|
58
|
+
const label = [title, formatPrice(price), status?.label]
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join(', ');
|
|
61
|
+
const content = (
|
|
62
|
+
<>
|
|
63
|
+
<View style={s.thumb}>
|
|
64
|
+
{imageUri ? (
|
|
65
|
+
<Photo source={{ uri: imageUri }} accessible={false} />
|
|
66
|
+
) : (
|
|
67
|
+
<View style={s.empty} />
|
|
68
|
+
)}
|
|
69
|
+
</View>
|
|
70
|
+
<View style={s.body}>
|
|
71
|
+
<Text variant="bodyLg" numberOfLines={1}>
|
|
72
|
+
{title}
|
|
73
|
+
</Text>
|
|
74
|
+
<Price value={price} originalValue={originalPrice} variant="label" />
|
|
75
|
+
{status ? (
|
|
76
|
+
<StatusBadge tone={status.tone}>{status.label}</StatusBadge>
|
|
77
|
+
) : null}
|
|
78
|
+
</View>
|
|
79
|
+
{trailing}
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
if (!onPress) {
|
|
83
|
+
return (
|
|
84
|
+
<View style={[s.row, style]} accessibilityLabel={label}>
|
|
85
|
+
{content}
|
|
86
|
+
</View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return (
|
|
90
|
+
<PressableBase
|
|
91
|
+
onPress={onPress}
|
|
92
|
+
accessibilityLabel={label}
|
|
93
|
+
pressedStyle={s.pressed}
|
|
94
|
+
style={[s.row, style]}
|
|
95
|
+
>
|
|
96
|
+
{content}
|
|
97
|
+
</PressableBase>
|
|
98
|
+
);
|
|
99
|
+
}
|