@misebako/ui 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/README.md +75 -2
- package/dist/checkout/checkout-amounts.d.ts +41 -0
- package/dist/checkout/checkout-amounts.js +20 -0
- package/dist/checkout/checkout-amounts.js.map +1 -0
- package/dist/checkout/quote-fields.d.ts +16 -0
- package/dist/checkout/quote-fields.js +45 -0
- package/dist/checkout/quote-fields.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/orders/delivery-codes.d.ts +12 -0
- package/dist/orders/delivery-codes.js +26 -0
- package/dist/orders/delivery-codes.js.map +1 -0
- package/dist/orders/order-status.d.ts +36 -0
- package/dist/orders/order-status.js +28 -0
- package/dist/orders/order-status.js.map +1 -0
- package/dist/primitives/appearance-menu.d.ts +11 -0
- package/dist/primitives/appearance-menu.js +15 -0
- package/dist/primitives/appearance-menu.js.map +1 -0
- package/dist/primitives/bot-check.d.ts +123 -0
- package/dist/primitives/bot-check.js +425 -0
- package/dist/primitives/bot-check.js.map +1 -0
- package/dist/primitives/link.d.ts +11 -0
- package/dist/primitives/link.js +7 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/otp-input.d.ts +16 -0
- package/dist/primitives/otp-input.js +109 -0
- package/dist/primitives/otp-input.js.map +1 -0
- package/dist/primitives/phone-verify-modal.d.ts +41 -0
- package/dist/primitives/phone-verify-modal.js +200 -0
- package/dist/primitives/phone-verify-modal.js.map +1 -0
- package/dist/primitives/region-menu.d.ts +32 -0
- package/dist/primitives/region-menu.js +129 -0
- package/dist/primitives/region-menu.js.map +1 -0
- package/dist/primitives/rich-text.d.ts +9 -0
- package/dist/primitives/rich-text.js +52 -0
- package/dist/primitives/rich-text.js.map +1 -0
- package/dist/storefront/home-hero.d.ts +33 -0
- package/dist/storefront/home-hero.js +13 -0
- package/dist/storefront/home-hero.js.map +1 -0
- package/dist/storefront/product-gallery.d.ts +24 -0
- package/dist/storefront/product-gallery.js +49 -0
- package/dist/storefront/product-gallery.js.map +1 -0
- package/dist/styles.css +146 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.js +26 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +112 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mantine/core';
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
/** Allow only safe single-slash relative paths or HTTPS links inside rendered rich text. */
|
|
5
|
+
export function isSafeHref(href) {
|
|
6
|
+
if (href.startsWith('/') && !href.startsWith('//') && !/[\\\s]/.test(href)) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
return new URL(href).protocol === 'https:';
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function inline(block) {
|
|
17
|
+
return block.content?.map((part, index) => {
|
|
18
|
+
if (part.type === 'hardBreak')
|
|
19
|
+
return _jsx("br", {}, index);
|
|
20
|
+
let value = part.text;
|
|
21
|
+
for (const mark of part.marks ?? []) {
|
|
22
|
+
if (mark.type === 'bold') {
|
|
23
|
+
value = _jsx("strong", { children: value });
|
|
24
|
+
}
|
|
25
|
+
else if (mark.type === 'italic') {
|
|
26
|
+
value = _jsx("em", { children: value });
|
|
27
|
+
}
|
|
28
|
+
else if (mark.type === 'link' && isSafeHref(mark.attrs.href)) {
|
|
29
|
+
const external = !mark.attrs.href.startsWith('/');
|
|
30
|
+
value = (_jsxs("a", { href: mark.attrs.href, target: external ? '_blank' : undefined, rel: external ? 'noopener noreferrer nofollow' : undefined, children: [value, external && _jsx("span", { "aria-hidden": "true", children: " \u2197" })] }));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return _jsx(Fragment, { children: value }, index);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Render sanitized ProseMirror/TipTap rich text inside Mantine Typography styles. */
|
|
37
|
+
export function RichContent({ value, lang }) {
|
|
38
|
+
return (_jsx(Typography, { lang: lang, className: "misebako-rich-text", children: value.content.map((block, index) => {
|
|
39
|
+
if (block.type === 'paragraph')
|
|
40
|
+
return _jsx("p", { children: inline(block) }, index);
|
|
41
|
+
if (block.type === 'heading') {
|
|
42
|
+
return block.attrs.level === 2
|
|
43
|
+
? _jsx("h2", { children: inline(block) }, index)
|
|
44
|
+
: _jsx("h3", { children: inline(block) }, index);
|
|
45
|
+
}
|
|
46
|
+
const rows = block.content.map((item, position) => (_jsx("li", { children: item.content.map((row, offset) => _jsx("p", { children: inline(row) }, offset)) }, position)));
|
|
47
|
+
return block.type === 'orderedList'
|
|
48
|
+
? _jsx("ol", { start: block.attrs?.start, children: rows }, index)
|
|
49
|
+
: _jsx("ul", { children: rows }, index);
|
|
50
|
+
}) }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=rich-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../../src/primitives/rich-text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAGhD,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAC5C,C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+
import { type StoreLinkComponent } from '../primitives/link.js';
|
|
3
|
+
export interface HomeHeroBullet {
|
|
4
|
+
strong: string;
|
|
5
|
+
detail: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HomeHeroCategory {
|
|
8
|
+
slug: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SharedHomeHeroProps {
|
|
12
|
+
LinkComponent?: StoreLinkComponent;
|
|
13
|
+
FormComponent?: ComponentType<FormHTMLAttributes<HTMLFormElement> & {
|
|
14
|
+
action: string;
|
|
15
|
+
}>;
|
|
16
|
+
eyebrow: string;
|
|
17
|
+
title: string;
|
|
18
|
+
highlight: string;
|
|
19
|
+
description: string;
|
|
20
|
+
bullets: readonly HomeHeroBullet[];
|
|
21
|
+
primaryCta: string;
|
|
22
|
+
secondaryCta: string;
|
|
23
|
+
panelTitle: string;
|
|
24
|
+
searchLabel?: string;
|
|
25
|
+
searchPlaceholder: string;
|
|
26
|
+
searchButtonLabel: string;
|
|
27
|
+
searchFormAction?: string;
|
|
28
|
+
categoriesHeading: string;
|
|
29
|
+
allProductsChip: string;
|
|
30
|
+
categories: readonly HomeHeroCategory[];
|
|
31
|
+
}
|
|
32
|
+
/** Shared two-column storefront hero shared identically across Misebako and Noren stores. */
|
|
33
|
+
export declare function HomeHero({ LinkComponent, FormComponent, eyebrow, title, highlight, description, bullets, primaryCta, secondaryCta, panelTitle, searchLabel, searchPlaceholder, searchButtonLabel, searchFormAction, categoriesHeading, allProductsChip, categories, }: SharedHomeHeroProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Box, Button, Grid, Group, List, Paper, Stack, Text, TextInput, ThemeIcon, Title, } from '@mantine/core';
|
|
4
|
+
import { ArrowRight, BookOpen, Check, Search, Sparkles } from 'lucide-react';
|
|
5
|
+
import { DefaultStoreLink } from '../primitives/link.js';
|
|
6
|
+
/** Shared two-column storefront hero shared identically across Misebako and Noren stores. */
|
|
7
|
+
export function HomeHero({ LinkComponent, FormComponent, eyebrow, title, highlight, description, bullets, primaryCta, secondaryCta, panelTitle, searchLabel, searchPlaceholder, searchButtonLabel, searchFormAction = '/products', categoriesHeading, allProductsChip, categories, }) {
|
|
8
|
+
const NavLink = (LinkComponent ?? DefaultStoreLink);
|
|
9
|
+
const FormEl = FormComponent ?? 'form';
|
|
10
|
+
const visibleCategories = categories.slice(0, 6);
|
|
11
|
+
return (_jsx(Box, { component: "section", "aria-labelledby": "home-hero-title", className: "misebako-hero-wrapper", py: { base: 'md', md: 'xl' }, children: _jsxs(Grid, { className: "misebako-hero-inner", gap: { base: 'xl', md: 40 }, align: "center", children: [_jsx(Grid.Col, { span: { base: 12, md: 7 }, children: _jsxs(Stack, { gap: "md", align: "flex-start", children: [_jsx(Badge, { variant: "light", radius: "xl", size: "md", leftSection: _jsx(Sparkles, { size: 13, "aria-hidden": "true" }), children: eyebrow }), _jsxs(Title, { id: "home-hero-title", order: 1, className: "misebako-hero-title", children: [_jsx(Text, { component: "span", display: "block", inherit: true, children: title }), _jsx(Text, { component: "span", display: "block", inherit: true, className: "misebako-hero-highlight", children: highlight })] }), _jsx(Text, { size: "md", c: "dimmed", maw: 560, lh: 1.6, children: description }), _jsx(List, { mt: "xs", spacing: "sm", size: "sm", center: true, icon: _jsx(ThemeIcon, { size: 22, radius: "xl", variant: "light", children: _jsx(Check, { size: 13, "aria-hidden": "true" }) }), children: bullets.map((bullet, idx) => (_jsxs(List.Item, { children: [_jsx(Text, { component: "span", fw: 600, children: bullet.strong }), ' — ', _jsx(Text, { component: "span", c: "dimmed", children: bullet.detail })] }, `${bullet.strong}-${idx}`))) }), _jsxs(Group, { mt: "md", gap: "sm", wrap: "wrap", children: [_jsx(Button, { component: NavLink, href: "/products", size: "md", radius: "xl", rightSection: _jsx(ArrowRight, { size: 16, "aria-hidden": "true" }), children: primaryCta }), _jsx(Button, { component: NavLink, href: "/help", size: "md", radius: "xl", variant: "default", leftSection: _jsx(BookOpen, { size: 16, "aria-hidden": "true" }), children: secondaryCta })] })] }) }), _jsx(Grid.Col, { span: { base: 12, md: 5 }, children: _jsx(Paper, { withBorder: true, radius: "md", p: "lg", className: "misebako-hero-panel", children: _jsxs(Stack, { gap: "md", children: [_jsx(Title, { order: 2, fz: "sm", fw: 600, children: panelTitle }), _jsx(FormEl, { action: searchFormAction, role: "search", children: _jsxs(Group, { gap: "xs", wrap: "nowrap", align: "stretch", children: [_jsx(TextInput, { name: "q", type: "search", maxLength: 120, flex: 1, miw: 0, "aria-label": searchLabel ?? panelTitle, placeholder: searchPlaceholder, leftSection: _jsx(Search, { size: 15, "aria-hidden": "true" }) }), _jsx(Button, { type: "submit", variant: "light", px: "md", style: { flexShrink: 0 }, children: searchButtonLabel })] }) }), visibleCategories.length > 0 && (_jsxs(Stack, { gap: "xs", children: [_jsx(Title, { order: 3, fz: "xs", c: "dimmed", fw: 500, children: categoriesHeading }), _jsxs(Group, { gap: "xs", wrap: "wrap", children: [_jsx(Button, { component: NavLink, href: "/products", size: "xs", variant: "default", radius: "xl", children: allProductsChip }), visibleCategories.map(cat => (_jsx(Button, { component: NavLink, href: `/products?category=${encodeURIComponent(cat.slug)}`, size: "xs", variant: "light", radius: "xl", children: cat.name }, cat.slug)))] })] }))] }) }) })] }) }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=home-hero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home-hero.js","sourceRoot":"","sources":["../../src/storefront/home-hero.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EACL,KAAK,EACL,GAAG,EACH,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,SAAS,EACT,KAAK,GACN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAA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Q,EAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YACnE,iBAAiB,GACX,IACH,GACD,EAER,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,aACb,KAAC,KAAK,IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE,GAAG,YAAG,iBAAiB,GAAS,EACxE,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,aACzB,KAAC,MAAM,IAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,MAAM,EAAC,IAAI,YACjF,eAAe,GACT,EACR,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAC5B,KAAC,MAAM,IAEL,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,sBAAsB,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAC1D,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,OAAO,EACf,MAAM,EAAC,IAAI,YAEV,GAAG,CAAC,IAAI,IAPJ,GAAG,CAAC,IAAI,CAQN,CACV,CAAC,IACI,IACF,CACT,IACK,GACF,GACC,IACN,GACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ResellerProductImage } from '@misebako/sdk/schemas';
|
|
2
|
+
import { type StoreLinkComponent } from '../primitives/link.js';
|
|
3
|
+
export type ProductGalleryImage = ResellerProductImage;
|
|
4
|
+
export interface ProductCoverProps {
|
|
5
|
+
image?: ProductGalleryImage;
|
|
6
|
+
title?: string;
|
|
7
|
+
detail?: boolean;
|
|
8
|
+
ratio?: number;
|
|
9
|
+
placeholderSrc?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Shared product card / thumbnail cover frame with subtle border outline and broken-image fallback. */
|
|
12
|
+
export declare function ProductCover({ image, title, detail, ratio, placeholderSrc, }: ProductCoverProps): import("react").JSX.Element;
|
|
13
|
+
export interface ProductGalleryProps {
|
|
14
|
+
href: string;
|
|
15
|
+
title: string;
|
|
16
|
+
images: readonly ProductGalleryImage[];
|
|
17
|
+
selected?: string | null;
|
|
18
|
+
mediaTitle: string;
|
|
19
|
+
viewImageLabel: (index: number) => string;
|
|
20
|
+
placeholderSrc?: string;
|
|
21
|
+
LinkComponent?: StoreLinkComponent;
|
|
22
|
+
}
|
|
23
|
+
/** Shared product detail gallery matching Misebako's stable aspect-ratio frame and thumbnail strip. */
|
|
24
|
+
export declare function ProductGallery({ href, title, images, selected, mediaTitle, viewImageLabel, placeholderSrc, LinkComponent, }: ProductGalleryProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Anchor, AspectRatio, Box, Group, Image, Paper, Stack } from '@mantine/core';
|
|
5
|
+
import { DefaultStoreLink } from '../primitives/link.js';
|
|
6
|
+
const DEFAULT_PLACEHOLDER = '/images/product-placeholder.svg';
|
|
7
|
+
function StoreImage({ src, placeholderSrc = DEFAULT_PLACEHOLDER, onBroken, ...props }) {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const onBrokenRef = useRef(onBroken);
|
|
10
|
+
onBrokenRef.current = onBroken;
|
|
11
|
+
const [failed, setFailed] = useState();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (ref.current?.complete && ref.current.naturalWidth === 0 && ref.current.getAttribute('src') === src) {
|
|
14
|
+
setFailed(src);
|
|
15
|
+
onBrokenRef.current?.();
|
|
16
|
+
}
|
|
17
|
+
}, [src]);
|
|
18
|
+
return (_jsx(Image, { ...props, ref: ref, src: failed === src ? placeholderSrc : src, fallbackSrc: placeholderSrc, onError: () => {
|
|
19
|
+
setFailed(src);
|
|
20
|
+
onBrokenRef.current?.();
|
|
21
|
+
} }));
|
|
22
|
+
}
|
|
23
|
+
/** Shared product card / thumbnail cover frame with subtle border outline and broken-image fallback. */
|
|
24
|
+
export function ProductCover({ image, title = '', detail = false, ratio = 16 / 9, placeholderSrc = DEFAULT_PLACEHOLDER, }) {
|
|
25
|
+
return (_jsx(AspectRatio, { ratio: ratio, bg: "var(--mantine-color-default-hover)", className: "misebako-media", children: _jsx(StoreImage, { src: image ? (detail ? image.url : image.thumbnail || image.url) : placeholderSrc, placeholderSrc: placeholderSrc, alt: image ? title : '', loading: detail ? 'eager' : 'lazy', fit: detail ? 'contain' : 'cover', width: image?.width ?? 640, height: image?.height ?? 360, w: "100%", h: "100%" }) }));
|
|
26
|
+
}
|
|
27
|
+
/** Shared product detail gallery matching Misebako's stable aspect-ratio frame and thumbnail strip. */
|
|
28
|
+
export function ProductGallery({ href, title, images, selected, mediaTitle, viewImageLabel, placeholderSrc = DEFAULT_PLACEHOLDER, LinkComponent, }) {
|
|
29
|
+
const [broken, setBroken] = useState();
|
|
30
|
+
const current = images.find(image => image.id === selected) ?? images[0];
|
|
31
|
+
const isBroken = !!current && broken === current.url;
|
|
32
|
+
const width = !current || isBroken ? 640 : current.width;
|
|
33
|
+
const height = !current || isBroken ? 360 : current.height;
|
|
34
|
+
const ratio = width / height;
|
|
35
|
+
const minRatio = images.length && !isBroken ? Math.min(...images.map(image => image.width / image.height)) : ratio;
|
|
36
|
+
const stageRatio = Math.min(Math.max(minRatio, 4 / 5), 21 / 9);
|
|
37
|
+
const frameWidth = ratio >= stageRatio ? '100%' : `calc((100% - 2px) * ${ratio / stageRatio} + 2px)`;
|
|
38
|
+
const NavLink = (LinkComponent ?? DefaultStoreLink);
|
|
39
|
+
return (_jsxs(Stack, { gap: "xs", children: [_jsxs(Box, { style: { display: 'grid', width: '100%' }, children: [_jsx(Box, { "aria-hidden": true, style: { gridArea: '1 / 1', width: '100%', border: '1px solid transparent', pointerEvents: 'none' }, children: _jsx(Box, { style: { width: '100%', aspectRatio: String(stageRatio) } }) }), _jsx(Paper, { "data-gallery-frame": true, withBorder: true, radius: "md", style: { gridArea: '1 / 1', justifySelf: 'center', alignSelf: 'center', overflow: 'hidden', width: frameWidth }, children: _jsx(Box, { className: "misebako-media", style: { width: '100%', aspectRatio: `${width} / ${height}` }, children: _jsx(StoreImage, { src: current ? current.url : placeholderSrc, placeholderSrc: placeholderSrc, alt: current ? title : '', loading: "eager", fit: "contain", width: width, height: height, w: "100%", h: "100%", style: { display: 'block' }, onBroken: current ? () => setBroken(current.url) : undefined }, current?.url ?? placeholderSrc) }) })] }), images.length > 1 && (_jsx(Group, { component: "nav", "aria-label": mediaTitle, gap: "xs", children: images.map((image, index) => {
|
|
40
|
+
const thumbHref = `${href}${index ? `${href.includes('?') ? '&' : '?'}image=${encodeURIComponent(image.id)}` : ''}`;
|
|
41
|
+
const active = current ? image.id === current.id : index === 0;
|
|
42
|
+
return (_jsx(Anchor, { component: NavLink, scroll: false, prefetch: false, href: thumbHref, "aria-current": active ? 'page' : undefined, "aria-label": viewImageLabel(index + 1), children: _jsx(Box, { p: 2, bdrs: "md", style: {
|
|
43
|
+
border: `2px solid ${active
|
|
44
|
+
? 'var(--misebako-focus-border, var(--mantine-primary-color-filled))'
|
|
45
|
+
: 'var(--mantine-color-default-border)'}`,
|
|
46
|
+
}, children: _jsx(Box, { className: "misebako-media", style: { borderRadius: 4, overflow: 'hidden' }, children: _jsx(StoreImage, { src: image.thumbnail || image.url, placeholderSrc: placeholderSrc, w: 60, h: 40, fit: "cover", alt: "", style: { display: 'block' } }) }) }) }, image.id));
|
|
47
|
+
}) }))] }));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=product-gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-gallery.js","sour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ACN,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAC3B,GACE,GACF,IA9BD,KAAK,CAAC,EAAE,CA+BN,CACV,CAAA;gBACH,CAAC,CAAC,GACI,CACT,IACK,CACT,CAAA;AACH,CAAC"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
html {
|
|
2
|
+
-webkit-font-smoothing: antialiased;
|
|
3
|
+
-moz-osx-font-smoothing: grayscale;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
html:root,
|
|
7
|
+
html:root[data-mantine-color-scheme='light'] {
|
|
8
|
+
--mantine-color-dimmed: #555e67;
|
|
9
|
+
--misebako-hero-from: var(--mantine-color-blue-8);
|
|
10
|
+
--misebako-hero-to: var(--mantine-color-cyan-8);
|
|
11
|
+
--misebako-focus-border: var(--mantine-primary-color-filled);
|
|
12
|
+
--misebako-error-border: var(--mantine-color-error);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html:root[data-mantine-color-scheme='dark'] {
|
|
16
|
+
--mantine-color-dimmed: #a6adb5;
|
|
17
|
+
--misebako-hero-from: var(--mantine-color-blue-4);
|
|
18
|
+
--misebako-hero-to: var(--mantine-color-cyan-4);
|
|
19
|
+
--misebako-focus-border: var(--mantine-primary-color-4);
|
|
20
|
+
--misebako-error-border: var(--mantine-color-red-4);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
html:root[data-mantine-color-scheme='dark'] .mantine-focus-auto:focus-visible {
|
|
24
|
+
outline-color: var(--mantine-primary-color-4);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (max-width: 48em) {
|
|
28
|
+
.mantine-Input-input,
|
|
29
|
+
input:not([type='checkbox']):not([type='radio']),
|
|
30
|
+
select,
|
|
31
|
+
textarea {
|
|
32
|
+
font-size: max(16px, 1em);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body {
|
|
37
|
+
overflow-wrap: break-word;
|
|
38
|
+
font-variant-numeric: tabular-nums;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.tabular-nums {
|
|
42
|
+
font-variant-numeric: tabular-nums;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h1,
|
|
46
|
+
h2,
|
|
47
|
+
h3,
|
|
48
|
+
h4 {
|
|
49
|
+
text-wrap: balance;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
p {
|
|
53
|
+
text-wrap: pretty;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.mantine-Typography-root p {
|
|
57
|
+
text-wrap: auto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.misebako-rich-text {
|
|
61
|
+
max-width: 70ch;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.misebako-rich-text a {
|
|
65
|
+
text-decoration: underline;
|
|
66
|
+
text-underline-position: from-font;
|
|
67
|
+
text-decoration-thickness: from-font;
|
|
68
|
+
text-underline-offset: 0.14em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.misebako-media {
|
|
72
|
+
outline: 1px solid oklch(0 0 0 / 0.1);
|
|
73
|
+
outline-offset: -1px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
html:root[data-mantine-color-scheme='dark'] .misebako-media {
|
|
77
|
+
outline-color: oklch(1 0 0 / 0.1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.misebako-hero-wrapper {
|
|
81
|
+
position: relative;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.misebako-hero-inner {
|
|
85
|
+
position: relative;
|
|
86
|
+
z-index: 1;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.misebako-hero-title {
|
|
90
|
+
font-size: clamp(1.85rem, 4vw, 2.95rem);
|
|
91
|
+
font-weight: 800;
|
|
92
|
+
line-height: 1.15;
|
|
93
|
+
letter-spacing: -0.025em;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.misebako-hero-highlight {
|
|
97
|
+
background-image: linear-gradient(
|
|
98
|
+
120deg,
|
|
99
|
+
var(--misebako-hero-from) 0%,
|
|
100
|
+
var(--misebako-hero-to) 100%
|
|
101
|
+
);
|
|
102
|
+
-webkit-background-clip: text;
|
|
103
|
+
background-clip: text;
|
|
104
|
+
color: transparent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.misebako-hero-panel {
|
|
108
|
+
background: color-mix(in srgb, var(--mantine-color-body) 86%, transparent);
|
|
109
|
+
backdrop-filter: blur(8px);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.catalog-card:hover,
|
|
113
|
+
.catalog-card:focus-visible {
|
|
114
|
+
border-color: var(--misebako-focus-border);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.skip-link {
|
|
118
|
+
position: absolute;
|
|
119
|
+
inset-block-start: var(--mantine-spacing-xs);
|
|
120
|
+
inset-inline-start: var(--mantine-spacing-md);
|
|
121
|
+
z-index: 10;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.skip-link:not(:focus) {
|
|
125
|
+
clip-path: inset(50%);
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.skip-link:focus {
|
|
130
|
+
position: fixed;
|
|
131
|
+
z-index: 400;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.store-nav-links {
|
|
135
|
+
justify-content: flex-start;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@media (min-width: 48em) {
|
|
139
|
+
.store-nav-links {
|
|
140
|
+
justify-content: flex-end;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.promo-verified:focus-visible {
|
|
145
|
+
border-color: var(--mantine-color-green-text);
|
|
146
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MantineColorsTuple, MantineThemeOverride } from '@mantine/core';
|
|
2
|
+
/** Accessible high-contrast color palettes shared across Misebako and Noren stores. */
|
|
3
|
+
export declare const misebakoColors: Record<'teal' | 'orange' | 'green', MantineColorsTuple>;
|
|
4
|
+
/** Build a Mantine theme override preconfigured with Misebako accessibility and palette defaults. */
|
|
5
|
+
export declare function createMisebakoTheme(overrides?: MantineThemeOverride): MantineThemeOverride;
|
|
6
|
+
/** Default Mantine theme preset for Misebako main stores. */
|
|
7
|
+
export declare const misebakoTheme: MantineThemeOverride;
|
|
8
|
+
/** Mantine theme preset for Noren reseller stores (teal primary accent). */
|
|
9
|
+
export declare const norenTheme: MantineThemeOverride;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Accessible high-contrast color palettes shared across Misebako and Noren stores. */
|
|
2
|
+
export const misebakoColors = {
|
|
3
|
+
teal: ['#e6fcf5', '#c3fae8', '#96f2d7', '#63e6be', '#38d9a9', '#20c997', '#12b886', '#0ca678', '#077353', '#055c42'],
|
|
4
|
+
orange: ['#fff4e6', '#ffe8cc', '#ffd8a8', '#ffc078', '#ffa94d', '#ff922b', '#fd7e14', '#f76707', '#c2410c', '#9a3412'],
|
|
5
|
+
green: ['#ebfbee', '#d3f9d8', '#b2f2bb', '#8ce99a', '#69db7c', '#51cf66', '#40c057', '#37b24d', '#217a32', '#195f27'],
|
|
6
|
+
};
|
|
7
|
+
/** Build a Mantine theme override preconfigured with Misebako accessibility and palette defaults. */
|
|
8
|
+
export function createMisebakoTheme(overrides) {
|
|
9
|
+
return {
|
|
10
|
+
respectReducedMotion: true,
|
|
11
|
+
defaultRadius: 'md',
|
|
12
|
+
primaryShade: { light: 8, dark: 8 },
|
|
13
|
+
...overrides,
|
|
14
|
+
colors: {
|
|
15
|
+
...misebakoColors,
|
|
16
|
+
...overrides?.colors,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Default Mantine theme preset for Misebako main stores. */
|
|
21
|
+
export const misebakoTheme = createMisebakoTheme();
|
|
22
|
+
/** Mantine theme preset for Noren reseller stores (teal primary accent). */
|
|
23
|
+
export const norenTheme = createMisebakoTheme({
|
|
24
|
+
primaryColor: 'teal',
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,MAAM,CAAC,MAAM,cAAc,GAA4D;IACrF,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACpH,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACtH,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;CACtH,CAAA;AAED,qGAAqG;AACrG,MAAM,UAAU,mBAAmB,CAAC,SAAgC;IAClE,OAAO;QACL,oBAAoB,EAAE,IAAI;QAC1B,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;QACnC,GAAG,SAAS;QACZ,MAAM,EAAE;YACN,GAAG,cAAc;YACjB,GAAG,SAAS,EAAE,MAAM;SACrB;KACF,CAAA;AACH,CAAC;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAyB,mBAAmB,EAAE,CAAA;AAExE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAyB,mBAAmB,CAAC;IAClE,YAAY,EAAE,MAAM;CACrB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,114 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misebako/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared React 19 + Mantine 9 commerce UI components and theme for Misebako and Noren reseller stores.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"packageManager": "pnpm@12.18.0",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/misebako/ui.git"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./dist/styles.css"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./styles.css": "./dist/styles.css",
|
|
34
|
+
"./theme": {
|
|
35
|
+
"types": "./dist/theme/index.d.ts",
|
|
36
|
+
"import": "./dist/theme/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./rich-text": {
|
|
39
|
+
"types": "./dist/primitives/rich-text.d.ts",
|
|
40
|
+
"import": "./dist/primitives/rich-text.js"
|
|
41
|
+
},
|
|
42
|
+
"./otp-input": {
|
|
43
|
+
"types": "./dist/primitives/otp-input.d.ts",
|
|
44
|
+
"import": "./dist/primitives/otp-input.js"
|
|
45
|
+
},
|
|
46
|
+
"./phone-verify-modal": {
|
|
47
|
+
"types": "./dist/primitives/phone-verify-modal.d.ts",
|
|
48
|
+
"import": "./dist/primitives/phone-verify-modal.js"
|
|
49
|
+
},
|
|
50
|
+
"./bot-check": {
|
|
51
|
+
"types": "./dist/primitives/bot-check.d.ts",
|
|
52
|
+
"import": "./dist/primitives/bot-check.js"
|
|
53
|
+
},
|
|
54
|
+
"./appearance-menu": {
|
|
55
|
+
"types": "./dist/primitives/appearance-menu.d.ts",
|
|
56
|
+
"import": "./dist/primitives/appearance-menu.js"
|
|
57
|
+
},
|
|
58
|
+
"./region-menu": {
|
|
59
|
+
"types": "./dist/primitives/region-menu.d.ts",
|
|
60
|
+
"import": "./dist/primitives/region-menu.js"
|
|
61
|
+
},
|
|
62
|
+
"./product-gallery": {
|
|
63
|
+
"types": "./dist/storefront/product-gallery.d.ts",
|
|
64
|
+
"import": "./dist/storefront/product-gallery.js"
|
|
65
|
+
},
|
|
66
|
+
"./home-hero": {
|
|
67
|
+
"types": "./dist/storefront/home-hero.d.ts",
|
|
68
|
+
"import": "./dist/storefront/home-hero.js"
|
|
69
|
+
},
|
|
70
|
+
"./quote-fields": {
|
|
71
|
+
"types": "./dist/checkout/quote-fields.d.ts",
|
|
72
|
+
"import": "./dist/checkout/quote-fields.js"
|
|
73
|
+
},
|
|
74
|
+
"./checkout-amounts": {
|
|
75
|
+
"types": "./dist/checkout/checkout-amounts.d.ts",
|
|
76
|
+
"import": "./dist/checkout/checkout-amounts.js"
|
|
77
|
+
},
|
|
78
|
+
"./delivery-codes": {
|
|
79
|
+
"types": "./dist/orders/delivery-codes.d.ts",
|
|
80
|
+
"import": "./dist/orders/delivery-codes.js"
|
|
81
|
+
},
|
|
82
|
+
"./order-status": {
|
|
83
|
+
"types": "./dist/orders/order-status.d.ts",
|
|
84
|
+
"import": "./dist/orders/order-status.js"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"scripts": {
|
|
88
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && cp src/styles.css dist/styles.css",
|
|
89
|
+
"typecheck": "tsc --noEmit",
|
|
90
|
+
"test": "vitest run",
|
|
91
|
+
"prepublishOnly": "pnpm run build && pnpm run test"
|
|
92
|
+
},
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"@misebako/sdk": "^0.1.0"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"@mantine/core": "^9.0.0",
|
|
98
|
+
"@mantine/hooks": "^9.0.0",
|
|
99
|
+
"lucide-react": ">=0.400.0 || ^1.0.0",
|
|
100
|
+
"react": "^19.0.0",
|
|
101
|
+
"react-dom": "^19.0.0"
|
|
102
|
+
},
|
|
103
|
+
"devDependencies": {
|
|
104
|
+
"@mantine/core": "9.8.2",
|
|
105
|
+
"@mantine/hooks": "9.8.2",
|
|
106
|
+
"@types/react": "^19.2.0",
|
|
107
|
+
"@types/react-dom": "^19.2.0",
|
|
108
|
+
"lucide-react": "1.78.0",
|
|
109
|
+
"react": "^19.3.1",
|
|
110
|
+
"react-dom": "^19.3.1",
|
|
111
|
+
"typescript": "7.0.2",
|
|
112
|
+
"vitest": "5.1.0"
|
|
113
|
+
}
|
|
114
|
+
}
|