@seamly/web-ui 25.2.0-beta.1 → 25.2.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.
@@ -14591,7 +14591,7 @@ class API {
14591
14591
  return {
14592
14592
  clientName: "@seamly/web-ui",
14593
14593
  clientVariant: this.#layoutMode,
14594
- clientVersion: "25.2.0-beta.1",
14594
+ clientVersion: "25.2.0",
14595
14595
  currentUrl: window.location.toString(),
14596
14596
  screenResolution: `${window.screen.width}x${window.screen.height}`,
14597
14597
  timezone: (0,_utils__WEBPACK_IMPORTED_MODULE_13__.getTimeZone)(),
@@ -24761,15 +24761,16 @@ __webpack_require__.r(__webpack_exports__);
24761
24761
  /* harmony import */ var domains_config_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! domains/config/hooks */ "./src/javascripts/core/domains/config/hooks.ts");
24762
24762
  /* harmony import */ var domains_i18n_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! domains/i18n/hooks */ "./src/javascripts/core/domains/i18n/hooks.ts");
24763
24763
  /* harmony import */ var domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! domains/visibility/hooks */ "./src/javascripts/core/domains/visibility/hooks.ts");
24764
- /* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib/css */ "./src/javascripts/core/lib/css.ts");
24765
- /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! preact/compat */ "preact/compat");
24766
- /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_6__);
24767
- /* harmony import */ var ui_components_suggestions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ui/components/suggestions */ "./src/javascripts/core/ui/components/suggestions/index.tsx");
24768
- /* harmony import */ var ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ui/hooks/component-helper-hooks */ "./src/javascripts/core/ui/hooks/component-helper-hooks.ts");
24769
- /* harmony import */ var ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ui/hooks/focus-helper-hooks */ "./src/javascripts/core/ui/hooks/focus-helper-hooks.ts");
24770
- /* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ui/hooks/seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
24771
- /* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ui/hooks/utility-hooks */ "./src/javascripts/core/ui/hooks/utility-hooks.ts");
24772
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
24764
+ /* harmony import */ var focus_trap__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! focus-trap */ "./node_modules/focus-trap/dist/focus-trap.esm.js");
24765
+ /* harmony import */ var lib_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib/css */ "./src/javascripts/core/lib/css.ts");
24766
+ /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! preact/compat */ "preact/compat");
24767
+ /* harmony import */ var preact_compat__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(preact_compat__WEBPACK_IMPORTED_MODULE_7__);
24768
+ /* harmony import */ var ui_components_suggestions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ui/components/suggestions */ "./src/javascripts/core/ui/components/suggestions/index.tsx");
24769
+ /* harmony import */ var ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ui/hooks/component-helper-hooks */ "./src/javascripts/core/ui/hooks/component-helper-hooks.ts");
24770
+ /* harmony import */ var ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ui/hooks/focus-helper-hooks */ "./src/javascripts/core/ui/hooks/focus-helper-hooks.ts");
24771
+ /* harmony import */ var ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ui/hooks/seamly-state-hooks */ "./src/javascripts/core/ui/hooks/seamly-state-hooks.ts");
24772
+ /* harmony import */ var ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ui/hooks/utility-hooks */ "./src/javascripts/core/ui/hooks/utility-hooks.ts");
24773
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/preact/compat/jsx-runtime.mjs");
24773
24774
 
24774
24775
 
24775
24776
 
@@ -24783,25 +24784,28 @@ __webpack_require__.r(__webpack_exports__);
24783
24784
 
24784
24785
 
24785
24786
 
