@e1011/es-kit 1.1.50 → 1.1.54
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/hooks/esm/index.css +306 -199
- package/dist/hooks/index.css +306 -199
- package/dist/lib/cjs/index.css +107 -0
- package/dist/lib/cjs/src/core/ui/components/atoms/tag/tag.types.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/atoms/toggle/Toggle.js +2 -0
- package/dist/lib/cjs/src/core/ui/components/atoms/toggle/Toggle.js.map +1 -0
- package/dist/lib/cjs/src/core/ui/components/atoms/toggle/toggle.module.scss.js +2 -0
- package/dist/lib/cjs/src/core/ui/components/atoms/toggle/toggle.module.scss.js.map +1 -0
- package/dist/lib/cjs/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/index.css +107 -0
- package/dist/lib/esm/src/core/ui/components/atoms/tag/tag.types.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/atoms/toggle/Toggle.js +2 -0
- package/dist/lib/esm/src/core/ui/components/atoms/toggle/Toggle.js.map +1 -0
- package/dist/lib/esm/src/core/ui/components/atoms/toggle/toggle.module.scss.js +2 -0
- package/dist/lib/esm/src/core/ui/components/atoms/toggle/toggle.module.scss.js.map +1 -0
- package/dist/lib/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/index.d.ts +0 -1
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/index.d.ts +1 -0
- package/dist/types/src/core/ui/components/atoms/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/tag/tag.types.d.ts +1 -1
- package/dist/types/src/core/ui/components/atoms/tag/tag.types.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/text/text.types.d.ts +1 -1
- package/dist/types/src/core/ui/components/atoms/text/text.types.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/toggle/Toggle.d.ts +12 -0
- package/dist/types/src/core/ui/components/atoms/toggle/Toggle.d.ts.map +1 -0
- package/dist/types/src/core/ui/components/atoms/toggle/index.d.ts +2 -0
- package/dist/types/src/core/ui/components/atoms/toggle/index.d.ts.map +1 -0
- package/dist/types/src/core/ui/components/atoms/toggle/toggle.stories.d.ts +13 -0
- package/dist/types/src/core/ui/components/atoms/toggle/toggle.stories.d.ts.map +1 -0
- package/dist/types/src/core/ui/components/atoms/toggle/toggle.test.d.ts +5 -0
- package/dist/types/src/core/ui/components/atoms/toggle/toggle.test.d.ts.map +1 -0
- package/dist/types/src/core/ui/components/field/Field.d.ts +1 -0
- package/dist/types/src/core/ui/components/field/Field.d.ts.map +1 -1
- package/dist/types/src/core/ui/index.d.ts +1 -0
- package/dist/types/src/core/ui/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/types/CommonProps.d.ts +4 -0
- package/dist/types/src/core/ui/types/CommonProps.d.ts.map +1 -1
- package/dist/types/src/core/ui/types/index.d.ts +2 -0
- package/dist/types/src/core/ui/types/index.d.ts.map +1 -0
- package/dist/ui/esm/index.css +107 -0
- package/dist/ui/esm/src/core/ui/components/atoms/tag/tag.types.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/atoms/toggle/Toggle.js +2 -0
- package/dist/ui/esm/src/core/ui/components/atoms/toggle/Toggle.js.map +1 -0
- package/dist/ui/esm/src/core/ui/components/atoms/toggle/toggle.module.scss.js +2 -0
- package/dist/ui/esm/src/core/ui/components/atoms/toggle/toggle.module.scss.js.map +1 -0
- package/dist/ui/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/esm/src/core/ui/index.js +1 -1
- package/dist/ui/index.css +107 -0
- package/dist/ui/src/core/ui/components/atoms/tag/tag.types.js.map +1 -1
- package/dist/ui/src/core/ui/components/atoms/toggle/Toggle.js +2 -0
- package/dist/ui/src/core/ui/components/atoms/toggle/Toggle.js.map +1 -0
- package/dist/ui/src/core/ui/components/atoms/toggle/toggle.module.scss.js +2 -0
- package/dist/ui/src/core/ui/components/atoms/toggle/toggle.module.scss.js.map +1 -0
- package/dist/ui/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/src/core/ui/index.js +1 -1
- package/dist/utils/esm/index.css +306 -199
- package/dist/utils/index.css +306 -199
- package/package.json +1 -1
- package/dist/types/src/core/types/CommonProps.d.ts +0 -11
- package/dist/types/src/core/types/CommonProps.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,MAAM,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/ui/components/atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,kBAAkB,CAAA;AAChC,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/ui/components/atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,kBAAkB,CAAA;AAChC,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren, FC, MouseEvent } from 'react';
|
|
2
2
|
import { TextAndIconsProps } from '../textAndContent/textAndContent.types';
|
|
3
3
|
import { LayoutBoxProps } from '../../container/layoutBox/layoutBox.types';
|
|
4
|
-
import { CommonProps } from '
|
|
4
|
+
import { CommonProps } from '../../../types/CommonProps';
|
|
5
5
|
import { TextProps } from '../text/text.types';
|
|
6
6
|
export declare enum TagVariant {
|
|
7
7
|
info = "info",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"tag.types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,OAAO,aAAa;IACpB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,QAAQ,GAAG,iBAAiB,GAAG,WAAW,GAAG,iBAAiB,GAAG,cAAc,GAAG;IAC5F,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE;QACX,aAAa,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;KAC9B,CAAA;IACD,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren, CSSProperties, FC, MouseEventHandler } from 'react';
|
|
2
|
-
import { CommonProps } from '
|
|
2
|
+
import { CommonProps } from '../../../types/CommonProps';
|
|
3
3
|
export interface ITextProps extends PropsWithChildren, CSSProperties, CommonProps {
|
|
4
4
|
element?: string | FC;
|
|
5
5
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/text/text.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/text/text.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,MAAM,WAAW,UAAW,SAAQ,iBAAiB,EAAE,aAAa,EAAE,WAAW;IAC/E,OAAO,CAAC,EAAE,MAAM,GAAG,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,aAAa,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, ChangeEvent } from 'react';
|
|
2
|
+
import { CommonProps } from '../../../types';
|
|
3
|
+
import { FieldProps } from '../../field';
|
|
4
|
+
export type ToggleProps = CommonProps & PropsWithChildren & {
|
|
5
|
+
onChange?: (event: ChangeEvent) => void;
|
|
6
|
+
checked?: FieldProps['checked'];
|
|
7
|
+
disabled?: FieldProps['disabled'];
|
|
8
|
+
invalid?: FieldProps['invalid'];
|
|
9
|
+
};
|
|
10
|
+
export declare const Toggle: FC<ToggleProps>;
|
|
11
|
+
export type ToggleType = typeof Toggle;
|
|
12
|
+
//# sourceMappingURL=Toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/toggle/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEiC,EAAE,EAAE,iBAAiB,EAC3D,WAAW,EACZ,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,iBAAiB,GAAG;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACvC,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC/B,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC,CAAA;AAqDD,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAAsC,CAAA;AAEzE,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/toggle/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ToggleProps } from './Toggle';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'shadow-dom-container': any;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const ToggleBase: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ToggleProps>;
|
|
13
|
+
//# sourceMappingURL=toggle.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.stories.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/toggle/toggle.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAWzD,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAA;wBAMzC,IAAI;AAHT,wBAGS;AAuBT,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,sBAAsB,EAAE,GAAG,CAAA;SAC5B;KACF;CACF;AAuID,eAAO,MAAM,UAAU,kGAA0B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/atoms/toggle/toggle.test.tsx"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/ui/components/field/Field.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,SAAS,EAA8B,iBAAiB,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAA;AAKlH,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAI5D,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,KAAG,IAE7D,CAAA;AAID,eAAO,MAAM,gBAAgB,cAAe,iBAAiB,KAAG,IAE/D,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,SAAS,GAAG;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7D,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAA;IAClC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACvD,YAAY,CAAC,EAA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S,KAAK,IAAI,CAAA;IAC3C,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,UAAU,WAAY,SAAQ,UAAU;IACtC,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAKD,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAkBlC,CAAA;AASD,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAsJ/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { Ref, RefObject } from 'react';
|
|
1
2
|
export type CommonProps = {
|
|
2
3
|
id?: string;
|
|
3
4
|
'data-testid'?: string;
|
|
4
5
|
dataTestId?: string;
|
|
5
6
|
className?: string;
|
|
6
7
|
};
|
|
8
|
+
export type ForwardedRefContainer = {
|
|
9
|
+
forwardedRef?: RefObject<HTMLDivElement> | Ref<HTMLDivElement> | null;
|
|
10
|
+
};
|
|
7
11
|
//# sourceMappingURL=CommonProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonProps.d.ts","sourceRoot":"","sources":["../../../../../../src/core/ui/types/CommonProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
1
|
+
{"version":3,"file":"CommonProps.d.ts","sourceRoot":"","sources":["../../../../../../src/core/ui/types/CommonProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAGD,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC,GAAG,IAAI,CAAA;CACtE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/ui/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
package/dist/ui/esm/index.css
CHANGED
|
@@ -858,4 +858,111 @@
|
|
|
858
858
|
background-color: #FD8F3E;
|
|
859
859
|
border-color: #FD8F3E;
|
|
860
860
|
color: #632E03;
|
|
861
|
+
}
|
|
862
|
+
:root {
|
|
863
|
+
--divider-line: #4a4b4b;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.toggle-module_overflow-hidden__NxfFx, .toggle-module_text-truncate__Wg-Jx {
|
|
867
|
+
overflow: hidden !important;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.toggle-module_text-nowrap__F9ld6, .toggle-module_text-truncate__Wg-Jx {
|
|
871
|
+
white-space: nowrap !important;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.toggle-module_text-ellipsis__ftYlg, .toggle-module_text-truncate__Wg-Jx {
|
|
875
|
+
text-overflow: ellipsis !important;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.toggle-module_toggle__p1Ep4 {
|
|
879
|
+
display: inline-block;
|
|
880
|
+
position: relative;
|
|
881
|
+
max-width: 48px;
|
|
882
|
+
max-height: 24px;
|
|
883
|
+
width: 48px;
|
|
884
|
+
height: 24px;
|
|
885
|
+
border-radius: 16px !important;
|
|
886
|
+
}
|
|
887
|
+
.toggle-module_toggle__p1Ep4 input {
|
|
888
|
+
opacity: 0;
|
|
889
|
+
width: 0;
|
|
890
|
+
height: 0;
|
|
891
|
+
}
|
|
892
|
+
.toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG {
|
|
893
|
+
box-sizing: border-box;
|
|
894
|
+
position: absolute;
|
|
895
|
+
cursor: pointer;
|
|
896
|
+
width: 48px;
|
|
897
|
+
height: 24px;
|
|
898
|
+
top: 0;
|
|
899
|
+
left: 0;
|
|
900
|
+
right: 0;
|
|
901
|
+
bottom: 0;
|
|
902
|
+
background-color: transparent;
|
|
903
|
+
border: 1px solid #F4F4F4;
|
|
904
|
+
transition: transform, background-color 0.4s ease;
|
|
905
|
+
border-radius: 16px;
|
|
906
|
+
}
|
|
907
|
+
.toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG:before {
|
|
908
|
+
position: absolute;
|
|
909
|
+
content: "";
|
|
910
|
+
height: 20px;
|
|
911
|
+
width: 20px;
|
|
912
|
+
left: 1px;
|
|
913
|
+
bottom: 1px;
|
|
914
|
+
background-color: #F4F4F4;
|
|
915
|
+
transition: transform 0.4s ease;
|
|
916
|
+
border-radius: 50%;
|
|
917
|
+
}
|
|
918
|
+
.toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG {
|
|
919
|
+
background-color: #02B3E6;
|
|
920
|
+
border-color: #02B3E6;
|
|
921
|
+
}
|
|
922
|
+
.toggle-module_toggle__p1Ep4 input:focus + .toggle-module_slider__2IVaG {
|
|
923
|
+
box-shadow: 0 0 1px 1px #02B3E6;
|
|
924
|
+
}
|
|
925
|
+
.toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
|
|
926
|
+
transform: translateX(24px);
|
|
927
|
+
}
|
|
928
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH {
|
|
929
|
+
opacity: 0.65;
|
|
930
|
+
}
|
|
931
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH input {
|
|
932
|
+
pointer-events: none;
|
|
933
|
+
}
|
|
934
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG {
|
|
935
|
+
cursor: not-allowed;
|
|
936
|
+
}
|
|
937
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG:after {
|
|
938
|
+
content: " ";
|
|
939
|
+
z-index: -1;
|
|
940
|
+
display: block;
|
|
941
|
+
position: absolute;
|
|
942
|
+
height: 100%;
|
|
943
|
+
top: 0;
|
|
944
|
+
left: 0;
|
|
945
|
+
right: 0;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
.theme-dark .toggle-module_toggle__p1Ep4 input:enabled + .toggle-module_slider__2IVaG:hover {
|
|
949
|
+
background-color: #003A4C;
|
|
950
|
+
}
|
|
951
|
+
.theme-dark .toggle-module_toggle__p1Ep4 input:checked:enabled + .toggle-module_slider__2IVaG:hover {
|
|
952
|
+
background-color: #07a7d5;
|
|
953
|
+
}
|
|
954
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG {
|
|
955
|
+
border-color: #02a1cf;
|
|
956
|
+
}
|
|
957
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:hover {
|
|
958
|
+
background-color: rgba(2, 179, 230, 0.05);
|
|
959
|
+
}
|
|
960
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:before {
|
|
961
|
+
background-color: #02B3E6;
|
|
962
|
+
}
|
|
963
|
+
.theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
|
|
964
|
+
background-color: #F4F4F4;
|
|
965
|
+
}
|
|
966
|
+
.theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:hover {
|
|
967
|
+
background-color: #07c6fd;
|
|
861
968
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.types.js","sources":["../../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"sourcesContent":["import { PropsWithChildren, FC, MouseEvent } from 'react'\n\nimport { TextAndIconsProps } from '../textAndContent/textAndContent.types'\nimport { LayoutBoxProps } from '../../container/layoutBox/layoutBox.types'\nimport { CommonProps } from '
|
|
1
|
+
{"version":3,"file":"tag.types.js","sources":["../../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"sourcesContent":["import { PropsWithChildren, FC, MouseEvent } from 'react'\n\nimport { TextAndIconsProps } from '../textAndContent/textAndContent.types'\nimport { LayoutBoxProps } from '../../container/layoutBox/layoutBox.types'\nimport { CommonProps } from '../../../types/CommonProps'\nimport { TextProps } from '../text/text.types'\n\n\nexport enum TagVariant {\n info = 'info',\n veryLow = 'very-low',\n low = 'low',\n medium = 'medium',\n high = 'high',\n critical = 'critical',\n information = 'information',\n success = 'success',\n alert = 'alert',\n error = 'error',\n warning = 'warning',\n default = 'default'\n}\n\nexport type TagProps = PropsWithChildren & CommonProps & TextAndIconsProps & LayoutBoxProps & {\n variant?: TagVariant\n text?: string\n hashtag?: boolean\n inTable?: boolean\n components?: {\n TextComponent?: FC<TextProps>\n }\n onClick?: (event?: MouseEvent) => void\n className?: string\n}\n"],"names":["TagVariant"],"mappings":"AAQYA,IAAAA,WAAAA,GAAU,OAAVA,EAAU,KAAA,OAAVA,EAAU,QAAA,WAAVA,EAAU,IAAA,MAAVA,EAAU,OAAA,SAAVA,EAAU,KAAA,OAAVA,EAAU,SAAA,WAAVA,EAAU,YAAA,cAAVA,EAAU,QAAA,UAAVA,EAAU,MAAA,QAAVA,EAAU,MAAA,QAAVA,EAAU,QAAA,UAAVA,EAAU,QAAA,UAAVA,CAAU,EAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{extends as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import{memo as s,forwardRef as t,useId as a,useMemo as l}from"react";import r from"./toggle.module.scss.js";import{classNames as o}from"../../../../utils/helpers/ui.js";import{useParseProps as c}from"../../../../hooks/useParseProps.js";const i=t(((s,t)=>{let{id:i,checked:m=!1,disabled:d=!1,className:p="",invalid:n,onChange:g,...h}=s;const u=a(),b=l((()=>o(r.toggle,d&&r.disabled,p)),[d,p]),{dataProps:f,restProps:N}=c(h);return React.createElement("label",e({htmlFor:i??u,className:b},f,{style:N}),React.createElement("input",e({},h,{id:i??u,ref:t,role:"switch",type:"checkbox",disabled:d,checked:m,onChange:g})),React.createElement("span",{className:r.slider}))}));i.displayName="ToggleForwarded";const m=s(i);m.displayName="Toggle";export{m as Toggle};
|
|
2
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../../../../../../../src/core/ui/components/atoms/toggle/Toggle.tsx"],"sourcesContent":["import {\n useId,\n forwardRef, LegacyRef, memo, useMemo, FC, PropsWithChildren,\n ChangeEvent,\n} from 'react'\n\nimport { CommonProps } from '../../../types'\nimport { useParseProps } from '../../../../hooks'\nimport { classNames } from '../../../../utils'\nimport { FieldProps } from '../../field'\n\nimport classes from './toggle.module.scss'\n\n\nexport type ToggleProps = CommonProps & PropsWithChildren & {\n onChange?: (event: ChangeEvent) => void\n checked?: FieldProps['checked']\n disabled?: FieldProps['disabled']\n invalid?: FieldProps['invalid']\n}\n\n/**\n * Toggle component.\n *\n * @type {React.FC<ToggleProps>}\n * @returns {React.ReactElement} The Toggle.\n */\n\n\nconst ToggleForwarded = forwardRef(({\n id,\n checked = false,\n disabled = false,\n className = '',\n // TODO add eror styling for invalid\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n invalid,\n onChange,\n ...props\n}: ToggleProps, ref: LegacyRef<HTMLInputElement>) => {\n const shadowId = useId()\n\n const styles = useMemo(\n () => classNames(\n classes.toggle,\n disabled && classes.disabled,\n className,\n ),\n [disabled, className],\n )\n\n const { dataProps, restProps } = useParseProps(props)\n\n return (\n <label htmlFor={id ?? shadowId} className={styles} {...dataProps} style={restProps}>\n <input\n {...props}\n id={id ?? shadowId}\n ref={ref}\n role='switch'\n type='checkbox'\n disabled={disabled}\n checked={checked}\n onChange={onChange}\n />\n <span className={classes.slider} />\n </label>\n )\n})\n\nToggleForwarded.displayName = 'ToggleForwarded'\n\nexport const Toggle: FC<ToggleProps> = memo<ToggleProps>(ToggleForwarded)\n\nexport type ToggleType = typeof Toggle;\n\nToggle.displayName = 'Toggle'\n"],"names":["ToggleForwarded","forwardRef","_ref","ref","id","checked","disabled","className","invalid","onChange","props","shadowId","useId","styles","useMemo","classNames","classes","toggle","dataProps","restProps","useParseProps","React","createElement","_extends","htmlFor","style","role","type","slider","displayName","Toggle","memo"],"mappings":"8TA6BA,MAAMA,EAAkBC,GAAW,CAAAC,EAUnBC,KAAqC,IAVjBC,GAClCA,EAAEC,QACFA,GAAU,EAAKC,SACfA,GAAW,EAAKC,UAChBA,EAAY,GAAEC,QAGdA,EAAOC,SACPA,KACGC,GACSR,EACZ,MAAMS,EAAWC,IAEXC,EAASC,GACb,IAAMC,EACJC,EAAQC,OACRX,GAAYU,EAAQV,SACpBC,IAEF,CAACD,EAAUC,KAGPW,UAAEA,EAASC,UAAEA,GAAcC,EAAcV,GAE/C,OACEW,MAAAC,cAAA,QAAAC,EAAA,CAAOC,QAASpB,GAAMO,EAAUJ,UAAWM,GAAYK,EAAS,CAAEO,MAAON,IACvEE,MAAAC,cAAAC,QAAAA,KACMb,EAAK,CACTN,GAAIA,GAAMO,EACVR,IAAKA,EACLuB,KAAK,SACLC,KAAK,WACLrB,SAAUA,EACVD,QAASA,EACTI,SAAUA,KAEZY,MAAAC,cAAA,OAAA,CAAMf,UAAWS,EAAQY,SACnB,IAIZ5B,EAAgB6B,YAAc,wBAEjBC,EAA0BC,EAAkB/B,GAIzD8B,EAAOD,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={"overflow-hidden":"toggle-module_overflow-hidden__NxfFx","text-truncate":"toggle-module_text-truncate__Wg-Jx","text-nowrap":"toggle-module_text-nowrap__F9ld6","text-ellipsis":"toggle-module_text-ellipsis__ftYlg",toggle:"toggle-module_toggle__p1Ep4",slider:"toggle-module_slider__2IVaG",disabled:"toggle-module_disabled__0nElH"};export{e as default};
|
|
2
|
+
//# sourceMappingURL=toggle.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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, CSSProperties, createElement } from 'react'\n\nimport { classNames } from '../../../utils/helpers/ui'\n\nimport classes from './field.module.scss'\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\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 style?: CSSProperties\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)\nconst TextAreaComponent = memo((props) => createElement('textarea', props))\n\nTextAreaComponent.displayName = 'TextAreaComponent'\n\nconst InputComponent = memo((props) => createElement('input', props))\n\nInputComponent.displayName = 'InputComponent'\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 style,\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 <div\n className={classNames(\n classes.field,\n (disabled || userDisabled) && classes.disable,\n className,\n )}\n // TODO fix\n // error={error}\n style={style}\n >\n <label htmlFor={name} className='label'>{label}</label>\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 && (\n <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\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 </div>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","setIconColor","color","IconComponent","memo","React","createElement","setIconComponent","component","Select","_ref","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","TextAreaComponent","displayName","InputComponent","Field","_ref2","name","type","placeholder","error","disabled","userDisabled","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","style","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","classNames","classes","field","disable","htmlFor","id","onKeyDown","autoComplete","onClick","iconName"],"mappings":"6PAUA,IAAIA,EAAqCA,IAAM,UAElCC,MAAAA,EAAgBC,IAC3BF,EAAYE,CAAK,EAGnB,IAAIC,EAAmCC,GAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAAAA,EAAoBC,IAC/BL,EAAgBK,CAAS,EAuDdC,EACXL,GACA,SAAeM,GAAsD,IAArDC,QAAEA,EAAOC,MAAEA,EAAKC,SAAEA,KAAaC,GAAoBJ,EACjE,OACEL,MAAAC,cAAA,MAAA,CAAKS,UAAU,UACbV,MAAAC,cAAAU,SAAAA,KAAYF,EAAK,CAAEG,IAAKJ,EAAUK,aAAcN,IAC7CD,GAASQ,KAAKC,GACbf,MAA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D,IAIVV,EAAMF,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, CSSProperties, createElement } from 'react'\n\nimport { classNames } from '../../../utils/helpers/ui'\n\nimport classes from './field.module.scss'\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\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 checked?: 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 style?: CSSProperties\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)\nconst TextAreaComponent = memo((props) => createElement('textarea', props))\n\nTextAreaComponent.displayName = 'TextAreaComponent'\n\nconst InputComponent = memo((props) => createElement('input', props))\n\nInputComponent.displayName = 'InputComponent'\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 style,\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 <div\n className={classNames(\n classes.field,\n (disabled || userDisabled) && classes.disable,\n className,\n )}\n // TODO fix\n // error={error}\n style={style}\n >\n <label htmlFor={name} className='label'>{label}</label>\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 && (\n <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\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 </div>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","setIconColor","color","IconComponent","memo","React","createElement","setIconComponent","component","Select","_ref","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","TextAreaComponent","displayName","InputComponent","Field","_ref2","name","type","placeholder","error","disabled","userDisabled","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","style","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","classNames","classes","field","disable","htmlFor","id","onKeyDown","autoComplete","onClick","iconName"],"mappings":"6PAUA,IAAIA,EAAqCA,IAAM,UAElCC,MAAAA,EAAgBC,IAC3BF,EAAYE,CAAK,EAGnB,IAAIC,EAAmCC,GAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAAAA,EAAoBC,IAC/BL,EAAgBK,CAAS,EAwDdC,EACXL,GACA,SAAeM,GAAsD,IAArDC,QAAEA,EAAOC,MAAEA,EAAKC,SAAEA,KAAaC,GAAoBJ,EACjE,OACEL,MAAAC,cAAA,MAAA,CAAKS,UAAU,UACbV,MAAAC,cAAAU,SAAAA,KAAYF,EAAK,CAAEG,IAAKJ,EAAUK,aAAcN,IAC7CD,GAASQ,KAAKC,GACbf,MAAAC,cAAA,SAAA,CACEe,IAAK,GAAGC,KAAKC,UAAUH,KACvBR,MAAyB,iBAAXQ,EAAuBA,GAAsBR,MAAQQ,GAEhD,iBAAXA,EAAuBA,GAAsBI,MAAQJ,MAMzE,IAEIK,EAAoBrB,GAAMU,GAAUR,EAAc,WAAYQ,KAEpEW,EAAkBC,YAAc,oBAEhC,MAAMC,EAAiBvB,GAAMU,GAAUR,EAAc,QAASQ,KAE9Da,EAAeD,YAAc,uBAEhBE,EAAwBxB,GAAiByB,IA4BpC,IA5BqCL,MACrDA,EAAKM,KACLA,EAAIC,KACJA,EAAO,OAAMnB,MACbA,EAAKM,aACLA,EAAYc,YACZA,EAAWnB,SACXA,EAAQoB,MACRA,EAAKC,SACLA,EAAQC,aACRA,EAAYC,iBACZA,EAAgBC,aAChBA,EAAYC,SACZA,EAAQC,SACRA,EAAQC,SACRA,EAAQC,UACRA,EAASC,MACTA,EAAK3B,UACLA,EAAS4B,SACTA,EAAQC,cACRA,EAAaC,OACbA,EA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IAC1CF,KAAK,SACLC,YAAaA,EACbpB,MAAOA,EACPD,QAASA,EAETgC,SAAUA,EACVE,OAAQA,EACRC,QAASK,EACTe,UAAWf,EACXgB,aAAa,MACbjC,SAAUA,GACNpB,KAuBT0B,IAAaJ,GACZ/B,MAAAC,cAAA,OAAA,CACES,UAAW,mCAAkCiC,EAAgB,YAAc,IAC3EoB,QAASpB,GAET3C,MAAAC,cAACH,EAAa,CACZkE,SAAU7B,EACVtC,MAAOF,KAIZyC,GACCpC,MAAAC,cAAA,OAAA,CACES,UAAW,qCAAoCgC,EAAiB,YAAc,IAC9EqB,QAASrB,GAET1C,MAAAC,cAACH,EAAa,CACZkE,SAAU5B,EACVvC,MAAOF,KAIZuC,GAAYA,GAEdG,GAASA,GAEXL,GAAgBhC,MAAAC,cAAA,IAAA,CAAGS,UAAU,QAAQsB,GACrCC,GAAYjC,MAAAC,cAAA,IAAA,CAAGS,UAAW,SAAQkB,EAAQ,YAAc,KAAOK,GAC5D,IAIVV,EAAMF,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./utils/style.js";export{LayoutBox}from"./components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./components/container/CollapsibleContainer.js";export{ResizableContainer}from"./components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./components/dividers/DividerLine.js";export{IconBase}from"./components/icon/IconBase.js";export{Icon}from"./components/icon/Icon.js";export{ESIcon,ESIconBase}from"./components/icon/IconWC.js";export{Button,IconButton,keys}from"./components/atoms/button/Button.js";export{Text}from"./components/atoms/text/Text.js";export{Headline,HeadlineSecondary,HeadlineTertiary}from"./components/atoms/text/Headline.js";export{Paragraph,ParagraphBold,ParagraphBoldSmall,ParagraphSmall}from"./components/atoms/text/Paragraph.js";export{Link}from"./components/atoms/text/Link.js";export{AnchorLink}from"./components/atoms/text/anchor-link/AnchorLink.js";export{TextAndContent,TextAndIcons}from"./components/atoms/textAndContent/TextAndContent.js";export{Tag}from"./components/atoms/tag/Tag.js";export{TagVariant}from"./components/atoms/tag/tag.types.js";export{FlowLayout}from"./components/molecules/layouts/FlowLayout.js";export{Popover}from"./components/molecules/popover/PopoverLite.js";export{Tooltip}from"./components/molecules/popover/Tooltip.js";export{PopoverPlacement}from"./components/molecules/popover/popover.types.js";export{Popup}from"./components/molecules/popup/Popup.js";export{PopupAnimateVariant}from"./components/molecules/popup/popup.types.js";
|
|
1
|
+
export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./utils/style.js";export{LayoutBox}from"./components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./components/container/CollapsibleContainer.js";export{ResizableContainer}from"./components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./components/dividers/DividerLine.js";export{IconBase}from"./components/icon/IconBase.js";export{Icon}from"./components/icon/Icon.js";export{ESIcon,ESIconBase}from"./components/icon/IconWC.js";export{Button,IconButton,keys}from"./components/atoms/button/Button.js";export{Text}from"./components/atoms/text/Text.js";export{Headline,HeadlineSecondary,HeadlineTertiary}from"./components/atoms/text/Headline.js";export{Paragraph,ParagraphBold,ParagraphBoldSmall,ParagraphSmall}from"./components/atoms/text/Paragraph.js";export{Link}from"./components/atoms/text/Link.js";export{AnchorLink}from"./components/atoms/text/anchor-link/AnchorLink.js";export{TextAndContent,TextAndIcons}from"./components/atoms/textAndContent/TextAndContent.js";export{Tag}from"./components/atoms/tag/Tag.js";export{TagVariant}from"./components/atoms/tag/tag.types.js";export{Toggle}from"./components/atoms/toggle/Toggle.js";export{FlowLayout}from"./components/molecules/layouts/FlowLayout.js";export{Popover}from"./components/molecules/popover/PopoverLite.js";export{Tooltip}from"./components/molecules/popover/Tooltip.js";export{PopoverPlacement}from"./components/molecules/popover/popover.types.js";export{Popup}from"./components/molecules/popup/Popup.js";export{PopupAnimateVariant}from"./components/molecules/popup/popup.types.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/ui/index.css
CHANGED
|
@@ -858,4 +858,111 @@
|
|
|
858
858
|
background-color: #FD8F3E;
|
|
859
859
|
border-color: #FD8F3E;
|
|
860
860
|
color: #632E03;
|
|
861
|
+
}
|
|
862
|
+
:root {
|
|
863
|
+
--divider-line: #4a4b4b;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.toggle-module_overflow-hidden__NxfFx, .toggle-module_text-truncate__Wg-Jx {
|
|
867
|
+
overflow: hidden !important;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.toggle-module_text-nowrap__F9ld6, .toggle-module_text-truncate__Wg-Jx {
|
|
871
|
+
white-space: nowrap !important;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.toggle-module_text-ellipsis__ftYlg, .toggle-module_text-truncate__Wg-Jx {
|
|
875
|
+
text-overflow: ellipsis !important;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.toggle-module_toggle__p1Ep4 {
|
|
879
|
+
display: inline-block;
|
|
880
|
+
position: relative;
|
|
881
|
+
max-width: 48px;
|
|
882
|
+
max-height: 24px;
|
|
883
|
+
width: 48px;
|
|
884
|
+
height: 24px;
|
|
885
|
+
border-radius: 16px !important;
|
|
886
|
+
}
|
|
887
|
+
.toggle-module_toggle__p1Ep4 input {
|
|
888
|
+
opacity: 0;
|
|
889
|
+
width: 0;
|
|
890
|
+
height: 0;
|
|
891
|
+
}
|
|
892
|
+
.toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG {
|
|
893
|
+
box-sizing: border-box;
|
|
894
|
+
position: absolute;
|
|
895
|
+
cursor: pointer;
|
|
896
|
+
width: 48px;
|
|
897
|
+
height: 24px;
|
|
898
|
+
top: 0;
|
|
899
|
+
left: 0;
|
|
900
|
+
right: 0;
|
|
901
|
+
bottom: 0;
|
|
902
|
+
background-color: transparent;
|
|
903
|
+
border: 1px solid #F4F4F4;
|
|
904
|
+
transition: transform, background-color 0.4s ease;
|
|
905
|
+
border-radius: 16px;
|
|
906
|
+
}
|
|
907
|
+
.toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG:before {
|
|
908
|
+
position: absolute;
|
|
909
|
+
content: "";
|
|
910
|
+
height: 20px;
|
|
911
|
+
width: 20px;
|
|
912
|
+
left: 1px;
|
|
913
|
+
bottom: 1px;
|
|
914
|
+
background-color: #F4F4F4;
|
|
915
|
+
transition: transform 0.4s ease;
|
|
916
|
+
border-radius: 50%;
|
|
917
|
+
}
|
|
918
|
+
.toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG {
|
|
919
|
+
background-color: #02B3E6;
|
|
920
|
+
border-color: #02B3E6;
|
|
921
|
+
}
|
|
922
|
+
.toggle-module_toggle__p1Ep4 input:focus + .toggle-module_slider__2IVaG {
|
|
923
|
+
box-shadow: 0 0 1px 1px #02B3E6;
|
|
924
|
+
}
|
|
925
|
+
.toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
|
|
926
|
+
transform: translateX(24px);
|
|
927
|
+
}
|
|
928
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH {
|
|
929
|
+
opacity: 0.65;
|
|
930
|
+
}
|
|
931
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH input {
|
|
932
|
+
pointer-events: none;
|
|
933
|
+
}
|
|
934
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG {
|
|
935
|
+
cursor: not-allowed;
|
|
936
|
+
}
|
|
937
|
+
.toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG:after {
|
|
938
|
+
content: " ";
|
|
939
|
+
z-index: -1;
|
|
940
|
+
display: block;
|
|
941
|
+
position: absolute;
|
|
942
|
+
height: 100%;
|
|
943
|
+
top: 0;
|
|
944
|
+
left: 0;
|
|
945
|
+
right: 0;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
.theme-dark .toggle-module_toggle__p1Ep4 input:enabled + .toggle-module_slider__2IVaG:hover {
|
|
949
|
+
background-color: #003A4C;
|
|
950
|
+
}
|
|
951
|
+
.theme-dark .toggle-module_toggle__p1Ep4 input:checked:enabled + .toggle-module_slider__2IVaG:hover {
|
|
952
|
+
background-color: #07a7d5;
|
|
953
|
+
}
|
|
954
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG {
|
|
955
|
+
border-color: #02a1cf;
|
|
956
|
+
}
|
|
957
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:hover {
|
|
958
|
+
background-color: rgba(2, 179, 230, 0.05);
|
|
959
|
+
}
|
|
960
|
+
.theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:before {
|
|
961
|
+
background-color: #02B3E6;
|
|
962
|
+
}
|
|
963
|
+
.theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
|
|
964
|
+
background-color: #F4F4F4;
|
|
965
|
+
}
|
|
966
|
+
.theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:hover {
|
|
967
|
+
background-color: #07c6fd;
|
|
861
968
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.types.js","sources":["../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"sourcesContent":["import { PropsWithChildren, FC, MouseEvent } from 'react'\n\nimport { TextAndIconsProps } from '../textAndContent/textAndContent.types'\nimport { LayoutBoxProps } from '../../container/layoutBox/layoutBox.types'\nimport { CommonProps } from '
|
|
1
|
+
{"version":3,"file":"tag.types.js","sources":["../../../../../../../../src/core/ui/components/atoms/tag/tag.types.ts"],"sourcesContent":["import { PropsWithChildren, FC, MouseEvent } from 'react'\n\nimport { TextAndIconsProps } from '../textAndContent/textAndContent.types'\nimport { LayoutBoxProps } from '../../container/layoutBox/layoutBox.types'\nimport { CommonProps } from '../../../types/CommonProps'\nimport { TextProps } from '../text/text.types'\n\n\nexport enum TagVariant {\n info = 'info',\n veryLow = 'very-low',\n low = 'low',\n medium = 'medium',\n high = 'high',\n critical = 'critical',\n information = 'information',\n success = 'success',\n alert = 'alert',\n error = 'error',\n warning = 'warning',\n default = 'default'\n}\n\nexport type TagProps = PropsWithChildren & CommonProps & TextAndIconsProps & LayoutBoxProps & {\n variant?: TagVariant\n text?: string\n hashtag?: boolean\n inTable?: boolean\n components?: {\n TextComponent?: FC<TextProps>\n }\n onClick?: (event?: MouseEvent) => void\n className?: string\n}\n"],"names":["TagVariant"],"mappings":"aAQYA,IAAAA,WAAAA,GAAU,OAAVA,EAAU,KAAA,OAAVA,EAAU,QAAA,WAAVA,EAAU,IAAA,MAAVA,EAAU,OAAA,SAAVA,EAAU,KAAA,OAAVA,EAAU,SAAA,WAAVA,EAAU,YAAA,cAAVA,EAAU,QAAA,UAAVA,EAAU,MAAA,QAAVA,EAAU,MAAA,QAAVA,EAAU,QAAA,UAAVA,EAAU,QAAA,UAAVA,CAAU,EAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),s=require("react"),a=require("./toggle.module.scss.js"),r=require("../../../../utils/helpers/ui.js"),l=require("../../../../hooks/useParseProps.js");const t=s.forwardRef(((t,o)=>{let{id:d,checked:c=!1,disabled:i=!1,className:u="",invalid:n,onChange:m,...g}=t;const p=s.useId(),h=s.useMemo((()=>r.classNames(a.default.toggle,i&&a.default.disabled,u)),[i,u]),{dataProps:P,restProps:b}=l.useParseProps(g);return React.createElement("label",e.extends({htmlFor:d??p,className:h},P,{style:b}),React.createElement("input",e.extends({},g,{id:d??p,ref:o,role:"switch",type:"checkbox",disabled:i,checked:c,onChange:m})),React.createElement("span",{className:a.default.slider}))}));t.displayName="ToggleForwarded";const o=s.memo(t);o.displayName="Toggle",exports.Toggle=o;
|
|
2
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../../../../../../src/core/ui/components/atoms/toggle/Toggle.tsx"],"sourcesContent":["import {\n useId,\n forwardRef, LegacyRef, memo, useMemo, FC, PropsWithChildren,\n ChangeEvent,\n} from 'react'\n\nimport { CommonProps } from '../../../types'\nimport { useParseProps } from '../../../../hooks'\nimport { classNames } from '../../../../utils'\nimport { FieldProps } from '../../field'\n\nimport classes from './toggle.module.scss'\n\n\nexport type ToggleProps = CommonProps & PropsWithChildren & {\n onChange?: (event: ChangeEvent) => void\n checked?: FieldProps['checked']\n disabled?: FieldProps['disabled']\n invalid?: FieldProps['invalid']\n}\n\n/**\n * Toggle component.\n *\n * @type {React.FC<ToggleProps>}\n * @returns {React.ReactElement} The Toggle.\n */\n\n\nconst ToggleForwarded = forwardRef(({\n id,\n checked = false,\n disabled = false,\n className = '',\n // TODO add eror styling for invalid\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n invalid,\n onChange,\n ...props\n}: ToggleProps, ref: LegacyRef<HTMLInputElement>) => {\n const shadowId = useId()\n\n const styles = useMemo(\n () => classNames(\n classes.toggle,\n disabled && classes.disabled,\n className,\n ),\n [disabled, className],\n )\n\n const { dataProps, restProps } = useParseProps(props)\n\n return (\n <label htmlFor={id ?? shadowId} className={styles} {...dataProps} style={restProps}>\n <input\n {...props}\n id={id ?? shadowId}\n ref={ref}\n role='switch'\n type='checkbox'\n disabled={disabled}\n checked={checked}\n onChange={onChange}\n />\n <span className={classes.slider} />\n </label>\n )\n})\n\nToggleForwarded.displayName = 'ToggleForwarded'\n\nexport const Toggle: FC<ToggleProps> = memo<ToggleProps>(ToggleForwarded)\n\nexport type ToggleType = typeof Toggle;\n\nToggle.displayName = 'Toggle'\n"],"names":["ToggleForwarded","forwardRef","_ref","ref","id","checked","disabled","className","invalid","onChange","props","shadowId","useId","styles","useMemo","classNames","classes","toggle","dataProps","restProps","useParseProps","React","createElement","_extends","htmlFor","style","extends","role","type","default","slider","displayName","Toggle","memo"],"mappings":"2OA6BA,MAAMA,EAAkBC,EAAUA,YAAC,CAAAC,EAUnBC,KAAqC,IAVjBC,GAClCA,EAAEC,QACFA,GAAU,EAAKC,SACfA,GAAW,EAAKC,UAChBA,EAAY,GAAEC,QAGdA,EAAOC,SACPA,KACGC,GACSR,EACZ,MAAMS,EAAWC,EAAAA,QAEXC,EAASC,EAAOA,SACpB,IAAMC,EAAAA,WACJC,EAAAA,QAAQC,OACRX,GAAYU,EAAAA,QAAQV,SACpBC,IAEF,CAACD,EAAUC,KAGPW,UAAEA,EAASC,UAAEA,GAAcC,EAAAA,cAAcV,GAE/C,OACEW,MAAAC,cAAA,QAAAC,UAAA,CAAOC,QAASpB,GAAMO,EAAUJ,UAAWM,GAAYK,EAAS,CAAEO,MAAON,IACvEE,MAAAC,cAAAC,QAAAA,EAAAG,WACMhB,EAAK,CACTN,GAAIA,GAAMO,EACVR,IAAKA,EACLwB,KAAK,SACLC,KAAK,WACLtB,SAAUA,EACVD,QAASA,EACTI,SAAUA,KAEZY,MAAAC,cAAA,OAAA,CAAMf,UAAWS,EAAOa,QAACC,SACnB,IAIZ9B,EAAgB+B,YAAc,wBAEjBC,EAA0BC,EAAIA,KAAcjC,GAIzDgC,EAAOD,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.default={"overflow-hidden":"toggle-module_overflow-hidden__NxfFx","text-truncate":"toggle-module_text-truncate__Wg-Jx","text-nowrap":"toggle-module_text-nowrap__F9ld6","text-ellipsis":"toggle-module_text-ellipsis__ftYlg",toggle:"toggle-module_toggle__p1Ep4",slider:"toggle-module_slider__2IVaG",disabled:"toggle-module_disabled__0nElH"};
|
|
2
|
+
//# sourceMappingURL=toggle.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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, CSSProperties, createElement } from 'react'\n\nimport { classNames } from '../../../utils/helpers/ui'\n\nimport classes from './field.module.scss'\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\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 style?: CSSProperties\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)\nconst TextAreaComponent = memo((props) => createElement('textarea', props))\n\nTextAreaComponent.displayName = 'TextAreaComponent'\n\nconst InputComponent = memo((props) => createElement('input', props))\n\nInputComponent.displayName = 'InputComponent'\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 style,\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 <div\n className={classNames(\n classes.field,\n (disabled || userDisabled) && classes.disable,\n className,\n )}\n // TODO fix\n // error={error}\n style={style}\n >\n <label htmlFor={name} className='label'>{label}</label>\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 && (\n <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\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 </div>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","setIconComponent","Select","_ref","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","TextAreaComponent","displayName","InputComponent","Field","_ref2","name","type","placeholder","error","disabled","userDisabled","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","style","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","classNames","classes","default","field","disable","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"oLAUA,IAAIA,EAAqCA,IAAM,UAM/C,IAAIC,EAAmCC,EAAAA,MAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAwDAC,EACXJ,EAAIA,MACJ,SAAeK,GAAsD,IAArDC,QAAEA,EAAOC,MAAEA,EAAKC,SAAEA,KAAaC,GAAoBJ,EACjE,OACEJ,MAAAC,cAAA,MAAA,CAAKQ,UAAU,UACbT,MAAAC,cAAAS,SAAAA,EAAAA,WAAYF,EAAK,CAAEG,IAAKJ,EAAUK,aAAcN,IAC7CD,GAASQ,KAAKC,GACbd,MAAAC,cAAA,SAAA,CACEc,IAAK,GAAGC,KAAKC,UAAUH,KACvBR,MAAyB,iBAAXQ,EAAuBA,GAAsBR,MAAQQ,GAEhD,iBAAXA,EAAuBA,GAAsBI,MAAQJ,MAMzE,IAEIK,EAAoBpB,EAAIA,MAAES,GAAUP,EAAaA,cAAC,WAAYO,KAEpEW,EAAkBC,YAAc,oBAEhC,MAAMC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/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, CSSProperties, createElement } from 'react'\n\nimport { classNames } from '../../../utils/helpers/ui'\n\nimport classes from './field.module.scss'\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\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 checked?: 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 style?: CSSProperties\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)\nconst TextAreaComponent = memo((props) => createElement('textarea', props))\n\nTextAreaComponent.displayName = 'TextAreaComponent'\n\nconst InputComponent = memo((props) => createElement('input', props))\n\nInputComponent.displayName = 'InputComponent'\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 style,\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 <div\n className={classNames(\n classes.field,\n (disabled || userDisabled) && classes.disable,\n className,\n )}\n // TODO fix\n // error={error}\n style={style}\n >\n <label htmlFor={name} className='label'>{label}</label>\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 && (\n <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\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 </div>\n )\n})\n\nField.displayName = 'Field'\n"],"names":["iconColor","IconComponent","memo","React","createElement","setIconComponent","Select","_ref","options","value","inputRef","props","className","_extends","ref","defaultValue","map","option","key","JSON","stringify","label","TextAreaComponent","displayName","InputComponent","Field","_ref2","name","type","placeholder","error","disabled","userDisabled","withoutComponent","helpTextInfo","helpText","children","iconLeft","iconRight","addon","onChange","onChangeInner","onBlur","onFocus","rightIconClick","leftIconClick","style","Component","handleFocus","useCallback","event","preventDefault","handleChange","target","valueProps","useMemo","undefined","classNames","classes","default","field","disable","htmlFor","id","onKeyDown","autoComplete","onClick","iconName","color","component"],"mappings":"oLAUA,IAAIA,EAAqCA,IAAM,UAM/C,IAAIC,EAAmCC,EAAAA,MAAK,WAA2B,OAAOC,MAAAC,cAAA,OAAA,KAAS,IAE1EC,MAyDAC,EACXJ,EAAIA,MACJ,SAAeK,GAAsD,IAArDC,QAAEA,EAAOC,MAAEA,EAAKC,SAAEA,KAAaC,GAAoBJ,EACjE,OACEJ,MAAAC,cAAA,MAAA,CAAKQ,UAAU,UACbT,MAAAC,cAAAS,SAAAA,EAAAA,WAAYF,EAAK,CAAEG,IAAKJ,EAAUK,aAAcN,IAC7CD,GAASQ,KAAKC,GACbd,MAAAC,cAAA,SAAA,CACEc,IAAK,GAAGC,KAAKC,UAAUH,KACvBR,MAAyB,iBAAXQ,EAAuBA,GAAsBR,MAAQQ,GAEhD,iBAAXA,EAAuBA,GAAsBI,MAAQJ,MAMzE,IAEIK,EAAoBpB,EAAIA,MAAES,GAAUP,EAAaA,cAAC,WAAYO,KAEpEW,EAAkBC,YAAc,oBAEhC,MAAMC,EAAiBtB,EAAIA,MAAES,GAAUP,EAAaA,cAAC,QAASO,KAE9Da,EAAeD,YAAc,uBAEhBE,EAAwBvB,EAAIA,MAAawB,IA4BpC,IA5BqCL,MACrDA,EAAKM,KACLA,EAAIC,KACJA,EAAO,OAAMnB,MACbA,EAAKM,aACLA,EAAYc,YACZA,EAAWnB,SACXA,EAAQoB,MACRA,EAAKC,SACLA,EAAQC,aACRA,EAAYC,iBACZA,EAAgBC,aAChBA,EAAYC,SACZA,EAAQC,SACRA,EAAQC,SACRA,EAAQC,UACRA,EAASC,MACTA,EAAK3B,UACLA,EAAS4B,SACTA,EAAQC,cACRA,EAAaC,OACbA,EAAMC,QACNA,EAAOC,eACPA,EAAcC,cACdA,EAAarC,QACbA,EAAOsC,MACPA,KACGnC,GACQe,EACPqB,EAAqBvB,EAEpBY,G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