@donotdev/components 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/dist/types.d.ts CHANGED
@@ -17,6 +17,13 @@ import type { ButtonVariant } from './atomic/Button';
17
17
  * @author AMBROISE PARK Consulting
18
18
  */
19
19
  export type IconType = ComponentType<LucideProps> | ComponentType<any> | string | ReactNode;
20
+ /**
21
+ * Background painted behind an image frame (Card cover, ImageGallery stage and
22
+ * thumbnails). `'transparent'` (default) paints nothing; the others fill the
23
+ * frame with the theme token of the same name (`--muted`, `--primary`,
24
+ * `--secondary`, `--accent`). The reserved space (aspect ratio) is unaffected.
25
+ */
26
+ export type MediaBackground = 'transparent' | 'muted' | 'primary' | 'secondary' | 'accent';
20
27
  /**
21
28
  * Standardized content data structure for all marketing components.
22
29
  * This ensures consistency across Reveal, Carousel, etc.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AAEH,MAAM,MAAM,QAAQ,GAChB,aAAa,CAAC,WAAW,CAAC,GAE1B,aAAa,CAAC,GAAG,CAAC,GAClB,MAAM,GACN,SAAS,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,uDAAuD;IACvD,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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E;IAC/E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,iCAAiC;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wCAAwC;IACxC,GAAG,CAAC,EAAE;QACJ,kBAAkB;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,2BAA2B;QAC3B,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,mCAAmC;QACnC,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;KAC7B,CAAC;CACH,CAAC"}
@@ -40,7 +40,7 @@ These are the only ways one should handle layout to get to quick results functio
40
40
  - **FileButton** - Button that triggers file input selection.
41
41
  - **PortalButton** - Button that opens content in a portal overlay.
42
42
  - **ButtonGroup** - Visual grouping of buttons with joined borders. Supports horizontal/vertical orientation, variant propagation, and items-based API.
43
- - **SwipeAction** - Swipe-to-reveal trailing destructive action with a keyboard-accessible toggle; only explicit action-button activation invokes `onAction`. Exported with `SwipeActionProps` from `@donotdev/components`. Supply translated `actionLabel`, `revealLabel`, and `closeLabel`. See [SwipeAction](./SWIPE_ACTION.md).
43
+ - **SwipeAction** - Touch swipe-to-reveal trailing destructive action; only explicit action-button activation invokes `onAction`. Exported with `SwipeActionProps` from `@donotdev/components`. Supply a translated `actionLabel`. See [SwipeAction](./SWIPE_ACTION.md).
44
44
 
45
45
  ---
46
46
 
@@ -101,7 +101,7 @@ These are the only ways one should handle layout to get to quick results functio
101
101
 
102
102
  - **Table** - Accessible table component with sorting and selection.
103
103
  - **DataTable** - High-level table with built-in sorting, filtering, search, and pagination. `editable` (+ `getRowId`, `pendingChanges`, `onPendingChange`) edits the columns that declare `edit: { type: 'text' | 'number' | 'select', options }` in place: checked rows take one value from the bulk bar, Excel blocks paste across cells, Enter / arrows move, Esc cancels, Ctrl+Z undoes. The table never saves; the consumer writes `pendingChanges`. `cellErrors={{ [rowId]: { [columnKey]: message } }}` (+ `getRowId`, translated messages) marks cells that break a rule, like a value that does not parse: `data-invalid`, editors `aria-invalid` + `aria-describedby` to the message shown under the value (read-only cells show the message too).
104
- - **Card / ImageGallery images** - Pass the `{ fullUrl, thumbUrl }` pair (CRUD `Picture`) as `cover` / `coverHover` / `images`: phones (below 768px) download the thumbnail, larger screens the full image (`<picture>`). No width props.
104
+ - **Card / ImageGallery images** - Pass the `{ fullUrl, thumbUrl }` pair (CRUD `Picture`) as `cover` / `coverHover` / `images`: phones (below 768px) download the thumbnail, larger screens the full image (`<picture>`). No width props. The frame background is opt-in: `coverBackground` (Card) / `background` (ImageGallery) take `'transparent'` (default, paints nothing) | `'muted'` | `'primary'` | `'secondary'` | `'accent'` (theme tokens); the reserved aspect-ratio space is unchanged.
105
105
  - **Avatar** - Accessible avatar with image and fallback support.
106
106
  - **Badge** - Status indicator with semantic variants (polymorphic: div, span, mark).
107
107
  - **Tag** - Tag component for labels and categories. `removeLabel`: remove button label (default `'Remove'`).
@@ -12,21 +12,17 @@ interface SwipeActionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onActio
12
12
  children: ReactNode;
13
13
  onAction: () => void;
14
14
  actionLabel: string;
15
- revealLabel: string;
16
- closeLabel: string;
17
15
  disabled?: boolean;
18
16
  }
19
17
  ```
20
18
 
21
- Pass translated labels from the application. Native div attributes and event
19
+ Pass a translated `actionLabel` from the application. Native div attributes and event
22
20
  handlers apply to the outer wrapper. No routing, cart state, confirmation,
23
21
  persistence, dependencies, or translation provider are introduced.
24
22
 
25
23
  ```tsx
26
24
  <SwipeAction
27
25
  actionLabel={t('cart.removeItem')}
28
- revealLabel={t('cart.showActions')}
29
- closeLabel={t('cart.hideActions')}
30
26
  onAction={() => removeItem(item.id)}
31
27
  >
32
28
  <CartItem item={item} />
@@ -35,18 +31,16 @@ persistence, dependencies, or translation provider are introduced.
35
31
 
36
32
  ## Interaction and accessibility
37
33
 
38
- - The ellipsis toggle remains visible independently of gesture support. Native
39
- buttons support keyboard and assistive-technology activation.
40
- - The toggle exposes `aria-expanded` and `aria-controls`; its label switches
41
- between `revealLabel` and `closeLabel`.
34
+ - Reveal is by touch swipe only; there is no visible toggle. Offer another way
35
+ to perform the action (e.g. a remove button or stepping a quantity down to 0)
36
+ for mouse and keyboard users.
42
37
  - Native overflow clips the closed action. During a partial swipe the destructive
43
38
  background, trash icon and `actionLabel` progressively paint into view. Until
44
39
  fully open, the action remains inert, hidden from accessibility APIs, disabled,
45
40
  outside tab order and excluded from hit testing; visual reveal alone cannot delete.
46
- - The action follows row content and immediately precedes its toggle in tab
47
- order. Focusing row content closes an open reveal so links/editors are not clipped.
48
- - Escape closes and restores toggle focus. Activating the trash button closes
49
- and restores focus before invoking `onAction`. If that callback removes the row,
41
+ - The action follows row content in tab order. Focusing row content closes an open reveal so links/editors are not clipped.
42
+ - Escape closes the reveal. Activating the trash button closes it before
43
+ invoking `onAction`. If that callback removes the row,
50
44
  the owning list must move focus to a surviving row or its empty state.
51
45
  - Swiping toward inline-start reveals the action at inline-end. Reverse motion
52
46
  closes. Direction is inherited from the document or set using native `dir`.
@@ -58,11 +52,8 @@ persistence, dependencies, or translation provider are introduced.
58
52
  - Only pointers with `pointerType === 'touch'` may reveal/close by swiping.
59
53
  Mouse, pen, and unknown pointers never drag the row, including on hybrid
60
54
  touchscreen computers. Do not infer input mode from screen width.
61
- The persistent toggle and explicit action work without swiping. ShopKB also
62
- retains a directly visible remove button on its cart rows.
63
- - Both controls have minimum touch targets of 44 CSS pixels. Explicit toggles
64
- scroll instantly, so trash is immediately usable. There are no custom
65
- transitions; reduced-motion CSS keeps programmatic scrolling non-animated.
55
+ - The trash action has a minimum touch target of 44 CSS pixels. There are no
56
+ custom transitions; reduced-motion CSS keeps programmatic scrolling non-animated.
66
57
 
67
58
  ## Styling and integration
68
59
 
@@ -79,10 +70,9 @@ No pointer-move tracking, transforms, pointer capture, touchmove cancellation,
79
70
  axis math, or second gesture engine is used. Native scroll position synchronizes
80
71
  ARIA, inertness, and action availability only when the trailing snap endpoint is
81
72
  reached. Pointerdown classifies actual input (not media queries): non-touch
82
- pointers temporarily disable user scrolling while programmatic toggles still
83
- work. A non-passive wheel listener excludes horizontal/Shift-wheel scrolling;
84
- vertical wheel scrolling and Ctrl-wheel browser zoom remain native. Both action
85
- buttons use `touch-action: manipulation`.
73
+ pointers temporarily disable user scrolling. A non-passive wheel listener excludes horizontal/Shift-wheel scrolling;
74
+ vertical wheel scrolling and Ctrl-wheel browser zoom remain native. The action
75
+ button uses `touch-action: manipulation`.
86
76
 
87
77
  ## Verification
88
78
 
@@ -91,7 +81,7 @@ bun test ./packages/components/src/atomic/SwipeAction/__tests__/
91
81
  ```
92
82
 
93
83
  Happy-dom tests model scroll geometry/state, RTL, disabling, inertness,
94
- explicit deletion, focus restoration, input classification, wheel exclusion and
84
+ explicit deletion, input classification, wheel exclusion and
95
85
  SSR. It does not implement layout or native scrolling.
96
86
 
97
87
  ```sh
@@ -101,7 +91,7 @@ bun packages/components/tests/quantity-cart/run.ts
101
91
  The Chromium runner exercises trusted CDP touch, mouse/pen and wheel input,
102
92
  including hybrid desktop/touch profiles, a real enclosing `Stack tabIndex={-1}`,
103
93
  reverse swipes, held partial-touch pixel checks for destructive paint, closed
104
- clipping/accessibility/hit-test checks, immediate explicit trash, interactive exclusions, focus, RTL,
94
+ clipping/accessibility/hit-test checks, interactive exclusions, focus, RTL,
105
95
  responsive geometry, CSS zoom, reduced motion and scoped axe checks.
106
96
  These are emulated inputs, not physical-device certification. CDP pinch did not
107
97
  increase visual viewport scale on either the fixture or a plain control page;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/components",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Styled UI components for DoNotDev",