24786
- const Chat = (0,preact_compat__WEBPACK_IMPORTED_MODULE_6__.forwardRef)(({
24787
+
24788
+ const Chat = (0,preact_compat__WEBPACK_IMPORTED_MODULE_7__.forwardRef)(({
24787
24789
  children,
24788
24790
  className: givenClassName = ''
24789
24791
  }, forwardedRef) => {
24792
+ const focusTrap = (0,preact_compat__WEBPACK_IMPORTED_MODULE_7__.useRef)(null);
24790
24793
  const {
24791
24794
  closeChat,
24792
24795
  isOpen,
24793
24796
  isVisible
24794
24797
  } = (0,domains_visibility_hooks__WEBPACK_IMPORTED_MODULE_4__.useVisibility)();
24795
- const focusWindowOpenButton = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_9__.useWindowOpenButtonFocusing)();
24798
+ const focusWindowOpenButton = (0,ui_hooks_focus_helper_hooks__WEBPACK_IMPORTED_MODULE_10__.useWindowOpenButtonFocusing)();
24796
24799
  const {
24797
24800
  namespace,
24798
24801
  layoutMode
24799
24802
  } = (0,domains_config_hooks__WEBPACK_IMPORTED_MODULE_2__.useConfig)();
24800
24803
  const {
24801
24804
  isInline
24802
- } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_10__.useSeamlyLayoutMode)();
24803
- const appContainerClassNames = (0,ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_8__.useSeamlyAppContainerClassNames)();
24804
- const headingId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_11__.useGeneratedId)();
24805
+ } = (0,ui_hooks_seamly_state_hooks__WEBPACK_IMPORTED_MODULE_11__.useSeamlyLayoutMode)();
24806
+ const appContainerClassNames = (0,ui_hooks_component_helper_hooks__WEBPACK_IMPORTED_MODULE_9__.useSeamlyAppContainerClassNames)();
24807
+ const chatSectionId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_12__.useGeneratedId)();
24808
+ const headingId = (0,ui_hooks_utility_hooks__WEBPACK_IMPORTED_MODULE_12__.useGeneratedId)();
24805
24809
  const userHasResponded = (0,domains_app_hooks__WEBPACK_IMPORTED_MODULE_1__.useUserHasResponded)();
24806
24810
  const {
24807
24811
  t
@@ -24823,21 +24827,36 @@ const Chat = (0,preact_compat__WEBPACK_IMPORTED_MODULE_6__.forwardRef)(({
24823
24827
  focusWindowOpenButton();
24824
24828
  }
24825
24829
  };
24826
- return isVisible && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("section", {
24827
- className: (0,lib_css__WEBPACK_IMPORTED_MODULE_5__.className)(classNames),
24830
+ (0,preact_compat__WEBPACK_IMPORTED_MODULE_7__.useEffect)(() => {
24831
+ if (isVisible && layoutMode === 'window') {
24832
+ focusTrap.current = (0,focus_trap__WEBPACK_IMPORTED_MODULE_5__.createFocusTrap)(`#${chatSectionId}`, {
24833
+ // We set the initialFocus to false, as the `WindowOpenButton` takes care of that
24834
+ initialFocus: false
24835
+ });
24836
+ focusTrap.current.activate();
24837
+ }
24838
+ return () => {
24839
+ if (focusTrap.current) {
24840
+ focusTrap.current.deactivate();
24841
+ }
24842
+ };
24843
+ }, [chatSectionId, isVisible, layoutMode]);
24844
+ return isVisible && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("section", {
24845
+ id: chatSectionId,
24846
+ className: (0,lib_css__WEBPACK_IMPORTED_MODULE_6__.className)(classNames),
24828
24847
  onKeyDown: onKeyDownHandler,
24829
24848
  tabIndex: -1,
24830
24849
  ref: forwardedRef,
24831
24850
  role: layoutMode === 'window' ? 'dialog' : undefined,
24832
24851
  "aria-labelledby": headingId,
24833
- children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("h2", {
24834
- className: (0,lib_css__WEBPACK_IMPORTED_MODULE_5__.className)('chat__title', 'visually-hidden'),
24852
+ children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("h2", {
24853
+ className: (0,lib_css__WEBPACK_IMPORTED_MODULE_6__.className)('chat__title', 'visually-hidden'),
24835
24854
  id: headingId,
24836
24855
  children: t('window.srModalLayoutLabel')
24837
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", {
24838
- className: (0,lib_css__WEBPACK_IMPORTED_MODULE_5__.className)('chat-wrapper'),
24856
+ }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("div", {
24857
+ className: (0,lib_css__WEBPACK_IMPORTED_MODULE_6__.className)('chat-wrapper'),
24839
24858
  children: children
24840
- }), layoutMode === 'inline' && isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(ui_components_suggestions__WEBPACK_IMPORTED_MODULE_7__["default"], {
24859
+ }), layoutMode === 'inline' && isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(ui_components_suggestions__WEBPACK_IMPORTED_MODULE_8__["default"], {
24841
24860
  isAside: true
24842
24861
  })]
24843
24862
  });