@oliasoft-open-source/react-ui-library 4.1.8 → 4.1.9

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 (27) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +56 -19
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-6VNJS4EI-61786b88.js → Color-6VNJS4EI-9910c147.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-9fbdd665.js → DocsRenderer-NNNQARDV-a522b024.js} +1 -1
  6. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-7dfbdeb1.js → WithTooltip-4HIR6TLV-7bbadfaf.js} +1 -1
  7. package/dist/storybook/assets/{buttons-and-links-b39a62f1.js → buttons-and-links-be660e16.js} +1 -1
  8. package/dist/storybook/assets/{chunk-HLWAVYOI-94c87107.js → chunk-HLWAVYOI-276e8f5d.js} +1 -1
  9. package/dist/storybook/assets/{color-b09c7dd5.js → color-c94a1182.js} +1 -1
  10. package/dist/storybook/assets/{formatter-SWP5E3XI-1590745d.js → formatter-SWP5E3XI-f57a37f0.js} +1 -1
  11. package/dist/storybook/assets/{iframe-29873154.js → iframe-fb9f1f0f.js} +1 -1
  12. package/dist/storybook/assets/{index-efad89a2.js → index-58a452a8.js} +4 -4
  13. package/dist/storybook/assets/{input-validation-f7068903.js → input-validation-51ebd4aa.js} +1 -1
  14. package/dist/storybook/assets/{inputs-e58fac37.js → inputs-af297a42.js} +1 -1
  15. package/dist/storybook/assets/{layout-forms-cf1ed22a.js → layout-forms-2a3e62dd.js} +1 -1
  16. package/dist/storybook/assets/{layout-general-3992c48f.js → layout-general-acba141c.js} +1 -1
  17. package/dist/storybook/assets/{padding-and-spacing-e8028aeb.js → padding-and-spacing-8f874256.js} +1 -1
  18. package/dist/storybook/assets/{preview-e5f79fe7.js → preview-6696d9cf.js} +1 -1
  19. package/dist/storybook/assets/preview-e912e8bb.js +1 -0
  20. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-1c121633.js → syntaxhighlighter-NMPM6SWI-c8966e57.js} +1 -1
  21. package/dist/storybook/assets/{table.stories-4b91e144.js → table.stories-fabc902c.js} +85 -17
  22. package/dist/storybook/iframe.html +1 -1
  23. package/dist/storybook/index.json +1 -1
  24. package/dist/storybook/project.json +1 -1
  25. package/dist/storybook/stories.json +1 -1
  26. package/package.json +1 -1
  27. package/dist/storybook/assets/preview-3d227a52.js +0 -1
package/dist/index.d.ts CHANGED
@@ -808,6 +808,8 @@ export declare interface IModalProps {
808
808
  visible?: boolean;
809
809
  centered?: boolean;
810
810
  width?: TStringOrNumber;
811
+ onEnter?: () => void;
812
+ onEscape?: () => void;
811
813
  }
812
814
 
813
815
  export declare interface INativeSelectProps {
@@ -1501,7 +1503,7 @@ export declare enum MessageType {
1501
1503
  ERROR = "Error"
1502
1504
  }
1503
1505
 
1504
- export declare const Modal: ({ children, visible, centered, width, }: IModalProps) => JSX_2.Element;
1506
+ export declare const Modal: ({ children, visible, centered, width, onEnter, onEscape, }: IModalProps) => JSX_2.Element;
1505
1507
 
1506
1508
  export declare const NativeSelect: ({ disabled, error, warning, tooltip, options, onChange, onFocus, onBlur, right, small, tabIndex, selectedOption, width, groupOrder, testId, isInTable, clearable, placeholder, hasNonExistentValue, maxTooltipWidth, borderRadius, }: INativeSelectProps) => JSX_2.Element;
1507
1509
 
package/dist/index.js CHANGED
@@ -19445,6 +19445,19 @@ const Message = ({ message: message2 }) => {
19445
19445
  }
19446
19446
  ) : null });
19447
19447
  };
