@khipu/design-system 0.1.0-alpha.54 → 0.1.0-alpha.56
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
13
13
|
* Source: design-system/src/tokens/tokens.json
|
|
14
|
-
* Generated: 2026-
|
|
14
|
+
* Generated: 2026-05-04T19:11:26.827Z
|
|
15
15
|
*
|
|
16
16
|
* To regenerate:
|
|
17
17
|
* cd design-system && npm run tokens:generate
|
|
@@ -5177,15 +5177,35 @@ dialog#surveyModal button.circle {
|
|
|
5177
5177
|
|
|
5178
5178
|
/* ========================================
|
|
5179
5179
|
16 - SEGMENTED TABS (.kds-segmented-tabs)
|
|
5180
|
-
Pill-group toggle
|
|
5180
|
+
Pill-group toggle with sliding indicator
|
|
5181
5181
|
======================================== */
|
|
5182
5182
|
|
|
5183
5183
|
.kds-segmented-tabs {
|
|
5184
|
+
--_tab-count: 2;
|
|
5185
|
+
--_active-idx: 0;
|
|
5184
5186
|
height: var(--kds-spacing-5);
|
|
5185
|
-
background: var(--kds-color-background-
|
|
5187
|
+
background: var(--kds-color-background-muted);
|
|
5186
5188
|
border-radius: var(--kds-radius-lg);
|
|
5187
5189
|
padding: var(--kds-spacing-0-25);
|
|
5188
5190
|
display: flex;
|
|
5191
|
+
position: relative;
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5194
|
+
/* Sliding pill indicator */
|
|
5195
|
+
.kds-segmented-tabs::before {
|
|
5196
|
+
content: "";
|
|
5197
|
+
position: absolute;
|
|
5198
|
+
top: var(--kds-spacing-0-25);
|
|
5199
|
+
bottom: var(--kds-spacing-0-25);
|
|
5200
|
+
left: var(--kds-spacing-0-25);
|
|
5201
|
+
width: calc((100% - var(--kds-spacing-0-25) * 2) / var(--_tab-count));
|
|
5202
|
+
border-radius: calc(var(--kds-radius-lg) - var(--kds-spacing-0-25));
|
|
5203
|
+
background: var(--kds-color-background-default);
|
|
5204
|
+
box-shadow: var(--kds-shadow-card);
|
|
5205
|
+
transition: transform var(--kds-transition-standard) var(--kds-easing-standard);
|
|
5206
|
+
transform: translateX(calc(var(--_active-idx) * 100%));
|
|
5207
|
+
z-index: 0;
|
|
5208
|
+
pointer-events: none;
|
|
5189
5209
|
}
|
|
5190
5210
|
|
|
5191
5211
|
.kds-segmented-tabs.kds-segmented-tabs button {
|
|
@@ -5197,14 +5217,26 @@ dialog#surveyModal button.circle {
|
|
|
5197
5217
|
font-size: var(--kds-font-size-sm);
|
|
5198
5218
|
color: var(--kds-color-text-secondary);
|
|
5199
5219
|
cursor: pointer;
|
|
5200
|
-
transition:
|
|
5220
|
+
transition: color var(--kds-transition-shorter);
|
|
5221
|
+
position: relative;
|
|
5222
|
+
z-index: 1;
|
|
5223
|
+
display: flex;
|
|
5224
|
+
align-items: center;
|
|
5225
|
+
justify-content: center;
|
|
5226
|
+
box-sizing: border-box;
|
|
5227
|
+
block-size: auto;
|
|
5201
5228
|
}
|
|
5202
5229
|
|
|
5203
5230
|
.kds-segmented-tabs.kds-segmented-tabs button.active,
|
|
5204
5231
|
.kds-segmented-tabs.kds-segmented-tabs button[aria-selected="true"] {
|
|
5205
|
-
background:
|
|
5206
|
-
color: var(--kds-color-primary
|
|
5207
|
-
|
|
5232
|
+
background: transparent;
|
|
5233
|
+
color: var(--kds-color-text-primary);
|
|
5234
|
+
font-weight: var(--kds-font-weight-semibold);
|
|
5235
|
+
}
|
|
5236
|
+
|
|
5237
|
+
/* Auto-managed tab panels: hidden attribute must win over any display rule */
|
|
5238
|
+
[data-kds-tab-panel][hidden] {
|
|
5239
|
+
display: none;
|
|
5208
5240
|
}
|
|
5209
5241
|
|
|
5210
5242
|
|
|
@@ -5671,6 +5703,7 @@ button.kds-btn-success::after {
|
|
|
5671
5703
|
margin-top: var(--kds-spacing-1);
|
|
5672
5704
|
}
|
|
5673
5705
|
|
|
5706
|
+
|
|
5674
5707
|
/* -- Field group spacing -- */
|
|
5675
5708
|
.kds-field-group {
|
|
5676
5709
|
margin-top: var(--kds-spacing-1-75);
|
|
@@ -1135,11 +1135,34 @@ const ui = _context.ui;
|
|
|
1135
1135
|
/**
|
|
1136
1136
|
* Initialize segmented tabs
|
|
1137
1137
|
* Delegated click on .kds-segmented-tabs button toggles .active and aria-selected
|
|
1138
|
+
* Sets --_active-idx and --_tab-count CSS custom properties for sliding pill animation
|
|
1139
|
+
* Auto-manages tab panels via data-kds-tab-panel attributes on sibling elements
|
|
1138
1140
|
* Dispatches kds:tab:change with { index, button }
|
|
1139
1141
|
* @param {Element} root - Root element to scope listeners (default: document)
|
|
1140
1142
|
*/
|
|
1141
1143
|
function initSegmentedTabs(root) {
|
|
1142
1144
|
root = root || document;
|
|
1145
|
+
|
|
1146
|
+
/* Set initial CSS vars and panel visibility on all segmented-tab containers */
|
|
1147
|
+
root.querySelectorAll('.kds-segmented-tabs').forEach(function(tabs) {
|
|
1148
|
+
var buttons = tabs.querySelectorAll('button');
|
|
1149
|
+
tabs.style.setProperty('--_tab-count', buttons.length);
|
|
1150
|
+
var activeIdx = 0;
|
|
1151
|
+
buttons.forEach(function(b, i) {
|
|
1152
|
+
if (b.classList.contains('active') || b.getAttribute('aria-selected') === 'true') activeIdx = i;
|
|
1153
|
+
});
|
|
1154
|
+
tabs.style.setProperty('--_active-idx', activeIdx);
|
|
1155
|
+
|
|
1156
|
+
/* Auto-bind panels: find sibling elements with data-kds-tab-panel */
|
|
1157
|
+
var parent = tabs.parentElement;
|
|
1158
|
+
if (parent) {
|
|
1159
|
+
var panels = parent.querySelectorAll('[data-kds-tab-panel]');
|
|
1160
|
+
panels.forEach(function(panel, i) {
|
|
1161
|
+
panel.hidden = i !== activeIdx;
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1143
1166
|
root.addEventListener('click', function(e) {
|
|
1144
1167
|
var btn = e.target.closest('.kds-segmented-tabs button');
|
|
1145
1168
|
if (!btn) return;
|
|
@@ -1156,6 +1179,16 @@ const ui = _context.ui;
|
|
|
1156
1179
|
btn.setAttribute('aria-selected', 'true');
|
|
1157
1180
|
|
|
1158
1181
|
var index = Array.prototype.indexOf.call(buttons, btn);
|
|
1182
|
+
tabs.style.setProperty('--_active-idx', index);
|
|
1183
|
+
|
|
1184
|
+
/* Auto-toggle panels */
|
|
1185
|
+
var parent = tabs.parentElement;
|
|
1186
|
+
if (parent) {
|
|
1187
|
+
parent.querySelectorAll('[data-kds-tab-panel]').forEach(function(panel, i) {
|
|
1188
|
+
panel.hidden = i !== index;
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1159
1192
|
tabs.dispatchEvent(new CustomEvent('kds:tab:change', {
|
|
1160
1193
|
bubbles: true,
|
|
1161
1194
|
detail: { index: index, button: btn }
|