@fire-spark/rn-ui 0.0.2 → 0.0.4
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/product-detail.d.ts +14 -1
- package/dist/product-detail.js +59 -1
- package/package.json +1 -1
package/dist/product-detail.d.ts
CHANGED
|
@@ -78,6 +78,19 @@ declare const ProductDetailOptionLabel: ({ className, ...rest }: ViewProps) => R
|
|
|
78
78
|
declare const ProductDetailOptionName: ({ className, ...rest }: TextProps) => React.JSX.Element;
|
|
79
79
|
declare const ProductDetailOptionPrice: ({ className, ...rest }: TextProps) => React.JSX.Element;
|
|
80
80
|
declare const ProductDetailOptionControl: ({ className, ...rest }: ViewProps) => React.JSX.Element;
|
|
81
|
+
type OptionMarkProps = ViewProps & {
|
|
82
|
+
checked?: boolean;
|
|
83
|
+
};
|
|
84
|
+
/** Selection mark for `ProductDetailOptionControl`; the row owns the a11y role. */
|
|
85
|
+
declare const ProductDetailOptionRadio: (props: OptionMarkProps) => React.JSX.Element;
|
|
86
|
+
declare const ProductDetailOptionCheckbox: (props: OptionMarkProps) => React.JSX.Element;
|
|
87
|
+
declare const ProductDetailVariantGroup: ({ className, ...rest }: ViewProps) => React.JSX.Element;
|
|
88
|
+
declare const ProductDetailVariantOptions: ({ className, ...rest }: ViewProps) => React.JSX.Element;
|
|
89
|
+
type VariantOptionProps = PressableProps & {
|
|
90
|
+
selected?: boolean;
|
|
91
|
+
};
|
|
92
|
+
declare const ProductDetailVariantOption: (props: VariantOptionProps) => React.JSX.Element;
|
|
93
|
+
declare const ProductDetailVariantOptionImage: (props: UiImageProps) => React.JSX.Element;
|
|
81
94
|
declare const ProductDetailBack: ({ children, className, ...rest }: PressableProps) => React.JSX.Element;
|
|
82
95
|
declare const ProductDetailRelated: ({ className, ...rest }: ViewProps) => React.JSX.Element;
|
|
83
96
|
declare const ProductDetailRelatedTitle: ({ className, ...rest }: TextProps) => React.JSX.Element;
|
|
@@ -85,4 +98,4 @@ declare const ProductDetailRelatedGrid: ({ className, ...rest }: ViewProps) => R
|
|
|
85
98
|
declare const ProductDetailFooter: ({ className, ...rest }: ViewProps) => React.JSX.Element;
|
|
86
99
|
declare const ProductDetailSubmit: ({ children, className, ...rest }: PressableProps) => React.JSX.Element;
|
|
87
100
|
//#endregion
|
|
88
|
-
export { ProductDetail, ProductDetailActions, ProductDetailAnchorPrice, ProductDetailBack, ProductDetailBadge, ProductDetailBody, ProductDetailContextMeta, ProductDetailContextValue, ProductDetailDescription, ProductDetailDiscount, ProductDetailFooter, ProductDetailGroup, ProductDetailGroupDescription, ProductDetailGroupHeader, ProductDetailGroupHint, ProductDetailGroupRequired, ProductDetailGroupTitle, ProductDetailGroups, ProductDetailHeader, ProductDetailImage, ProductDetailImageSlot, ProductDetailLayout, ProductDetailMedia, ProductDetailMeta, ProductDetailOption, ProductDetailOptionControl, ProductDetailOptionLabel, ProductDetailOptionName, ProductDetailOptionPrice, ProductDetailOptions, ProductDetailPanel, ProductDetailPrice, ProductDetailProvider, ProductDetailProviderProps, ProductDetailQuantities, ProductDetailRelated, ProductDetailRelatedGrid, ProductDetailRelatedTitle, ProductDetailState, ProductDetailSubmit, ProductDetailTitle, useProductDetail };
|
|
101
|
+
export { ProductDetail, ProductDetailActions, ProductDetailAnchorPrice, ProductDetailBack, ProductDetailBadge, ProductDetailBody, ProductDetailContextMeta, ProductDetailContextValue, ProductDetailDescription, ProductDetailDiscount, ProductDetailFooter, ProductDetailGroup, ProductDetailGroupDescription, ProductDetailGroupHeader, ProductDetailGroupHint, ProductDetailGroupRequired, ProductDetailGroupTitle, ProductDetailGroups, ProductDetailHeader, ProductDetailImage, ProductDetailImageSlot, ProductDetailLayout, ProductDetailMedia, ProductDetailMeta, ProductDetailOption, ProductDetailOptionCheckbox, ProductDetailOptionControl, ProductDetailOptionLabel, ProductDetailOptionName, ProductDetailOptionPrice, ProductDetailOptionRadio, ProductDetailOptions, ProductDetailPanel, ProductDetailPrice, ProductDetailProvider, ProductDetailProviderProps, ProductDetailQuantities, ProductDetailRelated, ProductDetailRelatedGrid, ProductDetailRelatedTitle, ProductDetailState, ProductDetailSubmit, ProductDetailTitle, ProductDetailVariantGroup, ProductDetailVariantOption, ProductDetailVariantOptionImage, ProductDetailVariantOptions, useProductDetail };
|
package/dist/product-detail.js
CHANGED
|
@@ -139,7 +139,13 @@ const groupHeaderBase = "flex-row items-start justify-between gap-3";
|
|
|
139
139
|
const groupDescBase = "text-muted-foreground text-xs";
|
|
140
140
|
const optPriceBase = "text-muted-foreground text-sm tabular-nums";
|
|
141
141
|
const optControlBase = "shrink-0 flex-row items-center gap-2";
|
|
142
|
+
const markBase = "size-5 shrink-0 items-center justify-center border-2";
|
|
143
|
+
const radioBase = `${markBase} rounded-full`;
|
|
144
|
+
const checkboxBase = `${markBase} rounded-md`;
|
|
145
|
+
const tickBase = "text-primary-foreground text-xs font-bold leading-none";
|
|
142
146
|
const metaBase = "flex-row flex-wrap items-center gap-2";
|
|
147
|
+
const variantOptionBase = `min-w-24 items-center gap-2 rounded-xl border px-3 py-3`;
|
|
148
|
+
const variantOptionOn = "border-foreground bg-muted";
|
|
143
149
|
const ProductDetail = view(rootBase);
|
|
144
150
|
const ProductDetailBody = (props) => {
|
|
145
151
|
const { className, ref, ...rest } = props;
|
|
@@ -175,6 +181,58 @@ const ProductDetailOptionLabel = view("min-w-0 flex-1");
|
|
|
175
181
|
const ProductDetailOptionName = text(optionNameBase);
|
|
176
182
|
const ProductDetailOptionPrice = text(optPriceBase);
|
|
177
183
|
const ProductDetailOptionControl = view(optControlBase);
|
|
184
|
+
/** Selection mark for `ProductDetailOptionControl`; the row owns the a11y role. */
|
|
185
|
+
const ProductDetailOptionRadio = (props) => {
|
|
186
|
+
const { checked = false, className, children, ...rest } = props;
|
|
187
|
+
const tone = checked ? "border-primary" : "border-input";
|
|
188
|
+
const fill = checked ? children ?? /* @__PURE__ */ jsx(View, { className: "bg-primary size-2.5 rounded-full" }) : null;
|
|
189
|
+
return /* @__PURE__ */ jsx(View, {
|
|
190
|
+
className: cn(radioBase, tone, className),
|
|
191
|
+
...rest,
|
|
192
|
+
children: fill
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
const ProductDetailOptionCheckbox = (props) => {
|
|
196
|
+
const { checked = false, className, children, ...rest } = props;
|
|
197
|
+
const tone = checked ? "border-primary bg-primary" : "border-input";
|
|
198
|
+
const fill = checked ? children ?? /* @__PURE__ */ jsx(Text, {
|
|
199
|
+
className: tickBase,
|
|
200
|
+
children: "✓"
|
|
201
|
+
}) : null;
|
|
202
|
+
return /* @__PURE__ */ jsx(View, {
|
|
203
|
+
className: cn(checkboxBase, tone, className),
|
|
204
|
+
...rest,
|
|
205
|
+
children: fill
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
const ProductDetailVariantGroup = view("flex-col gap-3");
|
|
209
|
+
const ProductDetailVariantOptions = view("flex-row flex-wrap gap-2");
|
|
210
|
+
const ProductDetailVariantOption = (props) => {
|
|
211
|
+
const { selected = false, disabled, className, children, ...rest } = props;
|
|
212
|
+
const optionClass = cn(variantOptionBase, selected ? variantOptionOn : "border-border", disabled ? "opacity-50" : "", className);
|
|
213
|
+
const p1 = {
|
|
214
|
+
selected,
|
|
215
|
+
disabled: !!disabled,
|
|
216
|
+
checked: selected
|
|
217
|
+
};
|
|
218
|
+
let content = children;
|
|
219
|
+
if (typeof children === "string" || typeof children === "number") content = /* @__PURE__ */ jsx(Text, {
|
|
220
|
+
className: optionNameBase,
|
|
221
|
+
children
|
|
222
|
+
});
|
|
223
|
+
return /* @__PURE__ */ jsx(Pressable, {
|
|
224
|
+
role: "radio",
|
|
225
|
+
accessibilityState: p1,
|
|
226
|
+
disabled,
|
|
227
|
+
className: optionClass,
|
|
228
|
+
...rest,
|
|
229
|
+
children: content
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
const ProductDetailVariantOptionImage = (props) => /* @__PURE__ */ jsx(View, {
|
|
233
|
+
className: "size-14 overflow-hidden rounded-lg",
|
|
234
|
+
children: /* @__PURE__ */ jsx(UiImage, { ...props })
|
|
235
|
+
});
|
|
178
236
|
const ProductDetailBack = button(backBase, "text-muted-foreground");
|
|
179
237
|
const ProductDetailRelated = view(relatedBase);
|
|
180
238
|
const ProductDetailRelatedTitle = text(relatedTitleBase);
|
|
@@ -182,4 +240,4 @@ const ProductDetailRelatedGrid = view("flex-row flex-wrap gap-3");
|
|
|
182
240
|
const ProductDetailFooter = view(footerBase);
|
|
183
241
|
const ProductDetailSubmit = button(submitBase, submitLabel);
|
|
184
242
|
//#endregion
|
|
185
|
-
export { ProductDetail, ProductDetailAnchorPrice, ProductDetailBack, ProductDetailBadge, ProductDetailBody, ProductDetailDescription, ProductDetailDiscount, ProductDetailFooter, ProductDetailGroup, ProductDetailGroupDescription, ProductDetailGroupHeader, ProductDetailGroupHint, ProductDetailGroupRequired, ProductDetailGroupTitle, ProductDetailGroups, ProductDetailHeader, ProductDetailImage, ProductDetailImageSlot, ProductDetailLayout, ProductDetailMedia, ProductDetailMeta, ProductDetailOption, ProductDetailOptionControl, ProductDetailOptionLabel, ProductDetailOptionName, ProductDetailOptionPrice, ProductDetailOptions, ProductDetailPanel, ProductDetailPrice, ProductDetailProvider, ProductDetailRelated, ProductDetailRelatedGrid, ProductDetailRelatedTitle, ProductDetailSubmit, ProductDetailTitle, useProductDetail };
|
|
243
|
+
export { ProductDetail, ProductDetailAnchorPrice, ProductDetailBack, ProductDetailBadge, ProductDetailBody, ProductDetailDescription, ProductDetailDiscount, ProductDetailFooter, ProductDetailGroup, ProductDetailGroupDescription, ProductDetailGroupHeader, ProductDetailGroupHint, ProductDetailGroupRequired, ProductDetailGroupTitle, ProductDetailGroups, ProductDetailHeader, ProductDetailImage, ProductDetailImageSlot, ProductDetailLayout, ProductDetailMedia, ProductDetailMeta, ProductDetailOption, ProductDetailOptionCheckbox, ProductDetailOptionControl, ProductDetailOptionLabel, ProductDetailOptionName, ProductDetailOptionPrice, ProductDetailOptionRadio, ProductDetailOptions, ProductDetailPanel, ProductDetailPrice, ProductDetailProvider, ProductDetailRelated, ProductDetailRelatedGrid, ProductDetailRelatedTitle, ProductDetailSubmit, ProductDetailTitle, ProductDetailVariantGroup, ProductDetailVariantOption, ProductDetailVariantOptionImage, ProductDetailVariantOptions, useProductDetail };
|