@@ -516,9 +472,3 @@ EventInfo.propTypes = {
eventLocation: PropTypes.string,
eventTime: PropTypes.string,
};
-
-EventInfo.defaultProps = {
- eventFormat: "stack",
- eventLocation: "",
- eventTime: "",
-};
diff --git a/packages/unity-react-core/src/components/Pagination/PageItem/PageItem.jsx b/packages/unity-react-core/src/components/Pagination/PageItem/PageItem.jsx
index 026b248efb..918b3948c5 100644
--- a/packages/unity-react-core/src/components/Pagination/PageItem/PageItem.jsx
+++ b/packages/unity-react-core/src/components/Pagination/PageItem/PageItem.jsx
@@ -14,11 +14,11 @@ import React from "react";
*/
export const PageItem = ({
dataId,
- isClickeable,
- disabled,
- pageLinkIcon,
- selectedPage,
- onClick,
+ isClickeable = false,
+ disabled = false,
+ pageLinkIcon = false,
+ selectedPage = false,
+ onClick = () => {},
ellipses,
ariaLabel,
children,
@@ -69,11 +69,3 @@ PageItem.propTypes = {
ariaLabel: PropTypes.string,
ariaDisabled: PropTypes.bool,
};
-
-PageItem.defaultProps = {
- isClickeable: false,
- disabled: false,
- pageLinkIcon: false,
- selectedPage: false,
- onClick: () => {},
-};
diff --git a/packages/unity-react-core/src/components/Pagination/Pagination.jsx b/packages/unity-react-core/src/components/Pagination/Pagination.jsx
index 8574f174fa..1412c7a5e1 100644
--- a/packages/unity-react-core/src/components/Pagination/Pagination.jsx
+++ b/packages/unity-react-core/src/components/Pagination/Pagination.jsx
@@ -33,8 +33,8 @@ const defaultGAEvent = {
export const Pagination = ({
type,
background,
- currentPage,
- totalPages,
+ currentPage = 1,
+ totalPages = 10,
onChange,
}) => {
const [selectedPage, setSelectedPage] = useState(null);
@@ -230,8 +230,3 @@ Pagination.propTypes = {
*/
onChange: PropTypes.func.isRequired,
};
-
-Pagination.defaultProps = {
- currentPage: 1,
- totalPages: 10,
-};
From 804ce9acc756acb6031012b9cf9b6fb2aeb5a2ff Mon Sep 17 00:00:00 2001
From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com>
Date: Thu, 10 Apr 2025 12:09:16 -0700
Subject: [PATCH 07/14] fix(unity-bootstrap-theme): update build to include js
---
packages/unity-bootstrap-theme/jsconfig.json | 22 ++
packages/unity-bootstrap-theme/package.json | 12 +-
.../unity-bootstrap-theme/src/js/banner.js | 91 +++++++-
.../src/js/bootstrap-helper.js | 15 +-
.../src/js/charts-and-graphs.js | 11 +-
.../src/js/data-layer.js | 25 ++-
.../src/js/global-header.js | 10 +-
.../src/js/storybook-data-layer.js | 5 -
.../src/js/storybook-global-header.js | 5 -
.../src/js/tabbed-panels.js | 209 ++++++++----------
.../src/js/unity-bootstrap-theme.js | 1 -
.../scss/unity-bootstrap-header-footer.scss | 12 +
.../scss/unity-bootstrap-theme.bundle.scss | 3 +-
.../vite.config.bundle.js | 85 +++++++
packages/unity-bootstrap-theme/vite.config.js | 14 +-
15 files changed, 346 insertions(+), 174 deletions(-)
create mode 100644 packages/unity-bootstrap-theme/jsconfig.json
delete mode 100644 packages/unity-bootstrap-theme/src/js/storybook-data-layer.js
delete mode 100644 packages/unity-bootstrap-theme/src/js/storybook-global-header.js
create mode 100644 packages/unity-bootstrap-theme/src/scss/unity-bootstrap-header-footer.scss
create mode 100644 packages/unity-bootstrap-theme/vite.config.bundle.js
diff --git a/packages/unity-bootstrap-theme/jsconfig.json b/packages/unity-bootstrap-theme/jsconfig.json
new file mode 100644
index 0000000000..1d95ba1e0b
--- /dev/null
+++ b/packages/unity-bootstrap-theme/jsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM"],
+ "resolveJsonModule": true,
+ "jsx": "react",
+ "allowImportingTsExtensions": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node16",
+ "module": "node16",
+ "allowSyntheticDefaultImports": true,
+ "paths": {
+ "@shared/*": [ "../../shared/*" ],
+ },
+ },
+ "include": [
+ "src/**/*",
+ "stories/**/*",
+ "../../shared/**/*",
+ ],
+}
diff --git a/packages/unity-bootstrap-theme/package.json b/packages/unity-bootstrap-theme/package.json
index 046857e7f1..235874b446 100644
--- a/packages/unity-bootstrap-theme/package.json
+++ b/packages/unity-bootstrap-theme/package.json
@@ -13,7 +13,9 @@
"url": "git+https://github.com/ASU/asu-unity-stack.git"
},
"scripts": {
- "build": "vite build",
+ "build": "yarn build:1 && yarn build:2",
+ "build:1": "vite build",
+ "build:2": "vite build --config vite.config.bundle.js",
"watch": "rimraf ./dist && webpack --watch && rimraf ./.tmp",
"storybook": "storybook dev -p 9000",
"build-storybook": "storybook build -o ../../build/$npm_package_name",
@@ -77,14 +79,6 @@
"webpack-node-externals": "^3.0.0"
},
"exports": {
- "./js/global-header.js": {
- "module": "./src/js/storybook-global-header.js",
- "default": "./src/js/global-header.js"
- },
- "./js/data-layer.js": {
- "module": "./src/js/storybook-data-layer.js",
- "default": "./src/js/data-layer.js"
- },
"./*": "./*",
".": "./dist/css/unity-bootstrap-theme.css"
},
diff --git a/packages/unity-bootstrap-theme/src/js/banner.js b/packages/unity-bootstrap-theme/src/js/banner.js
index b90c378843..42192d9771 100644
--- a/packages/unity-bootstrap-theme/src/js/banner.js
+++ b/packages/unity-bootstrap-theme/src/js/banner.js
@@ -1,11 +1,84 @@
-const initBanner = () => {
- const closeButtons = document.querySelectorAll('.banner-close button');
- closeButtons.forEach((button) =>
- button.addEventListener('click', () => {
- const bannerToClose = button.parentElement.parentElement.parentElement;
- bannerToClose.classList.add('hidden-banner');
+// should we just use bootstrap's Alert
+
+import {
+ BaseComponent,
+ EventHandler,
+ enableDismissTrigger,
+ defineJQueryPlugin,
+} from "./bootstrap-helper.js";
+
+/**
+ * Constants
+ */
+
+const NAME = 'banner-container'
+const DATA_KEY = 'uds.banner'
+const EVENT_KEY = `.${DATA_KEY}`
+
+const EVENT_CLOSE = `close${EVENT_KEY}`
+const EVENT_CLOSED = `closed${EVENT_KEY}`
+const CLASS_NAME_FADE = 'fade'
+const CLASS_NAME_SHOW = 'show'
+
+/**
+ * Class definition
+ */
+
+class Banner extends BaseComponent {
+ // Getters
+ static get NAME() {
+ return NAME
+ }
+
+ // Public
+ close() {
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)
+
+ if (closeEvent.defaultPrevented) {
+ return
+ }
+
+ this._element.classList.remove(CLASS_NAME_SHOW)
+
+ const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)
+ this._queueCallback(() => this._destroyElement(), this._element, isAnimated)
+ }
+
+ // Private
+ _destroyElement() {
+ this._element.remove()
+ EventHandler.trigger(this._element, EVENT_CLOSED)
+ this.dispose()
+ }
+
+ // Static
+ static jQueryInterface(config) {
+ return this.each(function () {
+ const data = Banner.getOrCreateInstance(this)
+
+ if (typeof config !== 'string') {
+ return
+ }
+
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
+ throw new TypeError(`No method named "${config}"`)
+ }
+
+ data[config](this)
})
- );
-};
+ }
+}
+
+/**
+ * Data API implementation
+ */
+
+enableDismissTrigger(Banner, 'close')
+
+/**
+ * jQuery
+ */
+
+defineJQueryPlugin(Banner)
-export { initBanner };
+export default Banner
diff --git a/packages/unity-bootstrap-theme/src/js/bootstrap-helper.js b/packages/unity-bootstrap-theme/src/js/bootstrap-helper.js
index b5176666eb..af8ada0cf0 100644
--- a/packages/unity-bootstrap-theme/src/js/bootstrap-helper.js
+++ b/packages/unity-bootstrap-theme/src/js/bootstrap-helper.js
@@ -1,11 +1,4 @@
-import BaseComponent from 'bootstrap/js/src/base-component.js'
-import EventHandler from "bootstrap/js/src/dom/event-handler.js";
-import { enableDismissTrigger } from 'bootstrap/js/src/util/component-functions.js'
-import { defineJQueryPlugin } from 'bootstrap/js/src/util/index.js'
-
-export {
- BaseComponent,
- EventHandler,
- enableDismissTrigger,
- defineJQueryPlugin,
-};
+export { default as BaseComponent } from 'bootstrap/js/src/base-component.js';
+export { default as EventHandler } from "bootstrap/js/src/dom/event-handler.js";
+export { enableDismissTrigger } from 'bootstrap/js/src/util/component-functions.js';
+export { defineJQueryPlugin } from 'bootstrap/js/src/util/index.js';
diff --git a/packages/unity-bootstrap-theme/src/js/charts-and-graphs.js b/packages/unity-bootstrap-theme/src/js/charts-and-graphs.js
index a7233eda59..1a9b25bd27 100644
--- a/packages/unity-bootstrap-theme/src/js/charts-and-graphs.js
+++ b/packages/unity-bootstrap-theme/src/js/charts-and-graphs.js
@@ -1,11 +1,10 @@
-import { Chart, registerables } from 'chart.js';
-import { EventHandler } from './bootstrap-helper';
-
-// Chart.js library should be peer dependency
+import * as Chart from 'chart.js';
-Chart.register(...registerables);
+import { EventHandler } from './bootstrap-helper';
function initChart() {
+ Chart.Chart.register(...Chart.registerables);
+
const GRAPH_PERCENTAGE_COMPLETE = 50;
var ctx = document.getElementById('uds-donut');
@@ -37,7 +36,7 @@ function initChart() {
},
};
- var myChart = new Chart(ctx, config);
+ var myChart = new Chart.Chart(ctx, config);
};
EventHandler.on(window, 'load.uds.chart', initChart);
diff --git a/packages/unity-bootstrap-theme/src/js/data-layer.js b/packages/unity-bootstrap-theme/src/js/data-layer.js
index d401a3c5bb..bb02e76f43 100644
--- a/packages/unity-bootstrap-theme/src/js/data-layer.js
+++ b/packages/unity-bootstrap-theme/src/js/data-layer.js
@@ -1,4 +1,5 @@
-(function(){
+import { EventHandler } from "./bootstrap-helper";
+
function initDataLayer() {
/**
* Push events to data layer (Google Analytics)
@@ -144,6 +145,23 @@
});
})
);
+
+ document.querySelectorAll('[data-ga-footer]').forEach((element) =>
+ element.addEventListener('focus', () => {
+ const args = {
+ type: element.getAttribute('data-ga-footer-type').toLowerCase(),
+ section: element.getAttribute('data-ga-footer-section').toLowerCase(),
+ text: element.getAttribute('data-ga-footer').toLowerCase(),
+ };
+ pushGAEvent({
+ event: 'link',
+ action: 'click',
+ name: 'onclick',
+ region: 'footer',
+ ...args,
+ });
+ })
+ );
}
/* Function must be initialized after document load
@@ -151,4 +169,7 @@
* window.initDataLayer();
*/
window.initDataLayer = window.initDataLayer || initDataLayer;
-})();
+
+ EventHandler.on(window, 'load.uds.data-layer', initDataLayer);
+
+export { initDataLayer };
diff --git a/packages/unity-bootstrap-theme/src/js/global-header.js b/packages/unity-bootstrap-theme/src/js/global-header.js
index 54ed350301..c7b231a0c5 100644
--- a/packages/unity-bootstrap-theme/src/js/global-header.js
+++ b/packages/unity-bootstrap-theme/src/js/global-header.js
@@ -1,4 +1,5 @@
-(function(){
+import { EventHandler } from "./bootstrap-helper";
+
const initGlobalHeader = () => {
// Scroll state
const handleWindowScroll = () => {
@@ -9,7 +10,7 @@
: headerEl?.classList.remove('scrolled');
};
- window.addEventListener('scroll', handleWindowScroll);
+ EventHandler.on(window, 'scroll.uds.header', handleWindowScroll);
};
window.initGlobalHeader = window.initGlobalHeader || initGlobalHeader;
@@ -18,4 +19,7 @@
* Example:
* window.initGlobalHeader();
*/
-})();
+
+ EventHandler.on(window, 'load.uds.global-header', initGlobalHeader);
+
+export { initGlobalHeader };
diff --git a/packages/unity-bootstrap-theme/src/js/storybook-data-layer.js b/packages/unity-bootstrap-theme/src/js/storybook-data-layer.js
deleted file mode 100644
index 1ef8146689..0000000000
--- a/packages/unity-bootstrap-theme/src/js/storybook-data-layer.js
+++ /dev/null
@@ -1,5 +0,0 @@
-require('./data-layer.js');
-
-const { initDataLayer: googleAnalytics } = window;
-
-export { googleAnalytics };
diff --git a/packages/unity-bootstrap-theme/src/js/storybook-global-header.js b/packages/unity-bootstrap-theme/src/js/storybook-global-header.js
deleted file mode 100644
index f089fe6b4f..0000000000
--- a/packages/unity-bootstrap-theme/src/js/storybook-global-header.js
+++ /dev/null
@@ -1,5 +0,0 @@
-require('./global-header.js');
-
-const { initGlobalHeader } = window;
-
-export { initGlobalHeader };
diff --git a/packages/unity-bootstrap-theme/src/js/tabbed-panels.js b/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
index 74c1adf8e2..e711e26820 100644
--- a/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
+++ b/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
@@ -1,5 +1,8 @@
+import { EventHandler } from "./bootstrap-helper";
+
function initTabs() {
- "use strict";
+ ("use strict");
+
const DOM_ELEMENT_A = "a";
const DOM_ELEMENT_BUTTON = "button";
const DOM_ELEMENT_NAV_TABS = ".nav-tabs";
@@ -7,12 +10,12 @@ function initTabs() {
const DOM_ELEMENT_UDS_TABBED_PANELS = ".uds-tabbed-panels";
const DOM_ELEMENT_SCROLL_CONTROL_PREV = ".scroll-control-prev";
const DOM_ELEMENT_SCROLL_CONTROL_NEXT = ".scroll-control-next";
- const EVENT_LOAD = "load";
const EVENT_CLICK = "click";
const EVENT_SCROLL = "scroll";
+ const EVENT_FOCUS = "focus";
const CSS_DISPLAY_NONE = "none";
const CSS_DISPLAY_BLOCK = "block";
- const magicalNumberThree = 3;
+ const scrollTollerance = 10;
const LG_BREAKPOINT = 992;
// helpers functions
@@ -23,146 +26,120 @@ function initTabs() {
}
};
- const slideNav = (clicked, e, direction) => {
- e.preventDefault();
- const parentNav = Array.from(clicked.parentElement.children).filter(child =>
- child.classList.contains("nav-tabs")
- );
-
- let scrollPosition = parseInt(parentNav[0].dataset.scrollPosition, 10);
-
- const navItems = Array.from(
- parentNav[0].querySelectorAll(DOM_ELEMENT_NAV_ITEM)
- );
+ document
+ .querySelectorAll(DOM_ELEMENT_UDS_TABBED_PANELS)
+ .forEach(parentContainer => {
+ const parentNav = parentContainer.querySelector(DOM_ELEMENT_NAV_TABS);
+ const navItems = parentContainer.querySelectorAll(DOM_ELEMENT_NAV_ITEM);
+ const prevButton = parentContainer.querySelector(
+ DOM_ELEMENT_SCROLL_CONTROL_PREV
+ );
+ const nextButton = parentContainer.querySelector(
+ DOM_ELEMENT_SCROLL_CONTROL_NEXT
+ );
+ let scrollPosition = 0;
- // get left value to interact with scroll
- const rawLeftValue = getComputedStyle(parentNav[0]).left;
- const sanitizedLeftValue = rawLeftValue.replace("px", "");
- let scrollOffset = parseInt(sanitizedLeftValue, 10);
+ parentContainer.addEventListener(EVENT_CLICK, function (e) {
+ setButtonsCompatibility(e);
+ });
- if (direction === 1 && scrollPosition > 0) {
- scrollPosition -= 1;
- }
- if (scrollPosition < navItems.length - 1 && direction == -1) {
- scrollPosition += 1;
- }
- parentNav[0].dataset.scrollPosition = scrollPosition;
-
- scrollOffset = 0;
- for (var i = 0; i < scrollPosition; i++) {
- scrollOffset +=
- navItems[i].offsetWidth +
- parseInt(getComputedStyle(navItems[i]).marginLeft, 10) +
- parseInt(getComputedStyle(navItems[i]).marginRight, 10);
- }
+ const slideNav = (clicked, e, direction) => {
+ e.preventDefault();
- // set the position of the scroll of the .nav-tabs element
- parentNav[0].scrollLeft = scrollOffset;
- setControlVisibility(clicked, scrollOffset);
- };
+ // get left value to interact with scroll
+ const rawLeftValue = getComputedStyle(parentNav).left;
+ const sanitizedLeftValue = rawLeftValue.replace("px", "");
+ let scrollOffset = parseInt(sanitizedLeftValue, 10);
- const setControlVisibility = (clicked, scrollOffset) => {
- // select the nearest ancestor with the class ".uds-tabbed-panels".
- const parentContainer = clicked.closest(DOM_ELEMENT_UDS_TABBED_PANELS);
- // select the sibling parent elements of the clicked element.
- const parentNav = parentContainer.querySelector(DOM_ELEMENT_NAV_TABS);
+ if (direction === 1 && scrollPosition > 0) {
+ scrollPosition -= 1;
+ }
+ if (scrollPosition < navItems.length - 1 && direction == -1) {
+ scrollPosition += 1;
+ }
+ parentNav.dataset.scrollPosition = scrollPosition;
+
+ scrollOffset = 0;
+ for (var i = 0; i < scrollPosition; i++) {
+ scrollOffset +=
+ navItems[i].offsetWidth +
+ parseInt(getComputedStyle(navItems[i]).marginLeft, 10) +
+ parseInt(getComputedStyle(navItems[i]).marginRight, 10);
+ }
- // get the value of the data-scroll-position attribute and make sure it is an integer
- const scrollPosition = parseInt(parentNav.dataset.scrollPosition, 10);
- const tabPosition = parentNav.scrollWidth - scrollOffset;
+ // set the position of the scroll of the .nav-tabs element
+ parentNav.scrollLeft = scrollOffset;
+ setControlVisibility(clicked, scrollOffset);
+ };
- // hide or show the scroll buttons based on the scroll position
- if (scrollPosition == 0) {
- parentContainer.querySelector(
- DOM_ELEMENT_SCROLL_CONTROL_PREV
- ).style.display = CSS_DISPLAY_NONE;
- } else {
- parentContainer.querySelector(
- DOM_ELEMENT_SCROLL_CONTROL_PREV
- ).style.display = CSS_DISPLAY_BLOCK;
- }
- if (tabPosition <= parentContainer.offsetWidth) {
- parentContainer.querySelector(
- DOM_ELEMENT_SCROLL_CONTROL_NEXT
- ).style.display = CSS_DISPLAY_NONE;
- } else {
- parentContainer.querySelector(
- DOM_ELEMENT_SCROLL_CONTROL_NEXT
- ).style.display = CSS_DISPLAY_BLOCK;
- }
- };
+ const setControlVisibility = (clicked, scrollOffset) => {
+ const tabPosition = parentNav.scrollWidth - scrollOffset;
- // wait to load the page and all resources before initializing
- window.addEventListener(EVENT_LOAD, function windowLoad() {
- window.removeEventListener(EVENT_LOAD, windowLoad)
- // wait to DOM content is loaded before run these scripts
- document.addEventListener(EVENT_CLICK, function (e) {
- setButtonsCompatibility(e);
- });
+ // hide or show the scroll buttons based on the scroll position
+ if (scrollPosition == 0) {
+ prevButton.style.display = CSS_DISPLAY_NONE;
+ } else {
+ prevButton.style.display = CSS_DISPLAY_BLOCK;
+ }
+ if (tabPosition <= parentContainer.offsetWidth) {
+ nextButton.style.display = CSS_DISPLAY_NONE;
+ } else {
+ nextButton.style.display = CSS_DISPLAY_BLOCK;
+ }
+ };
- // handle focus event for tabs titles
- const navItems = document.querySelectorAll(DOM_ELEMENT_NAV_ITEM);
- navItems.forEach(tabTitle => {
- tabTitle.addEventListener("focus", function (e) {
- tabTitle.scrollIntoView();
- })
- })
-
- // handle scroll for tabs titles
- document.querySelectorAll(DOM_ELEMENT_UDS_TABBED_PANELS).forEach(item => {
- const nav = item.querySelector(DOM_ELEMENT_NAV_TABS);
- nav.addEventListener(EVENT_SCROLL, event => {
+ parentNav.addEventListener(EVENT_SCROLL, event => {
const scrollPos = event.target.scrollLeft;
- const prevButton = item.querySelector(DOM_ELEMENT_SCROLL_CONTROL_PREV);
- const nextButton = item.querySelector(DOM_ELEMENT_SCROLL_CONTROL_NEXT);
const atFarRight =
- nav.offsetWidth + scrollPos + magicalNumberThree >= nav.scrollWidth;
+ parentNav.offsetWidth + scrollPos + scrollTollerance >=
+ parentNav.scrollWidth;
prevButton.style.display =
- scrollPos === 0 ? CSS_DISPLAY_NONE : CSS_DISPLAY_BLOCK;
+ scrollPos < scrollTollerance ? CSS_DISPLAY_NONE : CSS_DISPLAY_BLOCK;
nextButton.style.display = atFarRight
? CSS_DISPLAY_NONE
: CSS_DISPLAY_BLOCK;
});
- });
+ // });
+
+ // handle focus event for tabs titles
+ navItems.forEach(tabTitle => {
+ tabTitle.addEventListener(EVENT_FOCUS, function (e) {
+ tabTitle.scrollIntoView();
+ });
+ });
- // click of the next button
- document
- .querySelector(DOM_ELEMENT_SCROLL_CONTROL_NEXT)
- .addEventListener(EVENT_CLICK, function (e) {
+ // click of the next button
+ nextButton.addEventListener(EVENT_CLICK, function (e) {
if (window.innerWidth > LG_BREAKPOINT) {
slideNav(this, e, -1);
}
});
- // click of the prev button
- document
- .querySelector(DOM_ELEMENT_SCROLL_CONTROL_PREV)
- .addEventListener(EVENT_CLICK, function (e) {
+ // click of the prev button
+ prevButton.addEventListener(EVENT_CLICK, function (e) {
if (window.innerWidth > LG_BREAKPOINT) {
slideNav(this, e, 1);
}
});
- // hide prev button on load
- document.querySelector(
- `${DOM_ELEMENT_UDS_TABBED_PANELS} ${DOM_ELEMENT_SCROLL_CONTROL_PREV}`
- ).style.display = CSS_DISPLAY_NONE;
+ // hide prev button on load
- // width of all tabs
- const navTabWidth =
- document.querySelector(DOM_ELEMENT_NAV_TABS).scrollWidth;
+ prevButton.style.display = CSS_DISPLAY_NONE;
- // width of the parent element
- const udsTabbedPanelsWidth = document.querySelector(
- DOM_ELEMENT_UDS_TABBED_PANELS
- ).offsetWidth;
+ // width of all tabs
+ const navTabWidth = parentNav.scrollWidth;
- if (navTabWidth <= udsTabbedPanelsWidth) {
- document.querySelector(
- `${DOM_ELEMENT_UDS_TABBED_PANELS} ${DOM_ELEMENT_SCROLL_CONTROL_NEXT}`
- ).style.display = CSS_DISPLAY_NONE;
- }
- });
-};
+ // width of the parent element
+ const udsTabbedPanelsWidth = parentContainer.offsetWidth;
+
+ if (navTabWidth <= udsTabbedPanelsWidth) {
+ nextButton.style.display = CSS_DISPLAY_NONE;
+ }
+ });
+}
+
+EventHandler.on(window, 'load.uds.tabs', initTabs);
+
+// window.addEventListener("load.uds.tabs", initTabs, true);
-export {initTabs}
+export { initTabs };
diff --git a/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js b/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js
index 4e5b7311be..e2f009ebba 100644
--- a/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js
+++ b/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js
@@ -14,7 +14,6 @@ import { initializeFixedTable } from "./tables.js";
import { initVideo } from "./video.js";
const unityBootstrap = {
- // EventHandler,
initAnchorMenu,
// Banner,
initBlockquoteAnimation,
diff --git a/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-header-footer.scss b/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-header-footer.scss
new file mode 100644
index 0000000000..2ec330b025
--- /dev/null
+++ b/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-header-footer.scss
@@ -0,0 +1,12 @@
+@import "shared";
+
+// 8. Add additional custom code here
+
+// import bootstrap core
+// @import "bootstrap/scss/bootstrap";
+// css Bootstrap doesn't have variables for
+// @import "unity-bootstrap-theme-extends";
+@import 'extends/global-header';
+@import 'extends/globalfooter';
+
+@import 'end-style';
diff --git a/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-theme.bundle.scss b/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-theme.bundle.scss
index 1faa1ce120..398cb6aab8 100755
--- a/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-theme.bundle.scss
+++ b/packages/unity-bootstrap-theme/src/scss/unity-bootstrap-theme.bundle.scss
@@ -1,7 +1,6 @@
$add_end_styles: false;
@import 'unity-bootstrap-theme';
-@import 'unity-bootstrap-header';
-@import 'unity-bootstrap-footer';
+@import 'unity-bootstrap-header-footer';
$add_end_styles: true;
@import 'end-style';
diff --git a/packages/unity-bootstrap-theme/vite.config.bundle.js b/packages/unity-bootstrap-theme/vite.config.bundle.js
new file mode 100644
index 0000000000..1789284ed3
--- /dev/null
+++ b/packages/unity-bootstrap-theme/vite.config.bundle.js
@@ -0,0 +1,85 @@
+import react from "@vitejs/plugin-react";
+import path, { resolve } from "path";
+import fs from "fs";
+import { defineConfig, transformWithEsbuild } from "vite";
+
+import pkg from "./package.json";
+/** @typedef {import('vite').UserConfig} UserConfig */
+
+/** @type {UserConfig} */
+const c = {
+ root: resolve(__dirname),
+ plugins: [
+ react(),
+ {
+ name: "treat-js-files-as-jsx",
+ async transform(code, id) {
+ if (!id.match(/stories\/.*\.js$/)) return null;
+
+ return transformWithEsbuild(code, id, {
+ loader: "jsx",
+ jsx: "automatic",
+ });
+ },
+ },
+ ],
+ optimizeDeps: {
+ esbuildOptions: {
+ target: "es2021",
+ loader: {
+ ".js": "jsx",
+ },
+ },
+ },
+ build: {
+ emptyOutDir: false,
+ sourcemap: true,
+ cssMinify: true,
+ cssCodeSplit: false,
+ lib: {
+ entry: resolve(__dirname, "src/js/unity-bootstrap-theme.js"),
+ formats: ["es", "cjs", "umd"],
+ name: 'unityBootstrap',
+ fileName: (format) => `js/${format}/unity-bootstrap-theme.js`,
+ },
+ outDir: "dist",
+ rollupOptions: {
+ external: [...Object.keys(pkg.peerDependencies), "chart.js"],
+ treeshake: true,
+ output: {
+ globals: {
+ "chart.js": "Chart",
+ },
+ assetFileNames: (assetInfo) => {
+ console.log(assetInfo)
+ if (assetInfo.originalFileNames && assetInfo.originalFileNames[0]?.includes("bundle")) {
+ return "css/unity-bootstrap-theme.bundle.[ext]";
+ }
+ return "css/[name].[ext]";
+ },
+ },
+ },
+ },
+ esbuild: {
+ loader: "jsx",
+ include: /.*\.jsx?$/,
+ exclude: [],
+ },
+ css: {
+ preprocessorOptions: {
+ scss: {
+ api: "modern-compiler",
+ },
+ },
+ },
+ server: {
+ port: 9000,
+ },
+ resolve: {
+ alias: [
+ { find: '@shared', replacement: path.resolve(__dirname, '../../shared') },
+ ],
+ },
+};
+
+export default defineConfig(c);
diff --git a/packages/unity-bootstrap-theme/vite.config.js b/packages/unity-bootstrap-theme/vite.config.js
index 658cbece41..e3863eba61 100644
--- a/packages/unity-bootstrap-theme/vite.config.js
+++ b/packages/unity-bootstrap-theme/vite.config.js
@@ -50,26 +50,30 @@ const c = {
entry: [
resolve(__dirname, "src/scss/unity-bootstrap-theme.bundle.scss"),
resolve(__dirname, "src/scss/unity-bootstrap-theme.scss"),
+ resolve(__dirname, "src/scss/unity-bootstrap-header-footer.scss"),
resolve(__dirname, "src/scss/unity-bootstrap-header.scss"),
resolve(__dirname, "src/scss/unity-bootstrap-footer.scss"),
resolve(__dirname, "src/js/global-header.js"),
resolve(__dirname, "src/js/data-layer.js"),
- resolve(__dirname, "../../node_modules/bootstrap/js/index.esm.js"),
+ // resolve(__dirname, "../../node_modules/bootstrap/js/index.esm.js"),
],
},
outDir: "dist",
rollupOptions: {
- external: Object.keys(pkg.peerDependencies),
+ external: [...Object.keys(pkg.peerDependencies), "chart.js"],
treeshake: true,
output: {
+ globals: {
+ "chart.js": "Chart",
+ },
entryFileNames: chunkInfo => {
if (chunkInfo.name.includes("index.esm")) {
- return "js/bootstrap.bundle.min.[format]";
+ return "js/[format]/bootstrap.bundle.min.js";
}
- return "js/[name].[format]";
+ return "js/[format]/[name].js";
},
- chunkFileNames: "js/[name].[format]",
+ chunkFileNames: "js/[format]/[name].js",
assetFileNames: (assetInfo) => {
if (assetInfo.originalFileNames && assetInfo.originalFileNames[0].includes("bundle")) {
return "css/unity-bootstrap-theme.bundle.[ext]";
From 118efeb5732c3bf881737b72cff9032acc2181d8 Mon Sep 17 00:00:00 2001
From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com>
Date: Thu, 10 Apr 2025 12:10:04 -0700
Subject: [PATCH 08/14] fix(unity-react-core): update sb to use uds js
---
packages/unity-react-core/src/core/models/shared-prop-types.js | 2 +-
packages/unity-react-core/vite.config.js | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/unity-react-core/src/core/models/shared-prop-types.js b/packages/unity-react-core/src/core/models/shared-prop-types.js
index b7d82960f9..57ddae8d5e 100644
--- a/packages/unity-react-core/src/core/models/shared-prop-types.js
+++ b/packages/unity-react-core/src/core/models/shared-prop-types.js
@@ -18,7 +18,7 @@ const contentPropType = PropTypes.shape({
const accordionCardPropTypes = PropTypes.shape({
color: PropTypes.oneOf(["gold", "maroon", "gray", "dark"]),
content: PropTypes.shape({
- icon: PropTypes.string,
+ icon: PropTypes.arrayOf(PropTypes.string),
header: PropTypes.string,
body: PropTypes.string,
}),
diff --git a/packages/unity-react-core/vite.config.js b/packages/unity-react-core/vite.config.js
index 9ca5287036..ce573119c8 100644
--- a/packages/unity-react-core/vite.config.js
+++ b/packages/unity-react-core/vite.config.js
@@ -73,6 +73,9 @@ export default defineConfig({
},
},
],
+ // optimizeDeps: {
+ // force: true,
+ // },
resolve: {
alias: {
"@shared": path.resolve(__dirname, "./../../shared"),
From c3f1e27d674f9fc31ab20c2353638ea58a7c72e0 Mon Sep 17 00:00:00 2001
From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com>
Date: Thu, 10 Apr 2025 12:28:12 -0700
Subject: [PATCH 09/14] chore(unity-react-core): lint fix
---
.../src/components/AnchorMenu/AnchorMenu.stories.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/unity-react-core/src/components/AnchorMenu/AnchorMenu.stories.jsx b/packages/unity-react-core/src/components/AnchorMenu/AnchorMenu.stories.jsx
index 2c6c397dd2..f7518e8e24 100644
--- a/packages/unity-react-core/src/components/AnchorMenu/AnchorMenu.stories.jsx
+++ b/packages/unity-react-core/src/components/AnchorMenu/AnchorMenu.stories.jsx
@@ -6,10 +6,10 @@ import {
getLoremSentences,
titleCaseDefinition,
} from "../../../../../shared/constants/strings";
+import { Basic as Header } from "../../../../unity-bootstrap-theme/stories/organisms/global-header/global-header.templates";
import { Divider } from "../Divider/Divider";
+import { useBaseSpecificFramework } from "../GaEventWrapper/useBaseSpecificFramework";
import { AnchorMenu } from "./AnchorMenu";
-import { Basic as Header } from "../../../../unity-bootstrap-theme/stories/organisms/global-header/global-header.templates.jsx";
-import { useBaseSpecificFramework } from "../GaEventWrapper/useBaseSpecificFramework.js";
const titleCaseTitle =
"Anchor Menus Should Always be Formatted with Title Case";
From d9efa19fa269e90525fb698eccafd255cbd68b48 Mon Sep 17 00:00:00 2001
From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com>
Date: Thu, 10 Apr 2025 16:02:02 -0700
Subject: [PATCH 10/14] chore(unity-react-core): storybook docs should only
render react example
---
.../.storybook/decorators.tsx | 29 ++++++-------------
.../unity-react-core/.storybook/preview.jsx | 10 -------
2 files changed, 9 insertions(+), 30 deletions(-)
diff --git a/packages/unity-react-core/.storybook/decorators.tsx b/packages/unity-react-core/.storybook/decorators.tsx
index bd4c65f287..ef94907bd0 100644
--- a/packages/unity-react-core/.storybook/decorators.tsx
+++ b/packages/unity-react-core/.storybook/decorators.tsx
@@ -18,14 +18,14 @@ declare interface ContainerProps {
const Full:ContainerComponent
= forwardRef((props, ref) => {
return (
-
+
)});
const UdsContainer:ContainerComponent = forwardRef((props, ref) => {
return (
)});
@@ -34,21 +34,22 @@ export const withContainer: Decorator = (
StoryFn,
{
args,
- globals: { framework = "react" },
+ globals,
parameters: { layout = "fullscreen" },
+ viewMode,
}
) => {
+ let { framework = "react" } = globals;
+ // Doc page will only render react framework
+ if(viewMode === "docs") {
+ framework = "react";
+ }
const isBootstrap = framework === "bootstrap";
- const isReact = !isBootstrap;
const root = React.useRef(null as any);
const emit = useChannel({ "HTML/CodeUpdated": () => {} });
-
-
const mount = () => {
- // console.log("sb mounting");
-
if (root.current) {
if (isBootstrap) {
// custom events created by eventSpy.js to allow storybook to dispatch load events after the page is loaded
@@ -58,7 +59,6 @@ export const withContainer: Decorator = (
emit("HTML/CodeUpdated", { code: root.current.innerHTML });
}
-
}
const unmount = () => {
@@ -77,19 +77,10 @@ export const withContainer: Decorator = (
}
}
-
-
-
-
-
-
-
useEffect(() => {
// @ts-ignore
if (!window.unloading) {
mount()
- } else {
-
}
return unmount
}, [StoryFn, args, framework]);
@@ -116,5 +107,3 @@ export const withContainer: Decorator = (
export const globalDecorators = [
withContainer
];
-
-
diff --git a/packages/unity-react-core/.storybook/preview.jsx b/packages/unity-react-core/.storybook/preview.jsx
index 893c937d86..01a9458598 100644
--- a/packages/unity-react-core/.storybook/preview.jsx
+++ b/packages/unity-react-core/.storybook/preview.jsx
@@ -7,9 +7,6 @@ import "@asu/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js";
import { globalDecorators } from "./decorators.tsx";
import { Container } from "./docPage.tsx";
-
-const sourceCodeRootSelector = "#html-root";
-
const parameters = {
controls: { expanded: true },
argTypes: {
@@ -29,13 +26,6 @@ const parameters = {
},
],
},
- html: {
- prettier: {
- tabWidth: 4,
- htmlWhitespaceSensitivity: "ignore",
- },
- root: sourceCodeRootSelector,
- },
docs: {
// Table of contents stopped working, so I disabled it.
// If we can figure out how to get it working again, we can re-enable it.
From 090021037959d12925a9551ef3235b483a774b68 Mon Sep 17 00:00:00 2001
From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com>
Date: Thu, 24 Apr 2025 13:12:32 -0700
Subject: [PATCH 11/14] feat(unity-bootstrap-theme): update dist files and
README docs for usage
---
.../.storybook/local-addon/addon.js | 22 +++-
.../.storybook/local-addon/entry.js | 3 +
.../.storybook/preview.js | 2 +-
packages/unity-bootstrap-theme/package.json | 6 +-
.../src/js/card-ranking.js | 6 +-
.../src/js/tabbed-panels.js | 6 +-
.../unity-bootstrap-theme/src/js/tables.js | 6 +-
...-bootstrap-theme.js => unity-bootstrap.js} | 16 +--
.../anchor-menu.examples.stories.js | 4 +
.../blockquote/blockquote.examples.stories.js | 6 +-
.../atoms/modals/modals.examples.stories.js | 3 +
.../atoms/modals/modals.templates.stories.js | 5 +-
.../atoms/video/video.templates.stories.js | 5 +
.../docs/GetStarted/get-started.stories.mdx | 37 +++++-
.../banners/banners.templates.stories.js | 5 +
.../calendar/calendar.templates.stories.js | 3 +
.../molecules/cards/cards.examples.stories.js | 10 ++
.../charts-and-graphs.templates.stories.js | 3 +
.../heroes/heroes.examples.stories.js | 6 +
.../image-parallax.examples.stories.js | 3 +
.../tabbed-panels.templates.stories.js | 7 +-
.../tables/tables.templates.stories.js | 6 +
.../global-footer.examples.stories.js | 3 +
.../global-header.examples.stories.js | 3 +
.../vite.config.bundle.js | 124 +++++++-----------
packages/unity-bootstrap-theme/vite.config.js | 68 ++++------
26 files changed, 216 insertions(+), 152 deletions(-)
rename packages/unity-bootstrap-theme/src/js/{unity-bootstrap-theme.js => unity-bootstrap.js} (73%)
diff --git a/packages/unity-bootstrap-theme/.storybook/local-addon/addon.js b/packages/unity-bootstrap-theme/.storybook/local-addon/addon.js
index aa71394add..c21b71102d 100644
--- a/packages/unity-bootstrap-theme/.storybook/local-addon/addon.js
+++ b/packages/unity-bootstrap-theme/.storybook/local-addon/addon.js
@@ -1,11 +1,29 @@
import React from 'react';
import { AddonPanel } from '@storybook/components';
-import { Source } from '@storybook/blocks';
import { addons, types } from '@storybook/addons';
-import { formatWithBabelParser } from './helpers';
import { Toggle } from '../../../../.storybook-config/Toggle'
addons.register('local-addon', (api) => {
+ addons.add('local-addon/panel', {
+ title: 'Javascript',
+ //👇 Sets the type of UI element in Storybook
+ type: types.PANEL,
+ paramKey: 'initFunc',
+ render: ({active, key}) => {
+
+ return(
+
+
+
+ This component requires Javascript.
+
+
View the documentation{" "}on how to use the component in your project.
+
+
+
+ )},
+ });
+
addons.add('local-addon/tools', {
title: 'tools',
type: types.TOOL,
diff --git a/packages/unity-bootstrap-theme/.storybook/local-addon/entry.js b/packages/unity-bootstrap-theme/.storybook/local-addon/entry.js
index ffa92e9e45..c59229045d 100644
--- a/packages/unity-bootstrap-theme/.storybook/local-addon/entry.js
+++ b/packages/unity-bootstrap-theme/.storybook/local-addon/entry.js
@@ -16,6 +16,9 @@ export const parameters = {
loadEvent: {
disable: false
},
+ initFunc: {
+ disable: true
+ },
docs:{
source: {
transform: (src,storyContext)=>{
diff --git a/packages/unity-bootstrap-theme/.storybook/preview.js b/packages/unity-bootstrap-theme/.storybook/preview.js
index 05796d5bd0..fc622e9c19 100644
--- a/packages/unity-bootstrap-theme/.storybook/preview.js
+++ b/packages/unity-bootstrap-theme/.storybook/preview.js
@@ -2,7 +2,7 @@ import "./eventSpy.js";
import "../src/scss/unity-bootstrap-theme.bundle.scss";
import { default as bootstrap } from "bootstrap/js/index.umd.js";
globalThis.bootstrap = bootstrap;
-import { default as udsBootstrap } from "@asu/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js";
+import { default as udsBootstrap } from "../src/js/unity-bootstrap.js";
globalThis.udsBootstrap = udsBootstrap;
import { removeFontAwesomeChanges } from "./local-addon/helpers";
diff --git a/packages/unity-bootstrap-theme/package.json b/packages/unity-bootstrap-theme/package.json
index e3a173c374..9551ea54e6 100644
--- a/packages/unity-bootstrap-theme/package.json
+++ b/packages/unity-bootstrap-theme/package.json
@@ -13,9 +13,9 @@
"url": "git+https://github.com/ASU/asu-unity-stack.git"
},
"scripts": {
- "build": "yarn build:1 && yarn build:2",
- "build:1": "vite build",
- "build:2": "vite build --config vite.config.bundle.js",
+ "build": "yarn build:css && yarn build:js",
+ "build:css": "vite build",
+ "build:js": "vite build --config vite.config.bundle.js",
"watch": "rimraf ./dist && webpack --watch && rimraf ./.tmp",
"storybook": "storybook dev -p 9000",
"build-storybook": "storybook build -o ../../build/$npm_package_name",
diff --git a/packages/unity-bootstrap-theme/src/js/card-ranking.js b/packages/unity-bootstrap-theme/src/js/card-ranking.js
index 88cc28d4ec..d0d1507eeb 100644
--- a/packages/unity-bootstrap-theme/src/js/card-ranking.js
+++ b/packages/unity-bootstrap-theme/src/js/card-ranking.js
@@ -1,7 +1,7 @@
import { EventHandler } from "./bootstrap-helper";
// method ot handle the custom behavior of the ranking card
-function rankingFunc() {
+function initRankingCard() {
const $infoLayer = document.querySelector(".info-layer");
const $toggleIcon = document.getElementById("dispatch");
@@ -11,6 +11,6 @@ function rankingFunc() {
};
-EventHandler.on(window, 'load.uds.ranking-card', rankingFunc);
+EventHandler.on(window, 'load.uds.ranking-card', initRankingCard);
-export { rankingFunc };
+export { initRankingCard };
diff --git a/packages/unity-bootstrap-theme/src/js/tabbed-panels.js b/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
index e711e26820..bd8b42ff5a 100644
--- a/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
+++ b/packages/unity-bootstrap-theme/src/js/tabbed-panels.js
@@ -1,6 +1,6 @@
import { EventHandler } from "./bootstrap-helper";
-function initTabs() {
+function initTabbedPanels() {
("use strict");
const DOM_ELEMENT_A = "a";
@@ -138,8 +138,8 @@ function initTabs() {
});
}
-EventHandler.on(window, 'load.uds.tabs', initTabs);
+EventHandler.on(window, 'load.uds.tabs', initTabbedPanels);
// window.addEventListener("load.uds.tabs", initTabs, true);
-export { initTabs };
+export { initTabbedPanels };
diff --git a/packages/unity-bootstrap-theme/src/js/tables.js b/packages/unity-bootstrap-theme/src/js/tables.js
index 57a3b2890f..6eeb122b29 100644
--- a/packages/unity-bootstrap-theme/src/js/tables.js
+++ b/packages/unity-bootstrap-theme/src/js/tables.js
@@ -14,7 +14,7 @@
import { EventHandler } from "./bootstrap-helper";
-function initializeFixedTable() {
+function initFixedTable() {
function setPreButtonPosition() {
const wrapperSelector = '.uds-table-fixed-wrapper';
const tableSelector = '.uds-table.uds-table-fixed table';
@@ -74,6 +74,6 @@ function initializeFixedTable() {
});
}
-EventHandler.on(window, 'load.uds.fixed-table', initializeFixedTable);
+EventHandler.on(window, 'load.uds.fixed-table', initFixedTable);
-export { initializeFixedTable };
+export { initFixedTable };
diff --git a/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js b/packages/unity-bootstrap-theme/src/js/unity-bootstrap.js
similarity index 73%
rename from packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js
rename to packages/unity-bootstrap-theme/src/js/unity-bootstrap.js
index e2f009ebba..2a1fcf0d65 100644
--- a/packages/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js
+++ b/packages/unity-bootstrap-theme/src/js/unity-bootstrap.js
@@ -1,33 +1,33 @@
-import { initAnchorMenu } from "./anchor-menu.js";
// import Banner from "./banner.js";
+import { initAnchorMenu } from "./anchor-menu.js";
import { initBlockquoteAnimation } from "./blockquote-animated.js";
import { initCalendar } from "./calendar.js";
-import { rankingFunc } from "./card-ranking.js";
+import { initRankingCard } from "./card-ranking.js";
import { initChart } from "./charts-and-graphs.js";
import { initDataLayer } from "./data-layer.js";
import { initGlobalHeader } from "./global-header.js";
import { initHeroesVideo } from "./heroes-video.js";
import { initImageParallax } from "./image-parallax.js";
import { initModals } from "./modals.js";
-import { initTabs } from "./tabbed-panels.js";
-import { initializeFixedTable } from "./tables.js";
+import { initTabbedPanels } from "./tabbed-panels.js";
+import { initFixedTable } from "./tables.js";
import { initVideo } from "./video.js";
const unityBootstrap = {
+ // Banner, // code updated to use bootstrap alert so we don't need this
initAnchorMenu,
- // Banner,
initBlockquoteAnimation,
initCalendar,
- rankingFunc,
initChart,
initDataLayer,
+ initFixedTable,
initGlobalHeader,
initHeroesVideo,
initImageParallax,
initModals,
- initializeFixedTable,
+ initRankingCard,
+ initTabbedPanels,
initVideo,
- initTabs,
}
export default unityBootstrap;
diff --git a/packages/unity-bootstrap-theme/stories/atoms/anchor-menu/anchor-menu.examples.stories.js b/packages/unity-bootstrap-theme/stories/atoms/anchor-menu/anchor-menu.examples.stories.js
index beff5b4fae..ea919af2fb 100644
--- a/packages/unity-bootstrap-theme/stories/atoms/anchor-menu/anchor-menu.examples.stories.js
+++ b/packages/unity-bootstrap-theme/stories/atoms/anchor-menu/anchor-menu.examples.stories.js
@@ -3,9 +3,13 @@ import React from "react";
import { imageName } from "../../../../../shared/assets";
import { htmlRootDecorator } from "../../../../../shared/components/Layout";
import {getLoremSentences} from "../../../../../shared/constants/strings";
+
export default {
title: "Atoms/Anchor Menu",
parameters: {
+ initFunc: {
+ disable: false,
+ },
header: {
forced: true,
},
diff --git a/packages/unity-bootstrap-theme/stories/atoms/blockquote/blockquote.examples.stories.js b/packages/unity-bootstrap-theme/stories/atoms/blockquote/blockquote.examples.stories.js
index 0e3006b417..bff33af586 100644
--- a/packages/unity-bootstrap-theme/stories/atoms/blockquote/blockquote.examples.stories.js
+++ b/packages/unity-bootstrap-theme/stories/atoms/blockquote/blockquote.examples.stories.js
@@ -219,7 +219,11 @@ export const BlockquoteAnimated = () => (
>
);
-
+BlockquoteAnimated.parameters = {
+ initFunc: {
+ disable: false,
+ },
+};
export const TestimonialsNoImage = () => (
<>
diff --git a/packages/unity-bootstrap-theme/stories/atoms/modals/modals.examples.stories.js b/packages/unity-bootstrap-theme/stories/atoms/modals/modals.examples.stories.js
index 68555a4534..7f04bf84ee 100644
--- a/packages/unity-bootstrap-theme/stories/atoms/modals/modals.examples.stories.js
+++ b/packages/unity-bootstrap-theme/stories/atoms/modals/modals.examples.stories.js
@@ -3,6 +3,9 @@ import React from "react";
export default {
title: "Atoms/Modals/Examples",
parameters: {
+ initFunc: {
+ disable: false,
+ },
header: {
forced: true,
},
diff --git a/packages/unity-bootstrap-theme/stories/atoms/modals/modals.templates.stories.js b/packages/unity-bootstrap-theme/stories/atoms/modals/modals.templates.stories.js
index c87847dee5..5b7fb7cab3 100644
--- a/packages/unity-bootstrap-theme/stories/atoms/modals/modals.templates.stories.js
+++ b/packages/unity-bootstrap-theme/stories/atoms/modals/modals.templates.stories.js
@@ -6,12 +6,15 @@ export default {
title: "Atoms/Modals/Templates",
decorators: [ defaultDecorator ],
parameters: {
+ initFunc: {
+ disable: false,
+ },
header: {
forced: true,
},
footer: {
forced: true,
- }
+ },
},
args: {open: true},
argTypes: {
diff --git a/packages/unity-bootstrap-theme/stories/atoms/video/video.templates.stories.js b/packages/unity-bootstrap-theme/stories/atoms/video/video.templates.stories.js
index 5668c84a8f..0d2879f732 100644
--- a/packages/unity-bootstrap-theme/stories/atoms/video/video.templates.stories.js
+++ b/packages/unity-bootstrap-theme/stories/atoms/video/video.templates.stories.js
@@ -13,6 +13,11 @@ export default {
control: { type: "boolean" },
},
},
+ parameters: {
+ initFunc: {
+ disable: false,
+ },
+ },
};
export const Default = ({content}) =>
diff --git a/packages/unity-bootstrap-theme/stories/docs/GetStarted/get-started.stories.mdx b/packages/unity-bootstrap-theme/stories/docs/GetStarted/get-started.stories.mdx
index d76d45d785..05a39d8b38 100755
--- a/packages/unity-bootstrap-theme/stories/docs/GetStarted/get-started.stories.mdx
+++ b/packages/unity-bootstrap-theme/stories/docs/GetStarted/get-started.stories.mdx
@@ -17,12 +17,37 @@ This is the Storybook reference site for the Unity Bootstrap theme. Browse the d
## ❯ Including Unity in your project
-We bundle the necessary CSS and Javascript in the `dist/` folder. There are more options so you don't have to include CSS you don't use.
-
-* `dist/unity-bootstrap-theme.bundle.css` - base theme with header and footer CSS
-* `dist/unity-bootstrap-theme.css` - base theme without header and footer CSS
-* `dist/unity-bootstrap-header.css` (optional) - header CSS only - don't use if using the Unity `component-header` React component
-* `dist/unity-bootstrap-footer.css` (optional) - footer CSS only - don't use if using the Unity `component-footer` React component
+We bundle the necessary CSS and Javascript in the `dist/` folder. There are more options so you don't have to include CSS you don't use.
+### CSS
+* `dist/css/unity-bootstrap-theme.bundle.css` - base theme with header and footer CSS
+* `dist/css/unity-bootstrap-theme.css` - base theme without header and footer CSS
+* `dist/css/unity-bootstrap-header-footer.css` (optional) - header and footer CSS only - don't use if using the Unity `component-header-footer` React component
+
+### Javascript
+All you need to do is include the script on your page, the scripts will execute with the window load event.
+We provide 3 formats ("UMD", "CJS", "ES").
+* exports:
+ * `initAnchorMenu`,
+ * `initBlockquoteAnimation`,
+ * `initCalendar`,
+ * `initChart`,
+ * `initDataLayer`,
+ * `initFixedTable`,
+ * `initGlobalHeader`,
+ * `initHeroesVideo`,
+ * `initImageParallax`,
+ * `initModals`,
+ * `initRankingCard`,
+ * `initTabbedPanels`,
+ * `initVideo`,
+* Unity File Formats
+ * dist/js/unity-bootstrap.umd.js (universal)
+ * creates a global variable `unityBootstrap` if you need to manaully call the init function ex: `unityBootstrap.initAnchorMenu()`
+ * dist/js/unity-bootstrap.cjs.js (common js)
+ * dist/js/unity-bootstrap.es.js (module)
+* Vendor Files
+ * dist/js/bootstrap.bundle.min.js (unaltered bootstrap version)
+ * dist/js/chart.min.js (only needed if you are using the donut chart)
## ❯ How to use the Unity Storybook reference site
diff --git a/packages/unity-bootstrap-theme/stories/molecules/banners/banners.templates.stories.js b/packages/unity-bootstrap-theme/stories/molecules/banners/banners.templates.stories.js
index d385da5dc8..6678d53d0f 100644
--- a/packages/unity-bootstrap-theme/stories/molecules/banners/banners.templates.stories.js
+++ b/packages/unity-bootstrap-theme/stories/molecules/banners/banners.templates.stories.js
@@ -25,6 +25,11 @@ export default {
args: {
color: "Orange",
},
+ parameters: {
+ initFunc: {
+ disable: false,
+ },
+ },
};
export const Banner = ({color}) => {
diff --git a/packages/unity-bootstrap-theme/stories/molecules/calendar/calendar.templates.stories.js b/packages/unity-bootstrap-theme/stories/molecules/calendar/calendar.templates.stories.js
index b8352665a8..9300680f28 100644
--- a/packages/unity-bootstrap-theme/stories/molecules/calendar/calendar.templates.stories.js
+++ b/packages/unity-bootstrap-theme/stories/molecules/calendar/calendar.templates.stories.js
@@ -6,6 +6,9 @@ export default {
title: "Molecules/Calendar/Templates",
decorators: [ defaultDecorator ],
parameters: {
+ initFunc: {
+ disable: false,
+ },
controls: { disable: true }
},
};
diff --git a/packages/unity-bootstrap-theme/stories/molecules/cards/cards.examples.stories.js b/packages/unity-bootstrap-theme/stories/molecules/cards/cards.examples.stories.js
index 8b9f58c812..465ca2f5ac 100644
--- a/packages/unity-bootstrap-theme/stories/molecules/cards/cards.examples.stories.js
+++ b/packages/unity-bootstrap-theme/stories/molecules/cards/cards.examples.stories.js
@@ -1530,6 +1530,11 @@ export const RankingCardLarge = () => (
);
+RankingCardLarge.parameters = {
+ initFunc: {
+ disable: false,
+ },
+};
RankingCardLarge.decorators = [ defaultDecorator ];
export const RankingCardSmall = () => (
@@ -1598,4 +1603,9 @@ export const RankingCardSmall = () => (