@synerise/ds-completed-within 1.2.30 → 1.2.31
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 +4 -0
- package/CLAUDE.md +99 -0
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.2.31](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@1.2.30...@synerise/ds-completed-within@1.2.31) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-completed-within
|
|
9
|
+
|
|
6
10
|
## [1.2.30](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@1.2.29...@synerise/ds-completed-within@1.2.30) (2026-07-16)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-completed-within
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# CompletedWithin (`@synerise/ds-completed-within`)
|
|
2
|
+
|
|
3
|
+
> A trigger button + dropdown picker that lets the user select a numeric value and a time period (e.g. "Completed within 3 days").
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
CompletedWithin.tsx — main component, state management + dropdown orchestration
|
|
10
|
+
CompletedWithin.types.ts — all prop interfaces and shared types
|
|
11
|
+
CompleteWithin.styles.ts — styled-components (note: intentional typo in filename)
|
|
12
|
+
index.ts — public exports
|
|
13
|
+
Settings/
|
|
14
|
+
Settings.tsx — dropdown content: InputNumber + Select for value/period
|
|
15
|
+
Settings.types.ts — SettingsProps (internal use only)
|
|
16
|
+
Settings.styles.ts — styled wrapper for the dropdown panel
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Public exports
|
|
20
|
+
|
|
21
|
+
### `CompletedWithin` (default export)
|
|
22
|
+
|
|
23
|
+
No `forwardRef`.
|
|
24
|
+
|
|
25
|
+
| Prop | Type | Default | Description |
|
|
26
|
+
|------|------|---------|-------------|
|
|
27
|
+
| `value` | `PeriodValue` | — | **Required.** Controlled value `{ period, value }`. |
|
|
28
|
+
| `onSetValue` | `(value: PeriodValue) => void` | — | **Required.** Called when dropdown closes with a valid value set. |
|
|
29
|
+
| `text` | `Partial<CompletedWithinTexts>` | see defaults below | Override any label. Merged with react-intl defaults. |
|
|
30
|
+
| `maxValue` | `number` | `undefined` | Upper bound for the numeric input. Value is clamped on dropdown close. |
|
|
31
|
+
| `periods` | `CustomPeriod[]` | Built-in 6 periods | Replaces the default period list entirely when provided. |
|
|
32
|
+
| `placeholder` | `string` | `undefined` | Label shown on the trigger button when no value is set. |
|
|
33
|
+
| `tooltip` | `string` | `undefined` | Tooltip shown on hover over the trigger button. |
|
|
34
|
+
| `readOnly` | `boolean` | `undefined` | Hides the dropdown and clear button; renders trigger only. |
|
|
35
|
+
|
|
36
|
+
### `PeriodValue` (type)
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
{ period: Period; value?: number }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### `Period` (type)
|
|
43
|
+
|
|
44
|
+
`'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'MONTHS' | 'YEARS' | string | undefined`
|
|
45
|
+
(uses `LiteralStringUnion` — accepts those literals with IDE autocomplete, but allows any string for custom periods)
|
|
46
|
+
|
|
47
|
+
### `CustomPeriod` (type)
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
{ value: Period; label: ReactNode }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `CompletedWithinTexts` (type)
|
|
54
|
+
|
|
55
|
+
| Key | Type | Default |
|
|
56
|
+
|-----|------|---------|
|
|
57
|
+
| `header` | `ReactNode` | `'Completed within'` |
|
|
58
|
+
| `completedLabel` | `ReactNode` | `'Completed within'` |
|
|
59
|
+
| `clear` | `ReactNode` | `'Clear'` |
|
|
60
|
+
| `periodPlaceholder` | `ReactNode` | `'Interval'` |
|
|
61
|
+
|
|
62
|
+
### `CompletedWithinProps` (type)
|
|
63
|
+
|
|
64
|
+
Re-exported props interface.
|
|
65
|
+
|
|
66
|
+
## Usage patterns
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import CompletedWithin from '@synerise/ds-completed-within';
|
|
70
|
+
import type { PeriodValue } from '@synerise/ds-completed-within';
|
|
71
|
+
|
|
72
|
+
const [value, setValue] = useState<PeriodValue>({ period: undefined, value: undefined });
|
|
73
|
+
|
|
74
|
+
<CompletedWithin
|
|
75
|
+
value={value}
|
|
76
|
+
onSetValue={setValue}
|
|
77
|
+
placeholder="Completed within"
|
|
78
|
+
maxValue={365}
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Implementation notes
|
|
83
|
+
|
|
84
|
+
- **`onSetValue` fires on dropdown close**, not on each keystroke. The component buffers changes in internal state (`innerValue`, `innerPeriod`) and only calls `onSetValue` when the Dropdown `onOpenChange` fires with `visible: false` AND both `innerValue` and `innerPeriod` are set.
|
|
85
|
+
- **`maxValue` clamping** — if `innerValue > maxValue` when the dropdown closes, `maxValue` is used instead. This happens silently with no validation UI.
|
|
86
|
+
- **Clear button** — only shown when `value.value !== undefined && value.value > 0` AND `readOnly` is false. Calls `onSetValue({ value: undefined, period: undefined })`.
|
|
87
|
+
- **Trigger mode** — renders as `'icon-label'` (clock icon + text) when a value is set or `placeholder` is provided, otherwise `'single-icon'` (clock only).
|
|
88
|
+
- **Default periods** are translated via react-intl using `DS.COMPLETED-WITHIN.{PERIOD}` message IDs. Custom `periods` prop bypasses i18n entirely.
|
|
89
|
+
- **`IntlProvider` required** — uses `useIntl()` directly. Wrap the app in `IntlProvider` or all text will fall back to English defaults.
|
|
90
|
+
- **Filename typo**: styles file is `CompleteWithin.styles.ts` (missing "d"), not `CompletedWithin.styles.ts`.
|
|
91
|
+
- **`DEFAULT_PERIODS`** is exported from `CompletedWithin.tsx` (not re-exported from `index.ts`) — not part of the public API.
|
|
92
|
+
|
|
93
|
+
## Key dependencies
|
|
94
|
+
|
|
95
|
+
- `@synerise/ds-dropdown` — wraps the Settings panel
|
|
96
|
+
- `@synerise/ds-tooltip` — trigger button hover tooltip (hidden while dropdown is open)
|
|
97
|
+
- `@synerise/ds-input-number` — numeric value input in Settings
|
|
98
|
+
- `@synerise/ds-select` — period selection in Settings
|
|
99
|
+
- `react-intl` — i18n for default labels
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-completed-within",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.31",
|
|
4
4
|
"description": "CompletedWithin 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,14 +42,14 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-button": "^1.5.
|
|
45
|
-
"@synerise/ds-dropdown": "^1.3.
|
|
46
|
-
"@synerise/ds-icon": "^1.18.
|
|
47
|
-
"@synerise/ds-input": "^1.7.
|
|
48
|
-
"@synerise/ds-input-number": "^1.2.
|
|
49
|
-
"@synerise/ds-select": "^1.3.
|
|
50
|
-
"@synerise/ds-tooltip": "^1.5.
|
|
51
|
-
"@synerise/ds-utils": "^1.10.
|
|
45
|
+
"@synerise/ds-button": "^1.5.35",
|
|
46
|
+
"@synerise/ds-dropdown": "^1.3.20",
|
|
47
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
48
|
+
"@synerise/ds-input": "^1.7.13",
|
|
49
|
+
"@synerise/ds-input-number": "^1.2.50",
|
|
50
|
+
"@synerise/ds-select": "^1.3.34",
|
|
51
|
+
"@synerise/ds-tooltip": "^1.5.4",
|
|
52
|
+
"@synerise/ds-utils": "^1.10.2"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"vitest": "4"
|
|
@@ -60,5 +61,5 @@
|
|
|
60
61
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
61
62
|
"styled-components": "^5.3.3"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
|
|
64
65
|
}
|