19448
+ const useKeyboardEvent = (key2, fn, dependencyList = []) => {
19449
+ useEffect(() => {
19450
+ const handler = (evt) => {
19451
+ if (evt.key === key2) {
19452
+ fn();
19453
+ }
19454
+ };
19455
+ window.addEventListener("keydown", handler);
19456
+ return () => {
19457
+ window.removeEventListener("keydown", handler);
19458
+ };
19459
+ }, dependencyList);
19460
+ };
19448
19461
  const Portal = ({ id: id2, children }) => {
19449
19462
  const parent = document.querySelector(`#${id2}`);
19450
19463
  const [mounted, setMounted] = useState(false);
@@ -19464,7 +19477,22 @@ const styles$q = {
19464
19477
  centered,
19465
19478
  newLine
19466
19479
  };
19467
- const Wrapper = ({ children }) => /* @__PURE__ */ jsx("div", { className: cx$2(styles$q.wrapper), children });
19480
+ const Wrapper = ({ children }) => {
19481
+ const wrapperRef = useRef(null);
19482
+ useEffect(() => {
19483
+ if (wrapperRef.current) {
19484
+ const firstFocusableElement = wrapperRef.current.querySelector(
19485
+ '[tabindex="0"]'
19486
+ );
19487
+ if (firstFocusableElement) {
19488
+ firstFocusableElement.focus();
19489
+ } else {
19490
+ wrapperRef.current.focus();
19491
+ }
19492
+ }
19493
+ }, []);
19494
+ return /* @__PURE__ */ jsx("div", { ref: wrapperRef, tabIndex: -1, className: cx$2(styles$q.wrapper), children });
19495
+ };
19468
19496
  const Content$2 = ({ children, width: width2, centered: centered2 }) => /* @__PURE__ */ jsx(
19469
19497
  "div",
19470
19498
  {
@@ -19477,11 +19505,33 @@ const Modal = ({
19477
19505
  children,
19478
19506
  visible = false,
19479
19507
  centered: centered2 = false,
19480
- width: width2 = "100%"
19481
- }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
19482
- /* @__PURE__ */ jsx(Portal, { id: "modalContainer", children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }),
19483
- /* @__PURE__ */ jsx("div", { id: "modalContainer" })
19484
- ] });
19508
+ width: width2 = "100%",
19509
+ onEnter,
19510
+ onEscape
19511
+ }) => {
19512
+ useKeyboardEvent(
19513
+ "Enter",
19514
+ () => {
19515
+ if (visible && onEnter) {
19516
+ onEnter();
19517
+ }
19518
+ },
19519
+ [visible, onEnter]
19520
+ );
19521
+ useKeyboardEvent(
19522
+ "Escape",
19523
+ () => {
19524
+ if (visible && onEscape) {
19525
+ onEscape();
19526
+ }
19527
+ },
19528
+ [visible, onEscape]
19529
+ );
19530
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
19531
+ /* @__PURE__ */ jsx(Portal, { id: "modalContainer", children: visible ? /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Content$2, { width: width2, centered: centered2, children }) }) : null }),
19532
+ /* @__PURE__ */ jsx("div", { id: "modalContainer" })
19533
+ ] });
19534
+ };
19485
19535
  const menu$1 = "_menu_12x4u_1";
19486
19536
  const header = "_header_12x4u_11";
19487
19537
  const item$3 = "_item_12x4u_27";
@@ -19994,19 +20044,6 @@ var reactKeyboardEventHandler = { exports: {} };
19994
20044
  })(reactKeyboardEventHandler);
19995
20045
  var reactKeyboardEventHandlerExports = reactKeyboardEventHandler.exports;
19996
20046
  const KeyboardEventHandler = /* @__PURE__ */ getDefaultExportFromCjs(reactKeyboardEventHandlerExports);
19997
- const useKeyboardEvent = (key2, fn, dependencyList = []) => {
19998
- useEffect(() => {
19999
- const handler = (evt) => {
20000
- if (evt.key === key2) {
20001
- fn();
20002
- }
20003
- };
20004
- window.addEventListener("keydown", handler);
20005
- return () => {
20006
- window.removeEventListener("keydown", handler);
20007
- };
20008
- }, dependencyList);
20009
- };
20010
20047
  const useFocus = () => {
20011
20048
  const ref2 = useRef(null);
20012
20049
  const setFocus = () => {