@misebako/ui 0.3.0 → 0.3.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.
package/README.md CHANGED
@@ -46,7 +46,7 @@ Import individual subpaths to avoid pulling unused client modules, or import fro
46
46
  | `@misebako/ui/bot-check` | Multi-provider human verification hook and widgets (`useBotCheck`, `TurnstileWidget`, `HCaptchaWidget`, `RecaptchaWidget`, `BotCheckError`) (`'use client'`). |
47
47
  | `@misebako/ui/appearance-menu` | Color-scheme switcher (`AppearanceMenu`: `auto` / `light` / `dark`). Changes the provider preference without writing a cookie (`'use client'`). |
48
48
  | `@misebako/ui/appearance-provider` | `AppearanceProvider` persists the preference in browser local storage and synchronizes it across tabs. System appearance changes never overwrite the selected preference (`'use client'`). |
49
- | `@misebako/ui/navigation-progress` | Theme-aware top bar for slow navigations. Mount `NavigationProgress` once with a localized accessible `label` and committed `routeKey` (pathname plus serialized query, without hash). Re-export `startNavigationProgress` as `onRouterTransitionStart` from the host's `instrumentation-client.ts`. Same-origin document navigations are also observed where the browser supports the Navigation API. |
49
+ | `@misebako/ui/navigation-progress` | Theme-aware top bar for slow navigations. Mount `NavigationProgress` once with a localized accessible `label` and committed `routeKey` (pathname plus serialized query, without hash). Re-export `startNavigationProgress` as `onRouterTransitionStart` from the host's `instrumentation-client.ts`. Same-origin document navigations are also observed where the browser supports the Navigation API; there, the router's history write on commit also clears the bar, so a navigation that ends on the current URL (such as a redirect back) does not leave it running. |
50
50
  | `@misebako/ui/region-menu` | Searchable language and display-currency picker (`RegionMenu`, `RegionMark`) (`'use client'`). |
51
51
  | `@misebako/ui/product-gallery` | Product cover and multi-image gallery with broken-image placeholder fallback (`ProductCover`, `ProductGallery`) (`'use client'`). |
52
52
  | `@misebako/ui/home-hero` | Responsive storefront hero with highlights, category shortcuts, and search form (`HomeHero`) (`'use client'`). |
