@synerise/ds-short-cuts 1.0.55 → 1.0.57
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 +67 -0
- package/package.json +6 -5
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.0.57](https://github.com/Synerise/synerise-design/compare/@synerise/ds-short-cuts@1.0.56...@synerise/ds-short-cuts@1.0.57) (2026-08-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-short-cuts
|
|
9
|
+
|
|
10
|
+
## [1.0.56](https://github.com/Synerise/synerise-design/compare/@synerise/ds-short-cuts@1.0.55...@synerise/ds-short-cuts@1.0.56) (2026-07-23)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-short-cuts
|
|
13
|
+
|
|
6
14
|
## [1.0.55](https://github.com/Synerise/synerise-design/compare/@synerise/ds-short-cuts@1.0.54...@synerise/ds-short-cuts@1.0.55) (2026-06-17)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-short-cuts
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# ShortCuts (`@synerise/ds-short-cuts`)
|
|
2
|
+
|
|
3
|
+
> A keyboard shortcut badge component that renders a styled key cap containing either text or an icon, in two sizes and two color variants.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
ShortCuts.tsx — main component
|
|
10
|
+
ShortCuts.types.ts — ShortCutsProps (ExactlyOne<icon, children> + WithHTMLAttributes)
|
|
11
|
+
ShortCuts.style.ts — Wrapper styled component with size/color/autoWidth logic
|
|
12
|
+
index.ts — default export only
|
|
13
|
+
__specs__/
|
|
14
|
+
ShortCuts.spec.tsx — Vitest tests (2 cases: text render, icon render)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Public exports
|
|
18
|
+
|
|
19
|
+
### `ShortCuts` (default export)
|
|
20
|
+
|
|
21
|
+
`ShortCutsProps = WithHTMLAttributes<HTMLDivElement, { … }> & ExactlyOne<{ icon? }, { children? }>`
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
|------|------|---------|-------------|
|
|
25
|
+
| `size` | `'S' \| 'L'` | `'L'` | `L` = 24px height, `S` = 18px height |
|
|
26
|
+
| `color` | `'light' \| 'dark'` | — | `light` = white bg / grey border; `dark` = grey-600 bg / grey-500 border |
|
|
27
|
+
| `autoWidth` | `boolean` | — | When `false` (default), width equals height (square); when `true`, width is `auto` |
|
|
28
|
+
| `icon` | `ReactNode` | — | Icon to display (mutually exclusive with `children`) |
|
|
29
|
+
| `children` | `ReactNode` | — | Text label to display (mutually exclusive with `icon`) |
|
|
30
|
+
|
|
31
|
+
Accepts all standard `<div>` HTML attributes.
|
|
32
|
+
|
|
33
|
+
**`ExactlyOne` constraint** — TypeScript enforces that exactly one of `icon` or `children` is provided. Passing both or neither is a type error.
|
|
34
|
+
|
|
35
|
+
No type exports from `index.ts`.
|
|
36
|
+
|
|
37
|
+
## Usage patterns
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import ShortCuts from '@synerise/ds-short-cuts';
|
|
41
|
+
import { ArrowUpM } from '@synerise/ds-icon';
|
|
42
|
+
|
|
43
|
+
// Text shortcut
|
|
44
|
+
<ShortCuts size="L" color="dark">ESC</ShortCuts>
|
|
45
|
+
|
|
46
|
+
// Icon shortcut
|
|
47
|
+
<ShortCuts size="S" color="light" icon={<ArrowUpM />} />
|
|
48
|
+
|
|
49
|
+
// Auto-width for longer labels
|
|
50
|
+
<ShortCuts size="L" color="light" autoWidth>Ctrl</ShortCuts>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Styling
|
|
54
|
+
|
|
55
|
+
`ShortCuts.style.ts`. The `Wrapper` is a flex `div` centered on both axes. Padding and width are computed via `getPadding()` and `getWidth()` helper functions based on `size` and `isIcon`. Icon color is `white` for `dark` variant, `grey-600` for `light` variant (hardcoded via `theme.palette`, applied as `Icon` `color` prop). Font size is hardcoded `11px`. Box shadow opacity: `0.5` for dark, `0.08` for light.
|
|
56
|
+
|
|
57
|
+
## Key dependencies
|
|
58
|
+
|
|
59
|
+
- `@synerise/ds-icon` — renders the `icon` node with `size={12}` and appropriate color
|
|
60
|
+
- `@synerise/ds-typography` — `Text size="xsmall"` for text content
|
|
61
|
+
|
|
62
|
+
## Implementation notes
|
|
63
|
+
|
|
64
|
+
- **`icon` branch ignores `children`** — when `icon` is provided, `children` is never rendered even if passed (the `ExactlyOne` type prevents this in TypeScript but not at runtime).
|
|
65
|
+
- **`color` has no default value in props** — `color` is optional with no default; when omitted, the styled component's conditional `props.color === 'dark'` evaluates to `false`, rendering the light variant appearance.
|
|
66
|
+
- **`ShortCutsProps` not exported** — `index.ts` only exports the default component; the type is not publicly accessible without a deep import.
|
|
67
|
+
- **Uses Vitest**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-short-cuts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "ShortCuts 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,11 +42,11 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-icon": "^1.18.
|
|
45
|
-
"@synerise/ds-typography": "^1.1.
|
|
45
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
46
|
+
"@synerise/ds-typography": "^1.1.28"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@synerise/ds-utils": "^1.10.
|
|
49
|
+
"@synerise/ds-utils": "^1.10.2"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"@synerise/ds-core": "*",
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"styled-components": "^5.3.3",
|
|
54
55
|
"vitest": "4"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "6df24ed12cd5f276d8eccde730591807982e3385"
|
|
57
58
|
}
|