chop-logic-components 0.4.0 → 0.5.1

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.
@@ -4,9 +4,10 @@ import { default as React, MouseEventHandler } from 'react';
4
4
  export type ChopLogicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
5
5
  text?: string;
6
6
  onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
7
- view?: 'primary' | 'secondary' | 'danger';
7
+ view?: 'primary' | 'secondary' | 'danger' | 'icon';
8
8
  disabled?: boolean;
9
9
  icon?: Icon;
10
+ label?: string;
10
11
  };
11
12
  declare const Button: React.FC<ChopLogicButtonProps>;
12
13
  export default Button;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const ChopLogicPortal: ({ children }: {
4
+ children: React.ReactElement;
5
+ }) => React.ReactPortal;
6
+ export default ChopLogicPortal;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
4
+ isOpened: boolean;
5
+ onClose: () => void;
6
+ title: string;
7
+ };
8
+ declare const ChopLogicModal: React.FC<ChopLogicModalProps>;
9
+ export default ChopLogicModal;
@@ -0,0 +1,5 @@
1
+ import { ChopLogicModalProps } from '../Modal';
2
+ import { default as React } from 'react';
3
+
4
+ declare const Example: React.FC<ChopLogicModalProps>;
5
+ export default Example;
@@ -0,0 +1,7 @@
1
+ import { default as Example } from './Example';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: Meta<typeof Example>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof Example>;
7
+ export declare const Default: Story;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+
3
+ type ChopLogicModalLayoutHeaderProps = {
4
+ title: string;
5
+ onClose: () => void;
6
+ };
7
+ declare const ChopLogicModalLayoutHeader: ({ title, onClose }: ChopLogicModalLayoutHeaderProps) => React.ReactElement;
8
+ export default ChopLogicModalLayoutHeader;
@@ -0,0 +1,9 @@
1
+ import { default as React, PropsWithChildren } from 'react';
2
+
3
+ type ModalLayoutProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
4
+ title: string;
5
+ onClose: () => void;
6
+ isOpened: boolean;
7
+ };
8
+ declare const ChopLogicModalLayout: ({ title, onClose, isOpened, children, ...rest }: ModalLayoutProps) => React.ReactElement;
9
+ export default ChopLogicModalLayout;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { useMount } from './use-mount';
2
+ export { useClickOutside } from './use-click-outside';
3
+ export { useModalFocusTrap } from './use-modal-focus-trap';
4
+ export { useKeyPress } from './use-key-press';
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+
3
+ type UseClickOutsideParams = {
4
+ ref: React.RefObject<HTMLDivElement>;
5
+ onClickOutsideHandler: () => void;
6
+ dependentRef?: React.RefObject<HTMLDivElement>;
7
+ };
8
+ /**
9
+ * Custom hook that triggers a callback when a click event occurs outside specified elements.
10
+ *
11
+ * @param {UseClickOutsideParams} ref - Reference to the main element to check if the click is outside
12
+ * @param {UseClickOutsideParams} onClickOutsideHandler - Callback function to execute when a click event occurs outside
13
+ * @param {UseClickOutsideParams} dependentRef - Reference to a dependent element to check if the click is outside
14
+ * @return {void} Function does not return anything
15
+ */
16
+ export declare const useClickOutside: ({ ref, onClickOutsideHandler, dependentRef }: UseClickOutsideParams) => void;
17
+ export {};
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+
3
+ type useKeyPressParams = {
4
+ keyCode: string;
5
+ ref: React.RefObject<HTMLDivElement>;
6
+ onKeyPress: () => void;
7
+ };
8
+ /**
9
+ * Hook that listens for a specific key press event and triggers an action when the key is pressed.
10
+ *
11
+ * @param {Object} params - An object containing the following properties:
12
+ * - ref: A ref object that refers to the HTML element to attach the event listener to.
13
+ * - keyCode: The key code of the key to listen for.
14
+ * - onKeyPress: A function to be called when the key is pressed.
15
+ * @return {void} This hook does not return anything.
16
+ */
17
+ export declare const useKeyPress: ({ ref, keyCode, onKeyPress }: useKeyPressParams) => void;
18
+ export {};
@@ -0,0 +1,14 @@
1
+ type ModalFocusTrapParams = {
2
+ modalRef: React.RefObject<HTMLDivElement>;
3
+ isOpened: boolean;
4
+ };
5
+ /**
6
+ * Traps the focus within a modal element when it is opened.
7
+ *
8
+ * @param {ModalFocusTrapParams} params - An object containing the modal reference and a boolean indicating whether the modal is opened.
9
+ * @param {React.RefObject<HTMLDivElement>} params.modalRef - A reference to the modal element.
10
+ * @param {boolean} params.isOpened - A boolean indicating whether the modal is opened.
11
+ * @return {void} This function does not return anything.
12
+ */
13
+ export declare const useModalFocusTrap: ({ modalRef, isOpened }: ModalFocusTrapParams) => void;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Custom hook that manages the mounting state based on the isOpened prop and a delay.
3
+ *
4
+ * @param {boolean} isOpened - Indicates if the component is opened.
5
+ * @param {number} [delay=300] - The delay in milliseconds before unmounting.
6
+ * @return {boolean} The current state of mounting.
7
+ */
8
+ export declare const useMount: (isOpened: boolean, delay?: number) => boolean;
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react");var ve={exports:{}},J={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react");var ve={exports:{}},J={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ue;function Er(){if(Ue)return J;Ue=1;var t=N,f=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,b={key:!0,ref:!0,__self:!0,__source:!0};function p(m,d,y){var c,R={},C=null,g=null;y!==void 0&&(C=""+y),d.key!==void 0&&(C=""+d.key),d.ref!==void 0&&(g=d.ref);for(c in d)s.call(d,c)&&!b.hasOwnProperty(c)&&(R[c]=d[c]);if(m&&m.defaultProps)for(c in d=m.defaultProps,d)R[c]===void 0&&(R[c]=d[c]);return{$$typeof:f,type:m,key:C,ref:g,props:R,_owner:l.current}}return J.Fragment=o,J.jsx=p,J.jsxs=p,J}var G={};/**
9
+ */var qe;function wr(){if(qe)return J;qe=1;var r=P,c=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function h(_,d,y){var u,R={},C=null,g=null;y!==void 0&&(C=""+y),d.key!==void 0&&(C=""+d.key),d.ref!==void 0&&(g=d.ref);for(u in d)i.call(d,u)&&!v.hasOwnProperty(u)&&(R[u]=d[u]);if(_&&_.defaultProps)for(u in d=_.defaultProps,d)R[u]===void 0&&(R[u]=d[u]);return{$$typeof:c,type:_,key:C,ref:g,props:R,_owner:s.current}}return J.Fragment=a,J.jsx=h,J.jsxs=h,J}var G={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,18 +14,18 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ve;function xr(){return Ve||(Ve=1,process.env.NODE_ENV!=="production"&&function(){var t=N,f=Symbol.for("react.element"),o=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),m=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),k=Symbol.iterator,$="@@iterator";function Y(e){if(e===null||typeof e!="object")return null;var r=k&&e[k]||e[$];return typeof r=="function"?r:null}var T=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];re("error",e,n)}}function re(e,r,n){{var a=T.ReactDebugCurrentFrame,_=a.getStackAddendum();_!==""&&(r+="%s",n=n.concat([_]));var v=n.map(function(u){return String(u)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var te=!1,X=!1,ne=!1,qe=!1,Ke=!1,be;be=Symbol.for("react.module.reference");function Ie(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===b||Ke||e===l||e===y||e===c||qe||e===g||te||X||ne||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===R||e.$$typeof===p||e.$$typeof===m||e.$$typeof===d||e.$$typeof===be||e.getModuleId!==void 0))}function Je(e,r,n){var a=e.displayName;if(a)return a;var _=r.displayName||r.name||"";return _!==""?n+"("+_+")":n}function me(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case o:return"Portal";case b:return"Profiler";case l:return"StrictMode";case y:return"Suspense";case c:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m:var r=e;return me(r)+".Consumer";case p:var n=e;return me(n._context)+".Provider";case d:return Je(e,e.render,"ForwardRef");case R:var a=e.displayName||null;return a!==null?a:D(e.type)||"Memo";case C:{var _=e,v=_._payload,u=_._init;try{return D(u(v))}catch{return null}}}return null}var A=Object.assign,q=0,ge,ye,Ee,xe,we,Re,Ce;function ke(){}ke.__reactDisabledLog=!0;function Ge(){{if(q===0){ge=console.log,ye=console.info,Ee=console.warn,xe=console.error,we=console.group,Re=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}}function Xe(){{if(q--,q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:ge}),info:A({},e,{value:ye}),warn:A({},e,{value:Ee}),error:A({},e,{value:xe}),group:A({},e,{value:we}),groupCollapsed:A({},e,{value:Re}),groupEnd:A({},e,{value:Ce})})}q<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=T.ReactCurrentDispatcher,oe;function z(e,r,n){{if(oe===void 0)try{throw Error()}catch(_){var a=_.stack.trim().match(/\n( *(at )?)/);oe=a&&a[1]||""}return`
18
- `+oe+e}}var ie=!1,H;{var ze=typeof WeakMap=="function"?WeakMap:Map;H=new ze}function je(e,r){if(!e||ie)return"";{var n=H.get(e);if(n!==void 0)return n}var a;ie=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=ae.current,ae.current=null,Ge();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(S){a=S}Reflect.construct(e,[],u)}else{try{u.call()}catch(S){a=S}e.call(u.prototype)}}else{try{throw Error()}catch(S){a=S}e()}}catch(S){if(S&&a&&typeof S.stack=="string"){for(var i=S.stack.split(`
19
- `),j=a.stack.split(`
20
- `),E=i.length-1,w=j.length-1;E>=1&&w>=0&&i[E]!==j[w];)w--;for(;E>=1&&w>=0;E--,w--)if(i[E]!==j[w]){if(E!==1||w!==1)do if(E--,w--,w<0||i[E]!==j[w]){var O=`
21
- `+i[E].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,O),O}while(E>=1&&w>=0);break}}}finally{ie=!1,ae.current=v,Xe(),Error.prepareStackTrace=_}var V=e?e.displayName||e.name:"",L=V?z(V):"";return typeof e=="function"&&H.set(e,L),L}function He(e,r,n){return je(e,!1)}function Ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Z(e,r,n){if(e==null)return"";if(typeof e=="function")return je(e,Ze(e));if(typeof e=="string")return z(e);switch(e){case y:return z("Suspense");case c:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return He(e.render);case R:return Z(e.type,r,n);case C:{var a=e,_=a._payload,v=a._init;try{return Z(v(_),r,n)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,Se={},Te=T.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,n=Z(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(n)}else Te.setExtraStackFrame(null)}function Qe(e,r,n,a,_){{var v=Function.call.bind(K);for(var u in e)if(v(e,u)){var i=void 0;try{if(typeof e[u]!="function"){var j=Error((a||"React class")+": "+n+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}i=e[u](r,u,a,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){i=E}i&&!(i instanceof Error)&&(Q(_),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",n,u,typeof i),Q(null)),i instanceof Error&&!(i.message in Se)&&(Se[i.message]=!0,Q(_),x("Failed %s type: %s",n,i.message),Q(null))}}}var er=Array.isArray;function se(e){return er(e)}function rr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function tr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function Pe(e){if(tr(e))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rr(e)),Oe(e)}var I=T.ReactCurrentOwner,nr={key:!0,ref:!0,__self:!0,__source:!0},De,Fe,ce;ce={};function ar(e){if(K.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function or(e){if(K.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ir(e,r){if(typeof e.ref=="string"&&I.current&&r&&I.current.stateNode!==r){var n=D(I.current.type);ce[n]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(I.current.type),e.ref),ce[n]=!0)}}function sr(e,r){{var n=function(){De||(De=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function cr(e,r){{var n=function(){Fe||(Fe=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var lr=function(e,r,n,a,_,v,u){var i={$$typeof:f,type:e,key:r,ref:n,props:u,_owner:v};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function ur(e,r,n,a,_){{var v,u={},i=null,j=null;n!==void 0&&(Pe(n),i=""+n),or(r)&&(Pe(r.key),i=""+r.key),ar(r)&&(j=r.ref,ir(r,_));for(v in r)K.call(r,v)&&!nr.hasOwnProperty(v)&&(u[v]=r[v]);if(e&&e.defaultProps){var E=e.defaultProps;for(v in E)u[v]===void 0&&(u[v]=E[v])}if(i||j){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&sr(u,w),j&&cr(u,w)}return lr(e,i,j,_,a,I.current,u)}}var le=T.ReactCurrentOwner,Ne=T.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,n=Z(e.type,e._source,r?r.type:null);Ne.setExtraStackFrame(n)}else Ne.setExtraStackFrame(null)}var ue;ue=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function $e(){{if(le.current){var e=D(le.current.type);if(e)return`
17
+ */var Ue;function Rr(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&function(){var r=P,c=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),_=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),k=Symbol.iterator,$="@@iterator";function A(e){if(e===null||typeof e!="object")return null;var t=k&&e[k]||e[$];return typeof t=="function"?t:null}var S=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];re("error",e,n)}}function re(e,t,n){{var o=S.ReactDebugCurrentFrame,p=o.getStackAddendum();p!==""&&(t+="%s",n=n.concat([p]));var b=n.map(function(f){return String(f)});b.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,b)}}var te=!1,X=!1,ne=!1,Ie=!1,Je=!1,be;be=Symbol.for("react.module.reference");function Ge(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===v||Je||e===s||e===y||e===u||Ie||e===g||te||X||ne||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===R||e.$$typeof===h||e.$$typeof===_||e.$$typeof===d||e.$$typeof===be||e.getModuleId!==void 0))}function Xe(e,t,n){var o=e.displayName;if(o)return o;var p=t.displayName||t.name||"";return p!==""?n+"("+p+")":n}function me(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case a:return"Portal";case v:return"Profiler";case s:return"StrictMode";case y:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _:var t=e;return me(t)+".Consumer";case h:var n=e;return me(n._context)+".Provider";case d:return Xe(e,e.render,"ForwardRef");case R:var o=e.displayName||null;return o!==null?o:F(e.type)||"Memo";case C:{var p=e,b=p._payload,f=p._init;try{return F(f(b))}catch{return null}}}return null}var L=Object.assign,K=0,ge,ye,Ee,xe,we,Re,Ce;function ke(){}ke.__reactDisabledLog=!0;function ze(){{if(K===0){ge=console.log,ye=console.info,Ee=console.warn,xe=console.error,we=console.group,Re=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}K++}}function He(){{if(K--,K===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:ge}),info:L({},e,{value:ye}),warn:L({},e,{value:Ee}),error:L({},e,{value:xe}),group:L({},e,{value:we}),groupCollapsed:L({},e,{value:Re}),groupEnd:L({},e,{value:Ce})})}K<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=S.ReactCurrentDispatcher,oe;function z(e,t,n){{if(oe===void 0)try{throw Error()}catch(p){var o=p.stack.trim().match(/\n( *(at )?)/);oe=o&&o[1]||""}return`
18
+ `+oe+e}}var ie=!1,H;{var Ze=typeof WeakMap=="function"?WeakMap:Map;H=new Ze}function je(e,t){if(!e||ie)return"";{var n=H.get(e);if(n!==void 0)return n}var o;ie=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=ae.current,ae.current=null,ze();try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(T){o=T}Reflect.construct(e,[],f)}else{try{f.call()}catch(T){o=T}e.call(f.prototype)}}else{try{throw Error()}catch(T){o=T}e()}}catch(T){if(T&&o&&typeof T.stack=="string"){for(var l=T.stack.split(`
19
+ `),j=o.stack.split(`
20
+ `),E=l.length-1,w=j.length-1;E>=1&&w>=0&&l[E]!==j[w];)w--;for(;E>=1&&w>=0;E--,w--)if(l[E]!==j[w]){if(E!==1||w!==1)do if(E--,w--,w<0||l[E]!==j[w]){var O=`
21
+ `+l[E].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,O),O}while(E>=1&&w>=0);break}}}finally{ie=!1,ae.current=b,He(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",M=V?z(V):"";return typeof e=="function"&&H.set(e,M),M}function Qe(e,t,n){return je(e,!1)}function er(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Z(e,t,n){if(e==null)return"";if(typeof e=="function")return je(e,er(e));if(typeof e=="string")return z(e);switch(e){case y:return z("Suspense");case u:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Qe(e.render);case R:return Z(e.type,t,n);case C:{var o=e,p=o._payload,b=o._init;try{return Z(b(p),t,n)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,Te={},Se=S.ReactDebugCurrentFrame;function Q(e){if(e){var t=e._owner,n=Z(e.type,e._source,t?t.type:null);Se.setExtraStackFrame(n)}else Se.setExtraStackFrame(null)}function rr(e,t,n,o,p){{var b=Function.call.bind(B);for(var f in e)if(b(e,f)){var l=void 0;try{if(typeof e[f]!="function"){var j=Error((o||"React class")+": "+n+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}l=e[f](t,f,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){l=E}l&&!(l instanceof Error)&&(Q(p),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",n,f,typeof l),Q(null)),l instanceof Error&&!(l.message in Te)&&(Te[l.message]=!0,Q(p),x("Failed %s type: %s",n,l.message),Q(null))}}}var tr=Array.isArray;function se(e){return tr(e)}function nr(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function ar(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function Pe(e){if(ar(e))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nr(e)),Oe(e)}var I=S.ReactCurrentOwner,or={key:!0,ref:!0,__self:!0,__source:!0},De,Fe,ce;ce={};function ir(e){if(B.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(B.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function cr(e,t){if(typeof e.ref=="string"&&I.current&&t&&I.current.stateNode!==t){var n=F(I.current.type);ce[n]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(I.current.type),e.ref),ce[n]=!0)}}function lr(e,t){{var n=function(){De||(De=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function ur(e,t){{var n=function(){Fe||(Fe=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var fr=function(e,t,n,o,p,b,f){var l={$$typeof:c,type:e,key:t,ref:n,props:f,_owner:b};return l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function dr(e,t,n,o,p){{var b,f={},l=null,j=null;n!==void 0&&(Pe(n),l=""+n),sr(t)&&(Pe(t.key),l=""+t.key),ir(t)&&(j=t.ref,cr(t,p));for(b in t)B.call(t,b)&&!or.hasOwnProperty(b)&&(f[b]=t[b]);if(e&&e.defaultProps){var E=e.defaultProps;for(b in E)f[b]===void 0&&(f[b]=E[b])}if(l||j){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&lr(f,w),j&&ur(f,w)}return fr(e,l,j,p,o,I.current,f)}}var le=S.ReactCurrentOwner,Ne=S.ReactDebugCurrentFrame;function U(e){if(e){var t=e._owner,n=Z(e.type,e._source,t?t.type:null);Ne.setExtraStackFrame(n)}else Ne.setExtraStackFrame(null)}var ue;ue=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function $e(){{if(le.current){var e=F(le.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function fr(e){return""}var Ae={};function dr(e){{var r=$e();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
23
+ Check the render method of \``+e+"`."}return""}}function _r(e){return""}var Ae={};function pr(e){{var t=$e();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
24
24
 
25
- Check the top-level render call using <`+n+">.")}return r}}function Le(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=dr(r);if(Ae[n])return;Ae[n]=!0;var a="";e&&e._owner&&e._owner!==le.current&&(a=" It was passed a child from "+D(e._owner.type)+"."),U(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,a),U(null)}}function Me(e,r){{if(typeof e!="object")return;if(se(e))for(var n=0;n<e.length;n++){var a=e[n];fe(a)&&Le(a,r)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var _=Y(e);if(typeof _=="function"&&_!==e.entries)for(var v=_.call(e),u;!(u=v.next()).done;)fe(u.value)&&Le(u.value,r)}}}function _r(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===R))n=r.propTypes;else return;if(n){var a=D(r);Qe(n,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var _=D(r);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var a=r[n];if(a!=="children"&&a!=="key"){U(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),U(null);break}}e.ref!==null&&(U(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var We={};function Ye(e,r,n,a,_,v){{var u=Ie(e);if(!u){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j=fr();j?i+=j:i+=$e();var E;e===null?E="null":se(e)?E="array":e!==void 0&&e.$$typeof===f?(E="<"+(D(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,i)}var w=ur(e,r,n,_,v);if(w==null)return w;if(u){var O=r.children;if(O!==void 0)if(a)if(se(O)){for(var V=0;V<O.length;V++)Me(O[V],e);Object.freeze&&Object.freeze(O)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Me(O,e)}if(K.call(r,"key")){var L=D(e),S=Object.keys(r).filter(function(yr){return yr!=="key"}),de=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!We[L+de]){var gr=S.length>0?"{"+S.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+n+">.")}return t}}function Le(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=pr(t);if(Ae[n])return;Ae[n]=!0;var o="";e&&e._owner&&e._owner!==le.current&&(o=" It was passed a child from "+F(e._owner.type)+"."),U(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),U(null)}}function Me(e,t){{if(typeof e!="object")return;if(se(e))for(var n=0;n<e.length;n++){var o=e[n];fe(o)&&Le(o,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var p=A(e);if(typeof p=="function"&&p!==e.entries)for(var b=p.call(e),f;!(f=b.next()).done;)fe(f.value)&&Le(f.value,t)}}}function vr(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===d||t.$$typeof===R))n=t.propTypes;else return;if(n){var o=F(t);rr(n,e.props,"prop",o,e)}else if(t.PropTypes!==void 0&&!ue){ue=!0;var p=F(t);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hr(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var o=t[n];if(o!=="children"&&o!=="key"){U(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),U(null);break}}e.ref!==null&&(U(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var We={};function Ye(e,t,n,o,p,b){{var f=Ge(e);if(!f){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j=_r();j?l+=j:l+=$e();var E;e===null?E="null":se(e)?E="array":e!==void 0&&e.$$typeof===c?(E="<"+(F(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,l)}var w=dr(e,t,n,p,b);if(w==null)return w;if(f){var O=t.children;if(O!==void 0)if(o)if(se(O)){for(var V=0;V<O.length;V++)Me(O[V],e);Object.freeze&&Object.freeze(O)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Me(O,e)}if(B.call(t,"key")){var M=F(e),T=Object.keys(t).filter(function(xr){return xr!=="key"}),de=T.length>0?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}";if(!We[M+de]){var Er=T.length>0?"{"+T.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,de,L,gr,L),We[L+de]=!0}}return e===s?pr(w):_r(w),w}}function vr(e,r,n){return Ye(e,r,n,!0)}function hr(e,r,n){return Ye(e,r,n,!1)}var br=hr,mr=vr;G.Fragment=s,G.jsx=br,G.jsxs=mr}()),G}process.env.NODE_ENV==="production"?ve.exports=Er():ve.exports=xr();var h=ve.exports;const wr="_button_rrb70_1",Rr="_text_rrb70_21",Cr="_primary_rrb70_26",kr="_danger_rrb70_27",jr="_secondary_rrb70_50",Sr="_disabled_rrb70_66",B={button:wr,text:Rr,primary:Cr,danger:kr,secondary:jr,disabled:Sr};function P(t){return t.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="object"){const s=[];for(const l in o)o[l]&&s.push(l.trim());return s.join(" ")}}).filter(o=>!!o).join(" ")}const Tr=({disabled:t,onClick:f,text:o="Ok",type:s="button",view:l="primary",icon:b,...p})=>{const m=P([B.button,p==null?void 0:p.className,{[B.primary]:l==="primary",[B.secondary]:l==="secondary",[B.danger]:l==="danger",[B.disabled]:!!t}]);return h.jsxs("button",{type:s,className:m,onClick:t?void 0:f,disabled:t,...p,children:[b&&h.jsx("span",{className:b,"aria-hidden":"true"}),h.jsx("span",{className:B.text,children:o})]})},Or="_container_b5mrn_1",Pr="_wrapper_b5mrn_7",Dr="_input_b5mrn_21",Fr="_invalid_b5mrn_27",Nr="_error_b5mrn_47",$r="_disabled_b5mrn_51",M={container:Or,wrapper:Pr,input:Dr,invalid:Fr,error:Nr,disabled:$r},Ar="_label_16gin_1",Lr="_text_16gin_10",Mr="_required_16gin_16",_e={label:Ar,text:Lr,required:Mr},he=({label:t,required:f,inputId:o,className:s,isTextHidden:l=!1})=>h.jsxs("label",{htmlFor:o,className:P([_e.label,s]),children:[!l&&h.jsx("span",{className:_e.text,children:t}),f&&h.jsx("abbr",{title:"required",className:_e.required,children:"*"})]}),Wr="_message_1ly5l_1",Yr="_visible_1ly5l_8",Be={message:Wr,visible:Yr},Ur=({errorId:t,message:f="Invalid input",className:o,visible:s=!1})=>h.jsx("span",{id:t,className:P([Be.message,o,{[Be.visible]:s}]),children:f}),Vr=({id:t,name:f,label:o,disabled:s,placeholder:l="Type here...",valid:b=!0,required:p=!1,errorMessage:m,defaultValue:d,onChange:y,...c})=>{const[R,C]=N.useState(typeof d=="string"?d:""),g=`${t}_error`,k=P([M.container,c==null?void 0:c.className]),$=P([M.wrapper,{[M.disabled]:!!s,[M.invalid]:!b}]),Y=T=>{const{value:x=""}=T.target;C(x),y&&y(T)};return h.jsxs("div",{className:k,children:[h.jsxs("div",{className:$,children:[h.jsx(he,{label:o,required:p,inputId:t,className:M.label}),h.jsx("input",{id:t,name:f,type:"text",className:M.input,disabled:s,placeholder:l,required:p,"aria-invalid":!b,"aria-errormessage":g,value:R,onChange:Y,...c})]}),h.jsx(Ur,{errorId:g,message:m,className:M.error,visible:!b})]})},Br="_wrapper_gevmw_1",qr="_combobox_gevmw_17",Kr="_combobox_label_gevmw_42",Ir="_dropdown_gevmw_47",Jr="_dropdown_opened_gevmw_68",Gr="_option_gevmw_73",Xr="_active_gevmw_82",zr="_disabled_gevmw_91",Hr="_icon_gevmw_97",F={wrapper:Br,combobox:qr,combobox_label:Kr,dropdown:Ir,dropdown_opened:Jr,option:Gr,active:Xr,disabled:zr,icon:Hr},Zr=({ref:t,onClickOutsideHandler:f,dependentRef:o})=>{N.useEffect(()=>{const s=l=>{const b=(t==null?void 0:t.current)&&!t.current.contains(l.target),p=o!=null&&o.current?!o.current.contains(l.target):!0;b&&p&&f()};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[t,o,f])};var W=(t=>(t.CheckMark="chop-icon__check",t.Home="chop-icon__home",t.Menu="chop-icon__menu",t.Enlarge="chop-icon__enlarge2",t.Shrink="chop-icon__shrink2",t.Settings="chop-icon__cog",t.Delete="chop-icon__bin2",t.Up="chop-icon__circle-up",t.Down="chop-icon__circle-down",t.Right="chop-icon__circle-right",t.Left="chop-icon__circle-left",t.Sound="chop-icon__volume-medium",t.NoSound="chop-icon__volume-mute2",t.LightMode="chop-icon__sun",t.DarkMode="chop-icon__contrast",t.Cancel="chop-icon__close",t.Sidebar="chop-icon__magic-wand",t.Telegram="chop-icon__telegram",t.Github="chop-icon__github",t.Mail="chop-icon__mail4",t.Propositions="chop-icon__cube",t.Resolution="chop-icon__libreoffice",t.Predicates="chop-icon__cubes",t.TruthTables="chop-icon__delicious",t.Syllogisms="chop-icon__dice",t.English="chop-icon__english-lang",t.Russian="chop-icon__russian-lang",t.Required="chop-icon__fire",t.Checked="chop-icon__checkbox-checked",t.Unchecked="chop-icon__checkbox-unchecked",t.Info="chop-icon__exclamation-triangle",t.LinkedIn="chop-icon__linkedin-square",t.File="chop-icon__file-empty",t.Files="chop-icon__files-empty",t.Facebook="chop-icon__facebook2",t.CaretUp="chop-icon__caret-up",t.CaretDown="chop-icon__caret-down",t.SavePDF="chop-icon__file-pdf",t.ExportXML="chop-icon__download",t.ImportXML="chop-icon__upload",t.Copy="chop-icon__copy",t.Paste="chop-icon__paste",t.Cut="chop-icon__scissors",t.Reset="chop-icon__trash",t.Clear="chop-icon__cross",t))(W||{});const Qr=({isOpened:t,onClick:f,comboboxId:o,dropdownId:s,selected:l,name:b,placeholder:p,disabled:m,required:d})=>{const y=P([F.icon,{[W.CaretUp]:t,[W.CaretDown]:!t}]);return h.jsxs("button",{type:"button",name:b,value:l==null?void 0:l.id,role:"combobox","aria-haspopup":"listbox","aria-expanded":t,"aria-controls":s,id:o,className:F.combobox,onClick:f,disabled:m,"aria-required":d,children:[h.jsx("span",{className:F.combobox_label,children:(l==null?void 0:l.label)??p}),h.jsx("span",{className:y,"aria-hidden":"true"})]})};function pe(t){const f=document.getElementById(t);f&&f.focus()}const et=({value:t,isSelected:f,onSelect:o})=>{const{id:s,label:l}=t,b=P([F.icon,W.CheckMark]),p=m=>d=>{switch(d.key){case" ":case"SpaceBar":case"Enter":d.preventDefault(),o(m);break}};return h.jsxs("li",{id:s,role:"option",className:F.option,"aria-selected":f,tabIndex:0,onKeyDown:p(s),onClick:()=>o(s),children:[h.jsx("span",{children:l}),f&&h.jsx("span",{className:b,"aria-hidden":"true"})]})},rt=({values:t,isOpened:f,onClose:o,onSelect:s,dropdownId:l,comboboxId:b,selected:p})=>{const m=P([F.dropdown,{[F.dropdown_opened]:f}]),d=c=>{s(c),o(),pe(b)},y=c=>{let R="";t.forEach(g=>{document.getElementById(g.id)===document.activeElement&&(R=g.id)});const C=t.findIndex(g=>g.id===R);switch(c.key){case"Escape":c.preventDefault(),o();break;case"ArrowUp":{c.preventDefault();const g=C-1>=0?C-1:t.length-1,k=t[g];k&&pe(k.id);break}case"ArrowDown":case"Tab":{c.preventDefault();const g=C===t.length-1?0:C+1,k=t[g];k&&pe(k.id);break}}};return h.jsx("ul",{className:m,role:"listbox",id:l,tabIndex:-1,onKeyDown:y,children:t.map(c=>h.jsx(et,{value:c,onSelect:()=>d(c.id),isSelected:c.id===(p==null?void 0:p.id)},c.id))})},tt=({id:t,values:f,onSelectChange:o,name:s,label:l,required:b=!1,placeholder:p="Not selected",disabled:m=!1,...d})=>{const[y,c]=N.useState(!1),[R,C]=N.useState(),g=`${t}_combobox`,k=`${t}_dropdown`,$=P([F.wrapper,d==null?void 0:d.className,{[F.disabled]:m}]),Y=N.useRef(null),T=()=>c(!1),x=()=>c(!y),re=te=>{const X=f.find(ne=>ne.id===te);C(X),o==null||o(X)};return Zr({ref:Y,onClickOutsideHandler:T}),h.jsxs("div",{className:$,ref:Y,children:[h.jsx(he,{label:l,required:b,inputId:g,className:F.label}),h.jsx(Qr,{name:s,isOpened:y,comboboxId:g,dropdownId:k,onClick:x,selected:R,placeholder:p,disabled:m,required:b}),h.jsx(rt,{values:f,selected:R,isOpened:y,onClose:T,dropdownId:k,comboboxId:g,onSelect:re})]})},nt="_wrapper_1ab48_1",at="_input_1ab48_9",ot="_label_1ab48_23",it="_disabled_1ab48_38",ee={wrapper:nt,input:at,label:ot,disabled:it},st=({id:t,name:f,label:o,disabled:s,required:l=!1,onChange:b,isLabelHidden:p,className:m,...d})=>{const[y,c]=N.useState(!1),R=P([ee.wrapper,m,{[ee.disabled]:!!s}]),C=P([ee.label,{[W.Checked]:y,[W.Unchecked]:!y}]),g=k=>{if(s)return;const $=k.target.checked;c($),b&&b(k)};return h.jsxs("div",{className:R,children:[h.jsx("input",{id:t,name:f,type:"checkbox",className:ee.input,disabled:s,required:l,checked:y,onChange:g,"aria-label":p?o:void 0,...d}),h.jsx(he,{label:o,required:l,inputId:t,className:C,isTextHidden:p})]})};exports.ChopIcon=W;exports.ChopLogicButton=Tr;exports.ChopLogicCheckbox=st;exports.ChopLogicSelect=tt;exports.ChopLogicTextInput=Vr;
30
+ <%s key={someKey} {...props} />`,de,M,Er,M),We[M+de]=!0}}return e===i?hr(w):vr(w),w}}function br(e,t,n){return Ye(e,t,n,!0)}function mr(e,t,n){return Ye(e,t,n,!1)}var gr=mr,yr=br;G.Fragment=i,G.jsx=gr,G.jsxs=yr}()),G}process.env.NODE_ENV==="production"?ve.exports=wr():ve.exports=Rr();var m=ve.exports;const Cr="_button_11cqj_1",kr="_text_11cqj_21",jr="_primary_11cqj_26",Tr="_danger_11cqj_27",Sr="_secondary_11cqj_50",Or="_icon_11cqj_66",Pr="_disabled_11cqj_80",W={button:Cr,text:kr,primary:jr,danger:Tr,secondary:Sr,icon:Or,disabled:Pr};function D(r){return r.map(a=>{if(typeof a=="string")return a.trim();if(typeof a=="object"){const i=[];for(const s in a)a[s]&&i.push(s.trim());return i.join(" ")}}).filter(a=>!!a).join(" ")}const Dr=({disabled:r,onClick:c,text:a,type:i="button",view:s="primary",icon:v,label:h,..._})=>{const d=D([W.button,_==null?void 0:_.className,{[W.primary]:s==="primary",[W.secondary]:s==="secondary",[W.danger]:s==="danger",[W.icon]:s==="icon",[W.disabled]:!!r}]);return m.jsxs("button",{"aria-label":h,type:i,className:d,onClick:r?void 0:c,disabled:r,..._,children:[v&&m.jsx("span",{className:v,"aria-hidden":"true"}),s!=="icon"&&m.jsx("span",{className:W.text,children:a})]})},Fr="_container_b5mrn_1",Nr="_wrapper_b5mrn_7",$r="_input_b5mrn_21",Ar="_invalid_b5mrn_27",Lr="_error_b5mrn_47",Mr="_disabled_b5mrn_51",Y={container:Fr,wrapper:Nr,input:$r,invalid:Ar,error:Lr,disabled:Mr},Wr="_label_16gin_1",Yr="_text_16gin_10",qr="_required_16gin_16",_e={label:Wr,text:Yr,required:qr},he=({label:r,required:c,inputId:a,className:i,isTextHidden:s=!1})=>m.jsxs("label",{htmlFor:a,className:D([_e.label,i]),children:[!s&&m.jsx("span",{className:_e.text,children:r}),c&&m.jsx("abbr",{title:"required",className:_e.required,children:"*"})]}),Ur="_message_1ly5l_1",Vr="_visible_1ly5l_8",Ve={message:Ur,visible:Vr},Kr=({errorId:r,message:c="Invalid input",className:a,visible:i=!1})=>m.jsx("span",{id:r,className:D([Ve.message,a,{[Ve.visible]:i}]),children:c}),Br=({id:r,name:c,label:a,disabled:i,placeholder:s="Type here...",valid:v=!0,required:h=!1,errorMessage:_,defaultValue:d,onChange:y,...u})=>{const[R,C]=P.useState(typeof d=="string"?d:""),g=`${r}_error`,k=D([Y.container,u==null?void 0:u.className]),$=D([Y.wrapper,{[Y.disabled]:!!i,[Y.invalid]:!v}]),A=S=>{const{value:x=""}=S.target;C(x),y&&y(S)};return m.jsxs("div",{className:k,children:[m.jsxs("div",{className:$,children:[m.jsx(he,{label:a,required:h,inputId:r,className:Y.label}),m.jsx("input",{id:r,name:c,type:"text",className:Y.input,disabled:i,placeholder:s,required:h,"aria-invalid":!v,"aria-errormessage":g,value:R,onChange:A,...u})]}),m.jsx(Kr,{errorId:g,message:_,className:Y.error,visible:!v})]})},Ir="_wrapper_gevmw_1",Jr="_combobox_gevmw_17",Gr="_combobox_label_gevmw_42",Xr="_dropdown_gevmw_47",zr="_dropdown_opened_gevmw_68",Hr="_option_gevmw_73",Zr="_active_gevmw_82",Qr="_disabled_gevmw_91",et="_icon_gevmw_97",N={wrapper:Ir,combobox:Jr,combobox_label:Gr,dropdown:Xr,dropdown_opened:zr,option:Hr,active:Zr,disabled:Qr,icon:et},Ke=({ref:r,onClickOutsideHandler:c,dependentRef:a})=>{P.useEffect(()=>{const i=s=>{const v=(r==null?void 0:r.current)&&!r.current.contains(s.target),h=a!=null&&a.current?!a.current.contains(s.target):!0;v&&h&&c()};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[r,a,c])};var q=(r=>(r.CheckMark="chop-icon__check",r.Home="chop-icon__home",r.Menu="chop-icon__menu",r.Enlarge="chop-icon__enlarge2",r.Shrink="chop-icon__shrink2",r.Settings="chop-icon__cog",r.Delete="chop-icon__bin2",r.Up="chop-icon__circle-up",r.Down="chop-icon__circle-down",r.Right="chop-icon__circle-right",r.Left="chop-icon__circle-left",r.Sound="chop-icon__volume-medium",r.NoSound="chop-icon__volume-mute2",r.LightMode="chop-icon__sun",r.DarkMode="chop-icon__contrast",r.Cancel="chop-icon__close",r.Sidebar="chop-icon__magic-wand",r.Telegram="chop-icon__telegram",r.Github="chop-icon__github",r.Mail="chop-icon__mail4",r.Propositions="chop-icon__cube",r.Resolution="chop-icon__libreoffice",r.Predicates="chop-icon__cubes",r.TruthTables="chop-icon__delicious",r.Syllogisms="chop-icon__dice",r.English="chop-icon__english-lang",r.Russian="chop-icon__russian-lang",r.Required="chop-icon__fire",r.Checked="chop-icon__checkbox-checked",r.Unchecked="chop-icon__checkbox-unchecked",r.Info="chop-icon__exclamation-triangle",r.LinkedIn="chop-icon__linkedin-square",r.File="chop-icon__file-empty",r.Files="chop-icon__files-empty",r.Facebook="chop-icon__facebook2",r.CaretUp="chop-icon__caret-up",r.CaretDown="chop-icon__caret-down",r.SavePDF="chop-icon__file-pdf",r.ExportXML="chop-icon__download",r.ImportXML="chop-icon__upload",r.Copy="chop-icon__copy",r.Paste="chop-icon__paste",r.Cut="chop-icon__scissors",r.Reset="chop-icon__trash",r.Clear="chop-icon__cross",r))(q||{});const rt=({isOpened:r,onClick:c,comboboxId:a,dropdownId:i,selected:s,name:v,placeholder:h,disabled:_,required:d})=>{const y=D([N.icon,{[q.CaretUp]:r,[q.CaretDown]:!r}]);return m.jsxs("button",{type:"button",name:v,value:s==null?void 0:s.id,role:"combobox","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":i,id:a,className:N.combobox,onClick:c,disabled:_,"aria-required":d,children:[m.jsx("span",{className:N.combobox_label,children:(s==null?void 0:s.label)??h}),m.jsx("span",{className:y,"aria-hidden":"true"})]})};function pe(r){const c=document.getElementById(r);c&&c.focus()}const tt=({value:r,isSelected:c,onSelect:a})=>{const{id:i,label:s}=r,v=D([N.icon,q.CheckMark]),h=_=>d=>{switch(d.key){case" ":case"SpaceBar":case"Enter":d.preventDefault(),a(_);break}};return m.jsxs("li",{id:i,role:"option",className:N.option,"aria-selected":c,tabIndex:0,onKeyDown:h(i),onClick:()=>a(i),children:[m.jsx("span",{children:s}),c&&m.jsx("span",{className:v,"aria-hidden":"true"})]})},nt=({values:r,isOpened:c,onClose:a,onSelect:i,dropdownId:s,comboboxId:v,selected:h})=>{const _=D([N.dropdown,{[N.dropdown_opened]:c}]),d=u=>{i(u),a(),pe(v)},y=u=>{let R="";r.forEach(g=>{document.getElementById(g.id)===document.activeElement&&(R=g.id)});const C=r.findIndex(g=>g.id===R);switch(u.key){case"Escape":u.preventDefault(),a();break;case"ArrowUp":{u.preventDefault();const g=C-1>=0?C-1:r.length-1,k=r[g];k&&pe(k.id);break}case"ArrowDown":case"Tab":{u.preventDefault();const g=C===r.length-1?0:C+1,k=r[g];k&&pe(k.id);break}}};return m.jsx("ul",{className:_,role:"listbox",id:s,tabIndex:-1,onKeyDown:y,children:r.map(u=>m.jsx(tt,{value:u,onSelect:()=>d(u.id),isSelected:u.id===(h==null?void 0:h.id)},u.id))})},Be=({ref:r,keyCode:c,onKeyPress:a})=>{P.useEffect(()=>{const i=s=>{(s==null?void 0:s.code)===c&&(r!=null&&r.current)&&a()};return document.addEventListener("keydown",i,!1),()=>{document.removeEventListener("keydown",i,!1)}},[r,c,a])},at=({id:r,values:c,onSelectChange:a,name:i,label:s,required:v=!1,placeholder:h="Not selected",disabled:_=!1,...d})=>{const[y,u]=P.useState(!1),[R,C]=P.useState(),g=`${r}_combobox`,k=`${r}_dropdown`,$=D([N.wrapper,d==null?void 0:d.className,{[N.disabled]:_}]),A=P.useRef(null),S=()=>u(!1),x=()=>u(!y),re=te=>{const X=c.find(ne=>ne.id===te);C(X),a==null||a(X)};return Ke({ref:A,onClickOutsideHandler:S}),Be({keyCode:"Escape",ref:A,onKeyPress:S}),m.jsxs("div",{className:$,ref:A,children:[m.jsx(he,{label:s,required:v,inputId:g,className:N.label}),m.jsx(rt,{name:i,isOpened:y,comboboxId:g,dropdownId:k,onClick:x,selected:R,placeholder:h,disabled:_,required:v}),m.jsx(nt,{values:c,selected:R,isOpened:y,onClose:S,dropdownId:k,comboboxId:g,onSelect:re})]})},ot="_wrapper_1ab48_1",it="_input_1ab48_9",st="_label_1ab48_23",ct="_disabled_1ab48_38",ee={wrapper:ot,input:it,label:st,disabled:ct},lt=({id:r,name:c,label:a,disabled:i,required:s=!1,onChange:v,isLabelHidden:h,className:_,...d})=>{const[y,u]=P.useState(!1),R=D([ee.wrapper,_,{[ee.disabled]:!!i}]),C=D([ee.label,{[q.Checked]:y,[q.Unchecked]:!y}]),g=k=>{if(i)return;const $=k.target.checked;u($),v&&v(k)};return m.jsxs("div",{className:R,children:[m.jsx("input",{id:r,name:c,type:"checkbox",className:ee.input,disabled:i,required:s,checked:y,onChange:g,"aria-label":h?a:void 0,...d}),m.jsx(he,{label:a,required:s,inputId:r,className:C,isTextHidden:h})]})},ut=(r,c=300)=>{const[a,i]=P.useState(!1);return P.useEffect(()=>{r&&!a?i(!0):!r&&a&&setTimeout(()=>{i(!1)},c)},[r]),a},ft=({modalRef:r,isOpened:c})=>{P.useEffect(()=>{const a=r.current;if(!c||!a)return;const i=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),s=i[0],v=i[i.length-1],h=_=>{_.key==="Tab"&&(_.shiftKey&&document.activeElement===s?(_.preventDefault(),v.focus()):!_.shiftKey&&document.activeElement===v&&(_.preventDefault(),s.focus()))};return a.addEventListener("keydown",h),()=>{a.removeEventListener("keydown",h)}},[r,c])};exports.ChopIcon=q;exports.ChopLogicButton=Dr;exports.ChopLogicCheckbox=lt;exports.ChopLogicSelect=at;exports.ChopLogicTextInput=Br;exports.useClickOutside=Ke;exports.useKeyPress=Be;exports.useModalFocusTrap=ft;exports.useMount=ut;
31
31
  //# sourceMappingURL=index.cjs.js.map