@idds/js 1.0.72 → 1.0.74
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/dist/index.iife.js +133 -0
- package/dist/index.js +131 -0
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -38,8 +38,11 @@ var InaUI = (() => {
|
|
|
38
38
|
initSingleFileUpload: () => initSingleFileUpload,
|
|
39
39
|
initStepper: () => initStepper,
|
|
40
40
|
initTab: () => initTab,
|
|
41
|
+
initTabHorizontal: () => initTabHorizontal,
|
|
42
|
+
initTabVertical: () => initTabVertical,
|
|
41
43
|
initTimepicker: () => initTimepicker,
|
|
42
44
|
initToggle: () => initToggle,
|
|
45
|
+
setBrandTheme: () => setBrandTheme,
|
|
43
46
|
showToast: () => showToast
|
|
44
47
|
});
|
|
45
48
|
|
|
@@ -2584,6 +2587,116 @@ var InaUI = (() => {
|
|
|
2584
2587
|
});
|
|
2585
2588
|
}
|
|
2586
2589
|
|
|
2590
|
+
// src/js/components/stateful/tab-vertical.js
|
|
2591
|
+
function initTabVertical() {
|
|
2592
|
+
const tabs = document.querySelectorAll(`.${PREFIX}-tab-vertical`);
|
|
2593
|
+
tabs.forEach((container) => {
|
|
2594
|
+
if (container.dataset.initialized === "true") return;
|
|
2595
|
+
container.dataset.initialized = "true";
|
|
2596
|
+
const tabContainer = container.querySelector(
|
|
2597
|
+
`.${PREFIX}-tab-vertical__container`
|
|
2598
|
+
);
|
|
2599
|
+
if (!tabContainer) return;
|
|
2600
|
+
const tabButtons = tabContainer.querySelectorAll(
|
|
2601
|
+
`.${PREFIX}-tab-vertical__tab`
|
|
2602
|
+
);
|
|
2603
|
+
const containerDisabled = container.classList.contains(
|
|
2604
|
+
`${PREFIX}-tab-vertical--disabled`
|
|
2605
|
+
);
|
|
2606
|
+
const setActiveTab = (selectedTab) => {
|
|
2607
|
+
if (containerDisabled || selectedTab.classList.contains(
|
|
2608
|
+
`${PREFIX}-tab-vertical__tab--disabled`
|
|
2609
|
+
) || selectedTab.disabled) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
tabButtons.forEach((tab) => {
|
|
2613
|
+
const isSelected = tab === selectedTab;
|
|
2614
|
+
tab.setAttribute("aria-selected", isSelected);
|
|
2615
|
+
if (isSelected) {
|
|
2616
|
+
tab.classList.add(`${PREFIX}-tab-vertical__tab--selected`);
|
|
2617
|
+
} else {
|
|
2618
|
+
tab.classList.remove(`${PREFIX}-tab-vertical__tab--selected`);
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
container.dispatchEvent(
|
|
2622
|
+
new CustomEvent("tab:change", {
|
|
2623
|
+
bubbles: true,
|
|
2624
|
+
detail: {
|
|
2625
|
+
value: selectedTab.dataset.value,
|
|
2626
|
+
originalEvent: null
|
|
2627
|
+
}
|
|
2628
|
+
})
|
|
2629
|
+
);
|
|
2630
|
+
};
|
|
2631
|
+
tabButtons.forEach((tab) => {
|
|
2632
|
+
tab.addEventListener("click", () => {
|
|
2633
|
+
setActiveTab(tab);
|
|
2634
|
+
});
|
|
2635
|
+
tab.addEventListener("keydown", (e) => {
|
|
2636
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2637
|
+
e.preventDefault();
|
|
2638
|
+
setActiveTab(tab);
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
});
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
// src/js/components/stateful/tab-horizontal.js
|
|
2646
|
+
function initTabHorizontal() {
|
|
2647
|
+
const tabs = document.querySelectorAll(`.${PREFIX}-tab-horizontal`);
|
|
2648
|
+
tabs.forEach((container) => {
|
|
2649
|
+
if (container.dataset.initialized === "true") return;
|
|
2650
|
+
container.dataset.initialized = "true";
|
|
2651
|
+
const tabContainer = container.querySelector(
|
|
2652
|
+
`.${PREFIX}-tab-horizontal__container`
|
|
2653
|
+
);
|
|
2654
|
+
if (!tabContainer) return;
|
|
2655
|
+
const tabButtons = tabContainer.querySelectorAll(
|
|
2656
|
+
`.${PREFIX}-tab-horizontal__tab`
|
|
2657
|
+
);
|
|
2658
|
+
const containerDisabled = container.classList.contains(
|
|
2659
|
+
`${PREFIX}-tab-horizontal--disabled`
|
|
2660
|
+
);
|
|
2661
|
+
const setActiveTab = (selectedTab) => {
|
|
2662
|
+
if (containerDisabled || selectedTab.classList.contains(
|
|
2663
|
+
`${PREFIX}-tab-horizontal__tab--disabled`
|
|
2664
|
+
) || selectedTab.disabled) {
|
|
2665
|
+
return;
|
|
2666
|
+
}
|
|
2667
|
+
tabButtons.forEach((tab) => {
|
|
2668
|
+
const isSelected = tab === selectedTab;
|
|
2669
|
+
tab.setAttribute("aria-selected", isSelected);
|
|
2670
|
+
if (isSelected) {
|
|
2671
|
+
tab.classList.add(`${PREFIX}-tab-horizontal__tab--selected`);
|
|
2672
|
+
} else {
|
|
2673
|
+
tab.classList.remove(`${PREFIX}-tab-horizontal__tab--selected`);
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
container.dispatchEvent(
|
|
2677
|
+
new CustomEvent("tab:change", {
|
|
2678
|
+
bubbles: true,
|
|
2679
|
+
detail: {
|
|
2680
|
+
value: selectedTab.dataset.value,
|
|
2681
|
+
originalEvent: null
|
|
2682
|
+
}
|
|
2683
|
+
})
|
|
2684
|
+
);
|
|
2685
|
+
};
|
|
2686
|
+
tabButtons.forEach((tab) => {
|
|
2687
|
+
tab.addEventListener("click", () => {
|
|
2688
|
+
setActiveTab(tab);
|
|
2689
|
+
});
|
|
2690
|
+
tab.addEventListener("keydown", (e) => {
|
|
2691
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2692
|
+
e.preventDefault();
|
|
2693
|
+
setActiveTab(tab);
|
|
2694
|
+
}
|
|
2695
|
+
});
|
|
2696
|
+
});
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2587
2700
|
// src/js/components/stateless/toast.js
|
|
2588
2701
|
function showToast(optionsOrMessage, variant = "default", duration = 3e3) {
|
|
2589
2702
|
let message, title, state, style, position, actionHtml;
|
|
@@ -2653,6 +2766,24 @@ var InaUI = (() => {
|
|
|
2653
2766
|
}
|
|
2654
2767
|
}
|
|
2655
2768
|
|
|
2769
|
+
// src/js/utils/theme.js
|
|
2770
|
+
function setBrandTheme(brandName) {
|
|
2771
|
+
if (typeof document === "undefined") return;
|
|
2772
|
+
const root = document.documentElement;
|
|
2773
|
+
const oldBrand = root.getAttribute("data-brand");
|
|
2774
|
+
if (oldBrand === brandName) return;
|
|
2775
|
+
if (brandName) {
|
|
2776
|
+
root.setAttribute("data-brand", brandName);
|
|
2777
|
+
} else {
|
|
2778
|
+
root.removeAttribute("data-brand");
|
|
2779
|
+
}
|
|
2780
|
+
window.dispatchEvent(
|
|
2781
|
+
new CustomEvent("idds:theme-change", {
|
|
2782
|
+
detail: { brand: brandName, previousBrand: oldBrand }
|
|
2783
|
+
})
|
|
2784
|
+
);
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2656
2787
|
// src/js/index.js
|
|
2657
2788
|
var PREFIX = "ina";
|
|
2658
2789
|
|
|
@@ -2866,6 +2997,8 @@ var InaUI = (() => {
|
|
|
2866
2997
|
initPagination();
|
|
2867
2998
|
initSelectDropdown();
|
|
2868
2999
|
initChip();
|
|
3000
|
+
initTabVertical();
|
|
3001
|
+
initTabHorizontal();
|
|
2869
3002
|
});
|
|
2870
3003
|
}
|
|
2871
3004
|
return __toCommonJS(bundle_exports);
|
package/dist/index.js
CHANGED
|
@@ -2746,6 +2746,116 @@ function initPagination() {
|
|
|
2746
2746
|
});
|
|
2747
2747
|
}
|
|
2748
2748
|
|
|
2749
|
+
// src/js/components/stateful/tab-vertical.js
|
|
2750
|
+
function initTabVertical() {
|
|
2751
|
+
const tabs = document.querySelectorAll(`.${PREFIX}-tab-vertical`);
|
|
2752
|
+
tabs.forEach((container) => {
|
|
2753
|
+
if (container.dataset.initialized === "true") return;
|
|
2754
|
+
container.dataset.initialized = "true";
|
|
2755
|
+
const tabContainer = container.querySelector(
|
|
2756
|
+
`.${PREFIX}-tab-vertical__container`
|
|
2757
|
+
);
|
|
2758
|
+
if (!tabContainer) return;
|
|
2759
|
+
const tabButtons = tabContainer.querySelectorAll(
|
|
2760
|
+
`.${PREFIX}-tab-vertical__tab`
|
|
2761
|
+
);
|
|
2762
|
+
const containerDisabled = container.classList.contains(
|
|
2763
|
+
`${PREFIX}-tab-vertical--disabled`
|
|
2764
|
+
);
|
|
2765
|
+
const setActiveTab = (selectedTab) => {
|
|
2766
|
+
if (containerDisabled || selectedTab.classList.contains(
|
|
2767
|
+
`${PREFIX}-tab-vertical__tab--disabled`
|
|
2768
|
+
) || selectedTab.disabled) {
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2771
|
+
tabButtons.forEach((tab) => {
|
|
2772
|
+
const isSelected = tab === selectedTab;
|
|
2773
|
+
tab.setAttribute("aria-selected", isSelected);
|
|
2774
|
+
if (isSelected) {
|
|
2775
|
+
tab.classList.add(`${PREFIX}-tab-vertical__tab--selected`);
|
|
2776
|
+
} else {
|
|
2777
|
+
tab.classList.remove(`${PREFIX}-tab-vertical__tab--selected`);
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
container.dispatchEvent(
|
|
2781
|
+
new CustomEvent("tab:change", {
|
|
2782
|
+
bubbles: true,
|
|
2783
|
+
detail: {
|
|
2784
|
+
value: selectedTab.dataset.value,
|
|
2785
|
+
originalEvent: null
|
|
2786
|
+
}
|
|
2787
|
+
})
|
|
2788
|
+
);
|
|
2789
|
+
};
|
|
2790
|
+
tabButtons.forEach((tab) => {
|
|
2791
|
+
tab.addEventListener("click", () => {
|
|
2792
|
+
setActiveTab(tab);
|
|
2793
|
+
});
|
|
2794
|
+
tab.addEventListener("keydown", (e) => {
|
|
2795
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2796
|
+
e.preventDefault();
|
|
2797
|
+
setActiveTab(tab);
|
|
2798
|
+
}
|
|
2799
|
+
});
|
|
2800
|
+
});
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
// src/js/components/stateful/tab-horizontal.js
|
|
2805
|
+
function initTabHorizontal() {
|
|
2806
|
+
const tabs = document.querySelectorAll(`.${PREFIX}-tab-horizontal`);
|
|
2807
|
+
tabs.forEach((container) => {
|
|
2808
|
+
if (container.dataset.initialized === "true") return;
|
|
2809
|
+
container.dataset.initialized = "true";
|
|
2810
|
+
const tabContainer = container.querySelector(
|
|
2811
|
+
`.${PREFIX}-tab-horizontal__container`
|
|
2812
|
+
);
|
|
2813
|
+
if (!tabContainer) return;
|
|
2814
|
+
const tabButtons = tabContainer.querySelectorAll(
|
|
2815
|
+
`.${PREFIX}-tab-horizontal__tab`
|
|
2816
|
+
);
|
|
2817
|
+
const containerDisabled = container.classList.contains(
|
|
2818
|
+
`${PREFIX}-tab-horizontal--disabled`
|
|
2819
|
+
);
|
|
2820
|
+
const setActiveTab = (selectedTab) => {
|
|
2821
|
+
if (containerDisabled || selectedTab.classList.contains(
|
|
2822
|
+
`${PREFIX}-tab-horizontal__tab--disabled`
|
|
2823
|
+
) || selectedTab.disabled) {
|
|
2824
|
+
return;
|
|
2825
|
+
}
|
|
2826
|
+
tabButtons.forEach((tab) => {
|
|
2827
|
+
const isSelected = tab === selectedTab;
|
|
2828
|
+
tab.setAttribute("aria-selected", isSelected);
|
|
2829
|
+
if (isSelected) {
|
|
2830
|
+
tab.classList.add(`${PREFIX}-tab-horizontal__tab--selected`);
|
|
2831
|
+
} else {
|
|
2832
|
+
tab.classList.remove(`${PREFIX}-tab-horizontal__tab--selected`);
|
|
2833
|
+
}
|
|
2834
|
+
});
|
|
2835
|
+
container.dispatchEvent(
|
|
2836
|
+
new CustomEvent("tab:change", {
|
|
2837
|
+
bubbles: true,
|
|
2838
|
+
detail: {
|
|
2839
|
+
value: selectedTab.dataset.value,
|
|
2840
|
+
originalEvent: null
|
|
2841
|
+
}
|
|
2842
|
+
})
|
|
2843
|
+
);
|
|
2844
|
+
};
|
|
2845
|
+
tabButtons.forEach((tab) => {
|
|
2846
|
+
tab.addEventListener("click", () => {
|
|
2847
|
+
setActiveTab(tab);
|
|
2848
|
+
});
|
|
2849
|
+
tab.addEventListener("keydown", (e) => {
|
|
2850
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2851
|
+
e.preventDefault();
|
|
2852
|
+
setActiveTab(tab);
|
|
2853
|
+
}
|
|
2854
|
+
});
|
|
2855
|
+
});
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2749
2859
|
// src/js/components/stateless/toast.js
|
|
2750
2860
|
function showToast(optionsOrMessage, variant = "default", duration = 3e3) {
|
|
2751
2861
|
let message, title, state, style, position, actionHtml;
|
|
@@ -2815,6 +2925,24 @@ function showToast(optionsOrMessage, variant = "default", duration = 3e3) {
|
|
|
2815
2925
|
}
|
|
2816
2926
|
}
|
|
2817
2927
|
|
|
2928
|
+
// src/js/utils/theme.js
|
|
2929
|
+
function setBrandTheme(brandName) {
|
|
2930
|
+
if (typeof document === "undefined") return;
|
|
2931
|
+
const root = document.documentElement;
|
|
2932
|
+
const oldBrand = root.getAttribute("data-brand");
|
|
2933
|
+
if (oldBrand === brandName) return;
|
|
2934
|
+
if (brandName) {
|
|
2935
|
+
root.setAttribute("data-brand", brandName);
|
|
2936
|
+
} else {
|
|
2937
|
+
root.removeAttribute("data-brand");
|
|
2938
|
+
}
|
|
2939
|
+
window.dispatchEvent(
|
|
2940
|
+
new CustomEvent("idds:theme-change", {
|
|
2941
|
+
detail: { brand: brandName, previousBrand: oldBrand }
|
|
2942
|
+
})
|
|
2943
|
+
);
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2818
2946
|
// src/js/index.js
|
|
2819
2947
|
var PREFIX = "ina";
|
|
2820
2948
|
function initAll() {
|
|
@@ -2841,9 +2969,12 @@ function initAll() {
|
|
|
2841
2969
|
initTimepicker();
|
|
2842
2970
|
initPagination();
|
|
2843
2971
|
initChip();
|
|
2972
|
+
initTabVertical();
|
|
2973
|
+
initTabHorizontal();
|
|
2844
2974
|
}
|
|
2845
2975
|
export {
|
|
2846
2976
|
PREFIX,
|
|
2847
2977
|
initAll,
|
|
2978
|
+
setBrandTheme,
|
|
2848
2979
|
showToast
|
|
2849
2980
|
};
|