@stack-spot/portal-components 1.0.0 → 1.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## [1.1.0](https://github.com/stack-spot/portal-commons/compare/portal-components-v1.0.1...portal-components@v1.1.0) (2024-06-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add singleton for handling user menu outside of the component ([6720095](https://github.com/stack-spot/portal-commons/commit/67200959d763eaa6f73fc2eb40b84949dd1194eb))
9
+ * update component and layout ([0d72e00](https://github.com/stack-spot/portal-commons/commit/0d72e00968cf3b3cbb196dec66eedc42c75aacbf))
10
+ * update components and layout ([b82260f](https://github.com/stack-spot/portal-commons/commit/b82260f701d7f0115d9fcda8fec4e310cbc42998))
11
+ * update components and layout ([c1ba398](https://github.com/stack-spot/portal-commons/commit/c1ba398fdfc51aac0b0d8b1b7d5258c6ae857e51))
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare const Box: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
2
+ export declare const Box: React.FC<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>>;
3
3
  //# sourceMappingURL=styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/styled.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,GAAG,kOA+Bf,CAAA"}
1
+ {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/styled.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CA+BjG,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { getFontAppearance } from '@citric/core/dist/utils/theme.js';
2
2
  import { theme } from '@stack-spot/portal-theme';
3
3
  import { styled } from 'styled-components';
4
+ // the type below should be inferred, but a bug in TS+PNPM prevents it: https://github.com/microsoft/TypeScript/issues/42873
4
5
  export const Box = styled.nav `
5
6
  margin-bottom: 24px;
6
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/Breadcrumb/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;cAcf,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAY,EAAE,YAAY,CAAQ;;eAElE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;;;;;;;aAS1B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;eAGtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;CAG5C,CAAA"}
1
+ {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/Breadcrumb/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,4HAA4H;AAC5H,MAAM,CAAC,MAAM,GAAG,GAAsF,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;cAclG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAY,EAAE,YAAY,CAAQ;;eAElE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;;;;;;;aAS1B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;;;eAGtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;CAG5C,CAAA"}
@@ -47,6 +47,10 @@ export interface ListAction extends ItemWithIcon, Action {
47
47
  * Icon to render when this option is active.
48
48
  */
49
49
  iconActive?: React.ReactElement;
50
+ /**
51
+ * A class to be added to this item.
52
+ */
53
+ className?: string;
50
54
  }
51
55
  interface ListGroup {
52
56
  /**
@@ -57,6 +61,10 @@ interface ListGroup {
57
61
  * The items of this group.
58
62
  */
59
63
  children: ListItem[];
64
+ /**
65
+ * A class to be added to this item.
66
+ */
67
+ className?: string;
60
68
  }
61
69
  interface ListSection extends ListGroup {
62
70
  type: 'section';
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionList.d.ts","sourceRoot":"","sources":["../../src/components/SelectionList.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAsB,MAAM,0BAA0B,CAAA;AAExE,OAAO,EAAE,YAAY,EAA6C,MAAM,OAAO,CAAA;AAK/E,UAAU,WAAW;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClE;AAED,UAAU,YAAY;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,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AE,YAAY;IACvD,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,QAAQ,GAAG,WAAW,GAAG,eAAe,GAAG,UAAU,CAAA;AAW1D,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA2HD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,wFAEvB,kBAAkB,4CAsFpB,CAAA"}
@@ -64,24 +64,24 @@ const SelectionBox = styled.div `
64
64
  transition: ${MAX_HEIGHT_TRANSITION};
65
65
  }
66
66
  `;
67
- function renderAction({ label, href, onClick, icon, iconRight, active, target, iconActive = _jsx(Check, {}), }, { onClose, Link }) {
67
+ function renderAction({ label, href, onClick, icon, iconRight, active, target, iconActive = _jsx(Check, {}), className = '', }, { onClose, Link }) {
68
68
  function handleClick() {
69
69
  onClick?.();
70
70
  onClose?.();
71
71
  }
72
72
  const isTextLabel = typeof label === 'string';
73
- return (_jsx("li", { className: "action", children: _jsxs(Link, { href: href, onClick: handleClick, target: target, tabIndex: 0, "aria-selected": active, children: [icon && _jsx(IconBox, { children: icon }), isTextLabel ? _jsx(Text, { appearance: "body2", className: "label", children: label }) : label.element, iconRight && _jsx(IconBox, { children: iconRight }), active && _jsx(IconBox, { children: iconActive })] }) }, isTextLabel ? label : label.id));
73
+ return (_jsx("li", { className: "action", children: _jsxs(Link, { href: href, onClick: handleClick, target: target, tabIndex: 0, "aria-selected": active, className: className, children: [icon && _jsx(IconBox, { children: icon }), isTextLabel ? _jsx(Text, { appearance: "body2", className: "label", children: label }) : label.element, iconRight && _jsx(IconBox, { children: iconRight }), active && _jsx(IconBox, { children: iconActive })] }) }, isTextLabel ? label : label.id));
74
74
  }
75
- function renderCollapsible({ label, icon, iconRight, children }, { setCurrent, controllerId, Link }) {
75
+ function renderCollapsible({ label, icon, iconRight, className = '', children }, { setCurrent, controllerId, Link }) {
76
76
  function handleClick(ev) {
77
77
  // accessibility: this will tell the screen reader the section was expanded before this link is removed from the DOM.
78
78
  ev.target?.setAttribute?.('aria-expanded', 'true');
79
79
  setCurrent({ items: children, label });
80
80
  }
81
- return (_jsx("li", { className: "collapsible", children: _jsxs(Link, { onClick: handleClick, tabIndex: 0, "aria-expanded": false, "aria-controls": controllerId, children: [icon && _jsx(IconBox, { children: icon }), _jsx(Text, { appearance: "body2", className: "label", children: label }), iconRight && _jsx(IconBox, { children: iconRight }), _jsx(IconBox, { children: _jsx(ChevronRight, {}) })] }) }, label));
81
+ return (_jsx("li", { className: "collapsible", children: _jsxs(Link, { onClick: handleClick, tabIndex: 0, className: className, "aria-expanded": false, "aria-controls": controllerId, children: [icon && _jsx(IconBox, { children: icon }), _jsx(Text, { appearance: "body2", className: "label", children: label }), iconRight && _jsx(IconBox, { children: iconRight }), _jsx(IconBox, { children: _jsx(ChevronRight, {}) })] }) }, label));
82
82
  }
83
- function renderSection({ label, children }, options) {
84
- return (_jsxs("li", { className: "section", children: [label && _jsx(Text, { appearance: "overheader2", colorScheme: "primary", className: "section-title", children: label }), _jsx("ul", { children: children.map(i => renderItem(i, options)) })] }, label ?? children.map(c => c.label).join('-')));
83
+ function renderSection({ label, className = '', children }, options) {
84
+ return (_jsxs("li", { className: `${className} section`, children: [label && _jsx(Text, { appearance: "overheader2", colorScheme: "primary", className: "section-title", children: label }), _jsx("ul", { children: children.map(i => renderItem(i, options)) })] }, label ?? children.map(c => c.label).join('-')));
85
85
  }
86
86
  function renderItem(item, options) {
87
87
  if ('children' in item) {
@@ -114,7 +114,8 @@ export const SelectionList = ({ id, items, className, style, visible = true, max
114
114
  // if the element is not in the DOM anymore, we'll consider the click was inside the selection list
115
115
  const isClickInsideSelectionList = !target?.isConnected || wrapper.current?.contains(target);
116
116
  const isAction = target?.classList?.contains('action') || !!target?.closest('.action');
117
- if (!isClickInsideSelectionList || isAction)
117
+ const isInsideTour = !!target?.closest('#___reactour');
118
+ if (!isInsideTour && (!isClickInsideSelectionList || isAction))
118
119
  onHide?.();
119
120
  }, []);
120
121
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionList.js","sourceRoot":"","sources":["../../src/components/SelectionList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAa,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAgB,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAmB,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAyFvD,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACjC,MAAM,qBAAqB,GAAG,sBAAsB,qBAAqB,GAAG,IAAI,GAAG,CAAA;AA8CnF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAA2C;;gBAE1D,CAAC,EAAE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AAK,EAAE,KAAK,EACZ,SAAS,EAAE,WAAW,CAAC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,aAC7E,MAAM,iBACF,CAAC,OAAO,YAErB,eAAK,SAAS,EAAC,wBAAwB,aACpC,MAAM,EACN,OAAO,CAAC,MAAM;oBACb,CAAC,CAAC,CACA,MAAC,IAAI,IAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,UAAU,EAAC,QAAQ,aACrC,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;oCACd,wHAAwH;oCACvH,EAAE,CAAC,MAAsB,EAAE,YAAY,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;oCACpE,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;gCACzC,CAAC,EACD,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EACb,KAAK,EAAE,CAAC,CAAC,IAAI,mBACE,EAAE,mBACF,IAAI,YAEnB,KAAC,SAAS,KAAG,GACF,EACb,KAAC,IAAI,IAAC,UAAU,EAAC,YAAY,YAAE,OAAO,CAAC,KAAK,GAAQ,IAC/C,CACR;oBACD,CAAC,CAAC,SAAS,EAEb,yBACG,SAAS,EACT,KAAK;4BACJ,aAAI,SAAS,EAAC,QAAQ,YACnB,KAAK,GACH,IAEJ,IACD,GACO,CAChB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,IAAI,EAAE,SAAS;KAChB;IACD,EAAE,EAAE;QACF,IAAI,EAAE,QAAQ;KACf;CACmB,CAAA"}
1
+ {"version":3,"file":"SelectionList.js","sourceRoot":"","sources":["../../src/components/SelectionList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc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CAAC,EAAE,UAAU,EAAC,QAAQ,aACrC,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;oCACd,wHAAwH;oCACvH,EAAE,CAAC,MAAsB,EAAE,YAAY,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;oCACpE,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;gCACzC,CAAC,EACD,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EACb,KAAK,EAAE,CAAC,CAAC,IAAI,mBACE,EAAE,mBACF,IAAI,YAEnB,KAAC,SAAS,KAAG,GACF,EACb,KAAC,IAAI,IAAC,UAAU,EAAC,YAAY,YAAE,OAAO,CAAC,KAAK,GAAQ,IAC/C,CACR;oBACD,CAAC,CAAC,SAAS,EAEb,yBACG,SAAS,EACT,KAAK;4BACJ,aAAI,SAAS,EAAC,QAAQ,YACnB,KAAK,GACH,IAEJ,IACD,GACO,CAChB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,IAAI,EAAE,SAAS;KAChB;IACD,EAAE,EAAE;QACF,IAAI,EAAE,QAAQ;KACf;CACmB,CAAA"}
@@ -18,6 +18,7 @@ export declare const isNewTourStep: (step: ReactourStep) => boolean;
18
18
  * Tutorial: verifies if the key passed as parameter refers to a React Tour step that has already finished.
19
19
  *
20
20
  * The key refers to a finished step if the array stored as a cookie includes it.
21
+ * If the cookie is set to 'disabled', then the step will be considered finished.Particularly useful in scenarios like e2e tests.
21
22
  * @param key the step's identifier to check.
22
23
  * @returns true if the key refers to a finished step. False otherwise.
23
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Tour/utils.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,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,KAAG,YAkBrB,CAAA"}
@@ -3,6 +3,8 @@ import { theme } from '@stack-spot/portal-theme';
3
3
  import { getCookie, setCookie } from '../../utils/cookie.js';
4
4
  import { StepContainer } from './StepContainer.js';
5
5
  const TOUR_COOKIE = 'guided-tour-global';
6
+ const defaultExpires = new Date();
7
+ defaultExpires.setFullYear(new Date().getFullYear() + 1);
6
8
  const getTourCookie = () => {
7
9
  const currentTourObject = getCookie(TOUR_COOKIE);
8
10
  return currentTourObject ? currentTourObject.split(',') : [];
@@ -15,7 +17,7 @@ export const finishTourStep = (key) => {
15
17
  const finishedTours = getTourCookie();
16
18
  if (!finishedTours.includes(key))
17
19
  finishedTours.push(key);
18
- setCookie(TOUR_COOKIE, finishedTours.toString());
20
+ setCookie(TOUR_COOKIE, finishedTours.toString(), { expires: defaultExpires.toUTCString() });
19
21
  };
20
22
  /**
21
23
  * Tutorial: verifies if the React Tour step has not finished yet.
@@ -29,10 +31,14 @@ export const isNewTourStep = (step) => !hasFinishedTourStep(`${step.selector}`);
29
31
  * Tutorial: verifies if the key passed as parameter refers to a React Tour step that has already finished.
30
32
  *
31
33
  * The key refers to a finished step if the array stored as a cookie includes it.
34
+ * If the cookie is set to 'disabled', then the step will be considered finished.Particularly useful in scenarios like e2e tests.
32
35
  * @param key the step's identifier to check.
33
36
  * @returns true if the key refers to a finished step. False otherwise.
34
37
  */
35
- export const hasFinishedTourStep = (key) => getTourCookie().includes(key);
38
+ export const hasFinishedTourStep = (key) => {
39
+ const tourCookie = getTourCookie();
40
+ return tourCookie.includes(key) || tourCookie[0] === 'disabled';
41
+ };
36
42
  /**
37
43
  * Tutorial: utility for building a React Tour step. This already includes some default configuration for tours in Stackspot.
38
44
  * @param options the options for building the step: {@link StackspotTourStep}.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Tour/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAGhD,OA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;QACjF,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;KACjB;IACD,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;CAChB,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BannerWarning } from './components/BannerWarning.js';
2
2
  export { ChatBot } from './components/ChatBot.js';
3
3
  export { useKeyboardControls } from './hooks/keyboard.js';
4
- export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect, } from './hooks/service-now.js';
4
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now.js';
5
5
  export { useCheckTextOverflow } from './hooks/text.js';
6
6
  export { titleEffect, useTitleEffect } from './hooks/title.js';
7
7
  export { useEffectOnce } from './hooks/use-effect-once.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EACL,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,GAC/G,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { BannerWarning } from './components/BannerWarning.js';
2
2
  export { ChatBot } from './components/ChatBot.js';
3
3
  export { useKeyboardControls } from './hooks/keyboard.js';
4
- export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect, } from './hooks/service-now.js';
4
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now.js';
5
5
  export { useCheckTextOverflow } from './hooks/text.js';
6
6
  export { titleEffect, useTitleEffect } from './hooks/title.js';
7
7
  export { useEffectOnce } from './hooks/use-effect-once.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EACL,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,GAC/G,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,oBAAoB,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
@@ -17,8 +17,9 @@ export declare function getCookies(): Record<string, string | undefined>;
17
17
  * Sets the value of a cookie.
18
18
  * @param key the cookie name (identifier).
19
19
  * @param value the cookie value.
20
+ * @param customAttributes Accepted values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes.
20
21
  */
21
- export declare function setCookie(key: string, value: string): void;
22
+ export declare function setCookie(key: string, value: string, customAttributes?: Record<string, string>): void;
22
23
  /**
23
24
  * Removes a cookie.
24
25
  * @param key the cookie name (identifier).
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/utils/cookie.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,QAI/C;AAED;;;GAGG;AACH,wBAAgB,eAAe,WAG9B;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAO/D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAGnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,QAGvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,sBAEpC"}
1
+ {"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/utils/cookie.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,QAI/C;AAED;;;GAGG;AACH,wBAAgB,eAAe,WAG9B;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAO/D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,QAGlG;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,QAGvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,sBAEpC"}
@@ -1,6 +1,6 @@
1
1
  const DEFAULT_DOMAIN_REGEX = new RegExp(/(\.*(prd|stg|dev)*.stackspot.com)|localhost/);
2
2
  let cookieDomain = '';
3
- let cookieAttributes = '';
3
+ let cookieAttributes = {};
4
4
  /**
5
5
  * Setup the cookie utilities to use a another domain. By default, it's based on *.stackspot.com.
6
6
  * @param domainRegex the regex to identify the domain. Example: {@link DEFAULT_DOMAIN_REGEX}.
@@ -8,7 +8,7 @@ let cookieAttributes = '';
8
8
  export function setupCookies(domainRegex) {
9
9
  const portalUrl = new URL(location.href);
10
10
  cookieDomain = domainRegex.exec(portalUrl.host)?.[0] ?? '';
11
- cookieAttributes = `domain=${cookieDomain}; SameSite=Strict;`;
11
+ cookieAttributes = { domain: cookieDomain, SameSite: 'Strict' };
12
12
  }
13
13
  /**
14
14
  * Retrieves the current domain used for cookies. To change the domain, use `setupCookies(domainRegex)`.
@@ -36,11 +36,12 @@ export function getCookies() {
36
36
  * Sets the value of a cookie.
37
37
  * @param key the cookie name (identifier).
38
38
  * @param value the cookie value.
39
+ * @param customAttributes Accepted values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes.
39
40
  */
40
- export function setCookie(key, value) {
41
+ export function setCookie(key, value, customAttributes = {}) {
41
42
  if (!cookieAttributes)
42
43
  setupCookies(DEFAULT_DOMAIN_REGEX);
43
- document.cookie = `${key}=${value}; ${cookieAttributes}`;
44
+ document.cookie = `${key}=${value}; ${objectToCookieString({ ...cookieAttributes, ...customAttributes })}`;
44
45
  }
45
46
  /**
46
47
  * Removes a cookie.
@@ -49,7 +50,7 @@ export function setCookie(key, value) {
49
50
  export function removeCookie(key) {
50
51
  if (!cookieAttributes)
51
52
  setupCookies(DEFAULT_DOMAIN_REGEX);
52
- document.cookie = `${key}= ; ${cookieAttributes} expires = Thu, 01 Jan 1970 00:00:00 GMT`;
53
+ document.cookie = `${key}= ; ${objectToCookieString({ ...cookieAttributes, expires: 'Thu, 01 Jan 1970 00:00:00 GMT' })}`;
53
54
  }
54
55
  /**
55
56
  * Retrieves the value of a cookie given its key/name.
@@ -59,4 +60,5 @@ export function removeCookie(key) {
59
60
  export function getCookie(key) {
60
61
  return getCookies()[key];
61
62
  }
63
+ const objectToCookieString = (object) => Object.entries(object).reduce((prev, current) => `${prev} ${current[0]}=${current[1]};`, '');
62
64
  //# sourceMappingURL=cookie.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/utils/cookie.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,6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version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,11 @@
13
13
  "./svg": "./dist/svg/index.js",
14
14
  "./anchor": "./dist/context/anchor.js"
15
15
  },
16
+ "scripts": {
17
+ "build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
18
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
19
+ "check-tree-shaking": "agadoo"
20
+ },
16
21
  "peerDependencies": {
17
22
  "@citric/core": "^6.0.0",
18
23
  "@citric/icons": "^5.4.0 || ^6.0.0",
@@ -38,17 +43,15 @@
38
43
  "eslint-plugin-react": "^7.33.2",
39
44
  "eslint-plugin-react-hooks": "^4.6.0",
40
45
  "eslint-plugin-react-refresh": "^0.4.4",
46
+ "rimraf": "^5.0.7",
47
+ "styled-components": "6.1.10",
41
48
  "tsc-esm-fix": "^2.20.26",
42
49
  "typescript": "^5.2.2",
43
- "styled-components": "6.1.10"
50
+ "react": "18.2.0",
51
+ "react-dom": "18.2.0"
44
52
  },
45
53
  "dependencies": {
46
54
  "lodash": "^4.17.21",
47
55
  "reactour": "^1.19.3"
48
- },
49
- "scripts": {
50
- "build": "tsc && tsc-esm-fix --target='dist'",
51
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
52
- "check-tree-shaking": "agadoo"
53
56
  }
54
57
  }
@@ -2,7 +2,8 @@ import { getFontAppearance } from '@citric/core/dist/utils/theme'
2
2
  import { theme } from '@stack-spot/portal-theme'
3
3
  import { styled } from 'styled-components'
4
4
 
5
- export const Box = styled.nav`
5
+ // the type below should be inferred, but a bug in TS+PNPM prevents it: https://github.com/microsoft/TypeScript/issues/42873
6
+ export const Box: React.FC<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>> = styled.nav`
6
7
  margin-bottom: 24px;
7
8
 
8
9
  ul {
@@ -58,6 +58,10 @@ export interface ListAction extends ItemWithIcon, Action {
58
58
  * Icon to render when this option is active.
59
59
  */
60
60
  iconActive?: React.ReactElement,
61
+ /**
62
+ * A class to be added to this item.
63
+ */
64
+ className?: string,
61
65
  }
62
66
 
63
67
  interface ListGroup {
@@ -69,6 +73,10 @@ interface ListGroup {
69
73
  * The items of this group.
70
74
  */
71
75
  children: ListItem[],
76
+ /**
77
+ * A class to be added to this item.
78
+ */
79
+ className?: string,
72
80
  }
73
81
 
74
82
  interface ListSection extends ListGroup {
@@ -199,6 +207,7 @@ const SelectionBox = styled.div<{ $maxHeight: string, $scroll?: boolean }>`
199
207
 
200
208
  function renderAction({
201
209
  label, href, onClick, icon, iconRight, active, target, iconActive = <Check />,
210
+ className='',
202
211
  }: ListAction, { onClose, Link }: RenderOptions) {
203
212
  function handleClick() {
204
213
  onClick?.()
@@ -209,7 +218,8 @@ function renderAction({
209
218
 
210
219
  return (
211
220
  <li key={isTextLabel ? label : label.id} className="action">
212
- <Link href={href} onClick={handleClick} target={target} tabIndex={0} aria-selected={active}>
221
+ <Link href={href} onClick={handleClick} target={target} tabIndex={0} aria-selected={active}
222
+ className={className}>
213
223
  {icon && <IconBox>{icon}</IconBox>}
214
224
  {isTextLabel ? <Text appearance="body2" className="label">{label}</Text> : label.element}
215
225
  {iconRight && <IconBox>{iconRight}</IconBox>}
@@ -219,7 +229,8 @@ function renderAction({
219
229
  )
220
230
  }
221
231
 
222
- function renderCollapsible({ label, icon, iconRight, children }: ListCollapsible, { setCurrent, controllerId, Link }: RenderOptions) {
232
+ function renderCollapsible({ label, icon, iconRight, className='', children }:
233
+ ListCollapsible, { setCurrent, controllerId, Link }: RenderOptions) {
223
234
  function handleClick(ev: React.MouseEvent) {
224
235
  // accessibility: this will tell the screen reader the section was expanded before this link is removed from the DOM.
225
236
  (ev.target as HTMLElement)?.setAttribute?.('aria-expanded', 'true')
@@ -227,7 +238,7 @@ function renderCollapsible({ label, icon, iconRight, children }: ListCollapsible
227
238
  }
228
239
  return (
229
240
  <li key={label} className="collapsible">
230
- <Link onClick={handleClick} tabIndex={0} aria-expanded={false} aria-controls={controllerId}>
241
+ <Link onClick={handleClick} tabIndex={0} className={className} aria-expanded={false} aria-controls={controllerId}>
231
242
  {icon && <IconBox>{icon}</IconBox>}
232
243
  <Text appearance="body2" className="label">{label}</Text>
233
244
  {iconRight && <IconBox>{iconRight}</IconBox>}
@@ -237,9 +248,9 @@ function renderCollapsible({ label, icon, iconRight, children }: ListCollapsible
237
248
  )
238
249
  }
239
250
 
240
- function renderSection({ label, children }: ListSection, options: RenderOptions) {
251
+ function renderSection({ label, className = '', children }: ListSection, options: RenderOptions) {
241
252
  return (
242
- <li key={label ?? children.map(c => c.label).join('-')} className="section">
253
+ <li key={label ?? children.map(c => c.label).join('-')} className={`${className} section`}>
243
254
  {label && <Text appearance="overheader2" colorScheme="primary" className="section-title">{label}</Text>}
244
255
  <ul>{children.map(i => renderItem(i, options))}</ul>
245
256
  </li>
@@ -290,7 +301,8 @@ export const SelectionList = ({
290
301
  // if the element is not in the DOM anymore, we'll consider the click was inside the selection list
291
302
  const isClickInsideSelectionList = !target?.isConnected || wrapper.current?.contains(target)
292
303
  const isAction = target?.classList?.contains('action') || !!target?.closest('.action')
293
- if (!isClickInsideSelectionList || isAction) onHide?.()
304
+ const isInsideTour = !!target?.closest('#___reactour')
305
+ if (!isInsideTour && (!isClickInsideSelectionList || isAction)) onHide?.()
294
306
  }, [])
295
307
 
296
308
  useEffect(() => {
@@ -7,6 +7,9 @@ import { NavigationProps } from './StepNavigation'
7
7
 
8
8
  const TOUR_COOKIE = 'guided-tour-global'
9
9
 
10
+ const defaultExpires = new Date()
11
+ defaultExpires.setFullYear(new Date().getFullYear() + 1)
12
+
10
13
  const getTourCookie = () => {
11
14
  const currentTourObject = getCookie(TOUR_COOKIE)
12
15
  return currentTourObject ? currentTourObject.split(',') : []
@@ -19,7 +22,7 @@ const getTourCookie = () => {
19
22
  export const finishTourStep = (key: string) => {
20
23
  const finishedTours: string[] = getTourCookie()
21
24
  if (!finishedTours.includes(key)) finishedTours.push(key)
22
- setCookie(TOUR_COOKIE, finishedTours.toString())
25
+ setCookie(TOUR_COOKIE, finishedTours.toString(), { expires: defaultExpires.toUTCString() })
23
26
  }
24
27
 
25
28
  /**
@@ -35,10 +38,14 @@ export const isNewTourStep = (step: ReactourStep) => !hasFinishedTourStep(`${ste
35
38
  * Tutorial: verifies if the key passed as parameter refers to a React Tour step that has already finished.
36
39
  *
37
40
  * The key refers to a finished step if the array stored as a cookie includes it.
41
+ * If the cookie is set to 'disabled', then the step will be considered finished.Particularly useful in scenarios like e2e tests.
38
42
  * @param key the step's identifier to check.
39
43
  * @returns true if the key refers to a finished step. False otherwise.
40
44
  */
41
- export const hasFinishedTourStep = (key: string) => getTourCookie().includes(key)
45
+ export const hasFinishedTourStep = (key: string) => {
46
+ const tourCookie = getTourCookie()
47
+ return tourCookie.includes(key) || tourCookie[0] === 'disabled'
48
+ }
42
49
 
43
50
  interface StackspotTourStep extends ReactourStep {
44
51
  /**
package/src/index.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  export { BannerWarning } from './components/BannerWarning'
2
2
  export { ChatBot } from './components/ChatBot'
3
3
  export { useKeyboardControls } from './hooks/keyboard'
4
- export {
5
- openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect,
6
- } from './hooks/service-now'
4
+ export { openServiceNowChat, dictionary as serviceNowDictionary, useServiceNowChatButtonVisibility, useServiceNowEffect } from './hooks/service-now'
7
5
  export { useCheckTextOverflow } from './hooks/text'
8
6
  export { titleEffect, useTitleEffect } from './hooks/title'
9
7
  export { useEffectOnce } from './hooks/use-effect-once'
@@ -1,6 +1,6 @@
1
1
  const DEFAULT_DOMAIN_REGEX = new RegExp(/(\.*(prd|stg|dev)*.stackspot.com)|localhost/)
2
2
  let cookieDomain = ''
3
- let cookieAttributes = ''
3
+ let cookieAttributes = {}
4
4
 
5
5
  /**
6
6
  * Setup the cookie utilities to use a another domain. By default, it's based on *.stackspot.com.
@@ -9,7 +9,7 @@ let cookieAttributes = ''
9
9
  export function setupCookies(domainRegex: RegExp) {
10
10
  const portalUrl = new URL(location.href)
11
11
  cookieDomain = domainRegex.exec(portalUrl.host)?.[0] ?? ''
12
- cookieAttributes = `domain=${cookieDomain}; SameSite=Strict;`
12
+ cookieAttributes = { domain: cookieDomain, SameSite: 'Strict' }
13
13
  }
14
14
 
15
15
  /**
@@ -38,10 +38,11 @@ export function getCookies(): Record<string, string | undefined> {
38
38
  * Sets the value of a cookie.
39
39
  * @param key the cookie name (identifier).
40
40
  * @param value the cookie value.
41
+ * @param customAttributes Accepted values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes.
41
42
  */
42
- export function setCookie(key: string, value: string) {
43
+ export function setCookie(key: string, value: string, customAttributes: Record<string, string> = {}) {
43
44
  if (!cookieAttributes) setupCookies(DEFAULT_DOMAIN_REGEX)
44
- document.cookie = `${key}=${value}; ${cookieAttributes}`
45
+ document.cookie = `${key}=${value}; ${objectToCookieString({ ...cookieAttributes, ...customAttributes })}`
45
46
  }
46
47
 
47
48
  /**
@@ -50,7 +51,7 @@ export function setCookie(key: string, value: string) {
50
51
  */
51
52
  export function removeCookie(key: string) {
52
53
  if (!cookieAttributes) setupCookies(DEFAULT_DOMAIN_REGEX)
53
- document.cookie = `${key}= ; ${cookieAttributes} expires = Thu, 01 Jan 1970 00:00:00 GMT`
54
+ document.cookie = `${key}= ; ${objectToCookieString({ ...cookieAttributes, expires: 'Thu, 01 Jan 1970 00:00:00 GMT' })}`
54
55
  }
55
56
 
56
57
  /**
@@ -61,3 +62,5 @@ export function removeCookie(key: string) {
61
62
  export function getCookie(key: string) {
62
63
  return getCookies()[key]
63
64
  }
65
+
66
+ const objectToCookieString = (object: Record<string, string>): string => Object.entries(object).reduce((prev, current) => `${prev} ${current[0]}=${current[1]};`, '')