@multiplatform.one/frappe-ui 7.37.0 → 7.38.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/dist/cjs/record/RecordBars.cjs +4 -1
- package/dist/cjs/record/RecordBars.native.js +5 -1
- package/dist/cjs/record/RecordBars.native.js.map +1 -1
- package/dist/cjs/record/RecordPager.cjs +64 -45
- package/dist/cjs/record/RecordPager.native.js +65 -45
- package/dist/cjs/record/RecordPager.native.js.map +1 -1
- package/dist/esm/record/RecordBars.mjs +5 -2
- package/dist/esm/record/RecordBars.mjs.map +1 -1
- package/dist/esm/record/RecordBars.native.js +6 -2
- package/dist/esm/record/RecordBars.native.js.map +1 -1
- package/dist/esm/record/RecordPager.mjs +66 -47
- package/dist/esm/record/RecordPager.mjs.map +1 -1
- package/dist/esm/record/RecordPager.native.js +67 -47
- package/dist/esm/record/RecordPager.native.js.map +1 -1
- package/dist/jsx/record/RecordBars.mjs +5 -2
- package/dist/jsx/record/RecordBars.mjs.map +1 -1
- package/dist/jsx/record/RecordBars.native.js +5 -1
- package/dist/jsx/record/RecordBars.native.js.map +1 -1
- package/dist/jsx/record/RecordPager.mjs +66 -47
- package/dist/jsx/record/RecordPager.mjs.map +1 -1
- package/dist/jsx/record/RecordPager.native.js +65 -45
- package/dist/jsx/record/RecordPager.native.js.map +1 -1
- package/package.json +16 -16
- package/src/record/RecordBars.spec.tsx +64 -0
- package/src/record/RecordBars.tsx +12 -2
- package/src/record/RecordPager.spec.tsx +37 -0
- package/src/record/RecordPager.tsx +46 -34
- package/types/record/RecordBars.d.ts.map +1 -1
- package/types/record/RecordPager.d.ts.map +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Avatar, Text, XStack, YStack } from "@multiplatform.one/components";
|
|
2
|
-
import {
|
|
3
|
-
import { sizeRecipeEscape, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
1
|
+
import { Avatar, Text, XStack, YStack, isWeb, useTheme } from "@multiplatform.one/components";
|
|
2
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
4
3
|
import { ArrowLeftIcon, ArrowRightIcon } from "@phosphor-icons/react";
|
|
5
4
|
import { useTranslation } from "react-i18next";
|
|
6
5
|
|
|
@@ -21,8 +20,11 @@ function PagerButton({
|
|
|
21
20
|
testID?: string;
|
|
22
21
|
}) {
|
|
23
22
|
const { t } = useTranslation();
|
|
24
|
-
const
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const { knobProps, control } = useResolvedKnobs();
|
|
25
25
|
const isPrev = direction === "prev";
|
|
26
|
+
const label = isPrev ? t("Previous") : t("Next");
|
|
27
|
+
const Arrow = isPrev ? ArrowLeftIcon : ArrowRightIcon;
|
|
26
28
|
const avatar = (
|
|
27
29
|
<Avatar
|
|
28
30
|
src={entry.image}
|
|
@@ -32,39 +34,49 @@ function PagerButton({
|
|
|
32
34
|
/>
|
|
33
35
|
);
|
|
34
36
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
<YStack
|
|
38
|
+
{...(isWeb ? { render: <button type="button" /> } : {})}
|
|
39
|
+
role="button"
|
|
40
|
+
tabIndex={0}
|
|
41
|
+
aria-label={[label, entry.code, entry.title].filter(Boolean).join(" ")}
|
|
42
|
+
{...knobProps.inputSurface}
|
|
43
|
+
{...knobProps.containerRadius}
|
|
44
|
+
{...knobProps.panelPadding}
|
|
45
|
+
{...knobProps.gapSm}
|
|
46
|
+
backgroundColor="$background"
|
|
47
|
+
borderColor="$borderColor"
|
|
48
|
+
hoverStyle={control.hoverKnobProps}
|
|
49
|
+
pressStyle={control.pressKnobProps}
|
|
50
|
+
focusVisibleStyle={control.focusVisibleKnobProps}
|
|
51
|
+
flexGrow={1}
|
|
52
|
+
flexBasis={0}
|
|
42
53
|
minWidth={0}
|
|
54
|
+
cursor="pointer"
|
|
43
55
|
onPress={entry.onPress}
|
|
44
|
-
icon={isPrev ? <ArrowLeftIcon size={18} /> : undefined}
|
|
45
|
-
iconAfter={isPrev ? undefined : <ArrowRightIcon size={18} />}
|
|
46
56
|
testID={testID}
|
|
47
57
|
>
|
|
48
|
-
<XStack
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
<XStack
|
|
59
|
+
{...knobProps.gapSm}
|
|
60
|
+
alignItems="center"
|
|
61
|
+
flexDirection={isPrev ? "row" : "row-reverse"}
|
|
62
|
+
>
|
|
63
|
+
<Arrow size={knobProps.controlIcon.width} color={theme.color11?.val} />
|
|
64
|
+
<Text {...knobProps.label} color="$color11" numberOfLines={1} flexShrink={1}>
|
|
65
|
+
{label}
|
|
66
|
+
</Text>
|
|
67
|
+
</XStack>
|
|
68
|
+
<XStack {...knobProps.gapSm} alignItems="center" flexWrap="wrap">
|
|
69
|
+
{avatar}
|
|
70
|
+
{entry.code ? (
|
|
71
|
+
<Text {...knobProps.label} color="$color11">
|
|
72
|
+
{entry.code}
|
|
53
73
|
</Text>
|
|
54
|
-
|
|
55
|
-
{entry.code ? (
|
|
56
|
-
<Text {...nested.label} color="$color10">
|
|
57
|
-
{entry.code}
|
|
58
|
-
</Text>
|
|
59
|
-
) : null}
|
|
60
|
-
<Text fontWeight="700" numberOfLines={1} flexShrink={1}>
|
|
61
|
-
{entry.title}
|
|
62
|
-
</Text>
|
|
63
|
-
</XStack>
|
|
64
|
-
</YStack>
|
|
65
|
-
{isPrev ? null : avatar}
|
|
74
|
+
) : null}
|
|
66
75
|
</XStack>
|
|
67
|
-
|
|
76
|
+
<Text {...knobProps.body} fontWeight="700" textAlign="left">
|
|
77
|
+
{entry.title}
|
|
78
|
+
</Text>
|
|
79
|
+
</YStack>
|
|
68
80
|
);
|
|
69
81
|
}
|
|
70
82
|
|
|
@@ -81,16 +93,16 @@ export function RecordPager({
|
|
|
81
93
|
const { knobProps } = useResolvedKnobs();
|
|
82
94
|
if (!prev && !next) return null;
|
|
83
95
|
return (
|
|
84
|
-
<XStack
|
|
96
|
+
<XStack {...knobProps.gap} marginTop="$2" alignItems="stretch">
|
|
85
97
|
{prev ? (
|
|
86
98
|
<PagerButton direction="prev" entry={prev} testID={testID && `${testID}-prev`} />
|
|
87
99
|
) : (
|
|
88
|
-
<YStack />
|
|
100
|
+
<YStack flexGrow={1} flexBasis={0} minWidth={0} />
|
|
89
101
|
)}
|
|
90
102
|
{next ? (
|
|
91
103
|
<PagerButton direction="next" entry={next} testID={testID && `${testID}-next`} />
|
|
92
104
|
) : (
|
|
93
|
-
<YStack />
|
|
105
|
+
<YStack flexGrow={1} flexBasis={0} minWidth={0} />
|
|
94
106
|
)}
|
|
95
107
|
</XStack>
|
|
96
108
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordBars.d.ts","sourceRoot":"","sources":["../../src/record/RecordBars.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecordBars.d.ts","sourceRoot":"","sources":["../../src/record/RecordBars.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAKhE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,GACP,EAAE;IACD,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,OAAO,EAAE,uBAAuB,CAAC;IACjC,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,2CAqGA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordPager.d.ts","sourceRoot":"","sources":["../../src/record/RecordPager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecordPager.d.ts","sourceRoot":"","sources":["../../src/record/RecordPager.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAwED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,IAAI,EACJ,MAAM,GACP,EAAE;IACD,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,kDAiBA"}
|