@stack-spot/portal-layout 0.0.18 → 0.0.20

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.
Files changed (40) hide show
  1. package/dist/Layout.d.ts +3 -3
  2. package/dist/Layout.js +9 -9
  3. package/dist/LayoutOverlayManager.d.ts +3 -3
  4. package/dist/LayoutOverlayManager.js +7 -7
  5. package/dist/components/Dialog.js +2 -2
  6. package/dist/components/Header.d.ts +1 -1
  7. package/dist/components/Header.js +2 -2
  8. package/dist/components/OverlayContent.js +1 -1
  9. package/dist/components/SelectionList.d.ts +1 -1
  10. package/dist/components/Toaster.js +1 -1
  11. package/dist/components/UserMenu.d.ts +1 -1
  12. package/dist/components/UserMenu.js +1 -1
  13. package/dist/components/error/ErrorBoundary.d.ts +1 -1
  14. package/dist/components/error/ErrorBoundary.js +2 -2
  15. package/dist/components/error/ErrorFeedback.d.ts +1 -1
  16. package/dist/components/error/ErrorFeedback.js +5 -5
  17. package/dist/components/error/SilentErrorBoundary.d.ts +1 -1
  18. package/dist/components/error/SilentErrorBoundary.js +1 -1
  19. package/dist/components/menu/MenuContent.d.ts +1 -1
  20. package/dist/components/menu/MenuContent.d.ts.map +1 -1
  21. package/dist/components/menu/MenuContent.js +15 -11
  22. package/dist/components/menu/MenuContent.js.map +1 -1
  23. package/dist/components/menu/MenuSections.d.ts +1 -1
  24. package/dist/components/menu/MenuSections.js +1 -1
  25. package/dist/components/menu/PageSelector.d.ts +1 -1
  26. package/dist/components/menu/PageSelector.d.ts.map +1 -1
  27. package/dist/components/menu/PageSelector.js +6 -3
  28. package/dist/components/menu/PageSelector.js.map +1 -1
  29. package/dist/components/menu/types.d.ts +1 -1
  30. package/dist/components/menu/useCheckTextOverflow.d.ts +6 -0
  31. package/dist/components/menu/useCheckTextOverflow.d.ts.map +1 -0
  32. package/dist/components/menu/useCheckTextOverflow.js +20 -0
  33. package/dist/components/menu/useCheckTextOverflow.js.map +1 -0
  34. package/dist/index.d.ts +14 -14
  35. package/dist/index.js +14 -14
  36. package/dist/utils.js +1 -1
  37. package/package.json +3 -2
  38. package/src/components/menu/MenuContent.tsx +21 -17
  39. package/src/components/menu/PageSelector.tsx +4 -1
  40. package/src/components/menu/useCheckTextOverflow.tsx +26 -0
package/dist/Layout.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { WithStyle } from '@stack-spot/portal-theme';
2
2
  import '@stack-spot/portal-theme/dist/theme.css';
3
3
  import { ReactElement, ReactNode } from 'react';
4
- import { DescriptionFn, ErrorHandler } from './components/error/ErrorManager';
5
- import { HeaderProps } from './components/Header';
6
- import { MenuProps } from './components/menu/types';
4
+ import { DescriptionFn, ErrorHandler } from './components/error/ErrorManager.js';
5
+ import { HeaderProps } from './components/Header.js';
6
+ import { MenuProps } from './components/menu/types.js';
7
7
  import './layout.css';
8
8
  interface Props extends WithStyle {
9
9
  menu: MenuProps;
package/dist/Layout.js CHANGED
@@ -2,16 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CSSToCitricAdapter, listToClass } from '@stack-spot/portal-theme';
3
3
  import '@stack-spot/portal-theme/dist/theme.css';
4
4
  import { useEffect } from 'react';
5
- import { ErrorBoundary } from './components/error/ErrorBoundary';
6
- import { ErrorManager } from './components/error/ErrorManager';
7
- import { SilentErrorBoundary } from './components/error/SilentErrorBoundary';
8
- import { Header } from './components/Header';
9
- import { MenuContent } from './components/menu/MenuContent';
10
- import { MenuSections } from './components/menu/MenuSections';
11
- import { Toaster } from './components/Toaster';
12
- import { elementIds } from './elements';
5
+ import { ErrorBoundary } from './components/error/ErrorBoundary.js';
6
+ import { ErrorManager } from './components/error/ErrorManager.js';
7
+ import { SilentErrorBoundary } from './components/error/SilentErrorBoundary.js';
8
+ import { Header } from './components/Header.js';
9
+ import { MenuContent } from './components/menu/MenuContent.js';
10
+ import { MenuSections } from './components/menu/MenuSections.js';
11
+ import { Toaster } from './components/Toaster.js';
12
+ import { elementIds } from './elements.js';
13
13
  import './layout.css';
