@synerise/ds-popconfirm 1.4.0 → 1.4.2
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/CHANGELOG.md +8 -0
- package/CLAUDE.md +157 -0
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.4.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-popconfirm@1.4.1...@synerise/ds-popconfirm@1.4.2) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-popconfirm
|
|
9
|
+
|
|
10
|
+
## [1.4.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-popconfirm@1.4.0...@synerise/ds-popconfirm@1.4.1) (2026-07-16)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-popconfirm
|
|
13
|
+
|
|
6
14
|
# [1.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-popconfirm@1.3.25...@synerise/ds-popconfirm@1.4.0) (2026-06-27)
|
|
7
15
|
|
|
8
16
|
### Features
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Popconfirm (`@synerise/ds-popconfirm`)
|
|
2
|
+
|
|
3
|
+
> A floating confirmation dialog that wraps a trigger element and requires the user to confirm or cancel an action, with optional image carousel, close icon, and description.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
Popconfirm.tsx — main component (forwardRef, wraps @synerise/ds-popover)
|
|
10
|
+
Popconfirm.types.ts — PopconfirmProps, PopconfirmType, PopconfirmTexts
|
|
11
|
+
Popconfirm.styles.tsx — all styled-components for Popconfirm
|
|
12
|
+
Popconfirm.const.ts — POPOVER_OFFSET_CONFIG (mainAxis: 16)
|
|
13
|
+
ConfirmMessage/
|
|
14
|
+
ConfirmMessage.tsx — standalone tooltip-based confirm message component
|
|
15
|
+
ConfirmMessage.types.ts — ConfirmMessageProps
|
|
16
|
+
ConfirmMessage.style.ts — styled-components for ConfirmMessage
|
|
17
|
+
utils/
|
|
18
|
+
getTransitionConfig.ts — scaleY transition config for @floating-ui/react
|
|
19
|
+
index.ts — public exports
|
|
20
|
+
modules.d.ts — *.less module declaration
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Public exports
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import Popconfirm, { ConfirmMessage } from '@synerise/ds-popconfirm';
|
|
27
|
+
// types
|
|
28
|
+
import type { PopconfirmProps, PopconfirmTexts, ConfirmMessageProps } from '@synerise/ds-popconfirm';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `default` — `Popconfirm` component (also has `.ConfirmMessage` attached — deprecated access pattern)
|
|
32
|
+
- `ConfirmMessage` — named export (preferred)
|
|
33
|
+
- `PopconfirmProps` — type
|
|
34
|
+
- `PopconfirmTexts` — type (picks `okText | description | title | cancelText` from `PopconfirmProps`)
|
|
35
|
+
- `ConfirmMessageProps` — type
|
|
36
|
+
|
|
37
|
+
### `Popconfirm`
|
|
38
|
+
|
|
39
|
+
`forwardRef<HTMLElement, PopconfirmProps>` — delegates positioning/open state to `@synerise/ds-popover`.
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
|------|------|---------|-------------|
|
|
43
|
+
| `title` | `ReactNode` | — | Header text/node |
|
|
44
|
+
| `description` | `ReactNode` | — | Body text/node below title |
|
|
45
|
+
| `icon` | `ReactNode` | — | Icon displayed left of the title |
|
|
46
|
+
| `closeIcon` | `ReactNode` | — | Icon rendered as a close button (top-right); clicking it closes the popconfirm |
|
|
47
|
+
| `titlePadding` | `boolean` | — | Adjusts close icon margin and description top spacing |
|
|
48
|
+
| `images` | `string[]` | — | URLs rendered in a `@synerise/ds-carousel` (fade effect) |
|
|
49
|
+
| `imagesAutoplay` | `boolean` | — | Enables carousel autoplay |
|
|
50
|
+
| `imagesAutoplaySpeed` | `number` | `5000` | Autoplay interval in ms |
|
|
51
|
+
| `withLink` | `ReactNode` | — | Inline link node rendered below description |
|
|
52
|
+
| `cancelText` | `ReactNode` | — | Label for the cancel button |
|
|
53
|
+
| `cancelButtonProps` | `ButtonProps` | — | Extra props merged onto the cancel `@synerise/ds-button` |
|
|
54
|
+
| `okText` | `ReactNode` | — | Label for the confirm button |
|
|
55
|
+
| `okButtonProps` | `ButtonProps` | — | Extra props merged onto the confirm `@synerise/ds-button` |
|
|
56
|
+
| `okType` | `ButtonProps['type']` | `'primary'` | Type variant of the confirm button |
|
|
57
|
+
| `hideButtons` | `ReactNode` | — | Truthy value hides the button row entirely (type is `ReactNode`, not `boolean`) |
|
|
58
|
+
| `buttonsAlign` | `'left' \| 'right'` | — | Flex alignment of the button wrapper (`flex-start` for both; `right` omitted maps to `flex-end`) |
|
|
59
|
+
| `disabled` | `boolean` | — | When true, renders only `{children}` with no popover |
|
|
60
|
+
| `staticVisible` | `boolean` | — | Prevents dismiss on outside click (`dismissConfig.enabled = false`) |
|
|
61
|
+
| `placement` | `LegacyPopconfirmPlacement` | `'top'` | Popover placement (maps to `@floating-ui` placement via `getPlacement`) |
|
|
62
|
+
| `trigger` | `PopoverOptions['trigger']` | `'click'` | Open trigger (`'click'`, `'hover'`, or array) |
|
|
63
|
+
| `open` | `boolean` | — | Controlled open state (one-way: only syncs `false → true`) |
|
|
64
|
+
| `onOpenChange` | `(open: boolean) => void` | — | Callback when open state changes |
|
|
65
|
+
| `overlayClassName` | `string` | — | Class applied to the popconfirm container div |
|
|
66
|
+
| `overlayStyle` | `CSSProperties` | — | Inline styles applied to the popconfirm container div |
|
|
67
|
+
| `zIndex` | `number` | `theme.variables['zindex-popconfirm']` | Z-index override |
|
|
68
|
+
| `asChild` | `boolean` | `true` | Passed to `PopoverTrigger`; merges props onto the single child element |
|
|
69
|
+
| `children` | `ReactNode` | — | The trigger element |
|
|
70
|
+
| `getPopupContainer` | `PopoverOptions['getPopupContainer']` | — | Portal mount node override |
|
|
71
|
+
| `offsetConfig` | `PopoverOptions['offsetConfig']` | — | Override default 16px offset |
|
|
72
|
+
| `flipConfig` | `PopoverOptions['flipConfig']` | — | Flip middleware config |
|
|
73
|
+
| `shiftConfig` | `PopoverOptions['shiftConfig']` | — | Shift middleware config |
|
|
74
|
+
|
|
75
|
+
**`LegacyPopconfirmPlacement`** values: `'topLeft' | 'top' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottom' | 'bottomCenter' | 'bottomRight' | 'right' | 'left' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'`
|
|
76
|
+
|
|
77
|
+
### `ConfirmMessage`
|
|
78
|
+
|
|
79
|
+
A lightweight confirmation feedback component: clicking the child triggers `onClick(showMessage)`, and the consumer calls `showMessage()` to display a timed tooltip overlay.
|
|
80
|
+
|
|
81
|
+
| Prop | Type | Default | Description |
|
|
82
|
+
|------|------|---------|-------------|
|
|
83
|
+
| `title` | `string` | — | **Required.** Text shown inside the tooltip message |
|
|
84
|
+
| `onClick` | `(showMessage: () => void) => void` | — | **Required.** Consumer receives a callback to imperatively show the message |
|
|
85
|
+
| `children` | `ReactNode` | — | Trigger element |
|
|
86
|
+
| `icon` | `ReactNode` | — | Icon shown left of the title in the message |
|
|
87
|
+
| `displayDuration` | `number` | `5000` | How long (ms) the message stays visible |
|
|
88
|
+
| `placement` | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight'` | `'topLeft'` | Tooltip placement |
|
|
89
|
+
|
|
90
|
+
## Usage patterns
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import Popconfirm from '@synerise/ds-popconfirm';
|
|
94
|
+
|
|
95
|
+
// Basic
|
|
96
|
+
<Popconfirm
|
|
97
|
+
title="Are you sure?"
|
|
98
|
+
okText="Yes"
|
|
99
|
+
cancelText="No"
|
|
100
|
+
onConfirm={() => doSomething()}
|
|
101
|
+
onCancel={() => {}}
|
|
102
|
+
>
|
|
103
|
+
<button>Delete</button>
|
|
104
|
+
</Popconfirm>
|
|
105
|
+
|
|
106
|
+
// With description and image carousel
|
|
107
|
+
<Popconfirm
|
|
108
|
+
title="Are you sure?"
|
|
109
|
+
description="This action cannot be undone."
|
|
110
|
+
images={['https://example.com/img.jpg']}
|
|
111
|
+
imagesAutoplay
|
|
112
|
+
>
|
|
113
|
+
<button>Delete</button>
|
|
114
|
+
</Popconfirm>
|
|
115
|
+
|
|
116
|
+
// ConfirmMessage (named import preferred)
|
|
117
|
+
import { ConfirmMessage } from '@synerise/ds-popconfirm';
|
|
118
|
+
|
|
119
|
+
<ConfirmMessage
|
|
120
|
+
title="Copied!"
|
|
121
|
+
icon={<Icon component={<WarningFillM />} />}
|
|
122
|
+
onClick={(showMessage) => { copyToClipboard(); showMessage(); }}
|
|
123
|
+
>
|
|
124
|
+
<button>Copy</button>
|
|
125
|
+
</ConfirmMessage>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Styling
|
|
129
|
+
|
|
130
|
+
- Container: `max-width: 288px`, `padding: 16px`, `border-radius: 3px`, `background: theme.palette.white`, shadow from `theme.variables['box-shadow-2']`
|
|
131
|
+
- Title: `14px`, `font-weight: 500`, `color: theme.palette['grey-800']`
|
|
132
|
+
- Description: `13px`, `font-weight: 400`; `margin-top: 6px` only when `titlePadding` is falsy
|
|
133
|
+
- Buttons: `height: 32px`; cancel is always `type="secondary"`, confirm uses `okType`
|
|
134
|
+
- Arrow: custom SVG triangle, positioned via CSS classes (`ds-popover-arrow-*`) — rotated per placement
|
|
135
|
+
- Carousel dots: ds-carousel's `.ds-carousel-dots` restyled here to round dots; active dot (`.ds-carousel-dot-active`) uses `theme.palette['green-600']` border
|
|
136
|
+
- `ConfirmMessage` styles contain a hardcoded colour (`#404c5a` for text) — not a design token
|
|
137
|
+
|
|
138
|
+
## Key dependencies
|
|
139
|
+
|
|
140
|
+
- `@synerise/ds-popover` — provides `Popover`, `PopoverTrigger`, `PopoverContent`, `PopoverArrow`, `getPlacement`
|
|
141
|
+
- `@synerise/ds-button` — cancel and confirm buttons
|
|
142
|
+
- `@synerise/ds-tooltip` — used by `ConfirmMessage` internally
|
|
143
|
+
- `@synerise/ds-core` — `useTheme` for z-index and colour tokens
|
|
144
|
+
- `@synerise/ds-carousel` — image slideshow (fade + dots)
|
|
145
|
+
- `@floating-ui/react` — `UseTransitionStylesProps` (peer dep declared as devDependency)
|
|
146
|
+
|
|
147
|
+
## Implementation notes
|
|
148
|
+
|
|
149
|
+
- **Controlled `open` is one-way.** The effect only syncs `false → true` (sets `isOpen` when `open` becomes truthy but never back to `false`). Fully controlled close must be done by not passing `open=true`.
|
|
150
|
+
- **`disabled` short-circuits entirely** — renders `<>{children}</>` with no popover infrastructure mounted.
|
|
151
|
+
- **`staticVisible`** disables `@floating-ui` dismiss middleware; the popover will not close on outside click or blur.
|
|
152
|
+
- **`asChild=true` (default)** merges trigger props onto the direct child element using `PopoverTrigger`. Set `asChild={false}` to wrap the child in a span instead.
|
|
153
|
+
- **`hideButtons` type is `ReactNode`**, not `boolean`. Any truthy value hides buttons. This is a type inaccuracy in the source.
|
|
154
|
+
- **`Popconfirm.ConfirmMessage`** is a deprecated access pattern — use the named export `ConfirmMessage` instead (JSDoc `@deprecated` comment in `Popconfirm.tsx`).
|
|
155
|
+
- **`buttonsAlign`** default is effectively right-aligned (`flex-end`) when undefined, but the README says default is `'right'` — the prop simply being absent achieves the same visual result via a falsy branch.
|
|
156
|
+
- Tests use **Jest** (not Vitest), consistent with `jest.config.js` present in package root.
|
|
157
|
+
- `@floating-ui/react` is listed only in `devDependencies` despite `getTransitionConfig.ts` importing its types — safe at runtime because types are erased, but indicates the package relies on the host having it transitively.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-popconfirm",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Popconfirm UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"/dist",
|
|
19
19
|
"CHANGELOG.md",
|
|
20
|
+
"CLAUDE.md",
|
|
20
21
|
"README.md",
|
|
21
22
|
"package.json",
|
|
22
23
|
"LICENSE.md"
|
|
@@ -41,12 +42,12 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-button": "^1.5.
|
|
45
|
-
"@synerise/ds-carousel": "^1.1.
|
|
46
|
-
"@synerise/ds-icon": "^1.18.
|
|
47
|
-
"@synerise/ds-popover": "^1.6.
|
|
48
|
-
"@synerise/ds-tooltip": "^1.5.
|
|
49
|
-
"@synerise/ds-utils": "^1.10.
|
|
45
|
+
"@synerise/ds-button": "^1.5.35",
|
|
46
|
+
"@synerise/ds-carousel": "^1.1.1",
|
|
47
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
48
|
+
"@synerise/ds-popover": "^1.6.2",
|
|
49
|
+
"@synerise/ds-tooltip": "^1.5.4",
|
|
50
|
+
"@synerise/ds-utils": "^1.10.2"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@floating-ui/react": "^0.27.16",
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"styled-components": "^5.3.3",
|
|
59
60
|
"vitest": "4"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
|
|
62
63
|
}
|