achery-ui 0.12.0 → 0.13.1

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.
@@ -5639,6 +5639,7 @@ var BottomSheet = ({
5639
5639
  style
5640
5640
  }) => {
5641
5641
  const { tokens: tokens$1 } = useTheme();
5642
+ const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
5642
5643
  const slideAnim = react.useRef(new reactNative.Animated.Value(0)).current;
5643
5644
  const scrimAnim = react.useRef(new reactNative.Animated.Value(0)).current;
5644
5645
  react.useEffect(() => {
@@ -5715,6 +5716,9 @@ var BottomSheet = ({
5715
5716
  borderTopColor: tokens$1.border,
5716
5717
  // Square corners — spec is explicit about this
5717
5718
  borderRadius: 0,
5719
+ // Clear the home indicator so the last row is never cut off / hard
5720
+ // to tap on devices with a bottom safe area.
5721
+ paddingBottom: Math.max(insets.bottom, tokens.spacing.sp4),
5718
5722
  transform: [{ translateY }]
5719
5723
  },
5720
5724
  style
@@ -5993,6 +5997,133 @@ var MoreButton = ({ active, onPress, tokens: tokens$1 }) => /* @__PURE__ */ jsxR
5993
5997
  ]
5994
5998
  }
5995
5999
  );
6000
+ var cornerStyle = (corner, inset) => {
6001
+ if (corner === "none") return {};
6002
+ const [v, h] = corner.split("-");
6003
+ return { position: "absolute", [v]: inset, [h]: inset };
6004
+ };
6005
+ var Marginalia = ({
6006
+ glyph = "fern",
6007
+ size = 120,
6008
+ opacity = 0.4,
6009
+ accent = false,
6010
+ corner = "bottom-right",
6011
+ inset = 16,
6012
+ style
6013
+ }) => {
6014
+ const { tokens } = useTheme();
6015
+ const color = accent ? tokens.accent : tokens.fgMute;
6016
+ return /* @__PURE__ */ jsxRuntime.jsx(
6017
+ reactNative.View,
6018
+ {
6019
+ pointerEvents: "none",
6020
+ accessibilityElementsHidden: true,
6021
+ importantForAccessibility: "no-hide-descendants",
6022
+ style: [cornerStyle(corner, inset), { opacity }, style],
6023
+ children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: glyph, size, color })
6024
+ }
6025
+ );
6026
+ };
6027
+ var defaultNormalize = (t) => t.trim().toLowerCase().replace(/\s+/g, " ");
6028
+ var TagInput = ({
6029
+ value,
6030
+ onChange,
6031
+ suggestions = [],
6032
+ placeholder,
6033
+ onLeather = false,
6034
+ normalize = defaultNormalize,
6035
+ disabled = false,
6036
+ style
6037
+ }) => {
6038
+ const { tokens } = useTheme();
6039
+ const [text, setText] = react.useState("");
6040
+ const chipBorder = onLeather ? tokens.goldDeep : tokens.border;
6041
+ const chipText = onLeather ? tokens.materialLeatherFg : tokens.fg;
6042
+ const placeholderColor = onLeather ? `${tokens.materialLeatherFg}80` : tokens.fgMute;
6043
+ const add = (raw) => {
6044
+ const t = normalize(raw);
6045
+ if (t && !value.includes(t)) onChange([...value, t]);
6046
+ setText("");
6047
+ };
6048
+ const remove = (t) => onChange(value.filter((x) => x !== t));
6049
+ const handleChange = (t) => {
6050
+ if (t.endsWith(",") || t.endsWith(" ")) {
6051
+ const token = t.slice(0, -1);
6052
+ if (token.trim()) add(token);
6053
+ else setText("");
6054
+ return;
6055
+ }
6056
+ setText(t);
6057
+ };
6058
+ const matches = text.trim() ? suggestions.filter((s) => s.includes(normalize(text)) && !value.includes(s)).slice(0, 6) : [];
6059
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style, children: [
6060
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles.field, { borderColor: chipBorder }], children: [
6061
+ value.map((tag) => /* @__PURE__ */ jsxRuntime.jsxs(
6062
+ reactNative.Pressable,
6063
+ {
6064
+ onPress: () => !disabled && remove(tag),
6065
+ style: [styles.chip, { borderColor: chipBorder }],
6066
+ children: [
6067
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "caption", style: { color: chipText }, children: tag }),
6068
+ /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: "cross", size: 10, color: chipText })
6069
+ ]
6070
+ },
6071
+ tag
6072
+ )),
6073
+ /* @__PURE__ */ jsxRuntime.jsx(
6074
+ reactNative.TextInput,
6075
+ {
6076
+ value: text,
6077
+ editable: !disabled,
6078
+ onChangeText: handleChange,
6079
+ onSubmitEditing: () => text.trim() && add(text),
6080
+ onKeyPress: (e) => {
6081
+ if (e.nativeEvent.key === "Backspace" && !text && value.length) {
6082
+ const last = value[value.length - 1];
6083
+ if (last) remove(last);
6084
+ }
6085
+ },
6086
+ placeholder: value.length === 0 ? placeholder : void 0,
6087
+ placeholderTextColor: placeholderColor,
6088
+ autoCapitalize: "none",
6089
+ autoCorrect: false,
6090
+ style: [styles.input, { color: chipText }]
6091
+ }
6092
+ )
6093
+ ] }),
6094
+ matches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles.suggestions, children: matches.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
6095
+ reactNative.Pressable,
6096
+ {
6097
+ onPress: () => add(s),
6098
+ style: [styles.suggestion, { borderColor: tokens.borderMute }],
6099
+ children: /* @__PURE__ */ jsxRuntime.jsx(Text, { variant: "caption", style: { color: tokens.fg2 }, children: s })
6100
+ },
6101
+ s
6102
+ )) })
6103
+ ] });
6104
+ };
6105
+ var styles = reactNative.StyleSheet.create({
6106
+ field: {
6107
+ flexDirection: "row",
6108
+ flexWrap: "wrap",
6109
+ alignItems: "center",
6110
+ gap: 6,
6111
+ borderWidth: 1.5,
6112
+ padding: 8,
6113
+ minHeight: 44
6114
+ },
6115
+ chip: {
6116
+ flexDirection: "row",
6117
+ alignItems: "center",
6118
+ gap: 4,
6119
+ borderWidth: 1,
6120
+ paddingHorizontal: 8,
6121
+ paddingVertical: 4
6122
+ },
6123
+ input: { flex: 1, minWidth: 80, paddingVertical: 4, fontSize: 14 },
6124
+ suggestions: { flexDirection: "row", flexWrap: "wrap", gap: 6, marginTop: 6 },
6125
+ suggestion: { borderWidth: 1, paddingHorizontal: 8, paddingVertical: 4 }
6126
+ });
5996
6127
 
5997
6128
  exports.Badge = Badge;
5998
6129
  exports.BottomSheet = BottomSheet;
@@ -6007,6 +6138,7 @@ exports.GlyphAliases = GlyphAliases;
6007
6138
  exports.GlyphCategories = GlyphCategories;
6008
6139
  exports.GlyphPicker = GlyphPicker;
6009
6140
  exports.Input = Input;
6141
+ exports.Marginalia = Marginalia;
6010
6142
  exports.MaterialCard = MaterialCard;
6011
6143
  exports.MaterialEyebrow = MaterialEyebrow;
6012
6144
  exports.NativeThemeProvider = NativeThemeProvider;
@@ -6017,6 +6149,7 @@ exports.SheetRow = SheetRow;
6017
6149
  exports.Skeleton = Skeleton;
6018
6150
  exports.StatusDot = StatusDot;
6019
6151
  exports.Tabs = Tabs;
6152
+ exports.TagInput = TagInput;
6020
6153
  exports.Text = Text;
6021
6154
  exports.Textarea = Textarea;
6022
6155
  exports.ToastProvider = ToastProvider;