@e1011/es-kit 1.0.86 → 1.0.88
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.
- package/dist/lib/cjs/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/useStore.react.js +1 -1
- package/dist/lib/cjs/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/useStore.react.js +1 -1
- package/dist/lib/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -1
- package/dist/lib/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/lib/src/core/utils/appState/store/useStore.react.js +6 -1
- package/dist/lib/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/ui/components/field/Field.d.ts +1 -1
- package/dist/types/src/core/ui/components/field/Field.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/store/store.vanillajs.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/store/useStore.react.d.ts +5 -1
- package/dist/types/src/core/utils/appState/store/useStore.react.d.ts.map +1 -1
- package/dist/ui/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/useStore.react.js +1 -1
- package/dist/utils/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/utils/esm/src/core/utils/index.js +1 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
- package/dist/utils/src/core/utils/appState/store/useStore.react.js +1 -1
- package/dist/utils/src/core/utils/appState/store/useStore.react.js.map +1 -1
- package/dist/utils/src/core/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren } from 'react'\nimport styled from 'styled-components'\n\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\nexport const FieldWrapper: FC<FileWrapperProps> = styled.div<FileWrapperProps>`\n opacity: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 0.5 : 1)};\n pointer-events: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 'none' : 'auto')};\n flex: 1 1 auto;\n width: 100%;\n @media (min-width: 400px) {\n flex: 1;\n }\n .label {\n font-size: 0.8rem !important;\n font-weight: normal;\n }\n\n .help {\n text-align: left;\n }\n\n .mainControl {\n flex: 1;\n border-radius: 6px;\n box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);\n will-change: box-shadow;\n transition: box-shadow 250ms ease-in-out;\n &:hover {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n }\n button {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n .select {\n width: 100%;\n flex: 1;\n &::after {\n border-color: #000000 !important;\n }\n }\n\n .icon {\n &.is-action {\n cursor: pointer;\n pointer-events: initial !important;\n }\n }\n\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n .input[type=date]::-webkit-calendar-picker-indicator {\n opacity:0;\n -webkit-appearance: none;\n position: absolute;\n left: 0;\n top: 0;\n width: 40px;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n textarea {\n resize: none;\n }\n`\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n css?: string\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\n\nconst InputComponent = styled.input``\nconst TextAreaComponent = styled.textarea``\nconst StyledFieldLabel = styled.label`\n text-align: left;\n`\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n css,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <FieldWrapper\n className={`field ${className}`}\n error={error}\n disabled={disabled}\n userDisabled={userDisabled}\n css={css}\n >\n <StyledFieldLabel htmlFor={name} className='label'>{label}</StyledFieldLabel>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </FieldWrapper>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","FieldWrapper","styled","div","withConfig","displayName","componentId","_ref","disabled","userDisabled","_ref2","_StyledFieldWrapper","p","$_css","Select","_ref3","options","value","inputRef","props","_objectWithoutProperties","objectWithoutProperties","_excluded","className","_extends","ref","defaultValue","map","option","key","concat","JSON","stringify","_typeof","label","InputComponent","input","TextAreaComponent","textarea","StyledFieldLabel","Field","_ref4","name","_ref4$type","type","placeholder","error","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","css","_excluded2","Component","handleFocus","useCallback","event","_event$preventDefault","preventDefault","call","handleChange","target","valueProps","useMemo","undefined","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"mvBAQIA,EA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D,MAAAC,cAAA,OAAA,CACEuB,UAAS,oCAAAO,OAAsC4B,EAAiB,YAAc,IAC9EoB,QAASpB,GAET3D,MAAAC,cAACH,EAAa,CACZkF,SAAU3B,EACV4B,MAAOpF,KAIZsD,GAAYA,GAEdG,GAASA,GAEXL,GAAgBjD,MAAAC,cAAA,IAAA,CAAGuB,UAAU,QAAQyB,GACrCC,GAAYlD,MAAAC,cAAA,IAAA,CAAGuB,kBAASO,OAAUgB,EAAQ,YAAc,KAAOG,GAGtE,IAEAT,EAAMnC,YAAc,qFAtTQ,SAAC2E,GAC3BpF,EAAYoF,CACd,2BAIgC,SAACC,GAC/BpF,EAAgBoF,CAClB"}
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren } from 'react'\nimport styled from 'styled-components'\n\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren<unknown> & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\nexport const FieldWrapper: FC<FileWrapperProps> = styled.div<FileWrapperProps>`\n opacity: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 0.5 : 1)};\n pointer-events: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 'none' : 'auto')};\n flex: 1 1 auto;\n width: 100%;\n @media (min-width: 400px) {\n flex: 1;\n }\n .label {\n font-size: 0.8rem !important;\n font-weight: normal;\n }\n\n .help {\n text-align: left;\n }\n\n .mainControl {\n flex: 1;\n border-radius: 6px;\n box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);\n will-change: box-shadow;\n transition: box-shadow 250ms ease-in-out;\n &:hover {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n }\n button {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n .select {\n width: 100%;\n flex: 1;\n &::after {\n border-color: #000000 !important;\n }\n }\n\n .icon {\n &.is-action {\n cursor: pointer;\n pointer-events: initial !important;\n }\n }\n\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n .input[type=date]::-webkit-calendar-picker-indicator {\n opacity:0;\n -webkit-appearance: none;\n position: absolute;\n left: 0;\n top: 0;\n width: 40px;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n textarea {\n resize: none;\n }\n`\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n css?: string\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\n\nconst InputComponent = styled.input``\nconst TextAreaComponent = styled.textarea``\nconst StyledFieldLabel = styled.label`\n text-align: left;\n`\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n css,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <FieldWrapper\n className={`field ${className}`}\n error={error}\n disabled={disabled}\n userDisabled={userDisabled}\n css={css}\n >\n <StyledFieldLabel htmlFor={name} className='label'>{label}</StyledFieldLabel>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </FieldWrapper>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","FieldWrapper","styled","div","withConfig","displayName","componentId","_ref","disabled","userDisabled","_ref2","_StyledFieldWrapper","p","$_css","Select","_ref3","options","value","inputRef","props","_objectWithoutProperties","objectWithoutProperties","_excluded","className","_extends","ref","defaultValue","map","option","key","concat","JSON","stringify","_typeof","label","InputComponent","input","TextAreaComponent","textarea","StyledFieldLabel","Field","_ref4","name","_ref4$type","type","placeholder","error","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","css","_excluded2","Component","handleFocus","useCallback","event","_event$preventDefault","preventDefault","call","handleChange","target","valueProps","useMemo","undefined","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"mvBAQIA,EAAqC,WAAA,MAAM,SAAS,EAMpDC,EAAmCC,EAAAA,MAAK,WAA2B,OAAOC,MAAAC,cAAQ,OAAA,KAAC,IAc1EC,EAAqCC,EAAAA,QAAOC,IAAGC,WAAA,CAAAC,YAAA,sBAAAC,YAAA,eAAVJ,CAAU,CAAA,WAAA,mBAAA,61BAC/C,SAAAK,GAAA,IAAGC,EAAQD,EAARC,SAAUC,EAAYF,EAAZE,aAAY,OAAQD,GAAYC,EAAe,GAAM,CAAC,IAC5D,SAAAC,GAAA,IAAGF,EAAQE,EAARF,SAAUC,EAAYC,EAAZD,aAAY,OAAQD,GAAYC,EAAe,OAAS,MAAM,IAuE9FE,EAAAT,EAAA,QAAAD,GAAAG,WAAA,CAAAC,YAAA,6BAAAC,YAAA,eAAAJ,CAAA,CAAA,GAAA,KAAA,SAAAU,GAAA,OAAAA,EAAAC,KAAA,IA8CYC,EACXhB,EAAIA,MACJ,SAAeiB,GAAsD,IAAnDC,EAAOD,EAAPC,QAASC,EAAKF,EAALE,MAAOC,EAAQH,EAARG,SAAaC,EAAKC,EAAAC,wBAAAN,EAAAO,GAClD,OACEvB,MAAAC,cAAA,MAAA,CAAKuB,UAAU,UACbxB,MAAAC,cAAAwB,SAAAA,EAAAA,WAAYL,EAAK,CAAEM,IAAKP,EAAUQ,aAAcT,IAC7CD,aAAO,EAAPA,EAASW,KAAI,SAACC,GAAc,OAC3B7B,MAAAC,cAAA,SAAA,CACE6B,IAAG,GAAAC,OAAKC,KAAKC,UAAUJ,IACvBX,MAAyB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EACb5B,MAAOA,EACPD,QAASA,EAETsC,SAAUA,EACVE,OAAQA,EACRC,QAASM,EACTa,UAAWb,EACXc,aAAa,MACbrE,SAAUA,GACNW,KAqBTgC,IAAaJ,GACZhD,MAAAC,cAAA,OAAA,CACEuB,UAAS,kCAAAO,OAAoC6B,EAAgB,YAAc,IAC3EmB,QAASnB,GAET5D,MAAAC,cAACH,EAAa,CACZkF,SAAU5B,EACV6B,MAAOpF,KAIZwD,GACCrD,MAAAC,cAAA,OAAA,CACEuB,UAAS,oCAAAO,OAAsC4B,EAAiB,YAAc,IAC9EoB,QAASpB,GAET3D,MAAAC,cAACH,EAAa,CACZkF,SAAU3B,EACV4B,MAAOpF,KAIZsD,GAAYA,GAEdG,GAASA,GAEXL,GAAgBjD,MAAAC,cAAA,IAAA,CAAGuB,UAAU,QAAQyB,GACrCC,GAAYlD,MAAAC,cAAA,IAAA,CAAGuB,kBAASO,OAAUgB,EAAQ,YAAc,KAAOG,GAGtE,IAEAT,EAAMnC,YAAc,qFAtTQ,SAAC2E,GAC3BpF,EAAYoF,CACd,2BAIgC,SAACC,GAC/BpF,EAAgBoF,CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\nexport type Selector<T> = (state: Partial<T>) => Partial<T>;\n\nexport type Listener<T> = {\n selector?: Selector<T>\n} & ListenerCallBack<T>\n\nexport type Store<T> = {\n getState: () => Partial<T>\n setState: (state: Partial<T>) => void\n subscribe: (listener: Listener<T>) => () => void\n} & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\nexport type ActionHandler<T> = (state: Partial<T>) => Partial<T>\n\nexport type ActionHandlerCaller = () => void\n\n\nexport const createStore = <T>(initialState: Partial<T>, actions?: Record<string, ActionHandler<T>>): Store<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n\n // TODO parallelize await\n // eslint-disable-next-line no-await-in-loop\n await listener(selector ? selector(currentState) : currentState)\n }\n }\n\n const storeBaseicApi: Store<T> = {\n getState: () => currentState,\n setState,\n subscribe: (listener: Listener<T>) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n\n\n const resolvedActions: Record<string, ActionHandlerCaller> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: () => setState(actionHandler(currentState)),\n }),\n {},\n ) : null\n\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return storeCombinedWithActions\n}\n"],"names":["initialState","actions","_Object$entries","currentState","listeners","Set","setState","_ref","_asyncToGenerator","_regeneratorRuntime","regeneratorRuntime","mark","_callee","newState","_iterator","_step","_listener","selector","wrap","_context","prev","next","_createForOfIteratorHelper","s","n","done","listener","value","t0","e","f","finish","stop","_x","apply","this","arguments","storeBaseicApi","getState","subscribe","add","delete","resolvedActions","Object","entries","reduce","aggregator","_ref2","_ref3","_slicedToArray","actionName","actionHandler","_objectSpread","objectSpread2","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AOC,QAAQ3C,cAAQC,SAAvBA,EAAyB2C,QACnC,SACEC,EAA+CC,GAAA,IAAAC,EAAAC,EAAAA,cAAAF,EAAA,GAC9CG,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAAA,OAAAI,EAAAC,cAAAD,gBAAA,CAAA,EAEvBN,GAAUQ,CAAAA,EAAAA,EAAAC,eACZL,GAAAA,GAAa,WAAA,OAAM5C,EAAS6C,EAAchD,GAAc,IAAA,GAE3D,CAAA,GACE,KAON,OAL8BiD,EAAAA,cAAAA,EAAAA,cACzBf,CAAAA,EAAAA,GACCK,EAAkB,CAAEzC,QAAOmD,EAAAA,cAAA,CAAA,EAAOV,IAAsB,CAAE,EAIlE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t};return[t.useSyncExternalStore(e.subscribe,(function(){return r(e.getState())})),e.setState,e.actions]};exports.useState=function(t){return[e(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t}),t.setState,null==t?void 0:t.actions]},exports.useStore=e;
|
|
2
2
|
//# sourceMappingURL=useStore.react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport type { Store, Selector } from './store.vanillajs'\n\nexport const useStore = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n) => useSyncExternalStore(store.subscribe, () => selector(store.getState()))\n"],"names":["store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport type { Store, Selector } from './store.vanillajs'\n\nexport const useStore = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n) => [useSyncExternalStore(store.subscribe, () => selector(store.getState())), store.setState, store.actions]\n\nexport type useStateType<T> = [ReturnType<typeof useStore>, Store<T>['setState'], Store<T>['actions'] ]\n\nexport const useState = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n): useStateType<T> => ([\n useStore(store, selector),\n store.setState,\n store?.actions,\n ])\n"],"names":["useStore","store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState","setState","actions"],"mappings":"2FAIaA,EAAW,SACtBC,GAAe,IACfC,EAAqBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,SAACG,GAAK,OAAKA,CAAK,EAAA,MAIrC,CAACC,EAAoBA,qBAACN,EAAMO,WAAW,WAAA,OAAMN,EAASD,EAAMQ,WAAY,IAAER,EAAMS,SAAUT,EAAMU,QAAQ,mBAIrF,SACtBV,GACwC,MACnB,CACnBD,EAASC,EAFUE,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,SAACG,GAAK,OAAKA,CAAK,GAGtCL,EAAMS,SACNT,eAAAA,EAAOU,QACR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./core/hooks/useApi.js"),r=require("./core/hooks/useToggle.js"),t=require("./core/hooks/useTranslations.js"),o=require("./core/hooks/useOutsideClick.js"),s=require("./core/hooks/useResize.js"),i=require("./core/utils/helpers/birthnumber.validator.js"),a=require("./core/utils/helpers/birthnumberCZSKvalidator.js"),l=require("./core/utils/helpers/fileValidator.js"),n=require("./core/utils/helpers/date.js"),p=require("./core/utils/helpers/deviceInfo.js"),c=require("./core/utils/helpers/emailMatcher.js"),u=require("./core/utils/helpers/file.js"),x=require("./core/utils/helpers/objectOperations.js"),m=require("./core/utils/helpers/other.js"),d=require("./core/utils/helpers/textValueOperations.js"),C=require("./core/utils/helpers/valueOperations.js"),T=require("./core/utils/helpers/cancelableDelayedFunction.js"),v=require("./core/utils/keyExtractor.js"),j=require("./core/utils/date.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./core/hooks/useApi.js"),r=require("./core/hooks/useToggle.js"),t=require("./core/hooks/useTranslations.js"),o=require("./core/hooks/useOutsideClick.js"),s=require("./core/hooks/useResize.js"),i=require("./core/utils/helpers/birthnumber.validator.js"),a=require("./core/utils/helpers/birthnumberCZSKvalidator.js"),l=require("./core/utils/helpers/fileValidator.js"),n=require("./core/utils/helpers/date.js"),p=require("./core/utils/helpers/deviceInfo.js"),c=require("./core/utils/helpers/emailMatcher.js"),u=require("./core/utils/helpers/file.js"),x=require("./core/utils/helpers/objectOperations.js"),m=require("./core/utils/helpers/other.js"),d=require("./core/utils/helpers/textValueOperations.js"),C=require("./core/utils/helpers/valueOperations.js"),T=require("./core/utils/helpers/cancelableDelayedFunction.js"),v=require("./core/utils/keyExtractor.js"),j=require("./core/utils/date.js"),S=require("./core/utils/webComponents/webComponent.utils.js"),h=require("./core/utils/appState/store/store.vanillajs.js"),F=require("./core/utils/appState/store/useStore.react.js"),b=require("./core/ui/utils/style.js"),g=require("./core/ui/components/container/FBox.js"),q=require("./core/ui/components/container/Flex.js"),f=require("./core/ui/components/container/Placeholder.js"),I=require("./core/ui/components/container/CollapsibleContainerS.js"),D=require("./core/ui/components/container/CollapsibleContainer.js"),z=require("./core/ui/components/container/ResizableContainer.js"),O=require("./core/ui/components/field/Field.js"),V=require("./core/ui/components/dividers/DividerLine.js"),y=require("./core/ui/components/icon/IconBase.js"),R=require("./core/ui/components/icon/Icon.js"),k=require("./core/ui/components/icon/IconWC.js"),N=require("./core/constants/ui.constants.js");exports.useApi=e.useApi,exports.useToggle=r.useToggle,exports.createSafeT=t.createSafeT,exports.setUseTranslation=t.setUseTranslation,exports.useTranslations=t.useTranslations,exports.outsideClickHandler=o.outsideClickHandler,exports.useOutsideClick=o.useOutsideClick,exports.useResize=s.useResize,exports.isBirthNumberValid=i.isBirthNumberValid,exports.getMatch=a.getMatch,exports.isValidFormat=a.isValidFormat,exports.isValidModulo11=a.isValidModulo11,exports.parse=a.parse,exports.regex=a.regex,exports.parseCSVdata=l.parseCSVdata,exports.validateCSVFile=l.validateCSVFile,exports.validateCSVlines=l.validateCSVlines,exports.validateJSONFile=l.validateJSONFile,exports.validateLineCellTrimmed=l.validateLineCellTrimmed,exports.validateLineNumColumns=l.validateLineNumColumns,exports.validateSDFFile=l.validateSDFFile,exports.DATE_FORMAT=n.DATE_FORMAT,exports.formatDateToTimestamp=n.formatDateToTimestamp,exports.getDate=n.getDate,exports.getDeviceId=p.getDeviceId,exports.emailMatch=c.emailMatch,exports.emailMatcher=c.emailMatcher,exports.regexBuilder=c.regexBuilder,exports.cleanCsvLines=u.cleanCsvLines,exports.formatFilePath=u.formatFilePath,exports.arrayToObjectTree=x.arrayToObjectTree,exports.chunkArray=x.chunkArray,exports.duplicatesInArray=x.duplicatesInArray,exports.formatJsonString=x.formatJsonString,exports.formatObj=x.formatObj,exports.formatObj2=x.formatObj2,exports.debounce=m.debounce,exports.delay=m.delay,exports.memoize=m.memoize,exports.memoizeComplex=m.memoizeComplex,exports.memoizer=m.memoizer,exports.nestedTernary=m.nestedTernary,exports.escapeRegExp=d.escapeRegExp,exports.fileNameExt=d.fileNameExt,exports.findStringInText=d.findStringInText,exports.normalizeString=d.normalizeString,exports.removeWhitespaces=d.removeWhitespaces,exports.sanitizeId=d.sanitizeId,exports.sanitizePathId=d.sanitizePathId,exports.toLowerCase=d.toLowerCase,exports.toUpperCase=d.toUpperCase,exports.truncateText=d.truncateText,exports.Operation=C.Operation,exports.decrementValue=C.decrementValue,exports.incerementValue=C.incerementValue,exports.numberDefined=C.numberDefined,exports.numberOperation=C.numberOperation,exports.restrictNumberInLimits=C.restrictNumberInLimits,exports.setValue=C.setValue,exports.cancelableSetInterval=T.cancelableSetInterval,exports.cancelableSetTimeout=T.cancelableSetTimeout,exports.keyExtractor=v.keyExtractor,exports.keyExtractorFunction=v.keyExtractorFunction,exports.dateRangeFormat=j.dateRangeFormat,exports.getDateTime=j.getDateTime,exports.getTimeFromNow=j.getTimeFromNow,exports.getTimeFromNowOriginal=j.getTimeFromNowOriginal,exports.getTimeTo=j.getTimeTo,exports.ced=S.ced,exports.createResolveAttribute=S.createResolveAttribute,exports.customElementDefine=S.customElementDefine,exports.resolveAttributes=S.resolveAttributes,exports.createStore=h.createStore,exports.useState=F.useState,exports.useStore=F.useStore,exports.calculateColors=b.calculateColors,exports.calculatePercColor=b.calculatePercColor,exports.convertHex=b.convertHex,exports.convertRGB=b.convertRGB,Object.defineProperty(exports,"defaultFontSize",{enumerable:!0,get:function(){return b.defaultFontSize}}),exports.pxToRem=b.pxToRem,exports.resolveStyleValue=b.resolveStyleValue,exports.setDefaultFontSize=b.setDefaultFontSize,exports.toHex=b.toHex,exports.FBox=g.FBox,exports.Flex=q.Flex,exports.FlexTight=q.FlexTight,exports.FlexTightStyled=q.FlexTightStyled,exports.FlexWrapper=q.FlexWrapper,exports.Placeholder=f.Placeholder,exports.ContainerS=I.ContainerS,exports.CollapsibleContainer=D.CollapsibleContainer,exports.ResizableContainer=z.ResizableContainer,exports.Field=O.Field,exports.FieldWrapper=O.FieldWrapper,exports.Select=O.Select,exports.setIconColor=O.setIconColor,exports.setIconComponent=O.setIconComponent,exports.DividerHorizontal=V.DividerHorizontal,exports.DividerLine=V.DividerLine,exports.DividerVertical=V.DividerVertical,exports.IconBase=y.IconBase,exports.Icon=R.Icon,exports.IconWC=k.IconWC,exports.IconWCBase=k.IconWCBase,exports.EventName=N.EventName;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren } from 'react'\nimport styled from 'styled-components'\n\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\nexport const FieldWrapper: FC<FileWrapperProps> = styled.div<FileWrapperProps>`\n opacity: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 0.5 : 1)};\n pointer-events: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 'none' : 'auto')};\n flex: 1 1 auto;\n width: 100%;\n @media (min-width: 400px) {\n flex: 1;\n }\n .label {\n font-size: 0.8rem !important;\n font-weight: normal;\n }\n\n .help {\n text-align: left;\n }\n\n .mainControl {\n flex: 1;\n border-radius: 6px;\n box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);\n will-change: box-shadow;\n transition: box-shadow 250ms ease-in-out;\n &:hover {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n }\n button {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n .select {\n width: 100%;\n flex: 1;\n &::after {\n border-color: #000000 !important;\n }\n }\n\n .icon {\n &.is-action {\n cursor: pointer;\n pointer-events: initial !important;\n }\n }\n\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n .input[type=date]::-webkit-calendar-picker-indicator {\n opacity:0;\n -webkit-appearance: none;\n position: absolute;\n left: 0;\n top: 0;\n width: 40px;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n textarea {\n resize: none;\n }\n`\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n css?: string\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\n\nconst InputComponent = styled.input``\nconst TextAreaComponent = styled.textarea``\nconst StyledFieldLabel = styled.label`\n text-align: left;\n`\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n css,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <FieldWrapper\n className={`field ${className}`}\n error={error}\n disabled={disabled}\n userDisabled={userDisabled}\n css={css}\n >\n <StyledFieldLabel htmlFor={name} className='label'>{label}</StyledFieldLabel>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </FieldWrapper>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","setIconColor","color","IconComponent","memo","React","createElement","setIconComponent","component","FieldWrapper","styled","div","withConfig","displayName","componentId","_ref","disabled","userDisabled","_ref2","_StyledFieldWrapper","p","$_css","Select","_ref3","options","value","inputRef","props","_objectWithoutProperties","_excluded","className","_extends","ref","defaultValue","map","option","key","concat","JSON","stringify","_typeof","label","InputComponent","input","TextAreaComponent","textarea","StyledFieldLabel","Field","_ref4","name","_ref4$type","type","placeholder","error","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","css","_excluded2","Component","handleFocus","useCallback","event","_event$preventDefault","preventDefault","call","handleChange","target","valueProps","useMemo","undefined","htmlFor","id","onKeyDown","autoComplete","onClick","iconName"],"mappings":"krBAQIA,EAAqC,WAAA,MAAM,SAAS,EAE3CC,EAAe,SAACC,GAC3BF,EAAYE,CACd,EAEIC,EAAmCC,GAAK,WAA2B,OAAOC,MAAAC,cAA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AOF,KAIZyD,GAAYA,GAEdG,GAASA,GAEXL,GAAgBlD,MAAAC,cAAA,IAAA,CAAGwB,UAAU,QAAQyB,GACrCC,GAAYnD,MAAAC,cAAA,IAAA,CAAGwB,kBAASO,OAAUgB,EAAQ,YAAc,KAAOG,GAGtE,IAEAT,EAAMlC,YAAc"}
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../../src/core/ui/components/field/Field.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { FC, ReactNode, memo, useMemo, useCallback, PropsWithChildren } from 'react'\nimport styled from 'styled-components'\n\nimport type { FieldError, IconComponentType } from './types'\n\nlet iconColor: string | (() => string) = () => '#000000'\n\nexport const setIconColor = (color: string | (() => string)): void => {\n iconColor = color\n}\n\nlet IconComponent: IconComponentType = memo(function IconComponent() { return <span /> })\n\nexport const setIconComponent = (component: IconComponentType): void => {\n IconComponent = component\n}\n\nexport type FileWrapperProps = PropsWithChildren<unknown> & {\n className?: string\n error?: boolean\n disabled?: boolean\n userDisabled?: boolean\n css?: string\n}\n\nexport const FieldWrapper: FC<FileWrapperProps> = styled.div<FileWrapperProps>`\n opacity: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 0.5 : 1)};\n pointer-events: ${({ disabled, userDisabled }) => (disabled || userDisabled ? 'none' : 'auto')};\n flex: 1 1 auto;\n width: 100%;\n @media (min-width: 400px) {\n flex: 1;\n }\n .label {\n font-size: 0.8rem !important;\n font-weight: normal;\n }\n\n .help {\n text-align: left;\n }\n\n .mainControl {\n flex: 1;\n border-radius: 6px;\n box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.06);\n will-change: box-shadow;\n transition: box-shadow 250ms ease-in-out;\n &:hover {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n }\n button {\n box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);\n }\n .select {\n width: 100%;\n flex: 1;\n &::after {\n border-color: #000000 !important;\n }\n }\n\n .icon {\n &.is-action {\n cursor: pointer;\n pointer-events: initial !important;\n }\n }\n\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n .input[type=date]::-webkit-calendar-picker-indicator {\n opacity:0;\n -webkit-appearance: none;\n position: absolute;\n left: 0;\n top: 0;\n width: 40px;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n textarea {\n resize: none;\n }\n`\n\ntype EventType = { target: any; type?: any } & Partial<Event>\nexport interface FieldProps {\n label?: string\n name?: string\n type?: string\n min?: number | string | Date | any\n max?: number | string | Date | any\n value?: string | number | readonly string[] | undefined\n defaultValue?: string | number | readonly string[] | undefined\n placeholder?: string\n inputRef?: ReactHookFormRef\n error?: boolean\n errors?: FieldError\n disabled?: boolean\n userDisabled?: boolean\n helpTextInfo?: string\n helpText?: string\n iconLeft?: string\n iconRight?: string\n withoutComponent?: boolean\n addon?: ReactNode\n children?: ReactNode\n className?: string\n onChange?: (event?: EventType) => unknown\n // TODO, rename... something like changeHandler or valueDecorator\n onChangeInner?: (value: string | number) => string | number\n onBlur?: (event?: EventType) => void\n onFocus?: (event?: EventType | undefined) => void\n rightIconClick?: (event?: EventType) => void\n leftIconClick?: (event?: EventType) => void\n options?: any[] | null\n creatable?: boolean\n async?: boolean\n css?: string\n [key: string]: any\n}\n\ninterface SelectProps extends FieldProps {\n id?: string\n}\n\ntype OptionObj = { label: string | number | undefined; value: string | number | undefined }\ntype Option = OptionObj | string | number\n\nexport const Select: FC<SelectProps>\n= memo<SelectProps>(\n function Select({ options, value, inputRef, ...props }: SelectProps) {\n return (\n <div className='select'>\n <select {...props} ref={inputRef} defaultValue={value}>\n {options?.map((option: Option) => (\n <option\n key={`${JSON.stringify(option)}`}\n value={typeof option === 'object' ? (option as OptionObj)?.value : option}\n >\n {typeof option === 'object' ? (option as OptionObj)?.label : option}\n </option>\n ))}\n </select>\n </div>\n )\n },\n)\n\nconst InputComponent = styled.input``\nconst TextAreaComponent = styled.textarea``\nconst StyledFieldLabel = styled.label`\n text-align: left;\n`\n\nexport const Field: FC<FieldProps> = memo<FieldProps>(({\n label,\n name,\n type = 'text',\n value,\n defaultValue,\n placeholder,\n inputRef,\n error,\n disabled,\n userDisabled,\n withoutComponent,\n helpTextInfo,\n helpText,\n children,\n iconLeft,\n iconRight,\n addon,\n className,\n onChange,\n onChangeInner,\n onBlur,\n onFocus,\n rightIconClick,\n leftIconClick,\n options,\n css,\n ...props\n}: FieldProps) => {\n let Component: FC<any> = InputComponent\n\n if (!children && type === 'textarea') {\n Component = TextAreaComponent\n }\n const handleFocus = useCallback((event: Event | EventType | undefined) => {\n if (userDisabled) {\n event?.preventDefault?.()\n } else {\n onFocus && onFocus(event)\n }\n }, [userDisabled, onFocus])\n\n const handleChange = useCallback((event: { target: { value: string } }) => {\n if (userDisabled) {\n return\n }\n if (onChangeInner && event?.target) {\n // eslint-disable-next-line no-param-reassign\n event.target.value = onChangeInner((event.target.value as string)) as string\n onChange && onChange(event as EventType)\n } else {\n onChange && onChange(event as EventType)\n }\n }, [onChangeInner, onChange, userDisabled])\n\n const valueProps = useMemo(() => {\n if (value === undefined) {\n return { defaultValue }\n }\n return { value }\n }, [value, defaultValue])\n\n return (\n <FieldWrapper\n className={`field ${className}`}\n error={error}\n disabled={disabled}\n userDisabled={userDisabled}\n css={css}\n >\n <StyledFieldLabel htmlFor={name} className='label'>{label}</StyledFieldLabel>\n <div className={`field ${addon ? 'has-addons' : ''}`}>\n <div\n className={`control mainControl ${iconLeft && !withoutComponent\n ? 'has-icons-left' : ''} ${iconRight ? 'has-icons-right' : ''}`}\n >\n {!withoutComponent && ((!children && (type === 'select' || options))\n ? (\n <Select\n name={name}\n id={name}\n inputRef={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type='select'\n placeholder={placeholder}\n value={value}\n options={options}\n // TODO also handle change but value versus event.target.value issue\n onChange={onChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />\n )\n : (\n !children && <Component\n name={name}\n id={name}\n ref={inputRef}\n className={`input ${error ? 'is-danger' : ''}`}\n type={type}\n placeholder={placeholder}\n {...valueProps}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={handleFocus}\n onKeyDown={handleFocus}\n autoComplete='off'\n disabled={disabled}\n {...props}\n />))}\n\n {iconLeft && !withoutComponent && (\n <span\n className={`iconLeft icon is-small is-left ${leftIconClick ? 'is-action' : ''}`}\n onClick={leftIconClick}\n >\n <IconComponent\n iconName={iconLeft}\n color={iconColor}\n />\n </span>\n )}\n {iconRight && (\n <span\n className={`iconRight icon is-small is-right ${rightIconClick ? 'is-action' : ''}`}\n onClick={rightIconClick}\n >\n <IconComponent\n iconName={iconRight}\n color={iconColor}\n />\n </span>\n )}\n {children && children}\n </div>\n {addon && addon}\n </div>\n {helpTextInfo && <p className='help'>{helpTextInfo}</p>}\n {helpText && <p className={`help ${error ? 'is-danger' : ''}`}>{helpText}</p>}\n </FieldWrapper>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","setIconColor","color","IconComponent","memo","React","createElement","setIconComponent","component","FieldWrapper","styled","div","withConfig","displayName","componentId","_ref","disabled","userDisabled","_ref2","_StyledFieldWrapper","p","$_css","Select","_ref3","options","value","inputRef","props","_objectWithoutProperties","_excluded","className","_extends","ref","defaultValue","map","option","key","concat","JSON","stringify","_typeof","label","InputComponent","input","TextAreaComponent","textarea","StyledFieldLabel","Field","_ref4","name","_ref4$type","type","placeholder","error","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","css","_excluded2","Component","handleFocus","useCallback","event","_event$preventDefault","preventDefault","call","handleChange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EAAa,CACZmF,SAAU5B,EACVxD,MAAOF,KAIZ2D,GACCtD,MAAAC,cAAA,OAAA,CACEwB,UAAS,oCAAAO,OAAsC4B,EAAiB,YAAc,IAC9EoB,QAASpB,GAET5D,MAAAC,cAACH,EAAa,CACZmF,SAAU3B,EACVzD,MAAOF,KAIZyD,GAAYA,GAEdG,GAASA,GAEXL,GAAgBlD,MAAAC,cAAA,IAAA,CAAGwB,UAAU,QAAQyB,GACrCC,GAAYnD,MAAAC,cAAA,IAAA,CAAGwB,kBAASO,OAAUgB,EAAQ,YAAc,KAAOG,GAGtE,IAEAT,EAAMlC,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\nexport type Selector<T> = (state: Partial<T>) => Partial<T>;\n\nexport type Listener<T> = {\n selector?: Selector<T>\n} & ListenerCallBack<T>\n\nexport type Store<T> = {\n getState: () => Partial<T>\n setState: (state: Partial<T>) => void\n subscribe: (listener: Listener<T>) => () => void\n} & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\nexport type ActionHandler<T> = (state: Partial<T>) => Partial<T>\n\nexport type ActionHandlerCaller = () => void\n\n\nexport const createStore = <T>(initialState: Partial<T>, actions?: Record<string, ActionHandler<T>>): Store<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n\n // TODO parallelize await\n // eslint-disable-next-line no-await-in-loop\n await listener(selector ? selector(currentState) : currentState)\n }\n }\n\n const storeBaseicApi: Store<T> = {\n getState: () => currentState,\n setState,\n subscribe: (listener: Listener<T>) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n\n\n const resolvedActions: Record<string, ActionHandlerCaller> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: () => setState(actionHandler(currentState)),\n }),\n {},\n ) : null\n\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return storeCombinedWithActions\n}\n"],"names":["createStore","initialState","actions","_Object$entries","currentState","listeners","Set","setState","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","newState","_iterator","_step","_listener","selector","wrap","_context","prev","next","_createForOfIteratorHelper","s","n","done","listener","value","t0","e","f","finish","stop","_x","apply","this","arguments","storeBaseicApi","getState","subscribe","add","delete","resolvedActions","Object","entries","reduce","aggregator","_ref2","_ref3","_slicedToArray","actionName","actionHandler","_objectSpread","_defineProperty"],"mappings":"qtBAqBO,IAAMA,EAAc,SAAIC,EAA0BC,GAAyD,IAAAC,EAC5GC,EAA2BH,EACzBI,EAAY,IAAIC,IAEhBC,EAAQ,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,EAAOC,GAAoB,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAP,IAAAQ,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAC1CjB,EAAeS,EAEfC,EAAAQ,EACuBjB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OV,IAAsB,CAAE,EAIlE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useSyncExternalStore as
|
|
1
|
+
import{useSyncExternalStore as t}from"react";var n=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t};return[t(n.subscribe,(function(){return r(n.getState())})),n.setState,n.actions]},r=function(t){return[n(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t}),t.setState,null==t?void 0:t.actions]};export{r as useState,n as useStore};
|
|
2
2
|
//# sourceMappingURL=useStore.react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport type { Store, Selector } from './store.vanillajs'\n\nexport const useStore = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n) => useSyncExternalStore(store.subscribe, () => selector(store.getState()))\n"],"names":["useStore","store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState"],"mappings":"iDAIaA,EAAW,SACtBC,GAAe,IACfC,EAAqBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,SAACG,GAAK,OAAKA,CAAK,EAAA,
|
|
1
|
+
{"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport type { Store, Selector } from './store.vanillajs'\n\nexport const useStore = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n) => [useSyncExternalStore(store.subscribe, () => selector(store.getState())), store.setState, store.actions]\n\nexport type useStateType<T> = [ReturnType<typeof useStore>, Store<T>['setState'], Store<T>['actions'] ]\n\nexport const useState = <T>(\n store: Store<T>,\n selector: Selector<T> = (state) => state,\n): useStateType<T> => ([\n useStore(store, selector),\n store.setState,\n store?.actions,\n ])\n"],"names":["useStore","store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState","setState","actions","useState"],"mappings":"iDAIaA,EAAW,SACtBC,GAAe,IACfC,EAAqBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,SAACG,GAAK,OAAKA,CAAK,EAAA,MAIrC,CAACC,EAAqBN,EAAMO,WAAW,WAAA,OAAMN,EAASD,EAAMQ,WAAY,IAAER,EAAMS,SAAUT,EAAMU,QAAQ,EAIhGC,EAAW,SACtBX,GACwC,MACnB,CACnBD,EAASC,EAFUE,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,SAACG,GAAK,OAAKA,CAAK,GAGtCL,EAAMS,SACNT,eAAAA,EAAOU,QACR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{createSafeT,setUseTranslation,useTranslations}from"./core/hooks/useTranslations.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{isBirthNumberValid}from"./core/utils/helpers/birthnumber.validator.js";export{getMatch,isValidFormat,isValidModulo11,parse,regex}from"./core/utils/helpers/birthnumberCZSKvalidator.js";export{parseCSVdata,validateCSVFile,validateCSVlines,validateJSONFile,validateLineCellTrimmed,validateLineNumColumns,validateSDFFile}from"./core/utils/helpers/fileValidator.js";export{DATE_FORMAT,formatDateToTimestamp,getDate}from"./core/utils/helpers/date.js";export{getDeviceId}from"./core/utils/helpers/deviceInfo.js";export{emailMatch,emailMatcher,regexBuilder}from"./core/utils/helpers/emailMatcher.js";export{cleanCsvLines,formatFilePath}from"./core/utils/helpers/file.js";export{arrayToObjectTree,chunkArray,duplicatesInArray,formatJsonString,formatObj,formatObj2}from"./core/utils/helpers/objectOperations.js";export{debounce,delay,memoize,memoizeComplex,memoizer,nestedTernary}from"./core/utils/helpers/other.js";export{escapeRegExp,fileNameExt,findStringInText,normalizeString,removeWhitespaces,sanitizeId,sanitizePathId,toLowerCase,toUpperCase,truncateText}from"./core/utils/helpers/textValueOperations.js";export{Operation,decrementValue,incerementValue,numberDefined,numberOperation,restrictNumberInLimits,setValue}from"./core/utils/helpers/valueOperations.js";export{cancelableSetInterval,cancelableSetTimeout}from"./core/utils/helpers/cancelableDelayedFunction.js";export{keyExtractor,keyExtractorFunction}from"./core/utils/keyExtractor.js";export{dateRangeFormat,getDateTime,getTimeFromNow,getTimeFromNowOriginal,getTimeTo}from"./core/utils/date.js";export{ced,createResolveAttribute,customElementDefine,resolveAttributes}from"./core/utils/webComponents/webComponent.utils.js";export{createStore}from"./core/utils/appState/store/store.vanillajs.js";export{useStore}from"./core/utils/appState/store/useStore.react.js";export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./core/ui/utils/style.js";export{FBox}from"./core/ui/components/container/FBox.js";export{Flex,FlexTight,FlexTightStyled,FlexWrapper}from"./core/ui/components/container/Flex.js";export{Placeholder}from"./core/ui/components/container/Placeholder.js";export{ContainerS}from"./core/ui/components/container/CollapsibleContainerS.js";export{CollapsibleContainer}from"./core/ui/components/container/CollapsibleContainer.js";export{ResizableContainer}from"./core/ui/components/container/ResizableContainer.js";export{Field,FieldWrapper,Select,setIconColor,setIconComponent}from"./core/ui/components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./core/ui/components/dividers/DividerLine.js";export{IconBase}from"./core/ui/components/icon/IconBase.js";export{Icon}from"./core/ui/components/icon/Icon.js";export{IconWC,IconWCBase}from"./core/ui/components/icon/IconWC.js";export{EventName}from"./core/constants/ui.constants.js";
|
|
1
|
+
export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{createSafeT,setUseTranslation,useTranslations}from"./core/hooks/useTranslations.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{isBirthNumberValid}from"./core/utils/helpers/birthnumber.validator.js";export{getMatch,isValidFormat,isValidModulo11,parse,regex}from"./core/utils/helpers/birthnumberCZSKvalidator.js";export{parseCSVdata,validateCSVFile,validateCSVlines,validateJSONFile,validateLineCellTrimmed,validateLineNumColumns,validateSDFFile}from"./core/utils/helpers/fileValidator.js";export{DATE_FORMAT,formatDateToTimestamp,getDate}from"./core/utils/helpers/date.js";export{getDeviceId}from"./core/utils/helpers/deviceInfo.js";export{emailMatch,emailMatcher,regexBuilder}from"./core/utils/helpers/emailMatcher.js";export{cleanCsvLines,formatFilePath}from"./core/utils/helpers/file.js";export{arrayToObjectTree,chunkArray,duplicatesInArray,formatJsonString,formatObj,formatObj2}from"./core/utils/helpers/objectOperations.js";export{debounce,delay,memoize,memoizeComplex,memoizer,nestedTernary}from"./core/utils/helpers/other.js";export{escapeRegExp,fileNameExt,findStringInText,normalizeString,removeWhitespaces,sanitizeId,sanitizePathId,toLowerCase,toUpperCase,truncateText}from"./core/utils/helpers/textValueOperations.js";export{Operation,decrementValue,incerementValue,numberDefined,numberOperation,restrictNumberInLimits,setValue}from"./core/utils/helpers/valueOperations.js";export{cancelableSetInterval,cancelableSetTimeout}from"./core/utils/helpers/cancelableDelayedFunction.js";export{keyExtractor,keyExtractorFunction}from"./core/utils/keyExtractor.js";export{dateRangeFormat,getDateTime,getTimeFromNow,getTimeFromNowOriginal,getTimeTo}from"./core/utils/date.js";export{ced,createResolveAttribute,customElementDefine,resolveAttributes}from"./core/utils/webComponents/webComponent.utils.js";export{createStore}from"./core/utils/appState/store/store.vanillajs.js";export{useState,useStore}from"./core/utils/appState/store/useStore.react.js";export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./core/ui/utils/style.js";export{FBox}from"./core/ui/components/container/FBox.js";export{Flex,FlexTight,FlexTightStyled,FlexWrapper}from"./core/ui/components/container/Flex.js";export{Placeholder}from"./core/ui/components/container/Placeholder.js";export{ContainerS}from"./core/ui/components/container/CollapsibleContainerS.js";export{CollapsibleContainer}from"./core/ui/components/container/CollapsibleContainer.js";export{ResizableContainer}from"./core/ui/components/container/ResizableContainer.js";export{Field,FieldWrapper,Select,setIconColor,setIconComponent}from"./core/ui/components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./core/ui/components/dividers/DividerLine.js";export{IconBase}from"./core/ui/components/icon/IconBase.js";export{Icon}from"./core/ui/components/icon/Icon.js";export{IconWC,IconWCBase}from"./core/ui/components/icon/IconWC.js";export{EventName}from"./core/constants/ui.constants.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.vanillajs.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,YAAwB,EAAE,OAA0C,EAAY,EAAE;IAC/G,IAAI,YAAY,GAAe,YAAY,CAAA;IAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAA;IAExC,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAoB,EAAE,EAAE;QAC9C,YAAY,GAAG,QAAQ,CAAA;QAEvB,gDAAgD;QAChD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAChC,yBAAyB;YACzB,MAAM,QAAQ,GAA4B,QAAQ,EAAE,QAAQ,CAAA;YAE5D,oFAAoF;YACpF,+DAA+D;YAC/D,gEAAgE;YAChE,6BAA6B;YAE7B,yBAAyB;YACzB,4CAA4C;YAC5C,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;SACjE;IACH,CAAC,CAAA;IAED,MAAM,cAAc,GAAa;QAC/B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY;QAC5B,QAAQ;QACR,SAAS,EAAE,CAAC,QAAqB,EAAE,EAAE;YACnC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACzC,CAAC;KACF,CAAA;IAGD,MAAM,eAAe,GACjB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,CACzC,CACE,UAA+C,EAC/C,CAAC,UAAU,EAAE,aAAa,CAA6B,EACvD,EAAE,CAAC,CAAC;QACJ,GAAG,UAAU;QACb,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;KAC1D,CAAC,EACF,EAAE,CACH,CAAC,CAAC,CAAC,IAAI,CAAA;IAEV,MAAM,wBAAwB,GAAG;QAC/B,GAAG,cAAc;QACjB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAA;IAED,OAAO,wBAAwB,CAAA;AACjC,CAAC,CAAA"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { useSyncExternalStore } from 'react';
|
|
2
|
-
export const useStore = (store, selector = (state) => state) => useSyncExternalStore(store.subscribe, () => selector(store.getState()));
|
|
2
|
+
export const useStore = (store, selector = (state) => state) => [useSyncExternalStore(store.subscribe, () => selector(store.getState())), store.setState, store.actions];
|
|
3
|
+
export const useState = (store, selector = (state) => state) => ([
|
|
4
|
+
useStore(store, selector),
|
|
5
|
+
store.setState,
|
|
6
|
+
store?.actions,
|
|
7
|
+
]);
|
|
3
8
|
//# sourceMappingURL=useStore.react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStore.react.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAI5C,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,KAAe,EACf,WAAwB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAIxC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"useStore.react.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAI5C,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,KAAe,EACf,WAAwB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAIxC,EAAE,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;AAI7G,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,KAAe,EACf,WAAwB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EACvB,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,KAAK,CAAC,QAAQ;IACd,KAAK,EAAE,OAAO;CACf,CAAC,CAAA"}
|