chop-logic-components 0.0.3 → 0.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.
@@ -1 +1,3 @@
1
1
  export { default as ChopLogicButton } from './button/Button';
2
+ export { default as ChopLogicTextInput } from './inputs/text/TextInput';
3
+ export { default as ChopLogicSelect } from './inputs/select/Select';
@@ -0,0 +1,10 @@
1
+ import { default as React, PropsWithChildren } from 'react';
2
+
3
+ type ChopLogicErrorMessageProps = {
4
+ errorId: string;
5
+ visible?: boolean;
6
+ message?: string;
7
+ className?: string;
8
+ };
9
+ declare const ChopLogicErrorMessage: React.FC<PropsWithChildren<ChopLogicErrorMessageProps>>;
10
+ export default ChopLogicErrorMessage;
@@ -0,0 +1,10 @@
1
+ import { default as React, PropsWithChildren } from 'react';
2
+
3
+ type ChopLogicLabelProps = {
4
+ label: string;
5
+ required: boolean;
6
+ inputId: string;
7
+ className?: string;
8
+ };
9
+ declare const ChopLogicLabel: React.FC<PropsWithChildren<ChopLogicLabelProps>>;
10
+ export default ChopLogicLabel;
@@ -0,0 +1,14 @@
1
+ export type ChopLogicSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
2
+ id: string;
3
+ name: string;
4
+ label: string;
5
+ values: SelectValue[];
6
+ onSelect?: (value?: SelectValue) => void;
7
+ placeholder?: string;
8
+ };
9
+ export type SelectValue = {
10
+ id: string;
11
+ label: string;
12
+ };
13
+ declare const ChopLogicSelect: React.FC<ChopLogicSelectProps>;
14
+ export default ChopLogicSelect;
@@ -0,0 +1,5 @@
1
+ import { ChopLogicSelectProps } from '../Select';
2
+ import { default as React } from 'react';
3
+
4
+ declare const Example: React.FC<ChopLogicSelectProps>;
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,15 @@
1
+ import { SelectValue } from '../Select';
2
+
3
+ type SelectComboboxProps = {
4
+ isOpened: boolean;
5
+ disabled: boolean;
6
+ required: boolean;
7
+ onClick: () => void;
8
+ comboboxId: string;
9
+ dropdownId: string;
10
+ selected?: SelectValue;
11
+ placeholder?: string;
12
+ name: string;
13
+ };
14
+ declare const SelectCombobox: React.FC<SelectComboboxProps>;
15
+ export default SelectCombobox;
@@ -0,0 +1,13 @@
1
+ import { SelectValue } from '../Select';
2
+
3
+ type SelectDropdownProps = {
4
+ values: SelectValue[];
5
+ isOpened: boolean;
6
+ dropdownId: string;
7
+ comboboxId: string;
8
+ onClose: () => void;
9
+ selected?: SelectValue;
10
+ onSelect: (id: string) => void;
11
+ };
12
+ declare const SelectDropdown: React.FC<SelectDropdownProps>;
13
+ export default SelectDropdown;
@@ -0,0 +1,9 @@
1
+ import { SelectValue } from '../Select';
2
+
3
+ type SelectOptionProps = {
4
+ value: SelectValue;
5
+ isSelected: boolean;
6
+ onSelect: (id: string) => void;
7
+ };
8
+ declare const SelectOption: React.FC<SelectOptionProps>;
9
+ export default SelectOption;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
+ id: string;
5
+ name: string;
6
+ label: string;
7
+ valid?: boolean;
8
+ errorMessage?: string;
9
+ };
10
+ declare const TextInput: React.FC<ChopLogicTextInputProps>;
11
+ export default TextInput;
@@ -0,0 +1,5 @@
1
+ import { ChopLogicTextInputProps } from '../TextInput';
2
+ import { default as React } from 'react';
3
+
4
+ declare const Example: React.FC<ChopLogicTextInputProps>;
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;
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pe=require("react");var ee={exports:{}},$={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react");var ve={exports:{}},K={};/**
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 Se;function dr(){if(Se)return $;Se=1;var E=Pe,C=Symbol.for("react.element"),p=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,b=E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O={key:!0,ref:!0,__self:!0,__source:!0};function h(R,f,j){var g,T={},S=null,L=null;j!==void 0&&(S=""+j),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(L=f.ref);for(g in f)_.call(f,g)&&!O.hasOwnProperty(g)&&(T[g]=f[g]);if(R&&R.defaultProps)for(g in f=R.defaultProps,f)T[g]===void 0&&(T[g]=f[g]);return{$$typeof:C,type:R,key:S,ref:L,props:T,_owner:b.current}}return $.Fragment=p,$.jsx=h,$.jsxs=h,$}var Y={};/**
9
+ */var Le;function gr(){if(Le)return K;Le=1;var a=N,u=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,d=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function b(y,v,C){var c,x={},R=null,g=null;C!==void 0&&(R=""+C),v.key!==void 0&&(R=""+v.key),v.ref!==void 0&&(g=v.ref);for(c in v)l.call(v,c)&&!m.hasOwnProperty(c)&&(x[c]=v[c]);if(y&&y.defaultProps)for(c in v=y.defaultProps,v)x[c]===void 0&&(x[c]=v[c]);return{$$typeof:u,type:y,key:R,ref:g,props:x,_owner:d.current}}return K.Fragment=o,K.jsx=b,K.jsxs=b,K}var J={};/**
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 we;function vr(){return we||(we=1,process.env.NODE_ENV!=="production"&&function(){var E=Pe,C=Symbol.for("react.element"),p=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),R=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),re=Symbol.iterator,je="@@iterator";function xe(e){if(e===null||typeof e!="object")return null;var r=re&&e[re]||e[je];return typeof r=="function"?r:null}var x=E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function c(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ke("error",e,t)}}function ke(e,r,t){{var n=x.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var De=!1,Fe=!1,Ae=!1,Ie=!1,We=!1,te;te=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===_||e===O||We||e===b||e===j||e===g||Ie||e===L||De||Fe||Ae||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===T||e.$$typeof===h||e.$$typeof===R||e.$$typeof===f||e.$$typeof===te||e.getModuleId!==void 0))}function Ye(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ne(e){return e.displayName||"Context"}function m(e){if(e==null)return null;if(typeof e.tag=="number"&&c("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 _:return"Fragment";case p:return"Portal";case O:return"Profiler";case b:return"StrictMode";case j:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return ne(r)+".Consumer";case h:var t=e;return ne(t._context)+".Provider";case f:return Ye(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:m(e.type)||"Memo";case S:{var i=e,s=i._payload,o=i._init;try{return m(o(s))}catch{return null}}}return null}var w=Object.assign,A=0,ae,oe,ie,se,ue,le,ce;function fe(){}fe.__reactDisabledLog=!0;function Le(){{if(A===0){ae=console.log,oe=console.info,ie=console.warn,se=console.error,ue=console.group,le=console.groupCollapsed,ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:fe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}}function Me(){{if(A--,A===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:w({},e,{value:ae}),info:w({},e,{value:oe}),warn:w({},e,{value:ie}),error:w({},e,{value:se}),group:w({},e,{value:ue}),groupCollapsed:w({},e,{value:le}),groupEnd:w({},e,{value:ce})})}A<0&&c("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var B=x.ReactCurrentDispatcher,q;function M(e,r,t){{if(q===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return`
18
- `+q+e}}var J=!1,N;{var Ne=typeof WeakMap=="function"?WeakMap:Map;N=new Ne}function de(e,r){if(!e||J)return"";{var t=N.get(e);if(t!==void 0)return t}var n;J=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=B.current,B.current=null,Le();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(v){n=v}Reflect.construct(e,[],o)}else{try{o.call()}catch(v){n=v}e.call(o.prototype)}}else{try{throw Error()}catch(v){n=v}e()}}catch(v){if(v&&n&&typeof v.stack=="string"){for(var a=v.stack.split(`
19
- `),d=n.stack.split(`
20
- `),u=a.length-1,l=d.length-1;u>=1&&l>=0&&a[u]!==d[l];)l--;for(;u>=1&&l>=0;u--,l--)if(a[u]!==d[l]){if(u!==1||l!==1)do if(u--,l--,l<0||a[u]!==d[l]){var y=`
21
- `+a[u].replace(" at new "," at ");return e.displayName&&y.includes("<anonymous>")&&(y=y.replace("<anonymous>",e.displayName)),typeof e=="function"&&N.set(e,y),y}while(u>=1&&l>=0);break}}}finally{J=!1,B.current=s,Me(),Error.prepareStackTrace=i}var D=e?e.displayName||e.name:"",P=D?M(D):"";return typeof e=="function"&&N.set(e,P),P}function Ue(e,r,t){return de(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function U(e,r,t){if(e==null)return"";if(typeof e=="function")return de(e,Ve(e));if(typeof e=="string")return M(e);switch(e){case j:return M("Suspense");case g:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Ue(e.render);case T:return U(e.type,r,t);case S:{var n=e,i=n._payload,s=n._init;try{return U(s(i),r,t)}catch{}}}return""}var I=Object.prototype.hasOwnProperty,ve={},pe=x.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);pe.setExtraStackFrame(t)}else pe.setExtraStackFrame(null)}function Be(e,r,t,n,i){{var s=Function.call.bind(I);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var d=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){a=u}a&&!(a instanceof Error)&&(V(i),c("%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).",n||"React class",t,o,typeof a),V(null)),a instanceof Error&&!(a.message in ve)&&(ve[a.message]=!0,V(i),c("Failed %s type: %s",t,a.message),V(null))}}}var qe=Array.isArray;function K(e){return qe(e)}function Je(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Ke(e){try{return ge(e),!1}catch{return!0}}function ge(e){return""+e}function ye(e){if(Ke(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Je(e)),ge(e)}var W=x.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0},_e,be,G;G={};function ze(e){if(I.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Xe(e){if(I.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function He(e,r){if(typeof e.ref=="string"&&W.current&&r&&W.current.stateNode!==r){var t=m(W.current.type);G[t]||(c('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',m(W.current.type),e.ref),G[t]=!0)}}function Qe(e,r){{var t=function(){_e||(_e=!0,c("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function Ze(e,r){{var t=function(){be||(be=!0,c("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var er=function(e,r,t,n,i,s,o){var a={$$typeof:C,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function rr(e,r,t,n,i){{var s,o={},a=null,d=null;t!==void 0&&(ye(t),a=""+t),Xe(r)&&(ye(r.key),a=""+r.key),ze(r)&&(d=r.ref,He(r,i));for(s in r)I.call(r,s)&&!Ge.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var u=e.defaultProps;for(s in u)o[s]===void 0&&(o[s]=u[s])}if(a||d){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&Qe(o,l),d&&Ze(o,l)}return er(e,a,d,i,n,W.current,o)}}var z=x.ReactCurrentOwner,he=x.ReactDebugCurrentFrame;function k(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);he.setExtraStackFrame(t)}else he.setExtraStackFrame(null)}var X;X=!1;function H(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}function me(){{if(z.current){var e=m(z.current.type);if(e)return`
17
+ */var We;function Er(){return We||(We=1,process.env.NODE_ENV!=="production"&&function(){var a=N,u=Symbol.for("react.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),y=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),T=Symbol.iterator,M="@@iterator";function L(e){if(e===null||typeof e!="object")return null;var r=T&&e[T]||e[M];return typeof r=="function"?r:null}var S=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ee("error",e,t)}}function ee(e,r,t){{var n=S.ReactDebugCurrentFrame,f=n.getStackAddendum();f!==""&&(r+="%s",t=t.concat([f]));var p=t.map(function(s){return String(s)});p.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,p)}}var re=!1,G=!1,te=!1,Ue=!1,Be=!1,pe;pe=Symbol.for("react.module.reference");function qe(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===m||Be||e===d||e===C||e===c||Ue||e===g||re||G||te||typeof e=="object"&&e!==null&&(e.$$typeof===R||e.$$typeof===x||e.$$typeof===b||e.$$typeof===y||e.$$typeof===v||e.$$typeof===pe||e.getModuleId!==void 0))}function Ke(e,r,t){var n=e.displayName;if(n)return n;var f=r.displayName||r.name||"";return f!==""?t+"("+f+")":t}function be(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&E("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 l:return"Fragment";case o:return"Portal";case m:return"Profiler";case d:return"StrictMode";case C:return"Suspense";case c:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y:var r=e;return be(r)+".Consumer";case b:var t=e;return be(t._context)+".Provider";case v:return Ke(e,e.render,"ForwardRef");case x:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case R:{var f=e,p=f._payload,s=f._init;try{return P(s(p))}catch{return null}}}return null}var F=Object.assign,U=0,_e,me,he,ye,ge,Ee,we;function xe(){}xe.__reactDisabledLog=!0;function Je(){{if(U===0){_e=console.log,me=console.info,he=console.warn,ye=console.error,ge=console.group,Ee=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function Ge(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:_e}),info:F({},e,{value:me}),warn:F({},e,{value:he}),error:F({},e,{value:ye}),group:F({},e,{value:ge}),groupCollapsed:F({},e,{value:Ee}),groupEnd:F({},e,{value:we})})}U<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ne=S.ReactCurrentDispatcher,ae;function z(e,r,t){{if(ae===void 0)try{throw Error()}catch(f){var n=f.stack.trim().match(/\n( *(at )?)/);ae=n&&n[1]||""}return`
18
+ `+ae+e}}var oe=!1,X;{var ze=typeof WeakMap=="function"?WeakMap:Map;X=new ze}function Re(e,r){if(!e||oe)return"";{var t=X.get(e);if(t!==void 0)return t}var n;oe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=ne.current,ne.current=null,Je();try{if(r){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(O){n=O}Reflect.construct(e,[],s)}else{try{s.call()}catch(O){n=O}e.call(s.prototype)}}else{try{throw Error()}catch(O){n=O}e()}}catch(O){if(O&&n&&typeof O.stack=="string"){for(var i=O.stack.split(`
19
+ `),j=n.stack.split(`
20
+ `),h=i.length-1,w=j.length-1;h>=1&&w>=0&&i[h]!==j[w];)w--;for(;h>=1&&w>=0;h--,w--)if(i[h]!==j[w]){if(h!==1||w!==1)do if(h--,w--,w<0||i[h]!==j[w]){var k=`
21
+ `+i[h].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&X.set(e,k),k}while(h>=1&&w>=0);break}}}finally{oe=!1,ne.current=p,Ge(),Error.prepareStackTrace=f}var Y=e?e.displayName||e.name:"",A=Y?z(Y):"";return typeof e=="function"&&X.set(e,A),A}function Xe(e,r,t){return Re(e,!1)}function He(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,He(e));if(typeof e=="string")return z(e);switch(e){case C:return z("Suspense");case c:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Xe(e.render);case x:return H(e.type,r,t);case R:{var n=e,f=n._payload,p=n._init;try{return H(p(f),r,t)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,Ce={},je=S.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}function Qe(e,r,t,n,f){{var p=Function.call.bind(B);for(var s in e)if(p(e,s)){var i=void 0;try{if(typeof e[s]!="function"){var j=Error((n||"React class")+": "+t+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}i=e[s](r,s,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(Q(f),E("%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).",n||"React class",t,s,typeof i),Q(null)),i instanceof Error&&!(i.message in Ce)&&(Ce[i.message]=!0,Q(f),E("Failed %s type: %s",t,i.message),Q(null))}}}var Ze=Array.isArray;function ie(e){return Ze(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return Te(e),!1}catch{return!0}}function Te(e){return""+e}function Oe(e){if(rr(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),Te(e)}var q=S.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Se,ke,se;se={};function nr(e){if(B.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if(B.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&q.current&&r&&q.current.stateNode!==r){var t=P(q.current.type);se[t]||(E('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',P(q.current.type),e.ref),se[t]=!0)}}function ir(e,r){{var t=function(){Se||(Se=!0,E("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){ke||(ke=!0,E("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var cr=function(e,r,t,n,f,p,s){var i={$$typeof:u,type:e,key:r,ref:t,props:s,_owner:p};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:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function lr(e,r,t,n,f){{var p,s={},i=null,j=null;t!==void 0&&(Oe(t),i=""+t),ar(r)&&(Oe(r.key),i=""+r.key),nr(r)&&(j=r.ref,or(r,f));for(p in r)B.call(r,p)&&!tr.hasOwnProperty(p)&&(s[p]=r[p]);if(e&&e.defaultProps){var h=e.defaultProps;for(p in h)s[p]===void 0&&(s[p]=h[p])}if(i||j){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&ir(s,w),j&&sr(s,w)}return cr(e,i,j,f,n,q.current,s)}}var ce=S.ReactCurrentOwner,Pe=S.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}var le;le=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function De(){{if(ce.current){var e=P(ce.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function tr(e){return""}var Ee={};function nr(e){{var r=me();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
23
+ Check the render method of \``+e+"`."}return""}}function ur(e){return""}var Ie={};function fr(e){{var r=De();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
24
 
25
- Check the top-level render call using <`+t+">.")}return r}}function Re(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=nr(r);if(Ee[t])return;Ee[t]=!0;var n="";e&&e._owner&&e._owner!==z.current&&(n=" It was passed a child from "+m(e._owner.type)+"."),k(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),k(null)}}function Te(e,r){{if(typeof e!="object")return;if(K(e))for(var t=0;t<e.length;t++){var n=e[t];H(n)&&Re(n,r)}else if(H(e))e._store&&(e._store.validated=!0);else if(e){var i=xe(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)H(o.value)&&Re(o.value,r)}}}function ar(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===T))t=r.propTypes;else return;if(t){var n=m(r);Be(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!X){X=!0;var i=m(r);c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function or(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){k(e),c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),k(null);break}}e.ref!==null&&(k(e),c("Invalid attribute `ref` supplied to `React.Fragment`."),k(null))}}var Ce={};function Oe(e,r,t,n,i,s){{var o=$e(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" 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 d=tr();d?a+=d:a+=me();var u;e===null?u="null":K(e)?u="array":e!==void 0&&e.$$typeof===C?(u="<"+(m(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a)}var l=rr(e,r,t,i,s);if(l==null)return l;if(o){var y=r.children;if(y!==void 0)if(n)if(K(y)){for(var D=0;D<y.length;D++)Te(y[D],e);Object.freeze&&Object.freeze(y)}else c("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 Te(y,e)}if(I.call(r,"key")){var P=m(e),v=Object.keys(r).filter(function(fr){return fr!=="key"}),Q=v.length>0?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}";if(!Ce[P+Q]){var cr=v.length>0?"{"+v.join(": ..., ")+": ...}":"{}";c(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(Ie[t])return;Ie[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),W(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),W(null)}}function Ae(e,r){{if(typeof e!="object")return;if(ie(e))for(var t=0;t<e.length;t++){var n=e[t];ue(n)&&Fe(n,r)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var f=L(e);if(typeof f=="function"&&f!==e.entries)for(var p=f.call(e),s;!(s=p.next()).done;)ue(s.value)&&Fe(s.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===x))t=r.propTypes;else return;if(t){var n=P(r);Qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!le){le=!0;var f=P(r);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){W(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),W(null);break}}e.ref!==null&&(W(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}var $e={};function Ne(e,r,t,n,f,p){{var s=qe(e);if(!s){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=ur();j?i+=j:i+=De();var h;e===null?h="null":ie(e)?h="array":e!==void 0&&e.$$typeof===u?(h="<"+(P(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var w=lr(e,r,t,f,p);if(w==null)return w;if(s){var k=r.children;if(k!==void 0)if(n)if(ie(k)){for(var Y=0;Y<k.length;Y++)Ae(k[Y],e);Object.freeze&&Object.freeze(k)}else E("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 Ae(k,e)}if(B.call(r,"key")){var A=P(e),O=Object.keys(r).filter(function(yr){return yr!=="key"}),fe=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";if(!$e[A+fe]){var hr=O.length>0?"{"+O.join(": ..., ")+": ...}":"{}";E(`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} />`,Q,P,cr,P),Ce[P+Q]=!0}}return e===_?or(l):ar(l),l}}function ir(e,r,t){return Oe(e,r,t,!0)}function sr(e,r,t){return Oe(e,r,t,!1)}var ur=sr,lr=ir;Y.Fragment=_,Y.jsx=ur,Y.jsxs=lr}()),Y}process.env.NODE_ENV==="production"?ee.exports=dr():ee.exports=vr();var Z=ee.exports;const pr="_button_gs6r8_1",gr="_primary_gs6r8_15",yr="_danger_gs6r8_16",_r="_secondary_gs6r8_39",br="_text_gs6r8_46",hr="_disabled_gs6r8_55",F={button:pr,primary:gr,danger:yr,secondary:_r,text:br,disabled:hr};function mr(E){return E.map(p=>{if(typeof p=="string")return p.trim();if(typeof p=="object"){const _=[];for(const b in p)p[b]&&_.push(b.trim());return _.join(" ")}}).filter(p=>!!p).join(" ")}const Er={CheckMark:"✓",Ballot:"✗",ClockwiseTop:"↷",ClockwiseOpen:"↻",Pencil:"✎",Rightwards:"⇨",Leftwards:"⇦",Upwards:"⇧",Downwards:"⇩",Copyright:"©",Warning:"⚠",Question:"�",Envelope:"✉",Hart:"♥",Scissors:"✂",Star:"★"},Rr=({disabled:E,onClick:C,text:p="Ok",type:_="button",view:b="primary",icon:O,...h})=>{const R=mr([F.button,h==null?void 0:h.className,{[F.primary]:b==="primary",[F.secondary]:b==="secondary",[F.danger]:b==="danger",[F.disabled]:!!E}]);return Z.jsxs("button",{type:_,className:R,onClick:E?void 0:C,disabled:E,...h,children:[O&&Z.jsx("span",{children:`${Er[O]}`}),Z.jsx("span",{className:F.text,children:p})]})};exports.ChopLogicButton=Rr;
30
+ <%s key={someKey} {...props} />`,fe,A,hr,A),$e[A+fe]=!0}}return e===l?vr(w):dr(w),w}}function pr(e,r,t){return Ne(e,r,t,!0)}function br(e,r,t){return Ne(e,r,t,!1)}var _r=br,mr=pr;J.Fragment=l,J.jsx=_r,J.jsxs=mr}()),J}process.env.NODE_ENV==="production"?ve.exports=gr():ve.exports=Er();var _=ve.exports;const wr="_button_rrb70_1",xr="_text_rrb70_21",Rr="_primary_rrb70_26",Cr="_danger_rrb70_27",jr="_secondary_rrb70_50",Tr="_disabled_rrb70_66",V={button:wr,text:xr,primary:Rr,danger:Cr,secondary:jr,disabled:Tr};function I(a){return a.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="object"){const l=[];for(const d in o)o[d]&&l.push(d.trim());return l.join(" ")}}).filter(o=>!!o).join(" ")}const Z={CheckMark:"✓",Ballot:"✗",ClockwiseTop:"↷",ClockwiseOpen:"↻",Pencil:"✎",Rightwards:"⇨",Leftwards:"⇦",Upwards:"⇧",Downwards:"⇩",Copyright:"©",Warning:"⚠",Question:"�",Envelope:"✉",Hart:"♥",Scissors:"✂",Star:"★"},Or=({disabled:a,onClick:u,text:o="Ok",type:l="button",view:d="primary",icon:m,...b})=>{const y=I([V.button,b==null?void 0:b.className,{[V.primary]:d==="primary",[V.secondary]:d==="secondary",[V.danger]:d==="danger",[V.disabled]:!!a}]);return _.jsxs("button",{type:l,className:y,onClick:a?void 0:u,disabled:a,...b,children:[m&&_.jsx("span",{children:`${Z[m]}`}),_.jsx("span",{className:V.text,children:o})]})},Sr="_container_b5mrn_1",kr="_wrapper_b5mrn_7",Pr="_input_b5mrn_21",Dr="_invalid_b5mrn_27",Ir="_error_b5mrn_47",Fr="_disabled_b5mrn_51",$={container:Sr,wrapper:kr,input:Pr,invalid:Dr,error:Ir,disabled:Fr},Ar="_label_195p3_1",$r="_required_195p3_10",Ye={label:Ar,required:$r},Me=({label:a,required:u,inputId:o,className:l})=>_.jsxs("label",{htmlFor:o,className:I([Ye.label,l]),children:[a,u&&_.jsx("abbr",{title:"required",className:Ye.required,children:"*"})]}),Nr="_message_1ly5l_1",Lr="_visible_1ly5l_8",Ve={message:Nr,visible:Lr},Wr=({errorId:a,message:u="Invalid input",className:o,visible:l=!1})=>_.jsx("span",{id:a,className:I([Ve.message,o,{[Ve.visible]:l}]),children:u}),Yr=({id:a,name:u,label:o,disabled:l,placeholder:d="Type here...",valid:m=!0,required:b=!1,errorMessage:y,defaultValue:v,onChange:C,...c})=>{const[x,R]=N.useState(typeof v=="string"?v:""),g=`${a}_error`,T=I([$.container,c==null?void 0:c.className]),M=I([$.wrapper,{[$.disabled]:!!l,[$.invalid]:!m}]),L=S=>{const{value:E=""}=S.target;R(E),C&&C(S)};return _.jsxs("div",{className:T,children:[_.jsxs("div",{className:M,children:[_.jsx(Me,{label:o,required:b,inputId:a,className:$.label}),_.jsx("input",{id:a,name:u,type:"text",className:$.input,disabled:l,placeholder:d,required:b,"aria-invalid":!m,"aria-errormessage":g,value:x,onChange:L,...c})]}),_.jsx(Wr,{errorId:g,message:y,className:$.error,visible:!m})]})},Vr="_wrapper_w3i6b_1",Mr="_combobox_w3i6b_17",Ur="_combobox_label_w3i6b_41",Br="_dropdown_w3i6b_46",qr="_dropdown_opened_w3i6b_67",Kr="_option_w3i6b_72",Jr="_active_w3i6b_80",Gr="_disabled_w3i6b_89",D={wrapper:Vr,combobox:Mr,combobox_label:Ur,dropdown:Br,dropdown_opened:qr,option:Kr,active:Jr,disabled:Gr},zr=({ref:a,onClickOutsideHandler:u,dependentRef:o})=>{N.useEffect(()=>{const l=d=>{const m=(a==null?void 0:a.current)&&!a.current.contains(d.target),b=o!=null&&o.current?!o.current.contains(d.target):!0;m&&b&&u()};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[a,o,u])},Xr=({isOpened:a,onClick:u,comboboxId:o,dropdownId:l,selected:d,name:m,placeholder:b,disabled:y,required:v})=>_.jsxs("button",{type:"button",name:m,value:d==null?void 0:d.id,role:"combobox","aria-haspopup":"listbox","aria-label":"Select one of the options","aria-expanded":a,"aria-controls":l,id:o,className:D.combobox,onClick:u,disabled:y,"aria-required":v,children:[_.jsx("span",{className:D.combobox_label,children:(d==null?void 0:d.label)??b}),_.jsx("span",{children:a?Z.Upwards:Z.Downwards})]});function de(a){const u=document.getElementById(a);u&&u.focus()}const Hr=({value:a,isSelected:u,onSelect:o})=>{const{id:l,label:d}=a,m=I([D.option]),b=y=>v=>{switch(v.key){case" ":case"SpaceBar":case"Enter":v.preventDefault(),o(y);break}};return _.jsxs("li",{id:l,role:"option",className:m,"aria-selected":u,tabIndex:0,onKeyDown:b(l),onClick:()=>o(l),children:[_.jsx("span",{children:d}),u&&_.jsx("span",{children:Z.CheckMark})]})},Qr=({values:a,isOpened:u,onClose:o,onSelect:l,dropdownId:d,comboboxId:m,selected:b})=>{const y=I([D.dropdown,{[D.dropdown_opened]:u}]),v=c=>{l(c),o(),de(m)},C=c=>{let x="";a.forEach(g=>{document.getElementById(g.id)===document.activeElement&&(x=g.id)});const R=a.findIndex(g=>g.id===x);switch(c.key){case"Escape":c.preventDefault(),o();break;case"ArrowUp":{c.preventDefault();const g=R-1>=0?R-1:a.length-1,T=a[g];T&&de(T.id);break}case"ArrowDown":case"Tab":{c.preventDefault();const g=R===a.length-1?0:R+1,T=a[g];T&&de(T.id);break}}};return _.jsx("ul",{className:y,role:"listbox",id:d,tabIndex:-1,onKeyDown:C,children:a.map(c=>_.jsx(Hr,{value:c,onSelect:()=>v(c.id),isSelected:c.id===(b==null?void 0:b.id)},c.id))})},Zr=({id:a,values:u,onSelect:o,name:l,label:d,required:m=!1,placeholder:b="Not selected",disabled:y=!1,...v})=>{const[C,c]=N.useState(!1),[x,R]=N.useState(),g=`${a}_combobox`,T=`${a}_dropdown`,M=I([D.wrapper,v==null?void 0:v.className,{[D.disabled]:y}]),L=N.useRef(null),S=()=>c(!1),E=()=>c(!C),ee=re=>{const G=u.find(te=>te.id===re);R(G),o==null||o(G)};return zr({ref:L,onClickOutsideHandler:S}),_.jsxs("div",{className:M,ref:L,children:[_.jsx(Me,{label:d,required:m,inputId:g,className:D.label}),_.jsx(Xr,{name:l,isOpened:C,comboboxId:g,dropdownId:T,onClick:E,selected:x,placeholder:b,disabled:y,required:m}),_.jsx(Qr,{values:u,selected:x,isOpened:C,onClose:S,dropdownId:T,comboboxId:g,onSelect:ee})]})};exports.ChopLogicButton=Or;exports.ChopLogicSelect=Zr;exports.ChopLogicTextInput=Yr;
31
31
  //# sourceMappingURL=index.cjs.js.map