@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.
@@ -1,6 +1,5 @@
1
- import { Avatar, Text, XStack, YStack } from "@multiplatform.one/components";
2
- import { Button } from "@multiplatform.one/forms";
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 { knobProps: nested } = useResolvedKnobs();
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
- <Button
36
- outlined
37
- minHeight={sizeRecipeEscape(
38
- 56,
39
- "pager button: room for the neighbor's two-line label beside its avatar",
40
- )}
41
- flexShrink={1}
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 gap="$2" alignItems="center" flexShrink={1} minWidth={0}>
49
- {isPrev ? avatar : null}
50
- <YStack alignItems={isPrev ? "flex-start" : "flex-end"} flexShrink={1} minWidth={0}>
51
- <Text {...nested.label} color="$color10" textTransform="uppercase" letterSpacing={1}>
52
- {isPrev ? t("Previous") : t("Next")}
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
- <XStack gap="$1.5" alignItems="baseline" minWidth={0}>
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
- </Button>
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 justifyContent="space-between" {...knobProps.gap} marginTop="$2">
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":"AAKA,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,2CAkGA"}
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":"AAMA,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;AA2DD,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"}
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"}