@avenue-ticketing/native 0.1.8 → 0.1.10

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,4 +1,4 @@
1
- import { createContext, useState, useMemo, useContext, isValidElement, useEffect } from 'react';
1
+ import { createContext, useState, useMemo, isValidElement, useContext, useEffect } from 'react';
2
2
  import { View, Text, Pressable, TextInput, ScrollView } from 'react-native-css/components';
3
3
  import { useNativeVariable } from 'react-native-css';
4
4
  import { MagnifyingGlassIcon } from 'phosphor-react-native/src/icons/MagnifyingGlass';
@@ -10,9 +10,9 @@ import 'phosphor-react-native/src/icons/EyeSlash';
10
10
  import 'phosphor-react-native/src/icons/Info';
11
11
  import 'phosphor-react-native/src/icons/Question';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
- import Svg, { Path } from 'react-native-svg';
14
13
  import { styled } from 'nativewind';
15
14
  import { UserIcon } from 'phosphor-react-native/src/icons/User';
15
+ import Svg, { Path } from 'react-native-svg';
16
16
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
17
17
  import Animated, { Easing, FadeIn, FadeOut, FadeInDown, FadeOutDown, useSharedValue, withDelay, withTiming, useAnimatedProps } from 'react-native-reanimated';
18
18
  import { CheckIcon } from 'phosphor-react-native/src/icons/Check';
@@ -118,18 +118,55 @@ var HintText = ({ children, isInvalid, size, className }) => {
118
118
  var avatarStyles = sortCx({
119
119
  root: "relative shrink-0 rounded-[7px]",
120
120
  rootRounded: "rounded-full",
121
- rootBorder: "ring-1 ring-secondary_alt",
122
- content: "relative size-full shrink-0 items-center justify-center overflow-hidden rounded-md bg-tertiary",
121
+ // white pad + hairline + shadow-xs. width lives on each size.
122
+ rootBorder: "border-solid border-secondary_alt bg-primary shadow-xs",
123
+ content: "relative size-full shrink-0 items-center justify-center overflow-hidden rounded-md",
123
124
  contentRounded: "rounded-full",
124
- initials: "text-quaternary",
125
+ initials: "text-utility-brand-600",
125
126
  icon: "text-fg-quaternary",
126
127
  sizes: {
127
- xs: { root: "size-6", rootWithBorder: "p-px", initials: "text-xs font-semibold", icon: "size-4" },
128
- sm: { root: "size-8", rootWithBorder: "p-px", initials: "text-sm font-semibold", icon: "size-5" },
129
- md: { root: "size-10", rootWithBorder: "p-px", initials: "text-md font-semibold", icon: "size-6" },
130
- lg: { root: "size-12", rootWithBorder: "p-[1.5px]", initials: "text-lg font-semibold", icon: "size-7" },
131
- xl: { root: "size-14", rootWithBorder: "p-0.5", initials: "text-xl font-semibold", icon: "size-8" },
132
- "2xl": { root: "size-16", rootWithBorder: "p-0.5", initials: "text-display-xs font-semibold", icon: "size-8" }
128
+ xs: {
129
+ root: "size-6",
130
+ rootWithBorder: "border-[0.5px] p-px",
131
+ placeholderBorder: "border-[0.5px] border-solid border-secondary",
132
+ initials: "text-xs font-medium",
133
+ icon: "size-3"
134
+ },
135
+ sm: {
136
+ root: "size-8",
137
+ rootWithBorder: "border-[0.5px] p-px",
138
+ placeholderBorder: "border-[0.5px] border-solid border-secondary",
139
+ initials: "text-sm font-medium",
140
+ icon: "size-4"
141
+ },
142
+ md: {
143
+ root: "size-10",
144
+ rootWithBorder: "border-[0.75px] p-px",
145
+ placeholderBorder: "border-[0.75px] border-solid border-secondary",
146
+ initials: "text-md font-medium",
147
+ icon: "size-5"
148
+ },
149
+ lg: {
150
+ root: "size-12",
151
+ rootWithBorder: "border-[0.75px] p-[1.5px]",
152
+ placeholderBorder: "border-[0.75px] border-solid border-secondary",
153
+ initials: "text-lg font-medium",
154
+ icon: "size-6"
155
+ },
156
+ xl: {
157
+ root: "size-14",
158
+ rootWithBorder: "border p-0.5",
159
+ placeholderBorder: "border border-solid border-secondary",
160
+ initials: "text-xl font-medium",
161
+ icon: "size-7"
162
+ },
163
+ "2xl": {
164
+ root: "size-16",
165
+ rootWithBorder: "border p-0.5",
166
+ placeholderBorder: "border border-solid border-secondary",
167
+ initials: "text-display-xs font-medium",
168
+ icon: "size-8"
169
+ }
133
170
  }
134
171
  });
135
172
  var AVATAR_SIZE_PX = {
@@ -141,11 +178,11 @@ var AVATAR_SIZE_PX = {
141
178
  "2xl": 64
142
179
  };
143
180
  var AVATAR_ICON_SIZE_PX = {
144
- xs: 16,
145
- sm: 20,
146
- md: 24,
147
- lg: 28,
148
- xl: 32,
181
+ xs: 12,
182
+ sm: 16,
183
+ md: 20,
184
+ lg: 24,
185
+ xl: 28,
149
186
  "2xl": 32
150
187
  };
151
188
  var AVATAR_INITIALS_LINE_HEIGHT_PX = {
@@ -240,14 +277,7 @@ var VerifiedTick = ({ size, className }) => {
240
277
  );
241
278
  };
242
279
  var AvatarCount = ({ count, className }) => {
243
- return /* @__PURE__ */ jsx(View, { className: cx(avatarCountStyles.root, className), children: /* @__PURE__ */ jsx(View, { className: cx("flex-row", avatarCountStyles.badge), children: /* @__PURE__ */ jsx(
244
- Text,
245
- {
246
- style: { includeFontPadding: false, lineHeight: AVATAR_COUNT_LABEL_LINE_HEIGHT_PX },
247
- className: avatarCountStyles.label,
248
- children: count
249
- }
250
- ) }) });
280
+ return /* @__PURE__ */ jsx(View, { className: cx(avatarCountStyles.root, className), children: /* @__PURE__ */ jsx(View, { className: cx("flex-row", avatarCountStyles.badge), children: /* @__PURE__ */ jsx(Text, { style: { includeFontPadding: false, lineHeight: AVATAR_COUNT_LABEL_LINE_HEIGHT_PX }, className: avatarCountStyles.label, children: count }) }) });
251
281
  };
252
282
  var Avatar = ({
253
283
  size = "md",
@@ -270,7 +300,7 @@ var Avatar = ({
270
300
  const sizeStyles = avatarStyles.sizes[size];
271
301
  const px = AVATAR_SIZE_PX[size];
272
302
  const iconPx = AVATAR_ICON_SIZE_PX[size];
273
- const fgQuaternary = useNativeVariable("--color-fg-quaternary") ?? "#a4a7ae";
303
+ const placeholderColor = useNativeVariable("--color-utility-brand-600") ?? "#7c3aed";
274
304
  const renderMainContent = () => {
275
305
  if (canShowImage && src) {
276
306
  return /* @__PURE__ */ jsx(
@@ -295,10 +325,10 @@ var Avatar = ({
295
325
  );
296
326
  }
297
327
  if (PlaceholderIcon) {
298
- return /* @__PURE__ */ jsx(PlaceholderIcon, { size: iconPx, color: fgQuaternary });
328
+ return /* @__PURE__ */ jsx(PlaceholderIcon, { size: iconPx, color: placeholderColor });
299
329
  }
300
330
  if (placeholder) return /* @__PURE__ */ jsx(Fragment, { children: placeholder });
301
- return /* @__PURE__ */ jsx(UserIcon, { size: iconPx, color: fgQuaternary });
331
+ return /* @__PURE__ */ jsx(UserIcon, { size: iconPx, color: placeholderColor });
302
332
  };
303
333
  const renderBadgeContent = () => {
304
334
  if (status) return /* @__PURE__ */ jsx(AvatarOnlineIndicator, { status, size });
@@ -326,6 +356,8 @@ var Avatar = ({
326
356
  "flex-row",
327
357
  avatarStyles.content,
328
358
  rounded && avatarStyles.contentRounded,
359
+ canShowImage ? "bg-tertiary" : "bg-utility-brand-50",
360
+ !canShowImage && border && sizeStyles.placeholderBorder,
329
361
  contentClassName
330
362
  ),
331
363
  children: renderMainContent()
@@ -834,34 +866,49 @@ var TagSelectRoot = ({
834
866
  children: [
835
867
  icon !== null ? /* @__PURE__ */ jsx(SelectGlyph, { icon: icon ?? MagnifyingGlassIcon, size: sizes[size].icon, color: fgQuaternary }) : null,
836
868
  /* @__PURE__ */ jsxs(View, { className: "min-w-0 flex-1 flex-row flex-wrap items-center gap-1.5", children: [
837
- selectedItems.items.map((item) => /* @__PURE__ */ jsxs(
838
- View,
839
- {
840
- className: cx(
841
- "border-primary bg-primary max-w-full flex-row items-center rounded-md border",
842
- size === "sm" ? "px-1 py-0.5" : "py-0.5 pr-1 pl-1.25"
843
- ),
844
- children: [
845
- /* @__PURE__ */ jsx(Avatar, { size: "xs", src: item.avatarUrl, alt: item.label, className: "size-4" }),
846
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, className: cx("text-secondary font-medium", size === "sm" ? "ml-1 text-xs" : "ml-1.25 text-sm"), children: valueFormatter ? valueFormatter(item) : item.label }),
847
- /* @__PURE__ */ jsx(
848
- Pressable,
849
- {
850
- accessibilityRole: "button",
851
- accessibilityLabel: "Remove",
852
- disabled: isDisabled,
853
- onPress: () => {
854
- selectedItems.remove(item.id);
855
- onItemCleared?.(item.id);
856
- },
857
- className: "ml-0.5 p-0.5",
858
- children: /* @__PURE__ */ jsx(XIcon, { size: size === "sm" ? 12 : 14, color: fgSecondary })
859
- }
860
- )
861
- ]
862
- },
863
- selectIdKey(item.id)
864
- )),
869
+ selectedItems.items.map((item) => {
870
+ const Icon = item.icon;
871
+ const leading = item.avatarUrl != null && item.avatarUrl !== "" ? /* @__PURE__ */ jsx(Avatar, { size: "xs", src: item.avatarUrl, alt: item.label, className: "size-4" }) : isValidElement(Icon) ? Icon : null;
872
+ return /* @__PURE__ */ jsxs(
873
+ View,
874
+ {
875
+ className: cx(
876
+ "border-primary bg-primary max-w-full flex-row items-center rounded-md border",
877
+ size === "sm" ? "px-1 py-0.5" : "py-0.5 pr-1 pl-1.25"
878
+ ),
879
+ children: [
880
+ leading,
881
+ /* @__PURE__ */ jsx(
882
+ Text,
883
+ {
884
+ numberOfLines: 1,
885
+ className: cx(
886
+ "text-secondary font-medium",
887
+ size === "sm" ? "text-xs" : "text-sm",
888
+ leading ? size === "sm" ? "ml-1" : "ml-1.25" : "ml-0.5"
889
+ ),
890
+ children: valueFormatter ? valueFormatter(item) : item.label
891
+ }
892
+ ),
893
+ /* @__PURE__ */ jsx(
894
+ Pressable,
895
+ {
896
+ accessibilityRole: "button",
897
+ accessibilityLabel: "Remove",
898
+ disabled: isDisabled,
899
+ onPress: () => {
900
+ selectedItems.remove(item.id);
901
+ onItemCleared?.(item.id);
902
+ },
903
+ className: "ml-0.5 p-0.5",
904
+ children: /* @__PURE__ */ jsx(XIcon, { size: size === "sm" ? 12 : 14, color: fgSecondary })
905
+ }
906
+ )
907
+ ]
908
+ },
909
+ selectIdKey(item.id)
910
+ );
911
+ }),
865
912
  /* @__PURE__ */ jsx(
866
913
  TextInput,
867
914
  {