@@ -0,0 +1,18 @@
1
+ export interface CheckoutStepsProps {
2
+ /** Visible step names, in order. Keep them to one or two words. */
3
+ steps: readonly string[];
4
+ /** Zero-based index of the current step. `steps.length` marks every step complete. */
5
+ active: number;
6
+ labels: {
7
+ /** Accessible name of the list, e.g. "Checkout progress". */
8
+ progress: string;
9
+ /** Appended to completed steps for screen readers, e.g. "completed". */
10
+ completed: string;
11
+ };
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Compact, non-interactive progress indicator for a checkout. The current step
16
+ * carries `aria-current="step"`; completed steps announce their state.
17
+ */
18
+ export declare function CheckoutSteps({ steps, active, labels, className }: CheckoutStepsProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check } from 'lucide-react';
3
+ /**
4
+ * Compact, non-interactive progress indicator for a checkout. The current step
5
+ * carries `aria-current="step"`; completed steps announce their state.
6
+ */
7
+ export function CheckoutSteps({ steps, active, labels, className }) {
8
+ return (_jsx("ol", { "aria-label": labels.progress, className: ['misebako-checkout-steps', className].filter(Boolean).join(' '), children: steps.map((step, index) => {
9
+ const state = index < active ? 'complete' : index === active ? 'current' : 'upcoming';
10
+ return (_jsxs("li", { "data-state": state, "aria-current": state === 'current' ? 'step' : undefined, children: [_jsx("span", { className: "misebako-checkout-step-marker", "aria-hidden": "true", children: state === 'complete' ? _jsx(Check, { size: 12, strokeWidth: 3 }) : index + 1 }), _jsxs("span", { className: "misebako-checkout-step-label", children: [step, state === 'complete' && _jsxs("span", { className: "misebako-visually-hidden", children: [", ", labels.completed] })] })] }, step));
11
+ }) }));
12
+ }
13
+ //# sourceMappingURL=checkout-steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-steps.js","sourceRoot":"","sources":["../../src/checkout/checkout-steps.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAgBpC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAsB;IACpF,OAAO,CACL,2BAAgB,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YACzG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACzB,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAA;YACrF,OAAO,CACL,4BAA2B,KAAK,kBAAgB,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aACtF,eAAM,SAAS,EAAC,+BAA+B,iBAAa,MAAM,YAC/D,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,GAClE,EACP,gBAAM,SAAS,EAAC,8BAA8B,aAC3C,IAAI,EACJ,KAAK,KAAK,UAAU,IAAI,gBAAM,SAAS,EAAC,0BAA0B,mBAAI,MAAM,CAAC,SAAS,IAAQ,IAC1F,KAPA,IAAI,CAQR,CACN,CAAA;QACH,CAAC,CAAC,GACC,CACN,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,5 +12,7 @@ export { ProductCover, ProductGallery, type ProductCoverProps, type ProductGalle
12
12
  export { HomeHero, type HomeHeroBullet, type HomeHeroCategory, type SharedHomeHeroProps } from './storefront/home-hero.js';
13
13
  export { QuoteFormFields, type QuoteFormFieldsProps } from './checkout/quote-fields.js';
14
14
  export { CheckoutAmounts, QuoteSummaryCard, type CheckoutAmountsProps, type CheckoutAmountsRate, type QuoteSummaryCardProps, } from './checkout/checkout-amounts.js';
15
+ export { CheckoutSteps, type CheckoutStepsProps, } from './checkout/checkout-steps.js';
16
+ export { orderStateTone, StatusBadge, statusToneColor, type StatusBadgeProps, type StatusTone, } from './primitives/status-badge.js';
15
17
  export { DeliveryCodeList, type DeliveryCodeListProps } from './orders/delivery-codes.js';
16
18
  export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, type NeedsInputFormProps, type OrderActionConfirmProps, } from './orders/order-status.js';
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ export { ProductCover, ProductGallery } from './storefront/product-gallery.js';
12
12
  export { HomeHero } from './storefront/home-hero.js';
13
13
  export { QuoteFormFields } from './checkout/quote-fields.js';
14
14
  export { CheckoutAmounts, QuoteSummaryCard, } from './checkout/checkout-amounts.js';
15
+ export { CheckoutSteps, } from './checkout/checkout-steps.js';
16
+ export { orderStateTone, StatusBadge, statusToneColor, } from './primitives/status-badge.js';
15
17
  export { DeliveryCodeList } from './orders/delivery-codes.js';
16
18
  export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, } from './orders/order-status.js';
17
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,gBAAgB,EAAgD,MAAM,sBAAsB,CAAA;AACrG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,2BAA2B,CAAA;AAC1F,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EACL,gBAAgB,GAGjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,GAKZ,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,cAAc,EAA4B,MAAM,iCAAiC,CAAA;AAC1F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AAU,GAIX,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAA8E,MAAM,iCAAiC,CAAA;AAC1J,OAAO,EAAE,QAAQ,EAAwE,MAAM,2BAA2B,CAAA;AAC1H,OAAO,EAAE,eAAe,EAA6B,MAAM,4BAA4B,CAAA;AACvF,OAAO,EACL,eAAe,EACf,gBAAgB,GAIjB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,aAAa,GAEd,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,GAGhB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAA8B,MAAM,4BAA4B,CAAA;AACzF,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,eAAe,GAGhB,MAAM,0BAA0B,CAAA"}
@@ -2,17 +2,10 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Alert, Button, Group, Stack, Text, Textarea } from '@mantine/core';
4
4
  import { credentialDefaultMaxChars } from '@misebako/sdk/quote-form';
5
+ import { orderStateTone, statusToneColor } from '../primitives/status-badge.js';
5
6
  /** Map order states to consistent Mantine badge colors across Misebako and Noren. */
6
7
  export function orderStateColor(status) {
7
- switch (status) {
8
- case 'DELIVERED':
9
- return 'teal';
10
- case 'REFUNDED':
11
- case 'RELEASED':
12
- return 'gray';
13
- default:
14
- return 'orange';
15
- }
8
+ return statusToneColor[orderStateTone(status)];
16
9
  }
17
10
  /** Check whether an active in-progress order is waiting on buyer credential input. */
18
11
  export function isAwaitingInput(order) {
@@ -1 +1 @@
1
- {"version":3,"file":"order-status.js","sourceRoot":"","sources":["../../src/orders/order-status.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC3E,OAAO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,EACV,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,sCAAsC,EAAE,EAAE,EACzE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,GACtD,EACF,KAAC,KAAK,cACJ,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,GAAG,yBAAyB,YACpH,MAAM,CAAC,MAAM,GACP,GACH,IACF,GACF,GACH,CACR,CAAA;AACH,CAAC;AAYD,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,eAAe,EACf,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,QAAQ,GACgB;IACxB,OAAO,CACL,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,aACb,KAAC,KAAK,IAAC,KAAK,EAAC,KAAK,YAAE,OAAO,GAAS,EACpC,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,aACzB,KAAC,MAAM,IAAC,KAAK,EAAC,KAAK,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,YAClD,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,GAClD,EACT,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,YACxD,SAAS,GACH,IACH,IACF,CACT,CAAA;AACH,CAAC"}
@@ -20,7 +20,10 @@ export function NavigationProgress({ label, routeKey }) {
20
20
  window.clearTimeout(revealTimer);
21
21
  window.clearTimeout(safetyTimer);
22
22
  revealTimer = undefined;
23
- setPending(false);
23
+ // The Next.js router calls history.pushState from useInsertionEffect, and the Navigation API dispatches
24
+ // `navigate` synchronously inside it. Defer the update until React has finished committing.
25
+ queueMicrotask(() => { if (!signal.aborted)
26
+ setPending(false); });
24
27
  }
25
28
  function begin() {
26
29
  revealTimer ??= window.setTimeout(() => setPending(true), 120);
@@ -35,7 +38,13 @@ export function NavigationProgress({ label, routeKey }) {
35
38
  begin();
36
39
  }, { signal });
37
40
  window.navigation?.addEventListener('navigate', event => {
38
- if (event.destination.sameDocument || event.downloadRequest !== null || event.defaultPrevented)
41
+ // Client routers write history when a navigation commits, even when it lands on the URL it started from.
42
+ if (event.destination.sameDocument) {
43
+ if (event.navigationType !== 'traverse')
44
+ finish();
45
+ return;
46
+ }
47
+ if (event.downloadRequest !== null || event.defaultPrevented)
39
48
  return;
40
49
  const url = new URL(event.destination.url);
41
50
  if (url.origin !== window.location.origin || url.protocol !== window.location.protocol)
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-progress.js","sourceRoot":"","sources":["../../src/primitives/navigation-progress.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,UAAU,GAAG,2BAA2B,CAAA;AAE9C,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAM;IACjD,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;IACzC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,EAAE,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AAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QACvD,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,KAAK,EAAE,CAAA;YACjB,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;YAChC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAClC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,cAAK,SAAS,EAAC,qBAAqB,EAAC,IAAI,EAAC,aAAa,gBAAa,KAAK,iBACjE,CAAC,OAAO,kBAAgB,OAAO,IAAI,SAAS,GAAI,CAAA;AACjE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type BadgeProps } from '@mantine/core';
3
+ /**
4
+ * Semantic meaning of a status. Each tone maps to exactly one color so a color
5
+ * means the same thing on every screen:
6
+ * - `success`: finished well (delivered, credited, active)
7
+ * - `progress`: moving forward, nothing to do yet (pending, awaiting payment)
8
+ * - `warning`: needs attention or a decision (refund requested, needs input)
9
+ * - `danger`: failed or blocked (declined, unknown, expired with loss)
10
+ * - `neutral`: closed or inactive (released, archived, disabled)
11
+ * - `info`: descriptive tag with no state meaning (source, channel)
12
+ */
13
+ export type StatusTone = 'success' | 'progress' | 'warning' | 'danger' | 'neutral' | 'info';
14
+ /** The Mantine color for each tone. Shared so tables, badges and dots agree. */
15
+ export declare const statusToneColor: Record<StatusTone, string>;
16
+ export interface StatusBadgeProps extends Omit<BadgeProps, 'color' | 'variant' | 'leftSection'> {
17
+ tone: StatusTone;
18
+ children: ReactNode;
19
+ /** Leading dot. On by default so state is never carried by color alone. */
20
+ withDot?: boolean;
21
+ }
22
+ /** Status pill with a fixed tone-to-color mapping and a shape cue (dot) for non-color readers. */
23
+ export declare function StatusBadge({ tone, children, withDot, size, ...rest }: StatusBadgeProps): import("react").JSX.Element;
24
+ /** Map an order lifecycle state to a tone. */
25
+ export declare function orderStateTone(status: string): StatusTone;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge } from '@mantine/core';
3
+ /** The Mantine color for each tone. Shared so tables, badges and dots agree. */
4
+ export const statusToneColor = {
5
+ success: 'teal',
6
+ progress: 'blue',
7
+ warning: 'orange',
8
+ danger: 'red',
9
+ neutral: 'gray',
10
+ info: 'violet',
11
+ };
12
+ /** Status pill with a fixed tone-to-color mapping and a shape cue (dot) for non-color readers. */
13
+ export function StatusBadge({ tone, children, withDot = true, size = 'sm', ...rest }) {
14
+ return (_jsx(Badge, { ...rest, size: size, variant: "light", color: statusToneColor[tone], "data-tone": tone, className: ['misebako-status-badge', rest.className].filter(Boolean).join(' '), leftSection: withDot ? _jsx("span", { className: "misebako-status-dot", "aria-hidden": "true" }) : undefined, children: children }));
15
+ }
16
+ /** Map an order lifecycle state to a tone. */
17
+ export function orderStateTone(status) {
18
+ switch (status) {
19
+ case 'DELIVERED':
20
+ return 'success';
21
+ case 'REFUNDED':
22
+ case 'RELEASED':
23
+ return 'neutral';
24
+ default:
25
+ return 'progress';
26
+ }
27
+ }
28
+ //# sourceMappingURL=status-badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-badge.js","sourceRoot":"","sources":["../../src/primitives/status-badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAmB,MAAM,eAAe,CAAA;AActD,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAA+B;IACzD,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,QAAQ;CACf,CAAA;AASD,kGAAkG;AAClG,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,EAAoB;IACpG,OAAO,CACL,KAAC,KAAK,OACA,IAAI,EACR,IAAI,EAAE,IAAI,EACV,OAAO,EAAC,OAAO,EACf,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,eACjB,IAAI,EACf,SAAS,EAAE,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9E,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,qBAAqB,iBAAa,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,YAE7F,QAAQ,GACH,CACT,CAAA;AACH,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,SAAS,CAAA;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,SAAS,CAAA;QAClB;YACE,OAAO,UAAU,CAAA;IACrB,CAAC;AACH,CAAC"}
package/dist/styles.css CHANGED
@@ -247,3 +247,123 @@ html:root[data-mantine-color-scheme='dark'] .misebako-media {
247
247
  .mantine-Button-loader {
248
248
  transform: translate(-50%, calc(-50% + calc(0.0625rem * var(--mantine-scale))));
249
249
  }
250
+
251
+ .misebako-visually-hidden {
252
+ position: absolute;
253
+ width: 1px;
254
+ height: 1px;
255
+ margin: -1px;
256
+ padding: 0;
257
+ overflow: hidden;
258
+ clip-path: inset(50%);
259
+ white-space: nowrap;
260
+ border: 0;
261
+ }
262
+
263
+ /* Status badge: the dot gives every state a shape cue, not just a color. */
264
+ .misebako-status-badge {
265
+ text-transform: none;
266
+ font-weight: 600;
267
+ letter-spacing: 0;
268
+ }
269
+
270
+ .misebako-status-dot {
271
+ display: block;
272
+ width: 0.4375rem;
273
+ height: 0.4375rem;
274
+ border-radius: 50%;
275
+ background-color: currentColor;
276
+ }
277
+
278
+ .misebako-status-badge[data-tone='progress'] .misebako-status-dot {
279
+ background-color: transparent;
280
+ box-shadow: inset 0 0 0 1.5px currentColor;
281
+ }
282
+
283
+ /* Checkout progress: numbered markers joined by a rule; the current step is filled. */
284
+ .misebako-checkout-steps {
285
+ display: flex;
286
+ align-items: center;
287
+ gap: var(--mantine-spacing-xs);
288
+ margin: 0;
289
+ padding: 0;
290
+ list-style: none;
291
+ font-size: var(--mantine-font-size-sm);
292
+ }
293
+
294
+ .misebako-checkout-steps > li {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 0.4375rem;
298
+ min-width: 0;
299
+ color: var(--mantine-color-dimmed);
300
+ }
301
+
302
+ .misebako-checkout-steps > li + li::before {
303
+ content: '';
304
+ flex: 0 1 1.5rem;
305
+ min-width: 0.5rem;
306
+ height: 1px;
307
+ background-color: var(--mantine-color-default-border);
308
+ }
309
+
310
+ .misebako-checkout-steps > li[data-state='current'] {
311
+ color: var(--mantine-color-text);
312
+ font-weight: 600;
313
+ }
314
+
315
+ .misebako-checkout-steps > li[data-state='complete'] + li::before {
316
+ background-color: var(--mantine-primary-color-filled);
317
+ }
318
+
319
+ .misebako-checkout-step-marker {
320
+ display: inline-flex;
321
+ flex-shrink: 0;
322
+ align-items: center;
323
+ justify-content: center;
324
+ width: 1.375rem;
325
+ height: 1.375rem;
326
+ border-radius: 50%;
327
+ border: 1px solid var(--mantine-color-default-border);
328
+ font-size: var(--mantine-font-size-xs);
329
+ font-weight: 600;
330
+ line-height: 1;
331
+ }
332
+
333
+ .misebako-checkout-steps > li[data-state='current'] .misebako-checkout-step-marker {
334
+ border-color: var(--mantine-primary-color-filled);
335
+ background-color: var(--mantine-primary-color-filled);
336
+ color: var(--mantine-primary-color-contrast);
337
+ }
338
+
339
+ .misebako-checkout-steps > li[data-state='complete'] .misebako-checkout-step-marker {
340
+ border-color: var(--mantine-primary-color-filled);
341
+ color: var(--mantine-primary-color-light-color);
342
+ background-color: var(--mantine-primary-color-light);
343
+ }
344
+
345
+ .misebako-checkout-step-label {
346
+ overflow: hidden;
347
+ text-overflow: ellipsis;
348
+ white-space: nowrap;
349
+ }
350
+
351
+ @media (max-width: 30em) {
352
+ /* On narrow screens only the current step keeps its label. */
353
+ .misebako-checkout-steps > li:not([data-state='current']) .misebako-checkout-step-label {
354
+ position: absolute;
355
+ width: 1px;
356
+ height: 1px;
357
+ overflow: hidden;
358
+ clip-path: inset(50%);
359
+ }
360
+ }
361
+
362
+ @media (forced-colors: active) {
363
+ .misebako-checkout-steps > li[data-state='current'] .misebako-checkout-step-marker {
364
+ forced-color-adjust: none;
365
+ background-color: Highlight;
366
+ color: HighlightText;
367
+ border-color: Highlight;
368
+ }
369
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misebako/ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Shared React 19 + Mantine 9 commerce UI components and theme for Misebako and Noren reseller stores.",
5
5
  "license": "Apache-2.0",
6
6
  "packageManager": "pnpm@12.18.0",
@@ -90,6 +90,14 @@
90
90
  "./order-status": {
91
91
  "types": "./dist/orders/order-status.d.ts",
92
92
  "import": "./dist/orders/order-status.js"
93
+ },
94
+ "./status-badge": {
95
+ "types": "./dist/primitives/status-badge.d.ts",
96
+ "import": "./dist/primitives/status-badge.js"
97
+ },
98
+ "./checkout-steps": {
99
+ "types": "./dist/checkout/checkout-steps.d.ts",
100
+ "import": "./dist/checkout/checkout-steps.js"
93
101
  }
94
102
  },
95
103
  "scripts": {