@superleapai/flow-ui 2.5.2 → 2.5.4
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/components/card-select.js +283 -0
- package/core/flow.js +76 -0
- package/dist/output.css +1 -1
- package/dist/superleap-flow.js +411 -44
- package/dist/superleap-flow.js.map +1 -1
- package/dist/superleap-flow.min.js +2 -2
- package/index.js +2 -0
- package/package.json +1 -1
package/dist/superleap-flow.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @superleapai/flow-ui v2.5.
|
|
2
|
+
* @superleapai/flow-ui v2.5.3
|
|
3
3
|
* A reusable design system for building multi-step forms
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-present SuperLeap
|
|
6
6
|
* Licensed under MIT
|
|
7
7
|
*
|
|
8
8
|
* Build: development
|
|
9
|
-
* Date: 2026-02-
|
|
9
|
+
* Date: 2026-02-25T17:41:37.089Z
|
|
10
10
|
*
|
|
11
11
|
* For documentation and examples, visit:
|
|
12
12
|
* https://github.com/superleap/superleap-flow
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
17
|
// ============================================
|
|
18
|
-
// File 1/
|
|
18
|
+
// File 1/42: node_modules/superleap-sdk/superleap.js
|
|
19
19
|
// ============================================
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -2642,7 +2642,7 @@
|
|
|
2642
2642
|
|
|
2643
2643
|
|
|
2644
2644
|
// ============================================
|
|
2645
|
-
// File 2/
|
|
2645
|
+
// File 2/42: core/superleapClient.js
|
|
2646
2646
|
// ============================================
|
|
2647
2647
|
|
|
2648
2648
|
/**
|
|
@@ -2810,7 +2810,7 @@
|
|
|
2810
2810
|
|
|
2811
2811
|
|
|
2812
2812
|
// ============================================
|
|
2813
|
-
// File 3/
|
|
2813
|
+
// File 3/42: core/bridge.js
|
|
2814
2814
|
// ============================================
|
|
2815
2815
|
|
|
2816
2816
|
/**
|
|
@@ -3338,7 +3338,7 @@
|
|
|
3338
3338
|
|
|
3339
3339
|
|
|
3340
3340
|
// ============================================
|
|
3341
|
-
// File 4/
|
|
3341
|
+
// File 4/42: core/crm.js
|
|
3342
3342
|
// ============================================
|
|
3343
3343
|
|
|
3344
3344
|
/**
|
|
@@ -3681,7 +3681,7 @@
|
|
|
3681
3681
|
|
|
3682
3682
|
|
|
3683
3683
|
// ============================================
|
|
3684
|
-
// File 5/
|
|
3684
|
+
// File 5/42: components/label.js
|
|
3685
3685
|
// ============================================
|
|
3686
3686
|
|
|
3687
3687
|
/**
|
|
@@ -3798,7 +3798,7 @@
|
|
|
3798
3798
|
|
|
3799
3799
|
|
|
3800
3800
|
// ============================================
|
|
3801
|
-
// File 6/
|
|
3801
|
+
// File 6/42: core/flow.js
|
|
3802
3802
|
// ============================================
|
|
3803
3803
|
|
|
3804
3804
|
/**
|
|
@@ -4393,6 +4393,81 @@
|
|
|
4393
4393
|
return field;
|
|
4394
4394
|
}
|
|
4395
4395
|
|
|
4396
|
+
/**
|
|
4397
|
+
* Create a card select field (uses CardSelect component when available, else radio fallback)
|
|
4398
|
+
* @param {Object} config - Configuration object
|
|
4399
|
+
* @param {string} config.label - Field label
|
|
4400
|
+
* @param {string} config.fieldId - State key for this field
|
|
4401
|
+
* @param {Array} config.options - Array of { value, label, description?, icon?, disabled? }
|
|
4402
|
+
* @param {boolean} [config.required] - Whether field is required
|
|
4403
|
+
* @param {Function} [config.onChange] - Optional change handler (receives selected value)
|
|
4404
|
+
* @param {string} [config.helpText] - Optional help text for tooltip
|
|
4405
|
+
* @param {boolean} [config.disabled] - Whether all cards are disabled
|
|
4406
|
+
* @param {string} [config.className] - Extra CSS class on card container
|
|
4407
|
+
* @returns {HTMLElement} Field wrapper element
|
|
4408
|
+
*/
|
|
4409
|
+
function createCardSelect(config) {
|
|
4410
|
+
const { label, fieldId, options = [], required = false, onChange, helpText = null, disabled = false, className } = config;
|
|
4411
|
+
|
|
4412
|
+
const field = createFieldWrapper(label, required, helpText);
|
|
4413
|
+
|
|
4414
|
+
if (getComponent("CardSelect") && getComponent("CardSelect").create) {
|
|
4415
|
+
const currentValue = get(fieldId);
|
|
4416
|
+
const cardSelectEl = getComponent("CardSelect").create({
|
|
4417
|
+
name: fieldId,
|
|
4418
|
+
options: options.map((opt) => ({
|
|
4419
|
+
value: opt.value,
|
|
4420
|
+
label: opt.label || opt.value,
|
|
4421
|
+
description: opt.description,
|
|
4422
|
+
icon: opt.icon,
|
|
4423
|
+
disabled: opt.disabled,
|
|
4424
|
+
})),
|
|
4425
|
+
value: currentValue,
|
|
4426
|
+
disabled,
|
|
4427
|
+
className,
|
|
4428
|
+
onChange: (value) => {
|
|
4429
|
+
set(fieldId, value);
|
|
4430
|
+
if (onChange) onChange(value);
|
|
4431
|
+
},
|
|
4432
|
+
});
|
|
4433
|
+
cardSelectEl._fieldId = fieldId;
|
|
4434
|
+
field.appendChild(cardSelectEl);
|
|
4435
|
+
return field;
|
|
4436
|
+
}
|
|
4437
|
+
|
|
4438
|
+
// Fallback: native radio buttons
|
|
4439
|
+
const radioGroup = document.createElement("div");
|
|
4440
|
+
radioGroup.className = "card-select-fallback";
|
|
4441
|
+
|
|
4442
|
+
options.forEach((opt) => {
|
|
4443
|
+
const wrapper = document.createElement("div");
|
|
4444
|
+
wrapper.className = "card-option";
|
|
4445
|
+
|
|
4446
|
+
const radio = document.createElement("input");
|
|
4447
|
+
radio.type = "radio";
|
|
4448
|
+
radio.name = fieldId;
|
|
4449
|
+
radio.value = opt.value;
|
|
4450
|
+
radio.id = `${fieldId}-${opt.value}`;
|
|
4451
|
+
radio.checked = get(fieldId) === opt.value;
|
|
4452
|
+
radio.disabled = disabled || !!opt.disabled;
|
|
4453
|
+
radio.addEventListener("change", () => {
|
|
4454
|
+
set(fieldId, opt.value);
|
|
4455
|
+
if (onChange) { onChange(opt.value); }
|
|
4456
|
+
});
|
|
4457
|
+
|
|
4458
|
+
const radioLabel = document.createElement("label");
|
|
4459
|
+
radioLabel.htmlFor = `${fieldId}-${opt.value}`;
|
|
4460
|
+
radioLabel.textContent = opt.label || opt.value;
|
|
4461
|
+
|
|
4462
|
+
wrapper.appendChild(radio);
|
|
4463
|
+
wrapper.appendChild(radioLabel);
|
|
4464
|
+
radioGroup.appendChild(wrapper);
|
|
4465
|
+
});
|
|
4466
|
+
|
|
4467
|
+
field.appendChild(radioGroup);
|
|
4468
|
+
return field;
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4396
4471
|
/**
|
|
4397
4472
|
* Create a multi-select field (uses MultiSelect component when available, else checkbox group)
|
|
4398
4473
|
* @param {Object} config - Configuration object
|
|
@@ -5577,6 +5652,7 @@
|
|
|
5577
5652
|
createTimePicker,
|
|
5578
5653
|
createDateTimePicker,
|
|
5579
5654
|
createRadioGroup,
|
|
5655
|
+
createCardSelect,
|
|
5580
5656
|
createMultiSelect,
|
|
5581
5657
|
createRecordSelect,
|
|
5582
5658
|
createRecordMultiSelect,
|
|
@@ -5641,7 +5717,7 @@
|
|
|
5641
5717
|
|
|
5642
5718
|
|
|
5643
5719
|
// ============================================
|
|
5644
|
-
// File 7/
|
|
5720
|
+
// File 7/42: components/toast.js
|
|
5645
5721
|
// ============================================
|
|
5646
5722
|
|
|
5647
5723
|
/**
|
|
@@ -5990,7 +6066,7 @@
|
|
|
5990
6066
|
|
|
5991
6067
|
|
|
5992
6068
|
// ============================================
|
|
5993
|
-
// File 8/
|
|
6069
|
+
// File 8/42: components/alert.js
|
|
5994
6070
|
// ============================================
|
|
5995
6071
|
|
|
5996
6072
|
/**
|
|
@@ -6278,7 +6354,7 @@
|
|
|
6278
6354
|
|
|
6279
6355
|
|
|
6280
6356
|
// ============================================
|
|
6281
|
-
// File 9/
|
|
6357
|
+
// File 9/42: components/button.js
|
|
6282
6358
|
// ============================================
|
|
6283
6359
|
|
|
6284
6360
|
/**
|
|
@@ -6485,7 +6561,7 @@
|
|
|
6485
6561
|
|
|
6486
6562
|
|
|
6487
6563
|
// ============================================
|
|
6488
|
-
// File 10/
|
|
6564
|
+
// File 10/42: components/spinner.js
|
|
6489
6565
|
// ============================================
|
|
6490
6566
|
|
|
6491
6567
|
/**
|
|
@@ -6627,7 +6703,7 @@
|
|
|
6627
6703
|
|
|
6628
6704
|
|
|
6629
6705
|
// ============================================
|
|
6630
|
-
// File 11/
|
|
6706
|
+
// File 11/42: components/badge.js
|
|
6631
6707
|
// ============================================
|
|
6632
6708
|
|
|
6633
6709
|
/**
|
|
@@ -6768,7 +6844,7 @@
|
|
|
6768
6844
|
|
|
6769
6845
|
|
|
6770
6846
|
// ============================================
|
|
6771
|
-
// File 12/
|
|
6847
|
+
// File 12/42: components/avatar.js
|
|
6772
6848
|
// ============================================
|
|
6773
6849
|
|
|
6774
6850
|
/**
|
|
@@ -6969,7 +7045,7 @@
|
|
|
6969
7045
|
|
|
6970
7046
|
|
|
6971
7047
|
// ============================================
|
|
6972
|
-
// File 13/
|
|
7048
|
+
// File 13/42: components/icon.js
|
|
6973
7049
|
// ============================================
|
|
6974
7050
|
|
|
6975
7051
|
/**
|
|
@@ -7209,7 +7285,7 @@
|
|
|
7209
7285
|
|
|
7210
7286
|
|
|
7211
7287
|
// ============================================
|
|
7212
|
-
// File 14/
|
|
7288
|
+
// File 14/42: components/popover.js
|
|
7213
7289
|
// ============================================
|
|
7214
7290
|
|
|
7215
7291
|
/**
|
|
@@ -7563,7 +7639,7 @@
|
|
|
7563
7639
|
|
|
7564
7640
|
|
|
7565
7641
|
// ============================================
|
|
7566
|
-
// File 15/
|
|
7642
|
+
// File 15/42: components/select.js
|
|
7567
7643
|
// ============================================
|
|
7568
7644
|
|
|
7569
7645
|
/**
|
|
@@ -8121,7 +8197,7 @@
|
|
|
8121
8197
|
|
|
8122
8198
|
|
|
8123
8199
|
// ============================================
|
|
8124
|
-
// File 16/
|
|
8200
|
+
// File 16/42: components/enum-select.js
|
|
8125
8201
|
// ============================================
|
|
8126
8202
|
|
|
8127
8203
|
/**
|
|
@@ -8904,7 +8980,7 @@
|
|
|
8904
8980
|
|
|
8905
8981
|
|
|
8906
8982
|
// ============================================
|
|
8907
|
-
// File 17/
|
|
8983
|
+
// File 17/42: components/record-select.js
|
|
8908
8984
|
// ============================================
|
|
8909
8985
|
|
|
8910
8986
|
/**
|
|
@@ -9842,7 +9918,7 @@
|
|
|
9842
9918
|
|
|
9843
9919
|
|
|
9844
9920
|
// ============================================
|
|
9845
|
-
// File 18/
|
|
9921
|
+
// File 18/42: components/multiselect.js
|
|
9846
9922
|
// ============================================
|
|
9847
9923
|
|
|
9848
9924
|
/**
|
|
@@ -10223,7 +10299,7 @@
|
|
|
10223
10299
|
|
|
10224
10300
|
|
|
10225
10301
|
// ============================================
|
|
10226
|
-
// File 19/
|
|
10302
|
+
// File 19/42: components/enum-multiselect.js
|
|
10227
10303
|
// ============================================
|
|
10228
10304
|
|
|
10229
10305
|
/**
|
|
@@ -11047,7 +11123,7 @@
|
|
|
11047
11123
|
|
|
11048
11124
|
|
|
11049
11125
|
// ============================================
|
|
11050
|
-
// File 20/
|
|
11126
|
+
// File 20/42: components/record-multiselect.js
|
|
11051
11127
|
// ============================================
|
|
11052
11128
|
|
|
11053
11129
|
/**
|
|
@@ -11949,7 +12025,7 @@
|
|
|
11949
12025
|
|
|
11950
12026
|
|
|
11951
12027
|
// ============================================
|
|
11952
|
-
// File 21/
|
|
12028
|
+
// File 21/42: components/input.js
|
|
11953
12029
|
// ============================================
|
|
11954
12030
|
|
|
11955
12031
|
/**
|
|
@@ -12210,7 +12286,7 @@
|
|
|
12210
12286
|
|
|
12211
12287
|
|
|
12212
12288
|
// ============================================
|
|
12213
|
-
// File 22/
|
|
12289
|
+
// File 22/42: components/currency.js
|
|
12214
12290
|
// ============================================
|
|
12215
12291
|
|
|
12216
12292
|
/**
|
|
@@ -12448,7 +12524,7 @@
|
|
|
12448
12524
|
|
|
12449
12525
|
|
|
12450
12526
|
// ============================================
|
|
12451
|
-
// File 23/
|
|
12527
|
+
// File 23/42: components/textarea.js
|
|
12452
12528
|
// ============================================
|
|
12453
12529
|
|
|
12454
12530
|
/**
|
|
@@ -12568,7 +12644,7 @@
|
|
|
12568
12644
|
|
|
12569
12645
|
|
|
12570
12646
|
// ============================================
|
|
12571
|
-
// File 24/
|
|
12647
|
+
// File 24/42: components/richtext-editor.js
|
|
12572
12648
|
// ============================================
|
|
12573
12649
|
|
|
12574
12650
|
/**
|
|
@@ -12908,7 +12984,7 @@
|
|
|
12908
12984
|
|
|
12909
12985
|
|
|
12910
12986
|
// ============================================
|
|
12911
|
-
// File 25/
|
|
12987
|
+
// File 25/42: components/checkbox.js
|
|
12912
12988
|
// ============================================
|
|
12913
12989
|
|
|
12914
12990
|
/**
|
|
@@ -13181,7 +13257,7 @@
|
|
|
13181
13257
|
|
|
13182
13258
|
|
|
13183
13259
|
// ============================================
|
|
13184
|
-
// File 26/
|
|
13260
|
+
// File 26/42: components/checkbox-group.js
|
|
13185
13261
|
// ============================================
|
|
13186
13262
|
|
|
13187
13263
|
/**
|
|
@@ -13384,7 +13460,7 @@
|
|
|
13384
13460
|
|
|
13385
13461
|
|
|
13386
13462
|
// ============================================
|
|
13387
|
-
// File 27/
|
|
13463
|
+
// File 27/42: components/radio-group.js
|
|
13388
13464
|
// ============================================
|
|
13389
13465
|
|
|
13390
13466
|
/**
|
|
@@ -13795,7 +13871,296 @@
|
|
|
13795
13871
|
|
|
13796
13872
|
|
|
13797
13873
|
// ============================================
|
|
13798
|
-
// File 28/
|
|
13874
|
+
// File 28/42: components/card-select.js
|
|
13875
|
+
// ============================================
|
|
13876
|
+
|
|
13877
|
+
/**
|
|
13878
|
+
* CardSelect Component (vanilla JS)
|
|
13879
|
+
* Full-width clickable card selection with icon, title, description, and check indicator.
|
|
13880
|
+
* Drop-in replacement / upgrade to RadioGroup when visual card UI is preferred.
|
|
13881
|
+
*/
|
|
13882
|
+
|
|
13883
|
+
(function (global) {
|
|
13884
|
+
|
|
13885
|
+
var COLORS = {
|
|
13886
|
+
selectedBorder: "#175259",
|
|
13887
|
+
unselectedBorder: "#e5e7eb",
|
|
13888
|
+
selectedBg: "#f0f9f8",
|
|
13889
|
+
unselectedBg: "#ffffff",
|
|
13890
|
+
selectedShadow: "0px 0px 0px 2px #e9f7f5",
|
|
13891
|
+
unselectedShadow: "0px 1.5px 4px -1px rgba(10,9,11,0.07)",
|
|
13892
|
+
hoverBorder: "#9ca3af",
|
|
13893
|
+
hoverShadow: "0px 5px 13px -5px rgba(10,9,11,0.05), 0px 2px 4px -1px rgba(10,9,11,0.02)",
|
|
13894
|
+
iconSelectedBg: "#d0ede9",
|
|
13895
|
+
iconUnselectedBg: "#f3f4f6",
|
|
13896
|
+
iconSelectedColor: "#175259",
|
|
13897
|
+
iconUnselectedColor: "#6b7280",
|
|
13898
|
+
titleSelected: "#175259",
|
|
13899
|
+
titleUnselected: "#111827",
|
|
13900
|
+
descSelected: "#35b18b",
|
|
13901
|
+
descUnselected: "#6b7280",
|
|
13902
|
+
checkBorderSelected: "#175259",
|
|
13903
|
+
checkBorderUnselected: "#d1d5db",
|
|
13904
|
+
checkBgSelected: "#175259",
|
|
13905
|
+
checkBgUnselected: "transparent",
|
|
13906
|
+
};
|
|
13907
|
+
|
|
13908
|
+
var CHECK_ICON =
|
|
13909
|
+
'<svg width="10" height="10" viewBox="0 0 10 10" fill="none"><path d="M2 5l2.5 2.5L8 3" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
13910
|
+
|
|
13911
|
+
function join() {
|
|
13912
|
+
return Array.prototype.filter.call(arguments, Boolean).join(" ");
|
|
13913
|
+
}
|
|
13914
|
+
|
|
13915
|
+
function applyCardStyles(card, isSelected) {
|
|
13916
|
+
card.style.borderColor = isSelected ? COLORS.selectedBorder : COLORS.unselectedBorder;
|
|
13917
|
+
card.style.background = isSelected ? COLORS.selectedBg : COLORS.unselectedBg;
|
|
13918
|
+
card.style.boxShadow = isSelected ? COLORS.selectedShadow : COLORS.unselectedShadow;
|
|
13919
|
+
}
|
|
13920
|
+
|
|
13921
|
+
function applyIconStyles(iconWrapper, isSelected) {
|
|
13922
|
+
iconWrapper.style.background = isSelected ? COLORS.iconSelectedBg : COLORS.iconUnselectedBg;
|
|
13923
|
+
iconWrapper.style.color = isSelected ? COLORS.iconSelectedColor : COLORS.iconUnselectedColor;
|
|
13924
|
+
}
|
|
13925
|
+
|
|
13926
|
+
function applyTitleStyles(titleEl, isSelected) {
|
|
13927
|
+
titleEl.style.color = isSelected ? COLORS.titleSelected : COLORS.titleUnselected;
|
|
13928
|
+
}
|
|
13929
|
+
|
|
13930
|
+
function applyDescStyles(descEl, isSelected) {
|
|
13931
|
+
descEl.style.color = isSelected ? COLORS.descSelected : COLORS.descUnselected;
|
|
13932
|
+
}
|
|
13933
|
+
|
|
13934
|
+
function applyCheckStyles(checkEl, isSelected) {
|
|
13935
|
+
checkEl.style.borderColor = isSelected ? COLORS.checkBorderSelected : COLORS.checkBorderUnselected;
|
|
13936
|
+
checkEl.style.background = isSelected ? COLORS.checkBgSelected : COLORS.checkBgUnselected;
|
|
13937
|
+
checkEl.innerHTML = isSelected ? CHECK_ICON : "";
|
|
13938
|
+
}
|
|
13939
|
+
|
|
13940
|
+
/**
|
|
13941
|
+
* Create a card select component
|
|
13942
|
+
* @param {Object} config
|
|
13943
|
+
* @param {string} [config.name] - name attribute for the group (used for id generation)
|
|
13944
|
+
* @param {Array} config.options - array of { value, label, description?, icon?, disabled? }
|
|
13945
|
+
* @param {string} [config.defaultValue] - initial selected value
|
|
13946
|
+
* @param {string} [config.value] - controlled value (takes priority over defaultValue)
|
|
13947
|
+
* @param {boolean} [config.disabled] - disable all cards
|
|
13948
|
+
* @param {string} [config.className] - extra class on wrapper
|
|
13949
|
+
* @param {Function} [config.onChange] - change handler (receives selected value)
|
|
13950
|
+
* @returns {HTMLElement} wrapper element with getValue/setValue/setDisabled API
|
|
13951
|
+
*/
|
|
13952
|
+
function create(config) {
|
|
13953
|
+
var opts = config || {};
|
|
13954
|
+
var name = opts.name || "card-select-" + Math.random().toString(36).substr(2, 9);
|
|
13955
|
+
var options = opts.options || [];
|
|
13956
|
+
var defaultValue = opts.defaultValue;
|
|
13957
|
+
var selectedValue = opts.value !== undefined ? opts.value : defaultValue;
|
|
13958
|
+
var disabled = !!opts.disabled;
|
|
13959
|
+
var className = opts.className || "";
|
|
13960
|
+
var onChange = opts.onChange;
|
|
13961
|
+
|
|
13962
|
+
// Wrapper container
|
|
13963
|
+
var wrapper = document.createElement("div");
|
|
13964
|
+
wrapper.setAttribute("role", "radiogroup");
|
|
13965
|
+
wrapper.setAttribute("dir", "ltr");
|
|
13966
|
+
wrapper.className = join("flex flex-col gap-3 w-full", className);
|
|
13967
|
+
|
|
13968
|
+
function updateAllCards(newValue) {
|
|
13969
|
+
var cards = wrapper.querySelectorAll("[data-card-value]");
|
|
13970
|
+
cards.forEach(function (card) {
|
|
13971
|
+
var cv = card.dataset.cardValue;
|
|
13972
|
+
var active = cv === newValue;
|
|
13973
|
+
applyCardStyles(card, active);
|
|
13974
|
+
card.setAttribute("aria-checked", active ? "true" : "false");
|
|
13975
|
+
var iw = card.querySelector("[data-icon]");
|
|
13976
|
+
var titleEl = card.querySelector("[data-title]");
|
|
13977
|
+
var descEl = card.querySelector("[data-desc]");
|
|
13978
|
+
var checkEl = card.querySelector("[data-check]");
|
|
13979
|
+
if (iw) applyIconStyles(iw, active);
|
|
13980
|
+
if (titleEl) applyTitleStyles(titleEl, active);
|
|
13981
|
+
if (descEl) applyDescStyles(descEl, active);
|
|
13982
|
+
if (checkEl) applyCheckStyles(checkEl, active);
|
|
13983
|
+
});
|
|
13984
|
+
}
|
|
13985
|
+
|
|
13986
|
+
options.forEach(function (option, index) {
|
|
13987
|
+
var optionValue = option.value;
|
|
13988
|
+
var optionLabel = option.label || option.value;
|
|
13989
|
+
var optionDesc = option.description || "";
|
|
13990
|
+
var optionIcon = option.icon || "";
|
|
13991
|
+
var optionDisabled = disabled || !!option.disabled;
|
|
13992
|
+
var isSelected = optionValue === selectedValue;
|
|
13993
|
+
|
|
13994
|
+
// Card element
|
|
13995
|
+
var card = document.createElement("div");
|
|
13996
|
+
card.dataset.cardValue = optionValue;
|
|
13997
|
+
card.id = name + "-card-" + index;
|
|
13998
|
+
card.setAttribute("role", "radio");
|
|
13999
|
+
card.setAttribute("aria-checked", isSelected ? "true" : "false");
|
|
14000
|
+
card.setAttribute("tabindex", optionDisabled ? "-1" : "0");
|
|
14001
|
+
|
|
14002
|
+
card.style.cssText = [
|
|
14003
|
+
"display: flex",
|
|
14004
|
+
"align-items: flex-start",
|
|
14005
|
+
"gap: 16px",
|
|
14006
|
+
"padding: 18px 20px",
|
|
14007
|
+
"border-radius: 10px",
|
|
14008
|
+
"border: 1.5px solid " + (isSelected ? COLORS.selectedBorder : COLORS.unselectedBorder),
|
|
14009
|
+
"background: " + (isSelected ? COLORS.selectedBg : COLORS.unselectedBg),
|
|
14010
|
+
"cursor: " + (optionDisabled ? "not-allowed" : "pointer"),
|
|
14011
|
+
"transition: border-color 0.15s, background 0.15s, box-shadow 0.15s",
|
|
14012
|
+
"box-shadow: " + (isSelected ? COLORS.selectedShadow : COLORS.unselectedShadow),
|
|
14013
|
+
"user-select: none",
|
|
14014
|
+
optionDisabled ? "opacity: 0.5" : "",
|
|
14015
|
+
].filter(Boolean).join("; ");
|
|
14016
|
+
|
|
14017
|
+
// Icon wrapper (only rendered when icon is provided)
|
|
14018
|
+
if (optionIcon) {
|
|
14019
|
+
var iconWrapper = document.createElement("div");
|
|
14020
|
+
iconWrapper.dataset.icon = "";
|
|
14021
|
+
iconWrapper.style.cssText = [
|
|
14022
|
+
"flex-shrink: 0",
|
|
14023
|
+
"width: 44px",
|
|
14024
|
+
"height: 44px",
|
|
14025
|
+
"border-radius: 8px",
|
|
14026
|
+
"background: " + (isSelected ? COLORS.iconSelectedBg : COLORS.iconUnselectedBg),
|
|
14027
|
+
"display: flex",
|
|
14028
|
+
"align-items: center",
|
|
14029
|
+
"justify-content: center",
|
|
14030
|
+
"color: " + (isSelected ? COLORS.iconSelectedColor : COLORS.iconUnselectedColor),
|
|
14031
|
+
"transition: background 0.15s, color 0.15s",
|
|
14032
|
+
].join("; ");
|
|
14033
|
+
iconWrapper.innerHTML = optionIcon;
|
|
14034
|
+
card.appendChild(iconWrapper);
|
|
14035
|
+
}
|
|
14036
|
+
|
|
14037
|
+
// Text wrapper
|
|
14038
|
+
var textWrapper = document.createElement("div");
|
|
14039
|
+
textWrapper.style.cssText = "display: flex; flex-direction: column; gap: 4px; flex: 1;";
|
|
14040
|
+
|
|
14041
|
+
var titleEl = document.createElement("span");
|
|
14042
|
+
titleEl.dataset.title = "";
|
|
14043
|
+
titleEl.textContent = optionLabel;
|
|
14044
|
+
titleEl.style.cssText = [
|
|
14045
|
+
"font-size: 14px",
|
|
14046
|
+
"font-weight: 600",
|
|
14047
|
+
"color: " + (isSelected ? COLORS.titleSelected : COLORS.titleUnselected),
|
|
14048
|
+
"line-height: 1.4",
|
|
14049
|
+
"transition: color 0.15s",
|
|
14050
|
+
].join("; ");
|
|
14051
|
+
textWrapper.appendChild(titleEl);
|
|
14052
|
+
|
|
14053
|
+
if (optionDesc) {
|
|
14054
|
+
var descEl = document.createElement("span");
|
|
14055
|
+
descEl.dataset.desc = "";
|
|
14056
|
+
descEl.textContent = optionDesc;
|
|
14057
|
+
descEl.style.cssText = [
|
|
14058
|
+
"font-size: 12px",
|
|
14059
|
+
"color: " + (isSelected ? COLORS.descSelected : COLORS.descUnselected),
|
|
14060
|
+
"line-height: 1.5",
|
|
14061
|
+
"transition: color 0.15s",
|
|
14062
|
+
].join("; ");
|
|
14063
|
+
textWrapper.appendChild(descEl);
|
|
14064
|
+
}
|
|
14065
|
+
|
|
14066
|
+
card.appendChild(textWrapper);
|
|
14067
|
+
|
|
14068
|
+
// Check indicator (radio circle in top-right)
|
|
14069
|
+
var checkEl = document.createElement("div");
|
|
14070
|
+
checkEl.dataset.check = "";
|
|
14071
|
+
checkEl.style.cssText = [
|
|
14072
|
+
"flex-shrink: 0",
|
|
14073
|
+
"width: 18px",
|
|
14074
|
+
"height: 18px",
|
|
14075
|
+
"border-radius: 50%",
|
|
14076
|
+
"border: 2px solid " + (isSelected ? COLORS.checkBorderSelected : COLORS.checkBorderUnselected),
|
|
14077
|
+
"background: " + (isSelected ? COLORS.checkBgSelected : COLORS.checkBgUnselected),
|
|
14078
|
+
"display: flex",
|
|
14079
|
+
"align-items: center",
|
|
14080
|
+
"justify-content: center",
|
|
14081
|
+
"margin-top: 2px",
|
|
14082
|
+
"transition: all 0.15s",
|
|
14083
|
+
].join("; ");
|
|
14084
|
+
if (isSelected) {
|
|
14085
|
+
checkEl.innerHTML = CHECK_ICON;
|
|
14086
|
+
}
|
|
14087
|
+
card.appendChild(checkEl);
|
|
14088
|
+
|
|
14089
|
+
// Hover and focus styles
|
|
14090
|
+
if (!optionDisabled) {
|
|
14091
|
+
card.addEventListener("mouseenter", function () {
|
|
14092
|
+
if (card.getAttribute("aria-checked") !== "true") {
|
|
14093
|
+
card.style.borderColor = COLORS.hoverBorder;
|
|
14094
|
+
card.style.boxShadow = COLORS.hoverShadow;
|
|
14095
|
+
}
|
|
14096
|
+
});
|
|
14097
|
+
card.addEventListener("mouseleave", function () {
|
|
14098
|
+
if (card.getAttribute("aria-checked") !== "true") {
|
|
14099
|
+
card.style.borderColor = COLORS.unselectedBorder;
|
|
14100
|
+
card.style.boxShadow = COLORS.unselectedShadow;
|
|
14101
|
+
}
|
|
14102
|
+
});
|
|
14103
|
+
|
|
14104
|
+
// Click handler
|
|
14105
|
+
card.addEventListener("click", function () {
|
|
14106
|
+
if (optionDisabled || disabled) return;
|
|
14107
|
+
selectedValue = optionValue;
|
|
14108
|
+
updateAllCards(selectedValue);
|
|
14109
|
+
if (typeof onChange === "function") {
|
|
14110
|
+
onChange(selectedValue);
|
|
14111
|
+
}
|
|
14112
|
+
});
|
|
14113
|
+
|
|
14114
|
+
// Keyboard support
|
|
14115
|
+
card.addEventListener("keydown", function (e) {
|
|
14116
|
+
if (optionDisabled || disabled) return;
|
|
14117
|
+
if (e.key === " " || e.key === "Enter") {
|
|
14118
|
+
e.preventDefault();
|
|
14119
|
+
card.click();
|
|
14120
|
+
}
|
|
14121
|
+
});
|
|
14122
|
+
}
|
|
14123
|
+
|
|
14124
|
+
wrapper.appendChild(card);
|
|
14125
|
+
});
|
|
14126
|
+
|
|
14127
|
+
// Public API
|
|
14128
|
+
wrapper.getValue = function () {
|
|
14129
|
+
return selectedValue !== undefined ? selectedValue : null;
|
|
14130
|
+
};
|
|
14131
|
+
|
|
14132
|
+
wrapper.setValue = function (newValue) {
|
|
14133
|
+
selectedValue = newValue;
|
|
14134
|
+
updateAllCards(newValue);
|
|
14135
|
+
};
|
|
14136
|
+
|
|
14137
|
+
wrapper.setDisabled = function (isDisabled) {
|
|
14138
|
+
disabled = !!isDisabled;
|
|
14139
|
+
wrapper.querySelectorAll("[data-card-value]").forEach(function (card) {
|
|
14140
|
+
card.style.cursor = disabled ? "not-allowed" : "pointer";
|
|
14141
|
+
card.style.opacity = disabled ? "0.5" : "1";
|
|
14142
|
+
card.setAttribute("tabindex", disabled ? "-1" : "0");
|
|
14143
|
+
});
|
|
14144
|
+
};
|
|
14145
|
+
|
|
14146
|
+
return wrapper;
|
|
14147
|
+
}
|
|
14148
|
+
|
|
14149
|
+
var CardSelect = {
|
|
14150
|
+
create: create,
|
|
14151
|
+
};
|
|
14152
|
+
|
|
14153
|
+
if (typeof module !== "undefined" && module.exports) {
|
|
14154
|
+
module.exports = CardSelect;
|
|
14155
|
+
} else {
|
|
14156
|
+
global.CardSelect = CardSelect;
|
|
14157
|
+
}
|
|
14158
|
+
})(typeof window !== "undefined" ? window : undefined);
|
|
14159
|
+
|
|
14160
|
+
|
|
14161
|
+
|
|
14162
|
+
// ============================================
|
|
14163
|
+
// File 29/42: components/enumeration.js
|
|
13799
14164
|
// ============================================
|
|
13800
14165
|
|
|
13801
14166
|
/**
|
|
@@ -14033,7 +14398,7 @@
|
|
|
14033
14398
|
|
|
14034
14399
|
|
|
14035
14400
|
// ============================================
|
|
14036
|
-
// File
|
|
14401
|
+
// File 30/42: components/time-picker.js
|
|
14037
14402
|
// ============================================
|
|
14038
14403
|
|
|
14039
14404
|
/**
|
|
@@ -14394,7 +14759,7 @@
|
|
|
14394
14759
|
|
|
14395
14760
|
|
|
14396
14761
|
// ============================================
|
|
14397
|
-
// File
|
|
14762
|
+
// File 31/42: components/duration/duration-utils.js
|
|
14398
14763
|
// ============================================
|
|
14399
14764
|
|
|
14400
14765
|
/**
|
|
@@ -14564,7 +14929,7 @@
|
|
|
14564
14929
|
|
|
14565
14930
|
|
|
14566
14931
|
// ============================================
|
|
14567
|
-
// File
|
|
14932
|
+
// File 32/42: components/duration/duration-constants.js
|
|
14568
14933
|
// ============================================
|
|
14569
14934
|
|
|
14570
14935
|
/**
|
|
@@ -14616,7 +14981,7 @@
|
|
|
14616
14981
|
|
|
14617
14982
|
|
|
14618
14983
|
// ============================================
|
|
14619
|
-
// File
|
|
14984
|
+
// File 33/42: components/duration/duration.js
|
|
14620
14985
|
// ============================================
|
|
14621
14986
|
|
|
14622
14987
|
/**
|
|
@@ -15075,7 +15440,7 @@
|
|
|
15075
15440
|
|
|
15076
15441
|
|
|
15077
15442
|
// ============================================
|
|
15078
|
-
// File
|
|
15443
|
+
// File 34/42: components/date-time-picker/date-time-picker-utils.js
|
|
15079
15444
|
// ============================================
|
|
15080
15445
|
|
|
15081
15446
|
/**
|
|
@@ -15334,7 +15699,7 @@
|
|
|
15334
15699
|
|
|
15335
15700
|
|
|
15336
15701
|
// ============================================
|
|
15337
|
-
// File
|
|
15702
|
+
// File 35/42: components/date-time-picker/date-time-picker.js
|
|
15338
15703
|
// ============================================
|
|
15339
15704
|
|
|
15340
15705
|
/**
|
|
@@ -15871,7 +16236,7 @@
|
|
|
15871
16236
|
|
|
15872
16237
|
|
|
15873
16238
|
// ============================================
|
|
15874
|
-
// File
|
|
16239
|
+
// File 36/42: components/phone-input/phone-utils.js
|
|
15875
16240
|
// ============================================
|
|
15876
16241
|
|
|
15877
16242
|
/**
|
|
@@ -16034,7 +16399,7 @@
|
|
|
16034
16399
|
|
|
16035
16400
|
|
|
16036
16401
|
// ============================================
|
|
16037
|
-
// File
|
|
16402
|
+
// File 37/42: components/phone-input/phone-input.js
|
|
16038
16403
|
// ============================================
|
|
16039
16404
|
|
|
16040
16405
|
/**
|
|
@@ -16432,7 +16797,7 @@
|
|
|
16432
16797
|
|
|
16433
16798
|
|
|
16434
16799
|
// ============================================
|
|
16435
|
-
// File
|
|
16800
|
+
// File 38/42: components/file-input.js
|
|
16436
16801
|
// ============================================
|
|
16437
16802
|
|
|
16438
16803
|
/**
|
|
@@ -17062,7 +17427,7 @@
|
|
|
17062
17427
|
|
|
17063
17428
|
|
|
17064
17429
|
// ============================================
|
|
17065
|
-
// File
|
|
17430
|
+
// File 39/42: components/table.js
|
|
17066
17431
|
// ============================================
|
|
17067
17432
|
|
|
17068
17433
|
/**
|
|
@@ -17403,7 +17768,7 @@
|
|
|
17403
17768
|
|
|
17404
17769
|
|
|
17405
17770
|
// ============================================
|
|
17406
|
-
// File
|
|
17771
|
+
// File 40/42: components/tabs.js
|
|
17407
17772
|
// ============================================
|
|
17408
17773
|
|
|
17409
17774
|
/**
|
|
@@ -17600,7 +17965,7 @@
|
|
|
17600
17965
|
|
|
17601
17966
|
|
|
17602
17967
|
// ============================================
|
|
17603
|
-
// File
|
|
17968
|
+
// File 41/42: components/steps.js
|
|
17604
17969
|
// ============================================
|
|
17605
17970
|
|
|
17606
17971
|
/**
|
|
@@ -17851,7 +18216,7 @@
|
|
|
17851
18216
|
|
|
17852
18217
|
|
|
17853
18218
|
// ============================================
|
|
17854
|
-
// File
|
|
18219
|
+
// File 42/42: index.js
|
|
17855
18220
|
// ============================================
|
|
17856
18221
|
|
|
17857
18222
|
/**
|
|
@@ -17945,6 +18310,7 @@
|
|
|
17945
18310
|
require("./components/checkbox.js");
|
|
17946
18311
|
require("./components/checkbox-group.js");
|
|
17947
18312
|
require("./components/radio-group.js");
|
|
18313
|
+
require("./components/card-select.js");
|
|
17948
18314
|
require("./components/table.js");
|
|
17949
18315
|
require("./components/tabs.js");
|
|
17950
18316
|
require("./components/steps.js");
|
|
@@ -18024,6 +18390,7 @@
|
|
|
18024
18390
|
"Checkbox",
|
|
18025
18391
|
"CheckboxGroup",
|
|
18026
18392
|
"RadioGroup",
|
|
18393
|
+
"CardSelect",
|
|
18027
18394
|
"SuperleapTable",
|
|
18028
18395
|
"Tabs",
|
|
18029
18396
|
"Steps",
|
|
@@ -18115,7 +18482,7 @@
|
|
|
18115
18482
|
},
|
|
18116
18483
|
});
|
|
18117
18484
|
document.dispatchEvent(event);
|
|
18118
|
-
console.log("[Superleap-Flow] Library ready - v2.5.
|
|
18485
|
+
console.log("[Superleap-Flow] Library ready - v2.5.3");
|
|
18119
18486
|
}
|
|
18120
18487
|
|
|
18121
18488
|
// Wait for DOM to be ready before dispatching event
|