@medalsocial/meda 3.0.0 → 3.2.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/README.md +36 -2
- package/dist/booking/add-child-sheet.d.ts +38 -0
- package/dist/booking/add-child-sheet.js +88 -0
- package/dist/booking/booking-skeleton.d.ts +24 -0
- package/dist/booking/booking-skeleton.js +17 -0
- package/dist/booking/confirmation.d.ts +85 -0
- package/dist/booking/confirmation.js +102 -0
- package/dist/booking/details-screen.d.ts +118 -0
- package/dist/booking/details-screen.js +314 -0
- package/dist/booking/format.d.ts +64 -0
- package/dist/booking/format.js +1 -0
- package/dist/booking/index.d.ts +35 -0
- package/dist/booking/index.js +40 -0
- package/dist/booking/internal/label-parts.d.ts +8 -0
- package/dist/booking/internal/label-parts.js +19 -0
- package/dist/booking/internal/ui.d.ts +33 -0
- package/dist/booking/internal/ui.js +35 -0
- package/dist/booking/label-keys.d.ts +34 -0
- package/dist/booking/label-keys.js +56 -0
- package/dist/booking/labels.d.ts +15 -0
- package/dist/booking/labels.js +17 -0
- package/dist/booking/live-status.d.ts +14 -0
- package/dist/booking/live-status.js +17 -0
- package/dist/booking/login-panel.d.ts +108 -0
- package/dist/booking/login-panel.js +239 -0
- package/dist/booking/login-sheet.d.ts +41 -0
- package/dist/booking/login-sheet.js +49 -0
- package/dist/booking/manage-screen.d.ts +113 -0
- package/dist/booking/manage-screen.js +369 -0
- package/dist/booking/otp-slots.d.ts +42 -0
- package/dist/booking/otp-slots.js +109 -0
- package/dist/booking/portal/account-card.d.ts +24 -0
- package/dist/booking/portal/account-card.js +18 -0
- package/dist/booking/portal/action-result.d.ts +30 -0
- package/dist/booking/portal/action-result.js +18 -0
- package/dist/booking/portal/age-confirm-card.d.ts +39 -0
- package/dist/booking/portal/age-confirm-card.js +42 -0
- package/dist/booking/portal/child-cards.d.ts +65 -0
- package/dist/booking/portal/child-cards.js +59 -0
- package/dist/booking/portal/data-controls.d.ts +48 -0
- package/dist/booking/portal/data-controls.js +103 -0
- package/dist/booking/portal/family-editor.d.ts +141 -0
- package/dist/booking/portal/family-editor.js +422 -0
- package/dist/booking/portal/logout-button.d.ts +21 -0
- package/dist/booking/portal/logout-button.js +27 -0
- package/dist/booking/portal/portal-shell.d.ts +71 -0
- package/dist/booking/portal/portal-shell.js +38 -0
- package/dist/booking/portal/portal-unreachable.d.ts +31 -0
- package/dist/booking/portal/portal-unreachable.js +19 -0
- package/dist/booking/portal/profile-form.d.ts +75 -0
- package/dist/booking/portal/profile-form.js +144 -0
- package/dist/booking/portal/rebook-cards.d.ts +44 -0
- package/dist/booking/portal/rebook-cards.js +35 -0
- package/dist/booking/portal/upcoming-bookings.d.ts +65 -0
- package/dist/booking/portal/upcoming-bookings.js +88 -0
- package/dist/booking/portal/vipps-link-row.d.ts +54 -0
- package/dist/booking/portal/vipps-link-row.js +80 -0
- package/dist/booking/portal/visit-history.d.ts +63 -0
- package/dist/booking/portal/visit-history.js +73 -0
- package/dist/booking/service-screen.d.ts +137 -0
- package/dist/booking/service-screen.js +233 -0
- package/dist/booking/slots.d.ts +12 -0
- package/dist/booking/slots.js +5 -0
- package/dist/booking/stylist-screen.d.ts +117 -0
- package/dist/booking/stylist-screen.js +226 -0
- package/dist/booking/summary-bar.d.ts +26 -0
- package/dist/booking/summary-bar.js +32 -0
- package/dist/booking/time-screen.d.ts +191 -0
- package/dist/booking/time-screen.js +418 -0
- package/dist/booking/types.d.ts +284 -0
- package/dist/booking/types.js +15 -0
- package/dist/booking/vipps-button.d.ts +49 -0
- package/dist/booking/vipps-button.js +33 -0
- package/dist/booking/who-screen.d.ts +121 -0
- package/dist/booking/who-screen.js +164 -0
- package/dist/primitives/checkbox.d.ts +23 -0
- package/dist/primitives/checkbox.js +20 -0
- package/dist/primitives/field.d.ts +47 -0
- package/dist/primitives/field.js +48 -0
- package/dist/primitives/index.d.ts +8 -0
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/sheet.d.ts +68 -0
- package/dist/primitives/sheet.js +303 -0
- package/dist/primitives/textarea.d.ts +14 -0
- package/dist/primitives/textarea.js +13 -0
- package/dist/styles/booking.css +10 -0
- package/package.json +8 -1
- package/skills/components/SKILL.md +53 -0
|
@@ -111,6 +111,59 @@ import { StatusPill } from '@medalsocial/meda';
|
|
|
111
111
|
|
|
112
112
|
**Why solid backgrounds (not tinted):** the 11px small size needs ≥4.5:1 contrast to pass WCAG AA. Tinted backgrounds (`bg-info/15 text-info`) fail axe gates at this size. Solid `bg-info text-info-foreground` etc. always passes via the theme tokens. If you need a tinted variant, use it at `size="md"` or larger only, and verify with `vitest-axe`.
|
|
113
113
|
|
|
114
|
+
## Form + sheet primitives — native elements, exported
|
|
115
|
+
|
|
116
|
+
`Checkbox`, `Field`, `Textarea` and `Sheet` ARE exported from `@medalsocial/meda` and
|
|
117
|
+
`@medalsocial/meda/primitives` (unlike the `src/components/ui/` adapters). They sit on
|
|
118
|
+
native elements so they stay small and work without JavaScript-heavy machinery:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { Checkbox, Field, Input, Sheet, Textarea } from '@medalsocial/meda/primitives';
|
|
122
|
+
|
|
123
|
+
<Field>
|
|
124
|
+
<Field.Label htmlFor="email">E-mail</Field.Label>
|
|
125
|
+
<Input id="email" invalid aria-describedby="email-error" />
|
|
126
|
+
<Field.Error id="email-error">Enter a valid e-mail address.</Field.Error>
|
|
127
|
+
</Field>
|
|
128
|
+
|
|
129
|
+
<Checkbox id="terms" onCheckedChange={setAccepted} /> {/* native <input type="checkbox"> */}
|
|
130
|
+
|
|
131
|
+
<Sheet open={open} onOpenChange={setOpen} dismissible={!saving}>
|
|
132
|
+
<Sheet.Trigger render={<Button variant="outline" />}>Add child</Sheet.Trigger>
|
|
133
|
+
<Sheet.Content> {/* native <dialog>, showModal() */}
|
|
134
|
+
<Sheet.Title>Add child</Sheet.Title>
|
|
135
|
+
<Sheet.Description>Only for this booking.</Sheet.Description>
|
|
136
|
+
…
|
|
137
|
+
<Sheet.Close render={<Button variant="ghost" size="sm" />} aria-label="Close">×</Sheet.Close>
|
|
138
|
+
</Sheet.Content>
|
|
139
|
+
</Sheet>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- `Field` owns no ids or state — wire `htmlFor` / `aria-describedby` yourself.
|
|
143
|
+
- `Sheet` is a bottom sheet on phones and a centred dialog from `md` (`side="bottom"` pins
|
|
144
|
+
the bottom sheet). Escape, backdrop click and `Sheet.Close` all go through `onOpenChange`;
|
|
145
|
+
`dismissible={false}` blocks them while a submit is in flight. Focus returns to the trigger.
|
|
146
|
+
- Reach for `src/components/ui/` (Base UI) only for menus, popovers and comboboxes.
|
|
147
|
+
|
|
148
|
+
## Booking screens — `@medalsocial/meda/booking`
|
|
149
|
+
|
|
150
|
+
Presentational screens for a booking flow, extracted so every customer site renders the
|
|
151
|
+
same wizard / manage page / portal. Rules when editing or adding one:
|
|
152
|
+
|
|
153
|
+
- **No data access.** No `fetch`, router, storage, cookies, env, or Medal/SDK types. Data
|
|
154
|
+
comes in as the structural shapes in `src/booking/types.ts`; outcomes leave as callbacks
|
|
155
|
+
(`onPick`, `onSubmit`, `onSave(...) => Promise<SaveResult>`).
|
|
156
|
+
- **No copy, no clock.** Every string is a `labels` key (`'<screen>.<thing>'`, declared in
|
|
157
|
+
the screen's `*_LABEL_KEYS` array and rolled up in `label-keys.ts`); every date / price
|
|
158
|
+
goes through the `format: BookingFormat` prop — never `Date` getters or `Intl`.
|
|
159
|
+
- **Colours through the bridge only** (`bg-primary`, `text-muted-foreground`, …).
|
|
160
|
+
`pnpm lint:tokens` rejects palette colours (`bg-white`, `text-green-600`) and arbitrary
|
|
161
|
+
colour values in `src/booking`.
|
|
162
|
+
- **Override ladder:** CSS variables → `labels` → `classNames` slots → `components` card
|
|
163
|
+
renderers (export the default renderer). Keep all four working in tests.
|
|
164
|
+
- **Public repo:** no customer names, copy, URLs or data. Stories and tests use the invented
|
|
165
|
+
«Salong Demo» fixtures in `src/booking/__stories__/`.
|
|
166
|
+
|
|
114
167
|
## ui-adapters — NOT exported from the npm package
|
|
115
168
|
|
|
116
169
|
shadcn-style adapters in `src/components/ui/` (`Dialog`, `DropdownMenu`, `Tooltip`, `Drawer`, `Command`, `Checkbox`, `Collapsible`) wrap `@base-ui/react`. **They are intentionally NOT exported from `@medalsocial/meda`** — meda follows the shadcn philosophy: you own the ui code.
|