@ckwag/elements 0.0.1-dev.07ede41
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/LICENSE +191 -0
- package/README.md +83 -0
- package/dist/Button/Button.css +265 -0
- package/dist/Button/Button.d.ts +29 -0
- package/dist/Button/Button.d.ts.map +1 -0
- package/dist/Button/Button.js +28 -0
- package/dist/Button/Button.js.map +1 -0
- package/dist/Button/index.d.ts +3 -0
- package/dist/Button/index.d.ts.map +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/index.js.map +1 -0
- package/dist/InlineMessage/InlineMessage.css +161 -0
- package/dist/InlineMessage/InlineMessage.d.ts +30 -0
- package/dist/InlineMessage/InlineMessage.d.ts.map +1 -0
- package/dist/InlineMessage/InlineMessage.js +39 -0
- package/dist/InlineMessage/InlineMessage.js.map +1 -0
- package/dist/InlineMessage/index.d.ts +3 -0
- package/dist/InlineMessage/index.d.ts.map +1 -0
- package/dist/InlineMessage/index.js +2 -0
- package/dist/InlineMessage/index.js.map +1 -0
- package/dist/InputField/InputField.css +275 -0
- package/dist/InputField/InputField.d.ts +38 -0
- package/dist/InputField/InputField.d.ts.map +1 -0
- package/dist/InputField/InputField.js +42 -0
- package/dist/InputField/InputField.js.map +1 -0
- package/dist/InputField/index.d.ts +3 -0
- package/dist/InputField/index.d.ts.map +1 -0
- package/dist/InputField/index.js +2 -0
- package/dist/InputField/index.js.map +1 -0
- package/dist/PasswordInput/PasswordInput.css +67 -0
- package/dist/PasswordInput/PasswordInput.d.ts +21 -0
- package/dist/PasswordInput/PasswordInput.d.ts.map +1 -0
- package/dist/PasswordInput/PasswordInput.js +41 -0
- package/dist/PasswordInput/PasswordInput.js.map +1 -0
- package/dist/PasswordInput/index.d.ts +3 -0
- package/dist/PasswordInput/index.d.ts.map +1 -0
- package/dist/PasswordInput/index.js +2 -0
- package/dist/PasswordInput/index.js.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.css +235 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +50 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.js +141 -0
- package/dist/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/SegmentedControl/index.d.ts +3 -0
- package/dist/SegmentedControl/index.d.ts.map +1 -0
- package/dist/SegmentedControl/index.js +2 -0
- package/dist/SegmentedControl/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +11 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -0
- package/dist/styles.css +5 -0
- package/dist/styles.layered.css +5 -0
- package/package.json +69 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password Input Component Styles
|
|
3
|
+
*
|
|
4
|
+
* Extends InputField with a semantic-token visibility toggle.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.ckw-password-input .ckw-input-field__input::-ms-reveal,
|
|
8
|
+
.ckw-password-input .ckw-input-field__input::-ms-clear {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ckw-password-input .ckw-input-field__icon {
|
|
13
|
+
width: var(--spacing-xl);
|
|
14
|
+
height: var(--spacing-xl);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ckw-password-input__toggle {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
width: var(--spacing-xl);
|
|
22
|
+
height: var(--spacing-xl);
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
margin: 0;
|
|
26
|
+
border: none;
|
|
27
|
+
border-radius: var(--border-radius-full);
|
|
28
|
+
background: transparent;
|
|
29
|
+
color: var(--interactive-text);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
outline: none;
|
|
32
|
+
transition:
|
|
33
|
+
background-color 150ms ease,
|
|
34
|
+
color 150ms ease;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ckw-password-input__toggle:hover:not(:disabled) {
|
|
38
|
+
background-color: var(--background-hover);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ckw-password-input__toggle:active:not(:disabled) {
|
|
42
|
+
background-color: var(--interactive-secondary-active);
|
|
43
|
+
color: var(--text-on-interactive-secondary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ckw-password-input__toggle:focus-visible {
|
|
47
|
+
outline: var(--border-weight-m) solid var(--border-active);
|
|
48
|
+
outline-offset: 2px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ckw-password-input__toggle:disabled {
|
|
52
|
+
color: var(--text-tertiary);
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ckw-password-input__toggle-icon {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
width: 20px;
|
|
61
|
+
height: 20px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ckw-password-input__toggle-icon > svg {
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputFieldProps } from '../InputField/InputField';
|
|
3
|
+
import './PasswordInput.css';
|
|
4
|
+
export interface PasswordInputProps extends Omit<InputFieldProps, 'type' | 'icon'> {
|
|
5
|
+
/** Controlled visibility state. When true, the password is shown as plain text. */
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
/** Initial visibility state for uncontrolled usage. */
|
|
8
|
+
defaultVisible?: boolean;
|
|
9
|
+
/** Called whenever the visibility toggle requests a state change. */
|
|
10
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
11
|
+
/** Additional native button props for the visibility toggle. */
|
|
12
|
+
visibilityToggleButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Password Input component for secure password entry with a visibility toggle.
|
|
16
|
+
*
|
|
17
|
+
* Composes InputField so labels, errors, disabled state, native input props,
|
|
18
|
+
* generated ids, and semantic token styling stay consistent with text inputs.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PasswordInput: React.ForwardRefExoticComponent<Omit<PasswordInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
+
//# sourceMappingURL=PasswordInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordInput.d.ts","sourceRoot":"","sources":["../../src/PasswordInput/PasswordInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IAChF,mFAAmF;IACnF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,gEAAgE;IAChE,2BAA2B,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;CAC7E;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0GAmFzB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { IconViewOff, IconViewOn } from '@ckwag/elements-icons';
|
|
4
|
+
import { InputField } from '../InputField/InputField';
|
|
5
|
+
import './PasswordInput.css';
|
|
6
|
+
/**
|
|
7
|
+
* Password Input component for secure password entry with a visibility toggle.
|
|
8
|
+
*
|
|
9
|
+
* Composes InputField so labels, errors, disabled state, native input props,
|
|
10
|
+
* generated ids, and semantic token styling stay consistent with text inputs.
|
|
11
|
+
*/
|
|
12
|
+
export const PasswordInput = React.forwardRef(function PasswordInput({ visible, defaultVisible = false, onVisibilityChange, visibilityToggleButtonProps, disabled = false, className, ...inputFieldProps }, ref) {
|
|
13
|
+
const [uncontrolledVisible, setUncontrolledVisible] = React.useState(defaultVisible);
|
|
14
|
+
const isControlled = visible !== undefined;
|
|
15
|
+
const isVisible = visible ?? uncontrolledVisible;
|
|
16
|
+
const { className: toggleButtonClassName, 'aria-label': toggleAriaLabel = 'Passwort anzeigen oder verbergen', onClick: onToggleClick, onMouseDown: onToggleMouseDown, onPointerDown: onTogglePointerDown, ...toggleButtonProps } = visibilityToggleButtonProps ?? {};
|
|
17
|
+
const rootClasses = ['ckw-password-input', className ?? ''].filter(Boolean).join(' ');
|
|
18
|
+
const toggleClasses = ['ckw-password-input__toggle', toggleButtonClassName ?? '']
|
|
19
|
+
.filter(Boolean)
|
|
20
|
+
.join(' ');
|
|
21
|
+
const handleVisibilityToggle = (event) => {
|
|
22
|
+
const nextVisible = !isVisible;
|
|
23
|
+
if (!isControlled) {
|
|
24
|
+
setUncontrolledVisible(nextVisible);
|
|
25
|
+
}
|
|
26
|
+
onVisibilityChange?.(nextVisible);
|
|
27
|
+
onToggleClick?.(event);
|
|
28
|
+
};
|
|
29
|
+
const handleTogglePointerDown = (event) => {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
onTogglePointerDown?.(event);
|
|
32
|
+
};
|
|
33
|
+
const handleToggleMouseDown = (event) => {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
onToggleMouseDown?.(event);
|
|
36
|
+
};
|
|
37
|
+
const visibilityIcon = isVisible ? (React.createElement(IconViewOff, { size: 20, "aria-hidden": "true" })) : (React.createElement(IconViewOn, { size: 20, "aria-hidden": "true" }));
|
|
38
|
+
return (React.createElement(InputField, { ...inputFieldProps, ref: ref, className: rootClasses, disabled: disabled, type: isVisible ? 'text' : 'password', icon: React.createElement("button", { ...toggleButtonProps, className: toggleClasses, type: "button", disabled: disabled, "aria-label": toggleAriaLabel, "aria-pressed": isVisible, onClick: handleVisibilityToggle, onPointerDown: handleTogglePointerDown, onMouseDown: handleToggleMouseDown },
|
|
39
|
+
React.createElement("span", { className: "ckw-password-input__toggle-icon", "aria-hidden": "true" }, visibilityIcon)) }));
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=PasswordInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordInput.js","sourceRoot":"","sources":["../../src/PasswordInput/PasswordInput.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,qBAAqB,CAAC;AAa7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAC3C,SAAS,aAAa,CACpB,EACE,OAAO,EACP,cAAc,GAAG,KAAK,EACtB,kBAAkB,EAClB,2BAA2B,EAC3B,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,GAAG,eAAe,EACnB,EACD,GAAG;IAEH,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACrF,MAAM,YAAY,GAAG,OAAO,KAAK,SAAS,CAAC;IAC3C,MAAM,SAAS,GAAG,OAAO,IAAI,mBAAmB,CAAC;IACjD,MAAM,EACJ,SAAS,EAAE,qBAAqB,EAChC,YAAY,EAAE,eAAe,GAAG,kCAAkC,EAClE,OAAO,EAAE,aAAa,EACtB,WAA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AAE,GAAG,EACR,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EACrC,IAAI,EACF,mCACM,iBAAiB,EACrB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,gBACN,eAAe,kBACb,SAAS,EACvB,OAAO,EAAE,sBAAsB,EAC/B,aAAa,EAAE,uBAAuB,EACtC,WAAW,EAAE,qBAAqB;YAElC,8BAAM,SAAS,EAAC,iCAAiC,iBAAa,MAAM,IACjE,cAAc,CACV,CACA,GAEX,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PasswordInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PasswordInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segmented Control Styles
|
|
3
|
+
*
|
|
4
|
+
* Uses only semantic design tokens from @ckwag/elements-tokens.
|
|
5
|
+
* Container is a pill-shaped track with a sliding indicator behind segments.
|
|
6
|
+
*
|
|
7
|
+
* Types: Default (auto-width), Fill (equal-width stretch)
|
|
8
|
+
* Content modes: label, icon-label, icon-compact
|
|
9
|
+
* States: Default, Hover, Active (sliding indicator)
|
|
10
|
+
*
|
|
11
|
+
* Icon-compact uses CSS grid `0fr → 1fr` on each segment to animate the label
|
|
12
|
+
* width. The indicator is positioned via offsetLeft/offsetWidth in a
|
|
13
|
+
* useLayoutEffect — no hidden measurer needed.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/* ============================================
|
|
17
|
+
Container
|
|
18
|
+
============================================ */
|
|
19
|
+
|
|
20
|
+
.ckw-segmented-control {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: var(--spacing-3xs);
|
|
25
|
+
padding: var(--spacing-2xs);
|
|
26
|
+
background-color: var(--background-control);
|
|
27
|
+
border: var(--border-weight-s) solid var(--border-soft);
|
|
28
|
+
border-radius: var(--border-radius-full);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ckw-segmented-control--fill {
|
|
32
|
+
display: flex;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* ============================================
|
|
37
|
+
Sliding Indicator
|
|
38
|
+
============================================ */
|
|
39
|
+
|
|
40
|
+
.ckw-segmented-control__indicator {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: var(--spacing-2xs);
|
|
43
|
+
bottom: var(--spacing-2xs);
|
|
44
|
+
left: 0;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
background-color: var(--background-active);
|
|
47
|
+
border: var(--border-weight-s) solid var(--border-active);
|
|
48
|
+
border-radius: var(--border-radius-full);
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
will-change: transform, width;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ckw-segmented-control__indicator--animated {
|
|
54
|
+
transition:
|
|
55
|
+
transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
56
|
+
width 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ============================================
|
|
60
|
+
Segment (button)
|
|
61
|
+
============================================ */
|
|
62
|
+
|
|
63
|
+
.ckw-segmented-control__segment {
|
|
64
|
+
position: relative;
|
|
65
|
+
z-index: 1;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: var(--spacing-2xs);
|
|
70
|
+
height: var(--spacing-2xl);
|
|
71
|
+
padding: var(--spacing-2xs) var(--spacing-m);
|
|
72
|
+
border: var(--border-weight-s) solid transparent;
|
|
73
|
+
border-radius: var(--border-radius-full);
|
|
74
|
+
background: none;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
transition: background-color 150ms ease;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ckw-segmented-control--fill .ckw-segmented-control__segment {
|
|
81
|
+
flex: 1 0 0;
|
|
82
|
+
min-width: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Icon-compact segment: flexbox with centered content.
|
|
87
|
+
* The inner wrapper handles the grid animation for label collapse.
|
|
88
|
+
*/
|
|
89
|
+
.ckw-segmented-control__segment--compact {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
gap: 0;
|
|
94
|
+
padding: var(--spacing-2xs) var(--spacing-m);
|
|
95
|
+
transition: background-color 150ms ease;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* Inner wrapper for icon-compact: CSS grid animates label column.
|
|
100
|
+
* Columns: [icon: auto] [label: 0fr or 1fr]
|
|
101
|
+
*/
|
|
102
|
+
.ckw-segmented-control__compact-inner {
|
|
103
|
+
display: grid;
|
|
104
|
+
grid-template-columns: auto 0fr;
|
|
105
|
+
align-items: center;
|
|
106
|
+
width: max-content;
|
|
107
|
+
transition: grid-template-columns 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.ckw-segmented-control__segment--active .ckw-segmented-control__compact-inner {
|
|
111
|
+
grid-template-columns: auto 1fr;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Fill + compact: all segments equal width (1/n) by default.
|
|
115
|
+
When the active label needs more space, min-width: max-content
|
|
116
|
+
pushes it wider and the inactives shrink to accommodate. */
|
|
117
|
+
.ckw-segmented-control--fill .ckw-segmented-control__segment--compact {
|
|
118
|
+
flex: 1 1 0;
|
|
119
|
+
min-width: 0;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ckw-segmented-control--fill
|
|
124
|
+
.ckw-segmented-control__segment--compact.ckw-segmented-control__segment--active {
|
|
125
|
+
min-width: max-content;
|
|
126
|
+
overflow: visible;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Hover (non-active only) */
|
|
130
|
+
.ckw-segmented-control__segment:hover:not(.ckw-segmented-control__segment--active) {
|
|
131
|
+
background-color: var(--background-hover);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Active — visuals come from the indicator behind, keep segment transparent */
|
|
135
|
+
.ckw-segmented-control__segment--active {
|
|
136
|
+
background: none;
|
|
137
|
+
border-color: transparent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Focus */
|
|
141
|
+
.ckw-segmented-control__segment:focus-visible {
|
|
142
|
+
outline: var(--border-weight-m) solid var(--border-active);
|
|
143
|
+
outline-offset: 2px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ============================================
|
|
147
|
+
Label
|
|
148
|
+
============================================ */
|
|
149
|
+
|
|
150
|
+
.ckw-segmented-control__label {
|
|
151
|
+
font-family: var(--font-family-brand), sans-serif;
|
|
152
|
+
font-size: var(--label-m-size);
|
|
153
|
+
line-height: var(--label-m-height);
|
|
154
|
+
font-weight: var(--label-m-weight);
|
|
155
|
+
color: var(--text-secondary);
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
text-overflow: ellipsis;
|
|
158
|
+
transition: color 150ms ease;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.ckw-segmented-control__segment--active .ckw-segmented-control__label {
|
|
162
|
+
color: var(--text-on-interactive-secondary);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/*
|
|
166
|
+
* Icon-compact label: lives in the second grid column.
|
|
167
|
+
* When inactive the column is 0fr so the label collapses.
|
|
168
|
+
* Opacity fades slightly faster than the width collapse so
|
|
169
|
+
* truncated text is never visible.
|
|
170
|
+
*/
|
|
171
|
+
.ckw-segmented-control__label--compact {
|
|
172
|
+
display: block;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
text-overflow: clip;
|
|
176
|
+
min-width: 0;
|
|
177
|
+
margin-left: var(--spacing-2xs);
|
|
178
|
+
opacity: 1;
|
|
179
|
+
transition:
|
|
180
|
+
opacity 150ms cubic-bezier(0.4, 0, 0.2, 1) 100ms,
|
|
181
|
+
margin-left 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
182
|
+
color 150ms ease;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.ckw-segmented-control__label--faded {
|
|
186
|
+
margin-left: 0;
|
|
187
|
+
opacity: 0;
|
|
188
|
+
transition:
|
|
189
|
+
opacity 80ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
190
|
+
margin-left 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
191
|
+
color 150ms ease;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ============================================
|
|
195
|
+
Icon
|
|
196
|
+
============================================ */
|
|
197
|
+
|
|
198
|
+
.ckw-segmented-control__icon {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
width: 24px;
|
|
203
|
+
height: 24px;
|
|
204
|
+
flex-shrink: 0;
|
|
205
|
+
color: var(--text-secondary);
|
|
206
|
+
transition: color 150ms ease;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.ckw-segmented-control__icon > svg {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 100%;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.ckw-segmented-control__segment--active .ckw-segmented-control__icon {
|
|
215
|
+
color: var(--text-on-interactive-secondary);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* ============================================
|
|
219
|
+
Docs-only forced states
|
|
220
|
+
============================================ */
|
|
221
|
+
|
|
222
|
+
.ckw-segmented-control--state-hover
|
|
223
|
+
.ckw-segmented-control__segment:first-child:not(.ckw-segmented-control__segment--active) {
|
|
224
|
+
background-color: var(--background-hover);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.ckw-segmented-control--state-focus-visible .ckw-segmented-control__segment:first-child {
|
|
228
|
+
outline: var(--border-weight-m) solid var(--border-active);
|
|
229
|
+
outline-offset: 2px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.ckw-segmented-control--state-disabled {
|
|
233
|
+
opacity: 0.4;
|
|
234
|
+
pointer-events: none;
|
|
235
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SegmentedControl.css';
|
|
3
|
+
export type SegmentedControlType = 'Default' | 'Fill';
|
|
4
|
+
export type SegmentedControlContentMode = 'label' | 'icon-label' | 'icon-compact';
|
|
5
|
+
export interface Segment {
|
|
6
|
+
/** Unique value identifying this segment. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Visible label text. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Optional icon (24×24 SVG recommended). */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface SegmentedControlProps {
|
|
14
|
+
/** Array of segments to render. Minimum 2. */
|
|
15
|
+
segments: Segment[];
|
|
16
|
+
/** The `value` of the currently active segment. */
|
|
17
|
+
activeValue: string;
|
|
18
|
+
/** Called when the user selects a different segment. */
|
|
19
|
+
onChange?: (value: string) => void;
|
|
20
|
+
/** Layout type. Default = auto-width segments; Fill = equal-width stretch. */
|
|
21
|
+
type?: SegmentedControlType;
|
|
22
|
+
/**
|
|
23
|
+
* Content display mode:
|
|
24
|
+
* - `label` — label only (default)
|
|
25
|
+
* - `icon-label` — icon + label on all segments
|
|
26
|
+
* - `icon-compact` — active shows icon + label, inactive show icon only;
|
|
27
|
+
* uses CSS grid `0fr → 1fr` for smooth label animation.
|
|
28
|
+
*/
|
|
29
|
+
contentMode?: SegmentedControlContentMode;
|
|
30
|
+
/** Accessible name for the radio group. */
|
|
31
|
+
'aria-label'?: string;
|
|
32
|
+
/** Id of an element that labels the radio group. */
|
|
33
|
+
'aria-labelledby'?: string;
|
|
34
|
+
/** Additional CSS class names on the outer container. */
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Segmented Control allows users to switch between related options,
|
|
39
|
+
* views, or states within the same context.
|
|
40
|
+
*
|
|
41
|
+
* Features a sliding indicator that smoothly animates between segments.
|
|
42
|
+
* Supports three content modes: label-only, icon + label, and icon-compact.
|
|
43
|
+
* In icon-compact mode, each segment uses CSS grid with `0fr → 1fr` column
|
|
44
|
+
* transitions to animate the label width — no hidden measurer needed.
|
|
45
|
+
* The indicator is positioned via offsetLeft/offsetWidth in a useLayoutEffect.
|
|
46
|
+
* Two layout types: Default (auto-width) and Fill (equal-width stretch).
|
|
47
|
+
* All styling uses semantic design tokens.
|
|
48
|
+
*/
|
|
49
|
+
export declare function SegmentedControl({ segments, activeValue, onChange, type, contentMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, className, }: SegmentedControlProps): React.JSX.Element;
|
|
50
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,wBAAwB,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAC;AACtD,MAAM,MAAM,2BAA2B,GAAG,OAAO,GAAG,YAAY,GAAG,cAAc,CAAC;AAKlF,MAAM,WAAW,OAAO;IACtB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAgB,EAChB,WAAqB,EACrB,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,SAAS,GACV,EAAE,qBAAqB,qBAmLvB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './SegmentedControl.css';
|
|
4
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
|
5
|
+
// ---
|
|
6
|
+
/**
|
|
7
|
+
* Segmented Control allows users to switch between related options,
|
|
8
|
+
* views, or states within the same context.
|
|
9
|
+
*
|
|
10
|
+
* Features a sliding indicator that smoothly animates between segments.
|
|
11
|
+
* Supports three content modes: label-only, icon + label, and icon-compact.
|
|
12
|
+
* In icon-compact mode, each segment uses CSS grid with `0fr → 1fr` column
|
|
13
|
+
* transitions to animate the label width — no hidden measurer needed.
|
|
14
|
+
* The indicator is positioned via offsetLeft/offsetWidth in a useLayoutEffect.
|
|
15
|
+
* Two layout types: Default (auto-width) and Fill (equal-width stretch).
|
|
16
|
+
* All styling uses semantic design tokens.
|
|
17
|
+
*/
|
|
18
|
+
export function SegmentedControl({ segments, activeValue, onChange, type = 'Default', contentMode = 'label', 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, className, }) {
|
|
19
|
+
const containerRef = React.useRef(null);
|
|
20
|
+
const segmentRefs = React.useRef(new Map());
|
|
21
|
+
const [indicator, setIndicator] = React.useState(null);
|
|
22
|
+
const [hasAnimated, setHasAnimated] = React.useState(false);
|
|
23
|
+
const isCompact = contentMode === 'icon-compact';
|
|
24
|
+
// Stable key so effects don't re-fire on new array references.
|
|
25
|
+
const segmentsKey = segments.map((s) => `${s.value}:${s.label ?? ''}`).join('|');
|
|
26
|
+
// --- Indicator positioning (all modes) ---
|
|
27
|
+
const updateIndicator = React.useCallback(() => {
|
|
28
|
+
const container = containerRef.current;
|
|
29
|
+
const activeEl = segmentRefs.current.get(activeValue);
|
|
30
|
+
if (!container || !activeEl) {
|
|
31
|
+
setIndicator(null);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const cRect = container.getBoundingClientRect();
|
|
35
|
+
const aRect = activeEl.getBoundingClientRect();
|
|
36
|
+
const borderLeft = parseFloat(getComputedStyle(container).borderLeftWidth) || 0;
|
|
37
|
+
setIndicator({ left: aRect.left - cRect.left - borderLeft, width: aRect.width });
|
|
38
|
+
}, [activeValue]);
|
|
39
|
+
// Position on mount + when active changes
|
|
40
|
+
useIsomorphicLayoutEffect(() => {
|
|
41
|
+
updateIndicator();
|
|
42
|
+
if (!hasAnimated) {
|
|
43
|
+
requestAnimationFrame(() => setHasAnimated(true));
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
}, [activeValue, segmentsKey, type, contentMode, hasAnimated]);
|
|
47
|
+
// For compact mode: the grid transition changes segment widths over 250ms.
|
|
48
|
+
// We need to keep re-measuring the indicator during the transition so it
|
|
49
|
+
// tracks the active segment's position as it expands/collapses.
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!isCompact || !hasAnimated)
|
|
52
|
+
return;
|
|
53
|
+
let frameId;
|
|
54
|
+
const start = performance.now();
|
|
55
|
+
const duration = 280; // slightly longer than 250ms transition to be safe
|
|
56
|
+
const tick = () => {
|
|
57
|
+
updateIndicator();
|
|
58
|
+
if (performance.now() - start < duration) {
|
|
59
|
+
frameId = requestAnimationFrame(tick);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
frameId = requestAnimationFrame(tick);
|
|
63
|
+
return () => cancelAnimationFrame(frameId);
|
|
64
|
+
}, [isCompact, hasAnimated, activeValue, updateIndicator]);
|
|
65
|
+
// --- Render ---
|
|
66
|
+
const handleKeyDown = (event, index) => {
|
|
67
|
+
const lastIndex = segments.length - 1;
|
|
68
|
+
let nextIndex = index;
|
|
69
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
|
|
70
|
+
nextIndex = index === lastIndex ? 0 : index + 1;
|
|
71
|
+
}
|
|
72
|
+
else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
|
|
73
|
+
nextIndex = index === 0 ? lastIndex : index - 1;
|
|
74
|
+
}
|
|
75
|
+
else if (event.key === 'Home') {
|
|
76
|
+
nextIndex = 0;
|
|
77
|
+
}
|
|
78
|
+
else if (event.key === 'End') {
|
|
79
|
+
nextIndex = lastIndex;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
const nextSegment = segments[nextIndex];
|
|
86
|
+
onChange?.(nextSegment.value);
|
|
87
|
+
segmentRefs.current.get(nextSegment.value)?.focus();
|
|
88
|
+
};
|
|
89
|
+
const classes = [
|
|
90
|
+
'ckw-segmented-control',
|
|
91
|
+
isCompact ? 'ckw-segmented-control--compact' : '',
|
|
92
|
+
type === 'Fill' ? 'ckw-segmented-control--fill' : '',
|
|
93
|
+
className ?? '',
|
|
94
|
+
]
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
.join(' ');
|
|
97
|
+
return (React.createElement("div", { className: classes, role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ref: containerRef },
|
|
98
|
+
indicator && (React.createElement("div", { className: [
|
|
99
|
+
'ckw-segmented-control__indicator',
|
|
100
|
+
hasAnimated ? 'ckw-segmented-control__indicator--animated' : '',
|
|
101
|
+
]
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.join(' '), style: {
|
|
104
|
+
transform: `translateX(${indicator.left}px)`,
|
|
105
|
+
width: `${indicator.width}px`,
|
|
106
|
+
} })),
|
|
107
|
+
segments.map((segment) => {
|
|
108
|
+
const isActive = segment.value === activeValue;
|
|
109
|
+
const showIcon = contentMode === 'icon-label' || isCompact;
|
|
110
|
+
const showLabel = contentMode === 'label' || contentMode === 'icon-label' || isCompact;
|
|
111
|
+
const segmentClasses = [
|
|
112
|
+
'ckw-segmented-control__segment',
|
|
113
|
+
isActive ? 'ckw-segmented-control__segment--active' : '',
|
|
114
|
+
isCompact ? 'ckw-segmented-control__segment--compact' : '',
|
|
115
|
+
]
|
|
116
|
+
.filter(Boolean)
|
|
117
|
+
.join(' ');
|
|
118
|
+
const labelClasses = [
|
|
119
|
+
'ckw-segmented-control__label',
|
|
120
|
+
isCompact ? 'ckw-segmented-control__label--compact' : '',
|
|
121
|
+
isCompact && !isActive ? 'ckw-segmented-control__label--faded' : '',
|
|
122
|
+
]
|
|
123
|
+
.filter(Boolean)
|
|
124
|
+
.join(' ');
|
|
125
|
+
return (React.createElement("button", { key: segment.value, ref: (el) => {
|
|
126
|
+
if (el) {
|
|
127
|
+
segmentRefs.current.set(segment.value, el);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
segmentRefs.current.delete(segment.value);
|
|
131
|
+
}
|
|
132
|
+
}, className: segmentClasses, role: "tab", "aria-selected": isActive, "aria-label": segment.label, tabIndex: isActive ? 0 : -1, onClick: () => onChange?.(segment.value) }, isCompact ? (
|
|
133
|
+
/* Compact: inner wrapper so icon+label stay grouped for centering */
|
|
134
|
+
React.createElement("span", { className: "ckw-segmented-control__compact-inner" },
|
|
135
|
+
segment.icon && (React.createElement("span", { className: "ckw-segmented-control__icon" }, segment.icon)),
|
|
136
|
+
segment.label && React.createElement("span", { className: labelClasses }, segment.label))) : (React.createElement(React.Fragment, null,
|
|
137
|
+
showIcon && segment.icon && (React.createElement("span", { className: "ckw-segmented-control__icon" }, segment.icon)),
|
|
138
|
+
showLabel && segment.label && (React.createElement("span", { className: labelClasses }, segment.label))))));
|
|
139
|
+
})));
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,wBAAwB,CAAC;AAKhC,MAAM,yBAAyB,GAC7B,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;AAoC1E,MAAM;AAEN;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,GAAG,SAAS,EAChB,WAAW,GAAG,OAAO,EACrB,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,SAAS,GACa;IACtB,MAAM,YAAY,GAAG,KAAK,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AACzD,YAAY,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SegmentedControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Button } from './Button/index.js';
|
|
2
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from './Button/index.js';
|
|
3
|
+
export { InputField } from './InputField/index.js';
|
|
4
|
+
export type { InputFieldProps, InputFieldState } from './InputField/index.js';
|
|
5
|
+
export { PasswordInput } from './PasswordInput/index.js';
|
|
6
|
+
export type { PasswordInputProps } from './PasswordInput/index.js';
|
|
7
|
+
export { InlineMessage } from './InlineMessage/index.js';
|
|
8
|
+
export type { InlineMessageBreakpoint, InlineMessageProps, InlineMessageStatus, } from './InlineMessage/index.js';
|
|
9
|
+
export { SegmentedControl } from './SegmentedControl/index.js';
|
|
10
|
+
export type { Segment, SegmentedControlContentMode, SegmentedControlProps, SegmentedControlType, } from './SegmentedControl/index.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @ckwag/elements — public exports
|
|
2
|
+
export { Button } from './Button/index.js';
|
|
3
|
+
export { InputField } from './InputField/index.js';
|
|
4
|
+
export { PasswordInput } from './PasswordInput/index.js';
|
|
5
|
+
export { InlineMessage } from './InlineMessage/index.js';
|
|
6
|
+
export { SegmentedControl } from './SegmentedControl/index.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|