14
- import { overlay } from './LayoutOverlayManager';
14
+ import { overlay } from './LayoutOverlayManager.js';
15
15
  export const RawLayout = ({ menuSections, menuContent, header, compactMenu = true, children, extra, errorDescriptor, onError, className, style }) => {
16
16
  // @ts-ignore
17
17
  const { bottomDialog, modal, rightPanel } = overlay.useOverlays();
@@ -1,7 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
- import { DialogOptions } from './components/Dialog';
3
- import { OverlayContentProps } from './components/OverlayContent';
4
- import { showToaster as showReactToaster } from './toaster';
2
+ import { DialogOptions } from './components/Dialog.js';
3
+ import { OverlayContentProps } from './components/OverlayContent.js';
4
+ import { showToaster as showReactToaster } from './toaster.js';
5
5
  interface AlertOptions extends Omit<DialogOptions, 'cancel'> {
6
6
  showButton?: boolean;
7
7
  }
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  /* eslint-disable react-hooks/rules-of-hooks */
3
3
  import { Button } from '@citric/core';
4
4
  import { useLayoutEffect, useState } from 'react';
5
- import { Dialog } from './components/Dialog';
6
- import { CLOSE_OVERLAY_ID, OverlayContent } from './components/OverlayContent';
7
- import { getDictionary } from './dictionary';
8
- import { elementIds, getLayoutElements } from './elements';
9
- import { ElementNotFound, LayoutError } from './errors';
10
- import { showToaster as showReactToaster } from './toaster';
11
- import { focusFirstChild, valueOfLayoutVar } from './utils';
5
+ import { Dialog } from './components/Dialog.js';
6
+ import { CLOSE_OVERLAY_ID, OverlayContent } from './components/OverlayContent.js';
7
+ import { getDictionary } from './dictionary.js';
8
+ import { elementIds, getLayoutElements } from './elements.js';
9
+ import { ElementNotFound, LayoutError } from './errors.js';
10
+ import { showToaster as showReactToaster } from './toaster.js';
11
+ import { focusFirstChild, valueOfLayoutVar } from './utils.js';
12
12
  function multipleCallsWarning(type, timeMS) {
13
13
  return `
14
14
  Attempted to show a modal or rightPanel while a ${type} was still being closed. Closing a ${type} takes only ${timeMS}ms, so this action
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Flex, Input, Text } from '@citric/core';
3
3
  import { interpolate } from '@stack-spot/portal-translate';
4
4
  import { useState } from 'react';
5
- import { useDictionary } from '../dictionary';
6
- import { OverlayContent } from './OverlayContent';
5
+ import { useDictionary } from '../dictionary.js';
6
+ import { OverlayContent } from './OverlayContent.js';
7
7
  const justifyButtons = {
8
8
  center: 'center',
9
9
  left: 'start',
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { SelectionListProps } from './SelectionList';
2
+ import { SelectionListProps } from './SelectionList.js';
3
3
  export interface HeaderProps {
4
4
  logo?: ReactNode;
5
5
  logoHref?: string;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Flex } from '@citric/core';
3
- import { Logo } from '../svg/Logo';
4
- import { UserMenu } from './UserMenu';
3
+ import { Logo } from '../svg/Logo.js';
4
+ import { UserMenu } from './UserMenu.js';
5
5
  export const Header = ({ logo, logoHref, center, right, userName, email, options }) => (_jsxs(_Fragment, { children: [_jsx("a", { href: logoHref, title: "Home", children: logo ?? _jsx(Logo, { style: { width: 130 } }) }), _jsx(Flex, { flex: 1, children: center }), right, userName && _jsx(UserMenu, { userName: userName, email: email, options: options })] }));
6
6
  //# sourceMappingURL=Header.js.map
@@ -4,7 +4,7 @@ import { TimesMini } from '@citric/icons';
4
4
  import { IconButton } from '@citric/ui';
5
5
  import { listToClass, theme } from '@stack-spot/portal-theme';
6
6
  import { styled } from 'styled-components';
7
- import { useDictionary } from '../dictionary';
7
+ import { useDictionary } from '../dictionary.js';
8
8
  export const CLOSE_OVERLAY_ID = 'close-overlay';
9
9
  const ContentBox = styled.section `
10
10
  display: flex;
@@ -1,6 +1,6 @@
1
1
  import { WithStyle } from '@stack-spot/portal-theme';
2
2
  import { ReactElement } from 'react';
3
- import { Action } from './types';
3
+ import { Action } from './types.js';
4
4
  interface ItemWithIcon {
5
5
  icon?: React.ReactElement;
6
6
  iconRight?: React.ReactElement;
@@ -3,7 +3,7 @@ import { TimesMini } from '@citric/icons';
3
3
  import { IconButton } from '@citric/ui';
4
4
  import { ToastContainer } from 'react-toastify';
5
5
  import 'react-toastify/dist/ReactToastify.css';
6
- import { useDictionary } from '../dictionary';
6
+ import { useDictionary } from '../dictionary.js';
7
7
  const CloseButton = ({ closeToast }) => {
8
8
  const t = useDictionary();
9
9
  return (_jsx(IconButton, { onClick: () => closeToast(null), title: t.dismiss, children: _jsx(TimesMini, {}) }));
@@ -1,4 +1,4 @@
1
- import { SelectionListProps } from './SelectionList';
1
+ import { SelectionListProps } from './SelectionList.js';
2
2
  interface Props {
3
3
  userName: string;
4
4
  email?: string;
@@ -6,7 +6,7 @@ import { theme } from '@stack-spot/portal-theme';
6
6
  import { interpolate, useTranslate } from '@stack-spot/portal-translate';
7
7
  import { useState } from 'react';
8
8
  import { styled } from 'styled-components';
9
- import { SelectionList } from './SelectionList';
9
+ import { SelectionList } from './SelectionList.js';
10
10
  const USER_MENU_ID = 'userMenu';
11
11
  const UserMenuBox = styled.div `
12
12
  .user-menu-header {
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { ErrorDescription } from './ErrorManager';
2
+ import { ErrorDescription } from './ErrorManager.js';
3
3
  interface State extends ErrorDescription {
4
4
  hasError: boolean;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Component } from 'react';
3
- import { ErrorFeedback } from './ErrorFeedback';
4
- import { ErrorManager } from './ErrorManager';
3
+ import { ErrorFeedback } from './ErrorFeedback.js';
4
+ import { ErrorManager } from './ErrorManager.js';
5
5
  export class ErrorBoundary extends Component {
6
6
  constructor(props) {
7
7
  super(props);
@@ -1,3 +1,3 @@
1
- import { ErrorDescription } from './ErrorManager';
1
+ import { ErrorDescription } from './ErrorManager.js';
2
2
  export declare const ErrorFeedback: ({ code, message, debug }: ErrorDescription) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=ErrorFeedback.d.ts.map
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Button, Container, Flex, LinkBox, Text } from '@citric/core';
3
3
  import { useTranslate } from '@stack-spot/portal-translate';
4
4
  import { useState } from 'react';
5
- import { Forbidden } from '../../svg/Forbidden';
6
- import { Logo } from '../../svg/Logo';
7
- import { NotFound } from '../../svg/NotFound';
8
- import { ServerError } from '../../svg/ServerError';
9
- import { Unauthenticated } from '../../svg/Unauthenticated';
5
+ import { Forbidden } from '../../svg/Forbidden.js';
6
+ import { Logo } from '../../svg/Logo.js';
7
+ import { NotFound } from '../../svg/NotFound.js';
8
+ import { ServerError } from '../../svg/ServerError.js';
9
+ import { Unauthenticated } from '../../svg/Unauthenticated.js';
10
10
  const imageStyle = {
11
11
  width: '200px',
12
12
  height: '200px',
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { ErrorDescription } from './ErrorManager';
2
+ import { ErrorDescription } from './ErrorManager.js';
3
3
  interface State extends ErrorDescription {
4
4
  hasError: boolean;
5
5
  message?: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { theme } from '@stack-spot/portal-theme';
3
3
  import { Component } from 'react';
4
- import { ErrorManager } from './ErrorManager';
4
+ import { ErrorManager } from './ErrorManager.js';
5
5
  export class SilentErrorBoundary extends Component {
6
6
  constructor(props) {
7
7
  super(props);
@@ -1,3 +1,3 @@
1
- import { MenuSectionContent } from './types';
1
+ import { MenuSectionContent } from './types.js';
2
2
  export declare const MenuContent: ({ pageSelector, goBack, title, subtitle, afterTitle, options, loading, error }: MenuSectionContent) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=MenuContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/menu/MenuContent.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAmC,kBAAkB,EAAE,MAAM,SAAS,CAAA;AA6L7E,eAAO,MAAM,WAAW,mFAAyF,kBAAkB,4CAoClI,CAAA"}
1
+ {"version":3,"file":"MenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/menu/MenuContent.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAmC,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAiM7E,eAAO,MAAM,WAAW,mFAAyF,kBAAkB,4CAoClI,CAAA"}
@@ -6,9 +6,10 @@ import { LoadingCircular } from '@citric/ui';
6
6
  import { listToClass, theme } from '@stack-spot/portal-theme';
7
7
  import { useMemo, useState } from 'react';
8
8
  import { styled } from 'styled-components';
9
- import { hideOverlayImmediately } from './MenuSections';
10
- import { PageSelector } from './PageSelector';
11
- import { MENU_CONTENT_ITEM_PADDING as ITEM_PADDING, MENU_CONTENT_PADDING as PADDING } from './constants';
9
+ import { hideOverlayImmediately } from './MenuSections.js';
10
+ import { PageSelector } from './PageSelector.js';
11
+ import { MENU_CONTENT_ITEM_PADDING as ITEM_PADDING, MENU_CONTENT_PADDING as PADDING } from './constants.js';
12
+ import { useCheckTextOverflow } from './useCheckTextOverflow.js';
12
13
  const BackLink = styled.a `
13
14
  display: flex;
14
15
  flex-direction: row;
@@ -128,16 +129,19 @@ const Title = styled.header `
128
129
  flex-direction: column;
129
130
  margin: ${PADDING}px 0 24px ${PADDING}px;
130
131
  `;
131
- const ActionItem = ({ label, onClick, href, active, icon, badge, overflow = 'wrap' }) => (_jsxs("a", { href: active ? undefined : href, onClick: () => {
132
- if (active)
133
- return;
134
- if (onClick)
135
- onClick();
136
- hideOverlayImmediately();
137
- }, className: listToClass(['action', 'item-row', active ? 'active' : undefined]), ...(active ? { 'aria-current': 'page' } : undefined), children: [icon, _jsx(Text, { appearance: "body2", className: `label ${overflow}`, children: label }), badge] }));
132
+ const ActionItem = ({ label, onClick, href, active, icon, badge, overflow = 'wrap' }) => {
133
+ const { ref, overflow: textOverflow } = useCheckTextOverflow();
134
+ return (_jsxs("a", { href: active ? undefined : href, onClick: () => {
135
+ if (active)
136
+ return;
137
+ if (onClick)
138
+ onClick();
139
+ hideOverlayImmediately();
140
+ }, className: listToClass(['action', 'item-row', active ? 'active' : undefined]), ...(active ? { 'aria-current': 'page' } : undefined), children: [icon, _jsx(Text, { ref: ref, appearance: "body2", className: `label ${overflow}`, title: textOverflow ? label : '', children: label }), badge] }));
141
+ };
138
142
  const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, badge, overflow = 'wrap' }) => {
139
143
  const [open, setOpen] = useState(initiallyOpened ?? children?.some(c => 'active' in c && c.active) ?? false);
140
- const items = useMemo(() => children?.map(renderOption), [children]);
144
+ const items = useMemo(() => children?.filter(i => !i.hidden).map(renderOption), [children]);
141
145
  const id = `menuGroup${label}`;
142
146
  return (_jsxs(_Fragment, { children: [_jsxs("a", { onClick: () => setOpen(!open), onKeyDown: e => e.key === 'Enter' && setOpen(!open), className: "item-row", tabIndex: 0, "aria-controls": id, "aria-expanded": open, children: [icon, _jsx(Text, { appearance: "body2", className: `label ${overflow}`, children: label }), badge, _jsx(IconBox, { children: _jsx(ChevronDown, { className: listToClass(['chevron', open ? 'open' : '']) }) })] }), _jsx(MenuGroup, { id: id, className: open ? 'open' : undefined, "aria-hidden": !open, children: items })] }));
143
147
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuContent.js","sourceRoot":"","sources":["../../../src/components/menu/MenuContent.tsx"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;A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M,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,aAClD,KAAC,OAAO,IAAC,WAAW,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,YACtC,KAAC,SAAS,KAAG,GACL,EACV,KAAC,IAAI,IAAC,UAAU,EAAC,OAAO,EAAC,cAAc,kBAAE,MAAM,CAAC,KAAK,GAAQ,IACpD,CACZ,EACA,KAAK,IAAI,CACR,MAAC,KAAK,eACJ,KAAC,IAAI,IAAC,UAAU,EAAC,aAAa,EAAC,WAAW,EAAC,SAAS,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,YAAG,KAAK,GAAQ,EAC7G,QAAQ,IAAI,KAAC,IAAI,IAAC,UAAU,EAAC,IAAI,YAAE,QAAQ,GAAQ,IAC9C,CACT,EACA,UAAU,EACV,YAAY,IAAI,KAAC,YAAY,OAAK,YAAY,GAAI,EAClD,aAAa,EAAE,IACf,CACJ,CAAA;AACH,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { MenuProps } from './types';
1
+ import { MenuProps } from './types.js';
2
2
  export declare function hideOverlayImmediately(): void;
3
3
  export declare const MenuSections: ({ sections, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
4
4
  //# sourceMappingURL=MenuSections.d.ts.map
@@ -4,7 +4,7 @@ import { IconBox, Text } from '@citric/core';
4
4
  import { ChevronLeft, Menu as MenuIcon } from '@citric/icons';
5
5
  import { useTranslate } from '@stack-spot/portal-translate';
6
6
  import { useCallback, useMemo, useState } from 'react';
7
- import { MenuContent } from './MenuContent';
7
+ import { MenuContent } from './MenuContent.js';
8
8
  const ARROW_HEIGHT = 24;
9
9
  const HIDE_OVERLAY_DELAY_MS = 400;
10
10
  const MENU_OVERLAY_ID = 'menuContentOverlay';
@@ -1,3 +1,3 @@
1
- import { Selector } from './types';
1
+ import { Selector } from './types.js';
2
2
  export declare const PageSelector: ({ options, value, button, loading, title }: Selector) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=PageSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageSelector.d.ts","sourceRoot":"","sources":["../../../src/components/menu/PageSelector.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAqElC,eAAO,MAAM,YAAY,+CAAgD,QAAQ,4CAsDhF,CAAA"}
1
+ {"version":3,"file":"PageSelector.d.ts","sourceRoot":"","sources":["../../../src/components/menu/PageSelector.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAsElC,eAAO,MAAM,YAAY,+CAAgD,QAAQ,4CAwDhF,CAAA"}
@@ -6,8 +6,9 @@ import { theme } from '@stack-spot/portal-theme';
6
6
  import { interpolate, useTranslate } from '@stack-spot/portal-translate';
7
7
  import { useMemo, useRef, useState } from 'react';
8
8
  import { styled } from 'styled-components';
9
- import { SelectionList } from '../SelectionList';
10
- import { MENU_CONTENT_PADDING as PADDING } from './constants';
9
+ import { SelectionList } from '../SelectionList.js';
10
+ import { MENU_CONTENT_PADDING as PADDING } from './constants.js';
11
+ import { useCheckTextOverflow } from './useCheckTextOverflow.js';
11
12
  const SelectorBox = styled.div `
12
13
  position: relative;
13
14
  margin: ${PADDING}px;
@@ -77,6 +78,7 @@ const SelectorBox = styled.div `
77
78
  export const PageSelector = ({ options, value, button, loading, title }) => {
78
79
  const t = useTranslate(dictionary);
79
80
  const [visible, setVisible] = useState(false);
81
+ const { ref, overflow } = useCheckTextOverflow();
80
82
  const id = useRef(`pageSelector${title || Math.random()}`);
81
83
  const { optionsWithIcon, selected } = useMemo(() => {
82
84
  let selected = options[0];
@@ -89,9 +91,10 @@ export const PageSelector = ({ options, value, button, loading, title }) => {
89
91
  });
90
92
  return { optionsWithIcon, selected };
91
93
  }, [options, value, button]);
94
+ const label = selected?.label ?? button?.label ?? value;
92
95
  return (_jsx(SelectorBox, { children: loading
93
96
  ? _jsx(LoadingCircular, {})
94
- : (_jsxs(_Fragment, { children: [title && _jsx(Text, { colorScheme: "light.700", sx: { mb: 3 }, children: title }), _jsxs("a", { onClick: () => setVisible(true), onKeyDown: e => e.key === 'Enter' && setVisible(true), title: value, tabIndex: 0, "aria-label": interpolate(t.accessibility, [value]), "aria-expanded": visible, "aria-controls": id.current, children: [selected?.icon && _jsx(IconBox, { children: selected?.icon }), _jsx(Text, { appearance: "body2", className: "label", children: selected?.label ?? button?.label ?? value }), _jsx(IconBox, { size: "xs", children: _jsx(Select, {}) })] }), _jsx(SelectionList, { id: id.current, visible: visible, items: optionsWithIcon, onHide: () => setVisible(false), after: button ? _jsx("a", { className: "view-all", href: button.href, onClick: button.onClick, children: button.label }) : undefined, scroll: true })] })) }));
97
+ : (_jsxs(_Fragment, { children: [title && _jsx(Text, { colorScheme: "light.700", sx: { mb: 3 }, children: title }), _jsxs("a", { onClick: () => setVisible(true), onKeyDown: e => e.key === 'Enter' && setVisible(true), title: value, tabIndex: 0, "aria-label": interpolate(t.accessibility, [value]), "aria-expanded": visible, "aria-controls": id.current, children: [selected?.icon && _jsx(IconBox, { children: selected?.icon }), _jsx(Text, { ref: ref, appearance: "body2", className: "label", title: overflow ? label : '', children: label }), _jsx(IconBox, { size: "xs", children: _jsx(Select, {}) })] }), _jsx(SelectionList, { id: id.current, visible: visible, items: optionsWithIcon, onHide: () => setVisible(false), after: button ? _jsx("a", { className: "view-all", href: button.href, onClick: button.onClick, children: button.label }) : undefined, scroll: true })] })) }));
95
98
  };
96
99
  const dictionary = {
97
100
  en: {
@@ -1 +1 @@
1
- {"version":3,"file":"PageSelector.js","sourceRoot":"","sources":["../../../src/components/menu/PageSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE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C,CAAC,EAAE,YAAG,KAAK,GAAQ,EACjG,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,MAAM,KAAG,GAAU,IACrC,EAEJ,KAAC,aAAa,IACZ,EAAE,EAAE,EAAE,CAAC,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,UAAU,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,YAAG,MAAM,CAAC,KAAK,GAAK,CAAC,CAAC,CAAC,SAAS,EAClH,MAAM,SACN,IACD,CACJ,GAES,CACf,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,aAAa,EAAE,2CAA2C;KAC3D;IACD,EAAE,EAAE;QACF,aAAa,EAAE,2CAA2C;KAC3D;CACmB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { Action } from '../types';
2
+ import { Action } from '../types.js';
3
3
  interface BaseMenuItem {
4
4
  hidden?: boolean;
5
5
  /**
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare function useCheckTextOverflow(): {
3
+ overflow: boolean;
4
+ ref: import("react").RefObject<HTMLParagraphElement>;
5
+ };
6
+ //# sourceMappingURL=useCheckTextOverflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCheckTextOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/menu/useCheckTextOverflow.tsx"],"names":[],"mappings":";AAEA,wBAAgB,oBAAoB;;;EAuBnC"}
@@ -0,0 +1,20 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+ export function useCheckTextOverflow() {
3
+ const [overflow, setOverflow] = useState(false);
4
+ const ref = useRef(null);
5
+ const checkOverflow = () => {
6
+ if (!ref.current) {
7
+ return;
8
+ }
9
+ const hasOverflow = ref.current.offsetWidth < ref.current.scrollWidth;
10
+ if (hasOverflow === overflow) {
11
+ return;
12
+ }
13
+ setOverflow(hasOverflow);
14
+ };
15
+ useEffect(() => {
16
+ checkOverflow();
17
+ }, [ref.current]);
18
+ return { overflow, ref };
19
+ }
20
+ //# sourceMappingURL=useCheckTextOverflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCheckTextOverflow.js","sourceRoot":"","sources":["../../../src/components/menu/useCheckTextOverflow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAA;IAE9C,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,OAAM;SACP;QAED,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAA;QAErE,IAAI,WAAW,KAAK,QAAQ,EAAE;YAC5B,OAAM;SACP;QAED,WAAW,CAAC,WAAW,CAAC,CAAA;IAC1B,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE,CAAA;IACjB,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAEjB,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;AAC1B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export { Layout } from './Layout';
2
- export { overlay } from './LayoutOverlayManager';
3
- export { Dialog } from './components/Dialog';
4
- export { Header, HeaderProps } from './components/Header';
5
- export { OverlayContent } from './components/OverlayContent';
6
- export { ListAction, SelectionList, SelectionListProps } from './components/SelectionList';
7
- export { MenuContent } from './components/menu/MenuContent';
8
- export { MenuSections } from './components/menu/MenuSections';
9
- export * from './components/menu/types';
10
- export * from './components/types';
11
- export * from './elements';
12
- export * from './errors';
13
- export { Logo as StackspotLogo } from './svg/Logo';
14
- export * from './utils';
1
+ export { Layout } from './Layout.js';
2
+ export { overlay } from './LayoutOverlayManager.js';
3
+ export { Dialog } from './components/Dialog.js';
4
+ export { Header, HeaderProps } from './components/Header.js';
5
+ export { OverlayContent } from './components/OverlayContent.js';
6
+ export { ListAction, SelectionList, SelectionListProps } from './components/SelectionList.js';
7
+ export { MenuContent } from './components/menu/MenuContent.js';
8
+ export { MenuSections } from './components/menu/MenuSections.js';
9
+ export * from './components/menu/types.js';
10
+ export * from './components/types.js';
11
+ export * from './elements.js';
12
+ export * from './errors.js';
13
+ export { Logo as StackspotLogo } from './svg/Logo.js';
14
+ export * from './utils.js';
15
15
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- export { Layout } from './Layout';
2
- export { overlay } from './LayoutOverlayManager';
3
- export { Dialog } from './components/Dialog';
4
- export { Header } from './components/Header';
5
- export { OverlayContent } from './components/OverlayContent';
6
- export { SelectionList } from './components/SelectionList';
7
- export { MenuContent } from './components/menu/MenuContent';
8
- export { MenuSections } from './components/menu/MenuSections';
9
- export * from './components/menu/types';
10
- export * from './components/types';
11
- export * from './elements';
12
- export * from './errors';
13
- export { Logo as StackspotLogo } from './svg/Logo';
14
- export * from './utils';
1
+ export { Layout } from './Layout.js';
2
+ export { overlay } from './LayoutOverlayManager.js';
3
+ export { Dialog } from './components/Dialog.js';
4
+ export { Header } from './components/Header.js';
5
+ export { OverlayContent } from './components/OverlayContent.js';
6
+ export { SelectionList } from './components/SelectionList.js';
7
+ export { MenuContent } from './components/menu/MenuContent.js';
8
+ export { MenuSections } from './components/menu/MenuSections.js';
9
+ export * from './components/menu/types.js';
10
+ export * from './components/types.js';
11
+ export * from './elements.js';
12
+ export * from './errors.js';
13
+ export { Logo as StackspotLogo } from './svg/Logo.js';
14
+ export * from './utils.js';
15
15
  //# sourceMappingURL=index.js.map
package/dist/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { valueOf } from '@stack-spot/portal-theme';
2
- import { getLayoutElements } from './elements';
2
+ import { getLayoutElements } from './elements.js';
3
3
  export function valueOfLayoutVar(varname) {
4
4
  const layout = document.getElementById('layout');
5
5
  if (!layout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/portal-layout",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,13 +28,14 @@
28
28
  "eslint-plugin-react": "^7.33.2",
29
29
  "eslint-plugin-react-hooks": "^4.6.0",
30
30
  "eslint-plugin-react-refresh": "^0.4.4",
31
+ "tsc-esm-fix": "^2.20.26",
31
32
  "typescript": "^5.2.2"
32
33
  },
33
34
  "dependencies": {
34
35
  "react-toastify": "^9.1.3"
35
36
  },
36
37
  "scripts": {
37
- "build": "tsc && cpy src/layout.css dist --flat",
38
+ "build": "tsc && tsc-esm-fix --target='dist' && cpy src/layout.css dist --flat",
38
39
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
39
40
  }
40
41
  }
@@ -9,6 +9,7 @@ import { hideOverlayImmediately } from './MenuSections'
9
9
  import { PageSelector } from './PageSelector'
10
10
  import { MENU_CONTENT_ITEM_PADDING as ITEM_PADDING, MENU_CONTENT_PADDING as PADDING } from './constants'
11
11
  import { ItemGroup, MenuAction, MenuItem, MenuSectionContent } from './types'
12
+ import { useCheckTextOverflow } from './useCheckTextOverflow'
12
13
 
13
14
  const BackLink = styled.a`
14
15
  display: flex;
@@ -132,26 +133,29 @@ const Title = styled.header`
132
133
  margin: ${PADDING}px 0 24px ${PADDING}px;
133
134
  `
134
135
 
135
- const ActionItem = ({ label, onClick, href, active, icon, badge, overflow = 'wrap' }: MenuAction) => (
136
- <a
137
- href={active ? undefined : href}
138
- onClick={() => {
139
- if (active) return
140
- if (onClick) onClick()
141
- hideOverlayImmediately()
142
- }}
143
- className={listToClass(['action', 'item-row', active ? 'active' : undefined])}
144
- {...(active ? { 'aria-current': 'page' } : undefined)}
145
- >
146
- {icon}
147
- <Text appearance="body2" className={`label ${overflow}`}>{label}</Text>
148
- {badge}
149
- </a>
150
- )
136
+ const ActionItem = ({ label, onClick, href, active, icon, badge, overflow = 'wrap' }: MenuAction) => {
137
+ const { ref, overflow: textOverflow } = useCheckTextOverflow()
138
+ return (
139
+ <a
140
+ href={active ? undefined : href}
141
+ onClick={() => {
142
+ if (active) return
143
+ if (onClick) onClick()
144
+ hideOverlayImmediately()
145
+ }}
146
+ className={listToClass(['action', 'item-row', active ? 'active' : undefined])}
147
+ {...(active ? { 'aria-current': 'page' } : undefined)}
148
+ >
149
+ {icon}
150
+ <Text ref={ref} appearance="body2" className={`label ${overflow}`} title={textOverflow ? label : ''}>{label}</Text>
151
+ {badge}
152
+ </a>
153
+ )
154
+ }
151
155
 
152
156
  const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, badge, overflow = 'wrap' }: ItemGroup) => {
153
157
  const [open, setOpen] = useState(initiallyOpened ?? children?.some(c => 'active' in c && c.active) ?? false)
154
- const items = useMemo(() => children?.map(renderOption), [children])
158
+ const items = useMemo(() => children?.filter(i => !i.hidden).map(renderOption), [children])
155
159
  const id = `menuGroup${label}`
156
160
 
157
161
  return (
@@ -8,6 +8,7 @@ import { styled } from 'styled-components'
8
8
  import { ListAction, SelectionList } from '../SelectionList'
9
9
  import { MENU_CONTENT_PADDING as PADDING } from './constants'
10
10
  import { Selector } from './types'
11
+ import { useCheckTextOverflow } from './useCheckTextOverflow'
11
12
 
12
13
  const SelectorBox = styled.div`
13
14
  position: relative;
@@ -79,6 +80,7 @@ const SelectorBox = styled.div`
79
80
  export const PageSelector = ({ options, value, button, loading, title }: Selector) => {
80
81
  const t = useTranslate(dictionary)
81
82
  const [visible, setVisible] = useState(false)
83
+ const { ref, overflow } = useCheckTextOverflow()
82
84
  const id = useRef(`pageSelector${title || Math.random()}`)
83
85
  const { optionsWithIcon, selected } = useMemo(
84
86
  () => {
@@ -95,6 +97,7 @@ export const PageSelector = ({ options, value, button, loading, title }: Selecto
95
97
  [options, value, button],
96
98
  )
97
99
 
100
+ const label = selected?.label ?? button?.label ?? value
98
101
 
99
102
  return (
100
103
  <SelectorBox>
@@ -113,7 +116,7 @@ export const PageSelector = ({ options, value, button, loading, title }: Selecto
113
116
  aria-controls={id.current}
114
117
  >
115
118
  {selected?.icon && <IconBox>{selected?.icon}</IconBox>}
116
- <Text appearance="body2" className="label">{selected?.label ?? button?.label ?? value}</Text>
119
+ <Text ref={ref} appearance="body2" className="label" title={overflow ? label : ''}>{label}</Text>
117
120
  <IconBox size="xs"><Select /></IconBox>
118
121
  </a>
119
122
 
@@ -0,0 +1,26 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+
3
+ export function useCheckTextOverflow() {
4
+ const [overflow, setOverflow] = useState<boolean>(false)
5
+ const ref = useRef<HTMLParagraphElement>(null)
6
+
7
+ const checkOverflow = () => {
8
+ if (!ref.current) {
9
+ return
10
+ }
11
+
12
+ const hasOverflow = ref.current.offsetWidth < ref.current.scrollWidth
13
+
14
+ if (hasOverflow === overflow) {
15
+ return
16
+ }
17
+
18
+ setOverflow(hasOverflow)
19
+ }
20
+
21
+ useEffect(() => {
22
+ checkOverflow()
23
+ }, [ref.current])
24
+
25
+ return { overflow, ref }
26
+ }