@idds/js 1.0.73 → 1.0.75

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.
@@ -42,6 +42,7 @@ var InaUI = (() => {
42
42
  initTabVertical: () => initTabVertical,
43
43
  initTimepicker: () => initTimepicker,
44
44
  initToggle: () => initToggle,
45
+ setBrandTheme: () => setBrandTheme,
45
46
  showToast: () => showToast
46
47
  });
47
48
 
@@ -2765,6 +2766,24 @@ var InaUI = (() => {
2765
2766
  }
2766
2767
  }
2767
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
+
2768
2787
  // src/js/index.js
2769
2788
  var PREFIX = "ina";
2770
2789
 
package/dist/index.js CHANGED
@@ -2925,6 +2925,24 @@ function showToast(optionsOrMessage, variant = "default", duration = 3e3) {
2925
2925
  }
2926
2926
  }
2927
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
+
2928
2946
  // src/js/index.js
2929
2947
  var PREFIX = "ina";
2930
2948
  function initAll() {
@@ -2957,5 +2975,6 @@ function initAll() {
2957
2975
  export {
2958
2976
  PREFIX,
2959
2977
  initAll,
2978
+ setBrandTheme,
2960
2979
  showToast
2961
2980
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idds/js",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },