tycho-components 0.29.5 → 0.29.6

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.
@@ -1,7 +1,12 @@
1
- import { ButtonDSModes } from "tycho-storybook/dist/Button/Button";
1
+ import { ButtonDSModes, ButtonDSSizes, TooltipPlacements } from 'tycho-storybook';
2
2
  type Props = {
3
+ mode?: ButtonDSModes;
3
4
  buttonMode?: ButtonDSModes;
5
+ size?: ButtonDSSizes;
6
+ iconSize?: ButtonDSSizes;
7
+ tooltipPlacement?: TooltipPlacements;
8
+ title?: string;
4
9
  keyboardLayout?: string;
5
10
  };
6
- export default function AppKeyboard({ buttonMode, keyboardLayout, }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export default function AppKeyboard({ mode, buttonMode, size, iconSize, tooltipPlacement, title, keyboardLayout, }: Props): import("react/jsx-runtime").JSX.Element;
7
12
  export {};
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { useTranslation } from "react-i18next";
4
- import { IconButton } from "tycho-storybook";
5
- import VirtualKeyboard from "../../shell/VirtualKeyboard";
6
- import { useCorpusUtils } from "../../configs/useCorpusUtils";
7
- export default function AppKeyboard({ buttonMode = "filled", keyboardLayout, }) {
8
- const { t } = useTranslation("header");
2
+ import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { IconButton, } from 'tycho-storybook';
5
+ import VirtualKeyboard from '../../shell/VirtualKeyboard';
6
+ import { useCorpusUtils } from '../../configs/useCorpusUtils';
7
+ export default function AppKeyboard({ mode, buttonMode = 'filled', size = 'medium', iconSize, tooltipPlacement, title, keyboardLayout, }) {
8
+ const { t } = useTranslation('header');
9
9
  const { getCorpus } = useCorpusUtils();
10
10
  const [openKeyboard, setOpenKeyboard] = useState(false);
11
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "medium", title: t("tooltip.keyboard"), mode: buttonMode }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t("button.close"), defaultLayout: keyboardLayout || getCorpus().keyboardLayout || "english" }))] }));
11
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: size, iconSize: iconSize, title: title || t('tooltip.keyboard'), mode: mode || buttonMode, tooltipPlacement: tooltipPlacement }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: keyboardLayout || getCorpus().keyboardLayout || 'english' }))] }));
12
12
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './common';
2
2
  export * from './shell';
3
+ export { default as HelpButton } from './shell/Header/HelpButton';
4
+ export type { HelpAction } from './shell/Header/HelpButton/HelpButton';
3
5
  export * from './configs';
4
6
  export * from './functions';
5
7
  export * from './features';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './common';
2
2
  export * from './shell';
3
+ export { default as HelpButton } from './shell/Header/HelpButton';
3
4
  export * from './configs';
4
5
  export * from './functions';
5
6
  export * from './features';
@@ -1,18 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { lazy, Suspense, useState } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { IconButton } from 'tycho-storybook';
2
+ import { lazy, Suspense } from 'react';
3
+ import { AppKeyboard } from '../../../common';
5
4
  import LanguageSelector from '../../LanguageSelector';
6
- import VirtualKeyboard from '../../VirtualKeyboard';
7
- import { useCorpusUtils } from '../../../configs/useCorpusUtils';
8
5
  import { useLoggedUtils } from '../../../configs/useLoggedUtils';
9
6
  import HelpButton from '../HelpButton';
10
7
  import './styles.scss';
11
8
  const HeaderNotifications = lazy(() => import('../../../features/Comments/HeaderNotifications'));
12
9
  export default function HeaderButtons({ hideKeyboard, notifications, keyboardLayout, helpActions, mobile, hideNotifications = false, hideLanguageSelector = false, hideHelpButton = false, }) {
13
- const { t } = useTranslation('header');
14
- const { getCorpus } = useCorpusUtils();
15
10
  const { isLogged } = useLoggedUtils();
16
- const [openKeyboard, setOpenKeyboard] = useState(false);
17
- return (_jsxs("div", { className: "header-buttons", children: [!hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "large", title: t('tooltip.keyboard'), mode: mobile ? 'outlined' : 'filled' })), !hideHelpButton && (_jsx(HelpButton, { helpActions: helpActions, mobile: mobile })), !hideNotifications && notifications && isLogged() && (_jsx(Suspense, { fallback: null, children: _jsx(HeaderNotifications, { uid: notifications.ref, mode: notifications.mode, mobile: mobile }) })), !hideLanguageSelector && (_jsx(LanguageSelector, { openToTop: mobile ? true : false, mobile: mobile })), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: keyboardLayout || getCorpus().keyboardLayout || 'english' }))] }));
11
+ return (_jsxs("div", { className: "header-buttons", children: [!hideKeyboard && (_jsx(AppKeyboard, { size: "large", keyboardLayout: keyboardLayout, mode: mobile ? 'outlined' : 'filled' })), !hideHelpButton && (_jsx(HelpButton, { helpActions: helpActions, mobile: mobile })), !hideNotifications && notifications && isLogged() && (_jsx(Suspense, { fallback: null, children: _jsx(HeaderNotifications, { uid: notifications.ref, mode: notifications.mode, mobile: mobile }) })), !hideLanguageSelector && (_jsx(LanguageSelector, { openToTop: mobile ? true : false, mobile: mobile }))] }));
18
12
  }
@@ -1,3 +1,4 @@
1
+ import { ButtonDSModes, ButtonDSSizes, TooltipPlacements } from 'tycho-storybook';
1
2
  export type HelpAction = {
2
3
  title: string;
3
4
  desc: string;
@@ -6,6 +7,11 @@ export type HelpAction = {
6
7
  type Props = {
7
8
  helpActions?: HelpAction[];
8
9
  mobile?: boolean;
10
+ mode?: ButtonDSModes;
11
+ size?: ButtonDSSizes;
12
+ iconSize?: ButtonDSSizes;
13
+ tooltipPlacement?: TooltipPlacements;
14
+ title?: string;
9
15
  };
10
- export default function HelpButton({ helpActions, mobile }: Props): import("react/jsx-runtime").JSX.Element;
16
+ export default function HelpButton({ helpActions, mobile, mode, size, iconSize, tooltipPlacement, title, }: Props): import("react/jsx-runtime").JSX.Element;
11
17
  export {};
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { IconButton } from 'tycho-storybook';
4
+ import { IconButton, } from 'tycho-storybook';
5
5
  import HelpModal from './HelpModal';
6
- export default function HelpButton({ helpActions, mobile }) {
6
+ export default function HelpButton({ helpActions, mobile, mode, size = 'large', iconSize, tooltipPlacement, title, }) {
7
7
  const { t } = useTranslation('header');
8
8
  const [open, setOpen] = useState(false);
9
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, { name: "live_help", size: "large", title: t('tooltip.tutorials'), onClick: () => setOpen(true), mode: mobile ? 'outlined' : 'filled', "data-tour": "help-button" }), open && (_jsx(HelpModal, { onClose: () => setOpen(false), helpActions: helpActions }))] }));
9
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, { name: "live_help", size: size, iconSize: iconSize, title: title || t('tooltip.tutorials'), onClick: () => setOpen(true), mode: mode || (mobile ? 'outlined' : 'filled'), tooltipPlacement: tooltipPlacement, "data-tour": "help-button" }), open && (_jsx(HelpModal, { onClose: () => setOpen(false), helpActions: helpActions }))] }));
10
10
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.29.5",
4
+ "version": "0.29.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {