@epignosis_llc/gnosis 6.6.18 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +202 -92
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/src/components/Button/Button.js +18 -14
- package/dist/esm/src/components/Button/Button.js.map +1 -1
- package/dist/esm/src/components/FormElements/Select/styles.js +1 -0
- package/dist/esm/src/components/FormElements/Select/styles.js.map +1 -1
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleLabel.js +2 -0
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleLabel.js.map +1 -1
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleSwitch.js +2 -0
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleSwitch.js.map +1 -1
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleSwitchCore.js +2 -0
- package/dist/esm/src/components/FormElements/ToggleSwitch/ToggleSwitchCore.js.map +1 -1
- package/dist/esm/src/components/Modal/styles.js +1 -0
- package/dist/esm/src/components/Modal/styles.js.map +1 -1
- package/dist/esm/src/components/SegmentedButtons/SegmentedButtons.js +73 -0
- package/dist/esm/src/components/SegmentedButtons/SegmentedButtons.js.map +1 -0
- package/dist/esm/src/components/SegmentedButtons/styles.js +37 -0
- package/dist/esm/src/components/SegmentedButtons/styles.js.map +1 -0
- package/dist/esm/src/components/Toast/ToastNotifications.js +2 -0
- package/dist/esm/src/components/Toast/ToastNotifications.js.map +1 -1
- package/dist/esm/src/index.js +1 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/theme/default/config/segmentedButtons.js +36 -0
- package/dist/esm/src/theme/default/config/segmentedButtons.js.map +1 -0
- package/dist/esm/src/theme/default/defaultTheme.js +2 -0
- package/dist/esm/src/theme/default/defaultTheme.js.map +1 -1
- package/dist/types/components/Button/Button.d.ts +3 -1
- package/dist/types/components/SegmentedButtons/SegmentedButtons.d.ts +16 -0
- package/dist/types/components/SegmentedButtons/styles.d.ts +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/theme/default/config/index.d.ts +1 -0
- package/dist/types/theme/default/config/segmentedButtons.d.ts +23 -0
- package/dist/types/theme/default/defaultTheme.d.ts +22 -0
- package/package.json +1 -1
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
* Released under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
10
|
import 'react';
|
|
11
11
|
import classNames from '../../../node_modules/classnames/index.js';
|
|
12
12
|
import Loader from '../Loaders/Loader.js';
|
|
13
13
|
import { btnContainer } from './styles.js';
|
|
14
|
-
import {
|
|
14
|
+
import { iconSizes, spinnerWrapperVariants } from './constants.js';
|
|
15
15
|
import { createElement as jsx } from '../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js';
|
|
16
16
|
import { AnimatePresence } from '../../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs.js';
|
|
17
17
|
import { m } from '../../../node_modules/framer-motion/dist/es/render/dom/motion-minimal.mjs.js';
|
|
18
18
|
import { domAnimation } from '../../../node_modules/framer-motion/dist/es/render/dom/features-animation.mjs.js';
|
|
19
19
|
import { LazyMotion } from '../../../node_modules/framer-motion/dist/es/components/LazyMotion/index.mjs.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["as", "color", "size", "variant", "block", "isLoading", "noGutters", "className", "rounded", "iconBefore", "iconAfter", "children", "disabled", "underlined", "active"];
|
|
21
|
+
var _excluded = ["as", "color", "size", "variant", "block", "isLoading", "noGutters", "className", "rounded", "iconBefore", "iconBeforeProps", "iconAfter", "iconAfterProps", "children", "disabled", "underlined", "active"];
|
|
22
22
|
var Button = function Button(props) {
|
|
23
|
-
var _classNames, _props$id;
|
|
23
|
+
var _classNames, _iconBeforeProps$heig, _iconAfterProps$heigh, _props$id;
|
|
24
24
|
var as = props.as,
|
|
25
25
|
_props$color = props.color,
|
|
26
26
|
color = _props$color === void 0 ? "primary" : _props$color,
|
|
@@ -39,7 +39,9 @@ var Button = function Button(props) {
|
|
|
39
39
|
_props$rounded = props.rounded,
|
|
40
40
|
rounded = _props$rounded === void 0 ? false : _props$rounded,
|
|
41
41
|
iconBefore = props.iconBefore,
|
|
42
|
+
iconBeforeProps = props.iconBeforeProps,
|
|
42
43
|
iconAfter = props.iconAfter,
|
|
44
|
+
iconAfterProps = props.iconAfterProps,
|
|
43
45
|
children = props.children,
|
|
44
46
|
disabled = props.disabled,
|
|
45
47
|
underlined = props.underlined,
|
|
@@ -49,6 +51,16 @@ var Button = function Button(props) {
|
|
|
49
51
|
var PrefixIcon = iconBefore;
|
|
50
52
|
var SuffixIcon = iconAfter;
|
|
51
53
|
var containerClassNames = classNames((_classNames = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames, className, Boolean(className)), "disabled", disabled || isLoading), "rounded", rounded), "solid", variant === "solid"), "outline", variant === "outline"), "ghost", variant === "ghost"), "linkButton", variant === "link"), "icon-after", SuffixIcon), "icon-before", PrefixIcon), "underlined", underlined), _defineProperty(_classNames, "active", active)));
|
|
54
|
+
var iconBeforePropsWithDefaults = _objectSpread2(_objectSpread2({}, iconBeforeProps), {}, {
|
|
55
|
+
height: (_iconBeforeProps$heig = iconBeforeProps === null || iconBeforeProps === void 0 ? void 0 : iconBeforeProps.height) !== null && _iconBeforeProps$heig !== void 0 ? _iconBeforeProps$heig : iconSizes[size],
|
|
56
|
+
className: classNames("icon", iconBeforeProps === null || iconBeforeProps === void 0 ? void 0 : iconBeforeProps.className),
|
|
57
|
+
"data-testid": "prefix-icon"
|
|
58
|
+
});
|
|
59
|
+
var iconAfterPropsWithDefaults = _objectSpread2(_objectSpread2({}, iconAfterProps), {}, {
|
|
60
|
+
height: (_iconAfterProps$heigh = iconAfterProps === null || iconAfterProps === void 0 ? void 0 : iconAfterProps.height) !== null && _iconAfterProps$heigh !== void 0 ? _iconAfterProps$heigh : iconSizes[size],
|
|
61
|
+
className: classNames("icon", iconAfterProps === null || iconAfterProps === void 0 ? void 0 : iconAfterProps.className),
|
|
62
|
+
"data-testid": "suffix-icon"
|
|
63
|
+
});
|
|
52
64
|
return jsx(LazyMotion, {
|
|
53
65
|
features: domAnimation
|
|
54
66
|
}, jsx(Component, _extends({
|
|
@@ -73,17 +85,9 @@ var Button = function Button(props) {
|
|
|
73
85
|
variants: spinnerWrapperVariants
|
|
74
86
|
}, jsx(Loader, {
|
|
75
87
|
size: "md"
|
|
76
|
-
}))), PrefixIcon && jsx(PrefixIcon, {
|
|
77
|
-
height: iconSizes[size],
|
|
78
|
-
className: "icon",
|
|
79
|
-
"data-testid": "prefix-icon"
|
|
80
|
-
}), jsx("span", {
|
|
88
|
+
}))), PrefixIcon && jsx(PrefixIcon, iconBeforePropsWithDefaults), jsx("span", {
|
|
81
89
|
className: "btn-text"
|
|
82
|
-
}, children), SuffixIcon && jsx(SuffixIcon,
|
|
83
|
-
height: iconSizes[size],
|
|
84
|
-
className: "icon",
|
|
85
|
-
"data-testid": "suffix-icon"
|
|
86
|
-
})));
|
|
90
|
+
}, children), SuffixIcon && jsx(SuffixIcon, iconAfterPropsWithDefaults)));
|
|
87
91
|
};
|
|
88
92
|
|
|
89
93
|
export { Button as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, ElementType } from \"react\";\nimport { SerializedStyles } from \"@emotion/react\";\nimport { LazyMotion, domAnimation, m, AnimatePresence } from \"framer-motion\";\nimport classNames from \"classnames\";\nimport Loader from \"../Loaders/Loader\";\nimport { btnContainer } from \"./styles\";\nimport { iconSizes, spinnerWrapperVariants } from \"./constants\";\nimport { IconType, PolymorphicComponentProps } from \"types/common\";\n\nexport type Color =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"primaryLight\"\n | \"primaryDarker\"\n | \"white\"\n | \"orange\";\n\nexport type Size = \"sm\" | \"md\" | \"lg\";\n\nexport type Props = {\n color?: Color;\n size?: Size;\n noGutters?: boolean;\n block?: boolean;\n isLoading?: boolean;\n iconBefore?: IconType;\n iconAfter?: IconType;\n className?: string;\n disabled?: boolean;\n rounded?: boolean;\n children: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"link\";\n underlined?: boolean;\n active?: boolean;\n};\n\nexport type ButtonProps<C extends ElementType> = PolymorphicComponentProps<C, Props>;\n\nconst Button = <C extends ElementType = \"button\">(props: ButtonProps<C>): ReactElement => {\n const {\n as,\n color = \"primary\",\n size = \"md\",\n variant = \"solid\",\n block = false,\n isLoading = false,\n noGutters = false,\n className = \"\",\n rounded = false,\n iconBefore,\n iconAfter,\n children,\n disabled,\n underlined,\n active,\n ...rest\n } = props;\n\n const Component = as || \"button\";\n const PrefixIcon = iconBefore;\n const SuffixIcon = iconAfter;\n const containerClassNames = classNames({\n [className]: Boolean(className),\n disabled: disabled || isLoading,\n rounded,\n solid: variant === \"solid\",\n outline: variant === \"outline\",\n ghost: variant === \"ghost\",\n linkButton: variant === \"link\",\n \"icon-after\": SuffixIcon,\n \"icon-before\": PrefixIcon,\n underlined: underlined,\n active: active,\n });\n\n return (\n <LazyMotion features={domAnimation}>\n <Component\n css={(theme): SerializedStyles => btnContainer(theme, { color, block, size, noGutters })}\n className={containerClassNames}\n {...((as === \"button\" || as === undefined) && { disabled: disabled || isLoading })}\n {...rest}\n >\n <AnimatePresence>\n {isLoading && (\n <m.div\n key={props.id ?? \"spinner\"}\n className=\"loading\"\n aria-label=\"loading\"\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={spinnerWrapperVariants}\n >\n <Loader size=\"md\" />\n </m.div>\n )}\n </AnimatePresence>\n {PrefixIcon &&
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, ElementType, SVGProps } from \"react\";\nimport { SerializedStyles } from \"@emotion/react\";\nimport { LazyMotion, domAnimation, m, AnimatePresence } from \"framer-motion\";\nimport classNames from \"classnames\";\nimport Loader from \"../Loaders/Loader\";\nimport { btnContainer } from \"./styles\";\nimport { iconSizes, spinnerWrapperVariants } from \"./constants\";\nimport { IconType, PolymorphicComponentProps } from \"types/common\";\n\nexport type Color =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"primaryLight\"\n | \"primaryDarker\"\n | \"white\"\n | \"orange\";\n\nexport type Size = \"sm\" | \"md\" | \"lg\";\n\nexport type Props = {\n color?: Color;\n size?: Size;\n noGutters?: boolean;\n block?: boolean;\n isLoading?: boolean;\n iconBefore?: IconType;\n iconBeforeProps?: SVGProps<SVGSVGElement>;\n iconAfter?: IconType;\n iconAfterProps?: SVGProps<SVGSVGElement>;\n className?: string;\n disabled?: boolean;\n rounded?: boolean;\n children: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"link\";\n underlined?: boolean;\n active?: boolean;\n};\n\nexport type ButtonProps<C extends ElementType> = PolymorphicComponentProps<C, Props>;\n\nconst Button = <C extends ElementType = \"button\">(props: ButtonProps<C>): ReactElement => {\n const {\n as,\n color = \"primary\",\n size = \"md\",\n variant = \"solid\",\n block = false,\n isLoading = false,\n noGutters = false,\n className = \"\",\n rounded = false,\n iconBefore,\n iconBeforeProps,\n iconAfter,\n iconAfterProps,\n children,\n disabled,\n underlined,\n active,\n ...rest\n } = props;\n\n const Component = as || \"button\";\n const PrefixIcon = iconBefore;\n const SuffixIcon = iconAfter;\n const containerClassNames = classNames({\n [className]: Boolean(className),\n disabled: disabled || isLoading,\n rounded,\n solid: variant === \"solid\",\n outline: variant === \"outline\",\n ghost: variant === \"ghost\",\n linkButton: variant === \"link\",\n \"icon-after\": SuffixIcon,\n \"icon-before\": PrefixIcon,\n underlined: underlined,\n active: active,\n });\n\n const iconBeforePropsWithDefaults = {\n ...iconBeforeProps,\n height: iconBeforeProps?.height ?? iconSizes[size],\n className: classNames(\"icon\", iconBeforeProps?.className),\n \"data-testid\": \"prefix-icon\",\n };\n\n const iconAfterPropsWithDefaults = {\n ...iconAfterProps,\n height: iconAfterProps?.height ?? iconSizes[size],\n className: classNames(\"icon\", iconAfterProps?.className),\n \"data-testid\": \"suffix-icon\",\n };\n\n return (\n <LazyMotion features={domAnimation}>\n <Component\n css={(theme): SerializedStyles => btnContainer(theme, { color, block, size, noGutters })}\n className={containerClassNames}\n {...((as === \"button\" || as === undefined) && { disabled: disabled || isLoading })}\n {...rest}\n >\n <AnimatePresence>\n {isLoading && (\n <m.div\n key={props.id ?? \"spinner\"}\n className=\"loading\"\n aria-label=\"loading\"\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={spinnerWrapperVariants}\n >\n <Loader size=\"md\" />\n </m.div>\n )}\n </AnimatePresence>\n {PrefixIcon && <PrefixIcon {...iconBeforePropsWithDefaults} />}\n <span className=\"btn-text\">{children}</span>\n {SuffixIcon && <SuffixIcon {...iconAfterPropsWithDefaults} />}\n </Component>\n </LazyMotion>\n );\n};\n\nexport default Button;\n"],"names":["Button","props","_classNames","_iconBeforeProps$heig","_iconAfterProps$heigh","_props$id","as","_props$color","color","_props$size","size","_props$variant","variant","_props$block","block","_props$isLoading","isLoading","_props$noGutters","noGutters","_props$className","className","_props$rounded","rounded","iconBefore","iconBeforeProps","iconAfter","iconAfterProps","children","disabled","underlined","active","rest","_objectWithoutProperties","_excluded","Component","PrefixIcon","SuffixIcon","containerClassNames","classNames","_defineProperty","Boolean","iconBeforePropsWithDefaults","_objectSpread","height","iconSizes","iconAfterPropsWithDefaults","___EmotionJSX","LazyMotion","features","domAnimation","_extends","css","theme","btnContainer","undefined","AnimatePresence","m","div","key","id","initial","animate","exit","variants","spinnerWrapperVariants","Loader"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,IAAMA,MAAM,GAAG,SAATA,MAAMA,CAAsCC,KAAqB,EAAmB;AAAA,EAAA,IAAAC,WAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,SAAA,CAAA;AACxF,EAAA,IACEC,EAAE,GAkBAL,KAAK,CAlBPK,EAAE;IAAAC,YAAA,GAkBAN,KAAK,CAjBPO,KAAK;AAALA,IAAAA,KAAK,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,YAAA;IAAAE,WAAA,GAiBfR,KAAK,CAhBPS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,WAAA;IAAAE,cAAA,GAgBTV,KAAK,CAfPW,OAAO;AAAPA,IAAAA,OAAO,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,cAAA;IAAAE,YAAA,GAefZ,KAAK,CAdPa,KAAK;AAALA,IAAAA,KAAK,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,YAAA;IAAAE,gBAAA,GAcXd,KAAK,CAbPe,SAAS;AAATA,IAAAA,SAAS,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,gBAAA;IAAAE,gBAAA,GAafhB,KAAK,CAZPiB,SAAS;AAATA,IAAAA,SAAS,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,gBAAA;IAAAE,gBAAA,GAYflB,KAAK,CAXPmB,SAAS;AAATA,IAAAA,SAAS,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,gBAAA;IAAAE,cAAA,GAWZpB,KAAK,CAVPqB,OAAO;AAAPA,IAAAA,OAAO,GAAAD,cAAA,KAAG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19
|
import '../../../theme/default/config/tag.js';
|
|
20
20
|
import '../../../theme/default/config/pagination.js';
|
|
21
21
|
import scrollbar from '../../../theme/default/config/scrollbar.js';
|
|
22
|
+
import '../../../theme/default/config/segmentedButtons.js';
|
|
22
23
|
import '../../../theme/default/config/statusTag.js';
|
|
23
24
|
|
|
24
25
|
var portalSelectZIndex = 9999;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../../../src/components/FormElements/Select/styles.ts"],"sourcesContent":["import { css, SerializedStyles, Theme } from \"@emotion/react\";\nimport {\n CSSObjectWithLabel,\n ClearIndicatorProps,\n ControlProps,\n DropdownIndicatorProps,\n GroupBase,\n MultiValueProps,\n OptionProps,\n PlaceholderProps,\n StylesConfig,\n} from \"react-select\";\nimport { InputSize } from \"../Input/Input\";\nimport { inputHeight } from \"../styles\";\nimport { CustomOption } from \"./types\";\nimport { formElements, scrollbar } from \"@theme/default/config\";\n\nconst portalSelectZIndex = 9999;\n\nexport const selectContainer = (\n { formElements }: Theme,\n {\n size,\n inline,\n isInlineFlex,\n minWidth,\n maxWidth,\n }: {\n size: InputSize;\n inline: boolean;\n isInlineFlex: boolean;\n minWidth: string;\n maxWidth: string;\n },\n): SerializedStyles => css`\n display: ${isInlineFlex ? \"inline-flex\" : \"flex\"};\n flex-direction: ${inline ? \"row\" : \"column\"};\n gap: ${inline ? \"1rem\" : \"0.5rem\"};\n align-items: ${inline ? \"center\" : \"normal\"};\n\n .label-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 0.25rem;\n\n label {\n margin: 0;\n\n &.required::after {\n content: \" *\";\n color: ${formElements.generic.required};\n }\n }\n\n div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n svg {\n color: ${formElements.input.infoTooltipColor};\n &:hover {\n cursor: pointer;\n }\n }\n }\n\n .select-create-label {\n display: flex;\n justify-content: space-between;\n padding-inline-end: 1rem;\n color: ${formElements.input.borderFocusColor};\n\n svg {\n color: ${formElements.input.borderFocusColor};\n\n line-height: 0;\n }\n }\n\n .select-input-wrapper {\n min-width: ${minWidth};\n max-width: ${maxWidth};\n flex-grow: 1;\n background-color: ${formElements.input.background};\n border-radius: 0.3125rem;\n\n .error {\n border-color: ${formElements.errors.errorBorderColor};\n }\n\n .control-${size} {\n /* minus border */\n &:hover,\n &.focused {\n border: 1px solid ${formElements.input.borderFocus};\n }\n\n min-height: calc(${inputHeight[size]} - 2px);\n }\n\n .selected {\n background-color: ${formElements.input.borderFocus};\n }\n\n .option-${size} {\n padding: 0.3125rem 1rem;\n word-break: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding-inline-end: 1rem;\n width: auto;\n }\n }\n`;\n\nexport const resolveStyles = ({\n size,\n menuMinWidth,\n allowTextWrap = false,\n}: {\n size: InputSize;\n menuMinWidth?: number;\n allowTextWrap?: boolean;\n}): StylesConfig<CustomOption> => ({\n menu: (base: CSSObjectWithLabel) => {\n return {\n ...base,\n zIndex: 1060,\n minWidth: menuMinWidth ?? \"auto\",\n };\n },\n // Modal overlays use a z-index of 9998\n // To ensure the menu appears on top, set its z-index to at least 9999\n menuPortal: (base) => ({ ...base, zIndex: portalSelectZIndex }),\n placeholder: (\n base: CSSObjectWithLabel,\n { isDisabled }: PlaceholderProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n return {\n ...base,\n fontStyle: \"italic\",\n color: isDisabled ? formElements.input.disabledColor : formElements.input.placeholderColor,\n };\n },\n groupHeading: (base: CSSObjectWithLabel) => ({\n ...base,\n color: formElements.generic.black,\n fontWeight: 700,\n }),\n dropdownIndicator: (\n base: CSSObjectWithLabel,\n { selectProps }: DropdownIndicatorProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n transform: selectProps.menuIsOpen ? \"rotate(-180deg)\" : \"rotate(0)\",\n transition: \"all .2s ease\",\n color: selectProps.isDisabled ? base.color : formElements.input.iconColor,\n \"&:hover\": {\n color: formElements.input.iconHoverColor,\n cursor: !selectProps.isDisabled ? \"pointer\" : \"not-allowed\",\n },\n }),\n clearIndicator: (\n base: CSSObjectWithLabel,\n { selectProps }: ClearIndicatorProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n color: selectProps.isDisabled ? base.color : formElements.input.iconColor,\n \"&:hover\": { color: formElements.input.iconHoverColor, cursor: \"pointer\" },\n }),\n control: (\n base: CSSObjectWithLabel,\n { isFocused, isDisabled }: ControlProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n const border = isDisabled\n ? `1px solid ${formElements.input.disabledBorder}`\n : isFocused\n ? `1px solid ${formElements.input.borderFocusColor}`\n : // default case, set border equal to the background color to avoid pixel shift\n `1px solid ${formElements.input.background}`;\n const backgroundColor = isDisabled\n ? formElements.input.disabledBackground\n : isFocused\n ? formElements.input.backgroundFocus\n : \"formElements.input.background;\";\n\n return {\n ...base,\n border,\n backgroundColor,\n boxShadow: \"none\",\n borderRadius: \"5px\",\n color: !isDisabled ? base.color : formElements.input.disabledColor,\n cursor: !isDisabled ? \"pointer\" : \"not-allowed\",\n pointerEvents: \"auto\",\n \"&:hover\": {\n borderColor: isDisabled\n ? formElements.input.disabledBorder\n : formElements.input.borderFocusColor,\n },\n };\n },\n multiValue: (base) => ({\n ...base,\n background: \"transparent\",\n }),\n multiValueLabel: (\n base: CSSObjectWithLabel,\n { isDisabled }: MultiValueProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n color: !isDisabled ? base.color : formElements.input.disabledColor,\n background: formElements.multiSelect.background,\n order: \"1\",\n borderRadius: \"0 2px 2px 0\",\n paddingRight: \"6px\",\n paddingLeft: \"6px\",\n \".custom-multi-value\": {\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n }),\n multiValueRemove: (base: CSSObjectWithLabel) => ({\n ...base,\n background: formElements.multiSelect.background,\n borderRadius: \"2px 0 0 2px\",\n \":hover\": {\n cursor: \"pointer\",\n background: formElements.multiSelect.hoverClose,\n },\n }),\n option: (\n base: CSSObjectWithLabel,\n {\n isSelected,\n isFocused,\n isDisabled,\n }: OptionProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n const commonStyles: CSSObjectWithLabel = {\n overflow: allowTextWrap ? \"visible\" : \"hidden\",\n textOverflow: allowTextWrap ? \"unset\" : \"ellipsis\",\n wordBreak: allowTextWrap ? \"break-word\" : \"keep-all\",\n whiteSpace: allowTextWrap ? \"normal\" : \"nowrap\",\n };\n\n return {\n ...base,\n backgroundColor: isSelected\n ? formElements.input.borderFocus\n : !isFocused\n ? \"transparent\"\n : formElements.input.hoverColor,\n color: isSelected\n ? formElements.input.textColorFocused\n : isDisabled\n ? formElements.input.disabledColor\n : \"inherit\",\n borderRadius: \"none\",\n \"&:hover\": {\n color: isSelected\n ? formElements.input.textColorFocused\n : isDisabled\n ? formElements.input.disabledColor\n : formElements.input.textColor,\n backgroundColor: isFocused\n ? !isSelected\n ? formElements.input.hoverColor\n : formElements.input.borderFocus\n : \"transparent\",\n },\n cursor: isDisabled ? \"default\" : \"pointer\",\n \".custom-option\": {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n ...commonStyles,\n },\n \".label-text\": {\n flex: 1,\n ...commonStyles,\n },\n \".hint-text\": {\n color: formElements.input.disabledColor,\n marginLeft: \"5px\",\n textAlign: \"right\",\n ...commonStyles,\n },\n };\n },\n menuList: (base: CSSObjectWithLabel) => ({\n ...base,\n marginTop: \"0.5rem\",\n marginBottom: \"0.5rem\",\n padding: \"0\",\n \"::-webkit-scrollbar\": {\n width: \"5px\",\n },\n \"::-webkit-scrollbar-track\": {\n background: scrollbar.background,\n borderRadius: \"10px\",\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: scrollbar.color,\n borderRadius: \"10px\",\n },\n }),\n indicatorsContainer: (base: CSSObjectWithLabel) => ({\n ...base,\n // it is important to set the indicator size to the same height as the input to avoid centering issues\n height: `calc(${inputHeight[size]} - 2px)`,\n }),\n singleValue: (base) => ({\n ...base,\n \".custom-value\": {\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n }),\n});\n\nexport const customLabelStyles = ({ level }: { level: number }): SerializedStyles => {\n return css`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 0.5rem;\n padding-inline-start: ${level <= 1 ? \"0\" : `${0.5 * level}rem`};\n `;\n};\n"],"names":["portalSelectZIndex","selectContainer","_ref","_ref2","formElements","size","inline","isInlineFlex","minWidth","maxWidth","css","generic","required","input","infoTooltipColor","borderFocusColor","background","errors","errorBorderColor","inputHeight","borderFocus","process","env","NODE_ENV","resolveStyles","_ref3","menuMinWidth","_ref3$allowTextWrap","allowTextWrap","menu","base","_objectSpread","zIndex","menuPortal","placeholder","_ref4","isDisabled","fontStyle","color","disabledColor","placeholderColor","groupHeading","black","fontWeight","dropdownIndicator","_ref5","selectProps","transform","menuIsOpen","transition","iconColor","iconHoverColor","cursor","clearIndicator","_ref6","control","_ref7","isFocused","border","concat","disabledBorder","backgroundColor","disabledBackground","backgroundFocus","boxShadow","borderRadius","pointerEvents","borderColor","multiValue","multiValueLabel","_ref8","multiSelect","order","paddingRight","paddingLeft","wordBreak","overflow","textOverflow","whiteSpace","multiValueRemove","hoverClose","option","_ref9","isSelected","commonStyles","hoverColor","textColorFocused","textColor","display","justifyContent","alignItems","flex","marginLeft","textAlign","menuList","marginTop","marginBottom","padding","width","scrollbar","indicatorsContainer","height","singleValue","customLabelStyles","_ref0","level"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAMA,kBAAkB,GAAG,IAAI,CAAA;AAExB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAAC,KAAA,EAAA;AAAA,EAAA,IACxBC,YAAY,GAAAF,IAAA,CAAZE,YAAY,CAAA;AAAA,EAAA,IAEZC,IAAI,G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CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAA,EAAA,GAAA,2BAAA,CAAA,CAAA;AAElE;;;;"}
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../src/components/FormElements/Select/styles.ts"],"sourcesContent":["import { css, SerializedStyles, Theme } from \"@emotion/react\";\nimport {\n CSSObjectWithLabel,\n ClearIndicatorProps,\n ControlProps,\n DropdownIndicatorProps,\n GroupBase,\n MultiValueProps,\n OptionProps,\n PlaceholderProps,\n StylesConfig,\n} from \"react-select\";\nimport { InputSize } from \"../Input/Input\";\nimport { inputHeight } from \"../styles\";\nimport { CustomOption } from \"./types\";\nimport { formElements, scrollbar } from \"@theme/default/config\";\n\nconst portalSelectZIndex = 9999;\n\nexport const selectContainer = (\n { formElements }: Theme,\n {\n size,\n inline,\n isInlineFlex,\n minWidth,\n maxWidth,\n }: {\n size: InputSize;\n inline: boolean;\n isInlineFlex: boolean;\n minWidth: string;\n maxWidth: string;\n },\n): SerializedStyles => css`\n display: ${isInlineFlex ? \"inline-flex\" : \"flex\"};\n flex-direction: ${inline ? \"row\" : \"column\"};\n gap: ${inline ? \"1rem\" : \"0.5rem\"};\n align-items: ${inline ? \"center\" : \"normal\"};\n\n .label-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 0.25rem;\n\n label {\n margin: 0;\n\n &.required::after {\n content: \" *\";\n color: ${formElements.generic.required};\n }\n }\n\n div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n svg {\n color: ${formElements.input.infoTooltipColor};\n &:hover {\n cursor: pointer;\n }\n }\n }\n\n .select-create-label {\n display: flex;\n justify-content: space-between;\n padding-inline-end: 1rem;\n color: ${formElements.input.borderFocusColor};\n\n svg {\n color: ${formElements.input.borderFocusColor};\n\n line-height: 0;\n }\n }\n\n .select-input-wrapper {\n min-width: ${minWidth};\n max-width: ${maxWidth};\n flex-grow: 1;\n background-color: ${formElements.input.background};\n border-radius: 0.3125rem;\n\n .error {\n border-color: ${formElements.errors.errorBorderColor};\n }\n\n .control-${size} {\n /* minus border */\n &:hover,\n &.focused {\n border: 1px solid ${formElements.input.borderFocus};\n }\n\n min-height: calc(${inputHeight[size]} - 2px);\n }\n\n .selected {\n background-color: ${formElements.input.borderFocus};\n }\n\n .option-${size} {\n padding: 0.3125rem 1rem;\n word-break: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding-inline-end: 1rem;\n width: auto;\n }\n }\n`;\n\nexport const resolveStyles = ({\n size,\n menuMinWidth,\n allowTextWrap = false,\n}: {\n size: InputSize;\n menuMinWidth?: number;\n allowTextWrap?: boolean;\n}): StylesConfig<CustomOption> => ({\n menu: (base: CSSObjectWithLabel) => {\n return {\n ...base,\n zIndex: 1060,\n minWidth: menuMinWidth ?? \"auto\",\n };\n },\n // Modal overlays use a z-index of 9998\n // To ensure the menu appears on top, set its z-index to at least 9999\n menuPortal: (base) => ({ ...base, zIndex: portalSelectZIndex }),\n placeholder: (\n base: CSSObjectWithLabel,\n { isDisabled }: PlaceholderProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n return {\n ...base,\n fontStyle: \"italic\",\n color: isDisabled ? formElements.input.disabledColor : formElements.input.placeholderColor,\n };\n },\n groupHeading: (base: CSSObjectWithLabel) => ({\n ...base,\n color: formElements.generic.black,\n fontWeight: 700,\n }),\n dropdownIndicator: (\n base: CSSObjectWithLabel,\n { selectProps }: DropdownIndicatorProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n transform: selectProps.menuIsOpen ? \"rotate(-180deg)\" : \"rotate(0)\",\n transition: \"all .2s ease\",\n color: selectProps.isDisabled ? base.color : formElements.input.iconColor,\n \"&:hover\": {\n color: formElements.input.iconHoverColor,\n cursor: !selectProps.isDisabled ? \"pointer\" : \"not-allowed\",\n },\n }),\n clearIndicator: (\n base: CSSObjectWithLabel,\n { selectProps }: ClearIndicatorProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n color: selectProps.isDisabled ? base.color : formElements.input.iconColor,\n \"&:hover\": { color: formElements.input.iconHoverColor, cursor: \"pointer\" },\n }),\n control: (\n base: CSSObjectWithLabel,\n { isFocused, isDisabled }: ControlProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n const border = isDisabled\n ? `1px solid ${formElements.input.disabledBorder}`\n : isFocused\n ? `1px solid ${formElements.input.borderFocusColor}`\n : // default case, set border equal to the background color to avoid pixel shift\n `1px solid ${formElements.input.background}`;\n const backgroundColor = isDisabled\n ? formElements.input.disabledBackground\n : isFocused\n ? formElements.input.backgroundFocus\n : \"formElements.input.background;\";\n\n return {\n ...base,\n border,\n backgroundColor,\n boxShadow: \"none\",\n borderRadius: \"5px\",\n color: !isDisabled ? base.color : formElements.input.disabledColor,\n cursor: !isDisabled ? \"pointer\" : \"not-allowed\",\n pointerEvents: \"auto\",\n \"&:hover\": {\n borderColor: isDisabled\n ? formElements.input.disabledBorder\n : formElements.input.borderFocusColor,\n },\n };\n },\n multiValue: (base) => ({\n ...base,\n background: \"transparent\",\n }),\n multiValueLabel: (\n base: CSSObjectWithLabel,\n { isDisabled }: MultiValueProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => ({\n ...base,\n color: !isDisabled ? base.color : formElements.input.disabledColor,\n background: formElements.multiSelect.background,\n order: \"1\",\n borderRadius: \"0 2px 2px 0\",\n paddingRight: \"6px\",\n paddingLeft: \"6px\",\n \".custom-multi-value\": {\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n }),\n multiValueRemove: (base: CSSObjectWithLabel) => ({\n ...base,\n background: formElements.multiSelect.background,\n borderRadius: \"2px 0 0 2px\",\n \":hover\": {\n cursor: \"pointer\",\n background: formElements.multiSelect.hoverClose,\n },\n }),\n option: (\n base: CSSObjectWithLabel,\n {\n isSelected,\n isFocused,\n isDisabled,\n }: OptionProps<CustomOption, boolean, GroupBase<CustomOption>>,\n ) => {\n const commonStyles: CSSObjectWithLabel = {\n overflow: allowTextWrap ? \"visible\" : \"hidden\",\n textOverflow: allowTextWrap ? \"unset\" : \"ellipsis\",\n wordBreak: allowTextWrap ? \"break-word\" : \"keep-all\",\n whiteSpace: allowTextWrap ? \"normal\" : \"nowrap\",\n };\n\n return {\n ...base,\n backgroundColor: isSelected\n ? formElements.input.borderFocus\n : !isFocused\n ? \"transparent\"\n : formElements.input.hoverColor,\n color: isSelected\n ? formElements.input.textColorFocused\n : isDisabled\n ? formElements.input.disabledColor\n : \"inherit\",\n borderRadius: \"none\",\n \"&:hover\": {\n color: isSelected\n ? formElements.input.textColorFocused\n : isDisabled\n ? formElements.input.disabledColor\n : formElements.input.textColor,\n backgroundColor: isFocused\n ? !isSelected\n ? formElements.input.hoverColor\n : formElements.input.borderFocus\n : \"transparent\",\n },\n cursor: isDisabled ? \"default\" : \"pointer\",\n \".custom-option\": {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n ...commonStyles,\n },\n \".label-text\": {\n flex: 1,\n ...commonStyles,\n },\n \".hint-text\": {\n color: formElements.input.disabledColor,\n marginLeft: \"5px\",\n textAlign: \"right\",\n ...commonStyles,\n },\n };\n },\n menuList: (base: CSSObjectWithLabel) => ({\n ...base,\n marginTop: \"0.5rem\",\n marginBottom: \"0.5rem\",\n padding: \"0\",\n \"::-webkit-scrollbar\": {\n width: \"5px\",\n },\n \"::-webkit-scrollbar-track\": {\n background: scrollbar.background,\n borderRadius: \"10px\",\n },\n \"::-webkit-scrollbar-thumb\": {\n backgroundColor: scrollbar.color,\n borderRadius: \"10px\",\n },\n }),\n indicatorsContainer: (base: CSSObjectWithLabel) => ({\n ...base,\n // it is important to set the indicator size to the same height as the input to avoid centering issues\n height: `calc(${inputHeight[size]} - 2px)`,\n }),\n singleValue: (base) => ({\n ...base,\n \".custom-value\": {\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n }),\n});\n\nexport const customLabelStyles = ({ level }: { level: number }): SerializedStyles => {\n return css`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 0.5rem;\n padding-inline-start: ${level <= 1 ? \"0\" : `${0.5 * level}rem`};\n `;\n};\n"],"names":["portalSelectZIndex","selectContainer","_ref","_ref2","formElements","size","inline","isInlineFlex","minWidth","maxWidth","css","generic","required","input","infoTooltipColor","borderFocusColor","background","errors","errorBorderColor","inputHeight","borderFocus","process","env","NODE_ENV","resolveStyles","_ref3","menuMinWidth","_ref3$allowTextWrap","allowTextWrap","menu","base","_objectSpread","zIndex","menuPortal","placeholder","_ref4","isDisabled","fontStyle","color","disabledColor","placeholderColor","groupHeading","black","fontWeight","dropdownIndicator","_ref5","selectProps","transform","menuIsOpen","transition","iconColor","iconHoverColor","cursor","clearIndicator","_ref6","control","_ref7","isFocused","border","concat","disabledBorder","backgroundColor","disabledBackground","backgroundFocus","boxShadow","borderRadius","pointerEvents","borderColor","multiValue","multiValueLabel","_ref8","multiSelect","order","paddingRight","paddingLeft","wordBreak","overflow","textOverflow","whiteSpace","multiValueRemove","hoverClose","option","_ref9","isSelected","commonStyles","hoverColor","textColorFocused","textColor","display","justifyContent","alignItems","flex","marginLeft","textAlign","menuList","marginTop","marginBottom","padding","width","scrollbar","indicatorsContainer","height","singleValue","customLabelStyles","_ref0","level"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAMA,kBAAkB,GAAG,IAAI,CAAA;AAExB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAAC,KAAA,EAAA;AAAA,EAAA,IACxBC,YAAY,GAAAF,IAAA,CAAZE,YAAY,CAAA;AAAA,EAAA,IAEZC,IAAI,GAAAF,KAAA,CAAJE,IAAI;IACJC,MAAM,GAAAH,KAAA,CAANG,MAAM;IACNC,YAAY,GAAAJ,KAAA,CAAZI,YAAY;IACZC,QAAQ,GAAAL,KAAA,CAARK,QAAQ;IACRC,QAAQ,G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
58
|
import '../Input/styles.js';
|
|
59
59
|
import '../../../../node_modules/core-js/modules/es.regexp.exec.js';
|
|
60
60
|
import '../../../../node_modules/core-js/modules/es.array.some.js';
|
|
61
|
+
import '../../SegmentedButtons/styles.js';
|
|
61
62
|
import '../../Toast/ToastNotifications.js';
|
|
62
63
|
import '../../../../node_modules/core-js/modules/es.function.name.js';
|
|
63
64
|
import '../../../theme/default/config/button.js';
|
|
@@ -68,6 +69,7 @@ import '../../../theme/default/config/progressBar.js';
|
|
|
68
69
|
import '../../../theme/default/config/table.js';
|
|
69
70
|
import '../../../theme/default/config/tag.js';
|
|
70
71
|
import '../../../theme/default/config/pagination.js';
|
|
72
|
+
import '../../../theme/default/config/segmentedButtons.js';
|
|
71
73
|
import '../../../theme/default/config/statusTag.js';
|
|
72
74
|
|
|
73
75
|
var TooltipIcon = function TooltipIcon(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleLabel.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleLabel.tsx"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport { Text, Tooltip } from \"../../../\";\nimport { InfoIconSVG } from \"../../../icons\";\n\ntype ToggleLabelProps = {\n label: string;\n position: \"before\" | \"after\";\n description?: string;\n tooltip?: string;\n required?: boolean;\n notSwitchedOff?: boolean;\n hasDescription?: boolean;\n onClick: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\ntype TooltipIconProps = {\n tooltip: string;\n};\n\nconst TooltipIcon: React.FC<TooltipIconProps> = ({ tooltip }) => (\n <Tooltip content={tooltip} parentProps={{ \"aria-label\": tooltip }}>\n <InfoIconSVG height={16} />\n </Tooltip>\n);\n\nconst labelClassNames = (\n customClassName: string,\n notSwitchedOff: boolean,\n isRequired: boolean,\n): string =>\n classNames(customClassName, {\n \"toggle-switch__label--binary-bold\": notSwitchedOff,\n \"toggle-switch__label--required\": isRequired,\n });\n\nconst ToggleLabel: React.FC<ToggleLabelProps> = ({\n label,\n position,\n description,\n tooltip,\n required = false,\n notSwitchedOff = false,\n hasDescription = false,\n onClick,\n}) => {\n const hasDescriptionTextWeight = hasDescription ? \"700\" : \"400\";\n const isBeforeLabel = position === \"before\";\n\n return (\n <div className={`toggle-switch__label-container toggle-switch__label-container--${position}`}>\n <Text\n fontSize=\"sm\"\n className={labelClassNames(\n `toggle-switch__label ${isBeforeLabel ? \"toggle-switch__label--before\" : \"\"}`,\n notSwitchedOff,\n required,\n )}\n onClick={onClick}\n as=\"div\"\n weight={hasDescriptionTextWeight}\n >\n {tooltip && isBeforeLabel && <TooltipIcon tooltip={tooltip} />}\n {label}\n {tooltip && !isBeforeLabel && <TooltipIcon tooltip={tooltip} />}\n </Text>\n {description && (\n <Text fontSize=\"sm\" as=\"div\" className=\"toggle-switch__description\">\n {description}\n </Text>\n )}\n </div>\n );\n};\n\nexport default ToggleLabel;\n"],"names":["TooltipIcon","_ref","tooltip","___EmotionJSX","Tooltip","content","parentProps","InfoIconSVG","height","labelClassNames","customClassName","notSwitchedOff","isRequired","classNames","ToggleLabel","_ref2","label","position","description","_ref2$required","required","_ref2$notSwitchedOff","_ref2$hasDescription","hasDescription","onClick","hasDescriptionTextWeight","isBeforeLabel","className","concat","Text","fontSize","as","weight"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleLabel.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleLabel.tsx"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport { Text, Tooltip } from \"../../../\";\nimport { InfoIconSVG } from \"../../../icons\";\n\ntype ToggleLabelProps = {\n label: string;\n position: \"before\" | \"after\";\n description?: string;\n tooltip?: string;\n required?: boolean;\n notSwitchedOff?: boolean;\n hasDescription?: boolean;\n onClick: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\ntype TooltipIconProps = {\n tooltip: string;\n};\n\nconst TooltipIcon: React.FC<TooltipIconProps> = ({ tooltip }) => (\n <Tooltip content={tooltip} parentProps={{ \"aria-label\": tooltip }}>\n <InfoIconSVG height={16} />\n </Tooltip>\n);\n\nconst labelClassNames = (\n customClassName: string,\n notSwitchedOff: boolean,\n isRequired: boolean,\n): string =>\n classNames(customClassName, {\n \"toggle-switch__label--binary-bold\": notSwitchedOff,\n \"toggle-switch__label--required\": isRequired,\n });\n\nconst ToggleLabel: React.FC<ToggleLabelProps> = ({\n label,\n position,\n description,\n tooltip,\n required = false,\n notSwitchedOff = false,\n hasDescription = false,\n onClick,\n}) => {\n const hasDescriptionTextWeight = hasDescription ? \"700\" : \"400\";\n const isBeforeLabel = position === \"before\";\n\n return (\n <div className={`toggle-switch__label-container toggle-switch__label-container--${position}`}>\n <Text\n fontSize=\"sm\"\n className={labelClassNames(\n `toggle-switch__label ${isBeforeLabel ? \"toggle-switch__label--before\" : \"\"}`,\n notSwitchedOff,\n required,\n )}\n onClick={onClick}\n as=\"div\"\n weight={hasDescriptionTextWeight}\n >\n {tooltip && isBeforeLabel && <TooltipIcon tooltip={tooltip} />}\n {label}\n {tooltip && !isBeforeLabel && <TooltipIcon tooltip={tooltip} />}\n </Text>\n {description && (\n <Text fontSize=\"sm\" as=\"div\" className=\"toggle-switch__description\">\n {description}\n </Text>\n )}\n </div>\n );\n};\n\nexport default ToggleLabel;\n"],"names":["TooltipIcon","_ref","tooltip","___EmotionJSX","Tooltip","content","parentProps","InfoIconSVG","height","labelClassNames","customClassName","notSwitchedOff","isRequired","classNames","ToggleLabel","_ref2","label","position","description","_ref2$required","required","_ref2$notSwitchedOff","_ref2$hasDescription","hasDescription","onClick","hasDescriptionTextWeight","isBeforeLabel","className","concat","Text","fontSize","as","weight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMA,WAAuC,GAAG,SAA1CA,WAAuCA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,OAAO,GAAAD,IAAA,CAAPC,OAAO,CAAA;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Aa,GAAGT,QAAQ,KAAK,QAAQ,CAAA;AAE3C,EAAA,OACEd,GAAA,CAAA,KAAA,EAAA;IAAKwB,SAAS,EAAA,iEAAA,CAAAC,MAAA,CAAoEX,QAAQ,CAAA;GACxFd,EAAAA,GAAA,CAAC0B,IAAI,EAAA;AACHC,IAAAA,QAAQ,EAAC,IAAI;AACbH,IAAAA,SAAS,EAAElB,eAAe,CAAAmB,uBAAAA,CAAAA,MAAA,CACAF,aAAa,GAAG,8BAA8B,GAAG,EAAE,CAAA,EAC3Ef,cAAc,EACdS,QACF,CAAE;AACFI,IAAAA,OAAO,EAAEA,OAAQ;AACjBO,IAAAA,EAAE,EAAC,KAAK;AACRC,IAAAA,MAAM,EAAEP,wBAAAA;AAAyB,GAAA,EAEhCvB,OAAO,IAAIwB,aAAa,IAAIvB,GAAA,CAACH,WAAW,EAAA;AAACE,IAAAA,OAAO,EAAEA,OAAAA;GAAU,CAAC,EAC7Dc,KAAK,EACLd,OAAO,IAAI,CAACwB,aAAa,IAAIvB,GAAA,CAACH,WAAW,EAAA;AAACE,IAAAA,OAAO,EAAEA,OAAAA;AAAQ,GAAE,CAC1D,CAAC,EACNgB,WAAW,IACVf,GAAA,CAAC0B,IAAI,EAAA;AAACC,IAAAA,QAAQ,EAAC,IAAI;AAACC,IAAAA,EAAE,EAAC,KAAK;AAACJ,IAAAA,SAAS,EAAC,4BAAA;GACpCT,EAAAA,WACG,CAEL,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -57,6 +57,7 @@ import '../../../../node_modules/core-js/modules/web.set-timeout.js';
|
|
|
57
57
|
import '../Input/styles.js';
|
|
58
58
|
import '../../../../node_modules/core-js/modules/es.regexp.exec.js';
|
|
59
59
|
import '../../../../node_modules/core-js/modules/es.array.some.js';
|
|
60
|
+
import '../../SegmentedButtons/styles.js';
|
|
60
61
|
import '../../Toast/ToastNotifications.js';
|
|
61
62
|
import '../../../../node_modules/core-js/modules/es.function.name.js';
|
|
62
63
|
import '../../../theme/default/config/button.js';
|
|
@@ -67,6 +68,7 @@ import '../../../theme/default/config/progressBar.js';
|
|
|
67
68
|
import '../../../theme/default/config/table.js';
|
|
68
69
|
import '../../../theme/default/config/tag.js';
|
|
69
70
|
import '../../../theme/default/config/pagination.js';
|
|
71
|
+
import '../../../theme/default/config/segmentedButtons.js';
|
|
70
72
|
import '../../../theme/default/config/statusTag.js';
|
|
71
73
|
import ToggleLabel from './ToggleLabel.js';
|
|
72
74
|
import ToggleSwitchCore from './ToggleSwitchCore.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitch.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleSwitch.tsx"],"sourcesContent":["import React, { useState, useEffect, useImperativeHandle, forwardRef } from \"react\";\nimport { SerializedStyles } from \"@emotion/utils\";\nimport { Text } from \"../../../\";\nimport ToggleLabel from \"./ToggleLabel\";\nimport ToggleSwitchCore from \"./ToggleSwitchCore\";\nimport { ToggleContainer } from \"./styles\";\n\ntype ToggleSpecificProps = {\n id: string;\n labelBefore?: string;\n labelAfter?: string;\n defaultChecked?: boolean;\n description?: string;\n labelledById?: string;\n isDisabled?: boolean;\n required?: boolean;\n tooltip?: string;\n variant?: \"primary\" | \"success\";\n showOutlineBorder?: boolean;\n size?: \"sm\" | \"md\";\n notSwitchedOff?: boolean;\n preventToggle?: boolean;\n subtitle?: string;\n hasInlineText?: boolean;\n inlineTextTranslations?: {\n enabled: string;\n disabled: string;\n };\n InternalIcon?: JSX.Element;\n onChange?: (isChecked: boolean) => void;\n};\n\ntype InputHTMLProps = Omit<React.ComponentPropsWithoutRef<\"input\">, keyof ToggleSpecificProps>;\n\nexport type ToggleProps = ToggleSpecificProps & InputHTMLProps;\n\nexport type ToggleSwitchHandlers = {\n toggle: () => void;\n};\n\nconst ToggleSwitch: React.ForwardRefRenderFunction<ToggleSwitchHandlers, ToggleProps> = (\n {\n id,\n labelBefore,\n labelAfter,\n description,\n labelledById,\n defaultChecked = false,\n preventToggle = false,\n isDisabled = false,\n required = false,\n hasInlineText = false,\n inlineTextTranslations = { enabled: \"Enabled\", disabled: \"Disabled\" },\n variant = \"primary\",\n showOutlineBorder = false,\n notSwitchedOff = false,\n size = \"sm\",\n subtitle = \"\",\n tooltip,\n InternalIcon,\n onChange,\n ...rest\n },\n ref,\n) => {\n const [isChecked, setIsChecked] = useState(defaultChecked);\n const hasDescription = Boolean(description);\n\n useEffect(() => {\n setIsChecked(defaultChecked);\n }, [defaultChecked]);\n\n const handleToggle = (\n e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>,\n ): void => {\n e.stopPropagation();\n\n if (isDisabled) return;\n\n if (!preventToggle) {\n setIsChecked((prev) => {\n const newValue = !prev;\n onChange?.(newValue);\n return newValue;\n });\n } else {\n onChange?.(isChecked);\n }\n };\n\n useImperativeHandle(ref, () => ({\n toggle: () => setIsChecked((prev) => !prev),\n }));\n\n return (\n <div\n id={id}\n tabIndex={0}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => e.key === \"Enter\" && handleToggle(e)}\n css={(theme): SerializedStyles =>\n ToggleContainer(theme, {\n isChecked,\n isDisabled,\n hasDescription,\n notSwitchedOff,\n showOutlineBorder,\n variant,\n size,\n })\n }\n data-testid={id}\n data-checked={isChecked}\n aria-label={tooltip}\n {...rest}\n >\n <div className=\"toggle-switch__container\">\n {labelBefore && (\n <ToggleLabel\n label={labelBefore}\n position=\"before\"\n description={description}\n tooltip={tooltip}\n notSwitchedOff={notSwitchedOff}\n hasDescription={hasDescription}\n onClick={handleToggle}\n />\n )}\n\n <ToggleSwitchCore\n isChecked={isChecked}\n variant={variant}\n size={size}\n hasInlineText={hasInlineText}\n inlineTextTranslations={inlineTextTranslations}\n InternalIcon={InternalIcon}\n labelledById={labelledById}\n onClick={handleToggle}\n />\n\n {labelAfter && (\n <ToggleLabel\n label={labelAfter}\n position=\"after\"\n description={description}\n tooltip={tooltip}\n required={required}\n notSwitchedOff={notSwitchedOff}\n hasDescription={hasDescription}\n onClick={handleToggle}\n />\n )}\n </div>\n\n {subtitle && (\n <div className=\"toggle-switch__subtitle\">\n <Text fontSize=\"sm\">{subtitle}</Text>\n </div>\n )}\n </div>\n );\n};\n\nexport default forwardRef(ToggleSwitch);\n"],"names":["ToggleSwitch","_ref","ref","id","labelBefore","labelAfter","description","labelledById","_ref$defaultChecked","defaultChecked","_ref$preventToggle","preventToggle","_ref$isDisabled","isDisabled","_ref$required","required","_ref$hasInlineText","hasInlineText","_ref$inlineTextTransl","inlineTextTranslations","enabled","disabled","_ref$variant","variant","_ref$showOutlineBorde","showOutlineBorder","_ref$notSwitchedOff","notSwitchedOff","_ref$size","size","_ref$subtitle","subtitle","tooltip","InternalIcon","onChange","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","hasDescription","Boolean","useEffect","handleToggle","e","stopPropagation","prev","newValue","useImperativeHandle","toggle","___EmotionJSX","_extends","tabIndex","onKeyDown","key","css","theme","ToggleContainer","className","ToggleLabel","label","position","onClick","ToggleSwitchCore","Text","fontSize","forwardRef"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleSwitch.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleSwitch.tsx"],"sourcesContent":["import React, { useState, useEffect, useImperativeHandle, forwardRef } from \"react\";\nimport { SerializedStyles } from \"@emotion/utils\";\nimport { Text } from \"../../../\";\nimport ToggleLabel from \"./ToggleLabel\";\nimport ToggleSwitchCore from \"./ToggleSwitchCore\";\nimport { ToggleContainer } from \"./styles\";\n\ntype ToggleSpecificProps = {\n id: string;\n labelBefore?: string;\n labelAfter?: string;\n defaultChecked?: boolean;\n description?: string;\n labelledById?: string;\n isDisabled?: boolean;\n required?: boolean;\n tooltip?: string;\n variant?: \"primary\" | \"success\";\n showOutlineBorder?: boolean;\n size?: \"sm\" | \"md\";\n notSwitchedOff?: boolean;\n preventToggle?: boolean;\n subtitle?: string;\n hasInlineText?: boolean;\n inlineTextTranslations?: {\n enabled: string;\n disabled: string;\n };\n InternalIcon?: JSX.Element;\n onChange?: (isChecked: boolean) => void;\n};\n\ntype InputHTMLProps = Omit<React.ComponentPropsWithoutRef<\"input\">, keyof ToggleSpecificProps>;\n\nexport type ToggleProps = ToggleSpecificProps & InputHTMLProps;\n\nexport type ToggleSwitchHandlers = {\n toggle: () => void;\n};\n\nconst ToggleSwitch: React.ForwardRefRenderFunction<ToggleSwitchHandlers, ToggleProps> = (\n {\n id,\n labelBefore,\n labelAfter,\n description,\n labelledById,\n defaultChecked = false,\n preventToggle = false,\n isDisabled = false,\n required = false,\n hasInlineText = false,\n inlineTextTranslations = { enabled: \"Enabled\", disabled: \"Disabled\" },\n variant = \"primary\",\n showOutlineBorder = false,\n notSwitchedOff = false,\n size = \"sm\",\n subtitle = \"\",\n tooltip,\n InternalIcon,\n onChange,\n ...rest\n },\n ref,\n) => {\n const [isChecked, setIsChecked] = useState(defaultChecked);\n const hasDescription = Boolean(description);\n\n useEffect(() => {\n setIsChecked(defaultChecked);\n }, [defaultChecked]);\n\n const handleToggle = (\n e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>,\n ): void => {\n e.stopPropagation();\n\n if (isDisabled) return;\n\n if (!preventToggle) {\n setIsChecked((prev) => {\n const newValue = !prev;\n onChange?.(newValue);\n return newValue;\n });\n } else {\n onChange?.(isChecked);\n }\n };\n\n useImperativeHandle(ref, () => ({\n toggle: () => setIsChecked((prev) => !prev),\n }));\n\n return (\n <div\n id={id}\n tabIndex={0}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => e.key === \"Enter\" && handleToggle(e)}\n css={(theme): SerializedStyles =>\n ToggleContainer(theme, {\n isChecked,\n isDisabled,\n hasDescription,\n notSwitchedOff,\n showOutlineBorder,\n variant,\n size,\n })\n }\n data-testid={id}\n data-checked={isChecked}\n aria-label={tooltip}\n {...rest}\n >\n <div className=\"toggle-switch__container\">\n {labelBefore && (\n <ToggleLabel\n label={labelBefore}\n position=\"before\"\n description={description}\n tooltip={tooltip}\n notSwitchedOff={notSwitchedOff}\n hasDescription={hasDescription}\n onClick={handleToggle}\n />\n )}\n\n <ToggleSwitchCore\n isChecked={isChecked}\n variant={variant}\n size={size}\n hasInlineText={hasInlineText}\n inlineTextTranslations={inlineTextTranslations}\n InternalIcon={InternalIcon}\n labelledById={labelledById}\n onClick={handleToggle}\n />\n\n {labelAfter && (\n <ToggleLabel\n label={labelAfter}\n position=\"after\"\n description={description}\n tooltip={tooltip}\n required={required}\n notSwitchedOff={notSwitchedOff}\n hasDescription={hasDescription}\n onClick={handleToggle}\n />\n )}\n </div>\n\n {subtitle && (\n <div className=\"toggle-switch__subtitle\">\n <Text fontSize=\"sm\">{subtitle}</Text>\n </div>\n )}\n </div>\n );\n};\n\nexport default forwardRef(ToggleSwitch);\n"],"names":["ToggleSwitch","_ref","ref","id","labelBefore","labelAfter","description","labelledById","_ref$defaultChecked","defaultChecked","_ref$preventToggle","preventToggle","_ref$isDisabled","isDisabled","_ref$required","required","_ref$hasInlineText","hasInlineText","_ref$inlineTextTransl","inlineTextTranslations","enabled","disabled","_ref$variant","variant","_ref$showOutlineBorde","showOutlineBorder","_ref$notSwitchedOff","notSwitchedOff","_ref$size","size","_ref$subtitle","subtitle","tooltip","InternalIcon","onChange","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","hasDescription","Boolean","useEffect","handleToggle","e","stopPropagation","prev","newValue","useImperativeHandle","toggle","___EmotionJSX","_extends","tabIndex","onKeyDown","key","css","theme","ToggleContainer","className","ToggleLabel","label","position","onClick","ToggleSwitchCore","Text","fontSize","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAMA,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EAuBnFC,GAAG,EACA;AAAA,EAAA,IAtBD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QAAQ,EAAC,IAAA;GAAMtC,EAAAA,QAAe,CACjC,CAEJ,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,qBAAeuC,aAAAA,UAAU,CAACtE,YAAY,CAAC;;;;"}
|
|
@@ -50,6 +50,7 @@ import '../../../../node_modules/core-js/modules/web.set-timeout.js';
|
|
|
50
50
|
import '../Input/styles.js';
|
|
51
51
|
import '../../../../node_modules/core-js/modules/es.regexp.exec.js';
|
|
52
52
|
import '../../../../node_modules/core-js/modules/es.array.some.js';
|
|
53
|
+
import '../../SegmentedButtons/styles.js';
|
|
53
54
|
import '../../Toast/ToastNotifications.js';
|
|
54
55
|
import '../../../../node_modules/core-js/modules/es.function.name.js';
|
|
55
56
|
import '../../../theme/default/config/button.js';
|
|
@@ -60,6 +61,7 @@ import '../../../theme/default/config/progressBar.js';
|
|
|
60
61
|
import '../../../theme/default/config/table.js';
|
|
61
62
|
import '../../../theme/default/config/tag.js';
|
|
62
63
|
import '../../../theme/default/config/pagination.js';
|
|
64
|
+
import '../../../theme/default/config/segmentedButtons.js';
|
|
63
65
|
import '../../../theme/default/config/statusTag.js';
|
|
64
66
|
import '../../../../node_modules/core-js/modules/es.symbol.constructor.js';
|
|
65
67
|
import '../../../../node_modules/core-js/modules/es.symbol.for.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleSwitchCore.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleSwitchCore.tsx"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport { Text } from \"../../../\";\n\nexport type ToggleSwitchVariant = \"primary\" | \"success\";\nexport type ToggleSwitchSize = \"sm\" | \"md\";\n\ntype ToggleSwitchCoreProps = {\n isChecked: boolean;\n variant: ToggleSwitchVariant;\n size: ToggleSwitchSize;\n hasInlineText?: boolean;\n inlineTextTranslations?: {\n enabled: string;\n disabled: string;\n };\n InternalIcon?: JSX.Element;\n labelledById?: string;\n onClick: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst switchClassNames = (customClassName: string, isMedium: boolean, isSuccess: boolean): string =>\n classNames(customClassName, {\n \"toggle-switch__switch--md\": isMedium,\n \"toggle-switch__switch--success\": isSuccess,\n });\n\nconst ToggleSwitchCore: React.FC<ToggleSwitchCoreProps> = ({\n isChecked,\n variant,\n size,\n hasInlineText = false,\n inlineTextTranslations = { enabled: \"Enabled\", disabled: \"Disabled\" },\n InternalIcon,\n labelledById,\n onClick,\n}) => {\n const isMedium = size === \"md\";\n const isSuccess = variant === \"success\";\n const hasIcon = Boolean(InternalIcon);\n\n return (\n <div className=\"toggle-switch__wrapper\">\n <div\n data-testid=\"switch\"\n data-checked={isChecked}\n className={switchClassNames(\"toggle-switch__switch\", isMedium, isSuccess)}\n onClick={onClick}\n role=\"switch\"\n aria-checked={isChecked}\n aria-labelledby={labelledById}\n >\n {hasInlineText && isMedium && (\n <Text fontSize=\"sm\" className=\"toggle-switch__inline-text\">\n {isChecked ? inlineTextTranslations.enabled : inlineTextTranslations.disabled}\n </Text>\n )}\n\n {hasIcon && <div className=\"toggle-switch__icon\">{InternalIcon}</div>}\n <div className={switchClassNames(\"toggle-switch__thumb\", isMedium, isSuccess)} />\n </div>\n </div>\n );\n};\n\nexport default ToggleSwitchCore;\n"],"names":["switchClassNames","customClassName","isMedium","isSuccess","classNames","ToggleSwitchCore","_ref","isChecked","variant","size","_ref$hasInlineText","hasInlineText","_ref$inlineTextTransl","inlineTextTranslations","enabled","disabled","InternalIcon","labelledById","onClick","hasIcon","Boolean","___EmotionJSX","className","role","Text","fontSize"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleSwitchCore.js","sources":["../../../../../../src/components/FormElements/ToggleSwitch/ToggleSwitchCore.tsx"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport { Text } from \"../../../\";\n\nexport type ToggleSwitchVariant = \"primary\" | \"success\";\nexport type ToggleSwitchSize = \"sm\" | \"md\";\n\ntype ToggleSwitchCoreProps = {\n isChecked: boolean;\n variant: ToggleSwitchVariant;\n size: ToggleSwitchSize;\n hasInlineText?: boolean;\n inlineTextTranslations?: {\n enabled: string;\n disabled: string;\n };\n InternalIcon?: JSX.Element;\n labelledById?: string;\n onClick: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst switchClassNames = (customClassName: string, isMedium: boolean, isSuccess: boolean): string =>\n classNames(customClassName, {\n \"toggle-switch__switch--md\": isMedium,\n \"toggle-switch__switch--success\": isSuccess,\n });\n\nconst ToggleSwitchCore: React.FC<ToggleSwitchCoreProps> = ({\n isChecked,\n variant,\n size,\n hasInlineText = false,\n inlineTextTranslations = { enabled: \"Enabled\", disabled: \"Disabled\" },\n InternalIcon,\n labelledById,\n onClick,\n}) => {\n const isMedium = size === \"md\";\n const isSuccess = variant === \"success\";\n const hasIcon = Boolean(InternalIcon);\n\n return (\n <div className=\"toggle-switch__wrapper\">\n <div\n data-testid=\"switch\"\n data-checked={isChecked}\n className={switchClassNames(\"toggle-switch__switch\", isMedium, isSuccess)}\n onClick={onClick}\n role=\"switch\"\n aria-checked={isChecked}\n aria-labelledby={labelledById}\n >\n {hasInlineText && isMedium && (\n <Text fontSize=\"sm\" className=\"toggle-switch__inline-text\">\n {isChecked ? inlineTextTranslations.enabled : inlineTextTranslations.disabled}\n </Text>\n )}\n\n {hasIcon && <div className=\"toggle-switch__icon\">{InternalIcon}</div>}\n <div className={switchClassNames(\"toggle-switch__thumb\", isMedium, isSuccess)} />\n </div>\n </div>\n );\n};\n\nexport default ToggleSwitchCore;\n"],"names":["switchClassNames","customClassName","isMedium","isSuccess","classNames","ToggleSwitchCore","_ref","isChecked","variant","size","_ref$hasInlineText","hasInlineText","_ref$inlineTextTransl","inlineTextTranslations","enabled","disabled","InternalIcon","labelledById","onClick","hasIcon","Boolean","___EmotionJSX","className","role","Text","fontSize"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqB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xBe,SAAS,EAAEtB,gBAAgB,CAAC,uBAAuB,EAAEE,QAAQ,EAAEC,SAAS,CAAE;AAC1Ee,IAAAA,OAAO,EAAEA,OAAQ;AACjBK,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,cAAA,EAAchB,SAAU;IACxB,iBAAiBU,EAAAA,YAAAA;AAAa,GAAA,EAE7BN,aAAa,IAAIT,QAAQ,IACxBmB,GAAA,CAACG,IAAI,EAAA;AAACC,IAAAA,QAAQ,EAAC,IAAI;AAACH,IAAAA,SAAS,EAAC,4BAAA;AAA4B,GAAA,EACvDf,SAAS,GAAGM,sBAAsB,CAACC,OAAO,GAAGD,sBAAsB,CAACE,QACjE,CACP,EAEAI,OAAO,IAAIE,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,qBAAA;GAAuBN,EAAAA,YAAkB,CAAC,EACrEK,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAEtB,gBAAgB,CAAC,sBAAsB,EAAEE,QAAQ,EAAEC,SAAS,CAAA;GAAI,CAC7E,CACF,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -18,6 +18,7 @@ import '../../theme/default/config/progressBar.js';
|
|
|
18
18
|
import '../../theme/default/config/table.js';
|
|
19
19
|
import '../../theme/default/config/tag.js';
|
|
20
20
|
import '../../theme/default/config/pagination.js';
|
|
21
|
+
import '../../theme/default/config/segmentedButtons.js';
|
|
21
22
|
import '../../theme/default/config/statusTag.js';
|
|
22
23
|
|
|
23
24
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../../src/components/Modal/styles.ts"],"sourcesContent":["import { css, Theme, SerializedStyles } from \"@emotion/react\";\nimport { Size } from \"./Modal\";\nimport { mq } from \"@theme/utils/breakpoints\";\nimport { modal } from \"@theme/default/config\";\n\nconst widthDimensions = {\n sm: \"32rem\",\n md: \"48rem\",\n lg: \"64rem\",\n fullscreen: \"100%\",\n};\n\nexport const modalContent = css`\n max-height: calc(90vh - 150px);\n overflow-y: auto;\n padding: 1.5rem;\n`;\n\nexport const modalHeader = ({ modal }: Theme): SerializedStyles => {\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.25rem;\n border-bottom: 1px solid ${modal.border};\n\n .close-btn {\n height: 32px;\n background: transparent;\n border: 0;\n margin: 0;\n padding: 0;\n\n svg {\n color: ${modal.color};\n\n &:hover {\n color: ${modal.iconHover};\n }\n }\n }\n `;\n};\n\nexport const modalFooter = ({ modal }: Theme): SerializedStyles => {\n return css`\n padding: 1.25rem;\n border-top: 1px solid ${modal.border};\n `;\n};\n\n// plain styles as string\nexport const portalStyles = (size: Size): SerializedStyles => {\n return css`\n .overlay-base {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background: rgba(0, 0, 0, 0.7);\n opacity: 0;\n z-index: 9999;\n transition: opacity 0.2s ease-in-out;\n\n &.overlay-before {\n opacity: 0;\n }\n }\n\n .overlay-after {\n opacity: 1;\n }\n\n .content-after {\n background-color: ${modal.content};\n height: 100%;\n width: 100%;\n border-radius: 0;\n\n ${mq[\"md\"]} {\n height: auto;\n border-radius: 5px;\n width: ${widthDimensions[size]};\n max-width: 90%;\n }\n\n ${size === \"fullscreen\" &&\n `\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n `}\n }\n `;\n};\n"],"names":["widthDimensions","sm","md","lg","fullscreen","modalContent","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","modalHeader","_ref","modal","css","border","color","iconHover","modalFooter","_ref2","portalStyles","size","content","mq"],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../src/components/Modal/styles.ts"],"sourcesContent":["import { css, Theme, SerializedStyles } from \"@emotion/react\";\nimport { Size } from \"./Modal\";\nimport { mq } from \"@theme/utils/breakpoints\";\nimport { modal } from \"@theme/default/config\";\n\nconst widthDimensions = {\n sm: \"32rem\",\n md: \"48rem\",\n lg: \"64rem\",\n fullscreen: \"100%\",\n};\n\nexport const modalContent = css`\n max-height: calc(90vh - 150px);\n overflow-y: auto;\n padding: 1.5rem;\n`;\n\nexport const modalHeader = ({ modal }: Theme): SerializedStyles => {\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.25rem;\n border-bottom: 1px solid ${modal.border};\n\n .close-btn {\n height: 32px;\n background: transparent;\n border: 0;\n margin: 0;\n padding: 0;\n\n svg {\n color: ${modal.color};\n\n &:hover {\n color: ${modal.iconHover};\n }\n }\n }\n `;\n};\n\nexport const modalFooter = ({ modal }: Theme): SerializedStyles => {\n return css`\n padding: 1.25rem;\n border-top: 1px solid ${modal.border};\n `;\n};\n\n// plain styles as string\nexport const portalStyles = (size: Size): SerializedStyles => {\n return css`\n .overlay-base {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background: rgba(0, 0, 0, 0.7);\n opacity: 0;\n z-index: 9999;\n transition: opacity 0.2s ease-in-out;\n\n &.overlay-before {\n opacity: 0;\n }\n }\n\n .overlay-after {\n opacity: 1;\n }\n\n .content-after {\n background-color: ${modal.content};\n height: 100%;\n width: 100%;\n border-radius: 0;\n\n ${mq[\"md\"]} {\n height: auto;\n border-radius: 5px;\n width: ${widthDimensions[size]};\n max-width: 90%;\n }\n\n ${size === \"fullscreen\" &&\n `\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n `}\n }\n `;\n};\n"],"names":["widthDimensions","sm","md","lg","fullscreen","modalContent","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","modalHeader","_ref","modal","css","border","color","iconHover","modalFooter","_ref2","portalStyles","size","content","mq"],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AAA,iDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,49FAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAA,EAAA,GAAA,qBAAA,CAAA,CAAA;AAExC,EAAC;;AAED;IACae,YAAY,GAAG,SAAfA,YAAYA,CAAIC,IAAU,EAAuB;AAC5D,EAAA,kCAAOP,GAAG,CAyBcD,oSAAAA,EAAAA,KAAK,CAACS,OAAO,8CAY/BD,IAAI,KAAK,YAAY,IAAA,oGAKxB,OAZGE,EAAE,CAAC,IAAI,CAAC,2CAGC1B,eAAe,CAACwB,IAAI,CAAC,yBAAAlB,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAAF,YAAAA,GAAAA,EAAAA,GAAAA,sBAAAA,CAAAA,EAAAA,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAA,EAAA,GAAA,i8FAAA,EAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAA,EAAA,GAAA,sBAAA,CAAA,CAAA;AAYtC;;;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* author: epignosis front-end team
|
|
5
|
+
* @epignosis_llc/gnosis.js v6.6.16
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
|
+
import '../../../node_modules/core-js/modules/es.array.map.js';
|
|
11
|
+
import 'react';
|
|
12
|
+
import classNames from '../../../node_modules/classnames/index.js';
|
|
13
|
+
import { segmentedButton, container } from './styles.js';
|
|
14
|
+
import { createElement as jsx } from '../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["options", "value", "onChange", "className", "ariaLabel"];
|
|
17
|
+
var getButtonClassName = function getButtonClassName(isSelected, showOnlyIcon) {
|
|
18
|
+
return classNames("segmented-buttons__button", {
|
|
19
|
+
"segmented-buttons__button--selected": isSelected,
|
|
20
|
+
"segmented-buttons__button--icon-only": showOnlyIcon
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var SegmentedButtons = function SegmentedButtons(_ref) {
|
|
24
|
+
var options = _ref.options,
|
|
25
|
+
value = _ref.value,
|
|
26
|
+
onChange = _ref.onChange,
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
ariaLabel = _ref.ariaLabel,
|
|
29
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
return jsx("div", _extends({
|
|
31
|
+
role: "group",
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
className: classNames("segmented-buttons", className),
|
|
34
|
+
css: container
|
|
35
|
+
}, rest), options.map(function (option, index) {
|
|
36
|
+
var Icon = option.icon;
|
|
37
|
+
var isSelected = option.value === value;
|
|
38
|
+
var hasLabel = Boolean(option.label);
|
|
39
|
+
var hasIcon = Boolean(Icon);
|
|
40
|
+
var showOnlyIcon = hasIcon && !hasLabel;
|
|
41
|
+
return jsx("button", {
|
|
42
|
+
key: option.value,
|
|
43
|
+
type: "button",
|
|
44
|
+
id: "segmented-button-".concat(index),
|
|
45
|
+
"data-testid": "segmented-buttons__button-".concat(index),
|
|
46
|
+
css: function css(theme) {
|
|
47
|
+
return segmentedButton(theme, {
|
|
48
|
+
isSelected: isSelected,
|
|
49
|
+
isFirst: index === 0,
|
|
50
|
+
isLast: index === options.length - 1,
|
|
51
|
+
hasLabel: hasLabel,
|
|
52
|
+
hasIcon: hasIcon
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
className: getButtonClassName(isSelected, showOnlyIcon),
|
|
56
|
+
disabled: option.disabled,
|
|
57
|
+
"aria-pressed": isSelected,
|
|
58
|
+
"aria-label": showOnlyIcon && typeof option.value === "string" ? option.value : undefined,
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
return onChange(option.value);
|
|
61
|
+
}
|
|
62
|
+
}, Icon && jsx(Icon, {
|
|
63
|
+
className: "segmented-buttons__icon",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
height: 16
|
|
66
|
+
}), hasLabel && jsx("span", {
|
|
67
|
+
className: "segmented-buttons__label"
|
|
68
|
+
}, option.label));
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export { SegmentedButtons as default };
|
|
73
|
+
//# sourceMappingURL=SegmentedButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedButtons.js","sources":["../../../../../src/components/SegmentedButtons/SegmentedButtons.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport { SerializedStyles } from \"@emotion/react\";\nimport classNames from \"classnames\";\nimport { container, segmentedButton } from \"./styles\";\nimport { IconType } from \"types/common\";\n\nexport type SegmentedButtonOption = {\n value: string;\n label?: ReactNode;\n icon?: IconType;\n disabled?: boolean;\n};\n\nexport type SegmentedButtonsProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"role\"\n> & {\n options: SegmentedButtonOption[];\n value: string;\n onChange: (value: string) => void;\n ariaLabel?: string;\n};\n\nconst getButtonClassName = (isSelected: boolean, showOnlyIcon: boolean): string =>\n classNames(\"segmented-buttons__button\", {\n \"segmented-buttons__button--selected\": isSelected,\n \"segmented-buttons__button--icon-only\": showOnlyIcon,\n });\n\nconst SegmentedButtons: FC<SegmentedButtonsProps> = ({\n options,\n value,\n onChange,\n className,\n ariaLabel,\n ...rest\n}) => {\n return (\n <div\n role=\"group\"\n aria-label={ariaLabel}\n className={classNames(\"segmented-buttons\", className)}\n css={container}\n {...rest}\n >\n {options.map((option, index) => {\n const Icon = option.icon;\n const isSelected = option.value === value;\n const hasLabel = Boolean(option.label);\n const hasIcon = Boolean(Icon);\n const showOnlyIcon = hasIcon && !hasLabel;\n\n return (\n <button\n key={option.value}\n type=\"button\"\n id={`segmented-button-${index}`}\n data-testid={`segmented-buttons__button-${index}`}\n css={(theme): SerializedStyles =>\n segmentedButton(theme, {\n isSelected,\n isFirst: index === 0,\n isLast: index === options.length - 1,\n hasLabel,\n hasIcon,\n })\n }\n className={getButtonClassName(isSelected, showOnlyIcon)}\n disabled={option.disabled}\n aria-pressed={isSelected}\n aria-label={showOnlyIcon && typeof option.value === \"string\" ? option.value : undefined}\n onClick={(): void => onChange(option.value)}\n >\n {Icon && <Icon className=\"segmented-buttons__icon\" aria-hidden=\"true\" height={16} />}\n {hasLabel && <span className=\"segmented-buttons__label\">{option.label}</span>}\n </button>\n );\n })}\n </div>\n );\n};\n\nexport default SegmentedButtons;\n"],"names":["getButtonClassName","isSelected","showOnlyIcon","classNames","SegmentedButtons","_ref","options","value","onChange","className","ariaLabel","rest","_objectWithoutProperties","_excluded","___EmotionJSX","_extends","role","css","container","map","option","index","Icon","icon","hasLabel","Boolean","label","hasIcon","key","type","id","concat","theme","segmentedButton","isFirst","isLast","length","disabled","undefined","onClick","height"],"mappings":";;;;;;;;;;;;;;;;AAuBA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,UAAmB,EAAEC,YAAqB,EAAA;EAAA,OACpEC,UAAU,CAAC,2BAA2B,EAAE;AACtC,IAAA,qCAAqC,EAAEF,UAAU;AACjD,IAAA,sCAAsC,EAAEC,YAAAA;AAC1C,GAAC,CAAC,CAAA;AAAA,CAAA,CAAA;AAEJ,IAAME,gBAA2C,GAAG,SAA9CA,gBAA2CA,CAAAC,IAAA,EAO3C;AAAA,EAAA,IANJC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,SAAS,GAAAL,IAAA,CAATK,SAAS;AACNC,IAAAA,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,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A,SAAS,EAAET,kBAAkB,CAACC,UAAU,EAAEC,YAAY,CAAE;MACxDmC,QAAQ,EAAEjB,MAAM,CAACiB,QAAS;AAC1B,MAAA,cAAA,EAAcpC,UAAW;AACzB,MAAA,YAAA,EAAYC,YAAY,IAAI,OAAOkB,MAAM,CAACb,KAAK,KAAK,QAAQ,GAAGa,MAAM,CAACb,KAAK,GAAG+B,SAAU;MACxFC,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,QAAA,OAAc/B,QAAQ,CAACY,MAAM,CAACb,KAAK,CAAC,CAAA;AAAA,OAAA;AAAC,KAAA,EAE3Ce,IAAI,IAAIR,GAAA,CAACQ,IAAI,EAAA;AAACb,MAAAA,SAAS,EAAC,yBAAyB;AAAC,MAAA,aAAA,EAAY,MAAM;AAAC+B,MAAAA,MAAM,EAAE,EAAA;AAAG,KAAE,CAAC,EACnFhB,QAAQ,IAAIV,GAAA,CAAA,MAAA,EAAA;AAAML,MAAAA,SAAS,EAAC,0BAAA;AAA0B,KAAA,EAAEW,MAAM,CAACM,KAAY,CACtE,CAAC,CAAA;AAEb,GAAC,CACE,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* author: epignosis front-end team
|
|
5
|
+
* @epignosis_llc/gnosis.js v6.6.16
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js';
|
|
10
|
+
|
|
11
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
12
|
+
var container = process.env.NODE_ENV === "production" ? {
|
|
13
|
+
name: "8irbms",
|
|
14
|
+
styles: "display:inline-flex;align-items:center"
|
|
15
|
+
} : {
|
|
16
|
+
name: "y2i3w0-container",
|
|
17
|
+
styles: "display:inline-flex;align-items:center;label:container;",
|
|
18
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFVNEIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBUaGVtZSwgU2VyaWFsaXplZFN0eWxlcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG50eXBlIFNlZ21lbnRlZEJ1dHRvbkF0dHJzID0ge1xuICBpc1NlbGVjdGVkOiBib29sZWFuO1xuICBpc0ZpcnN0OiBib29sZWFuO1xuICBpc0xhc3Q6IGJvb2xlYW47XG4gIGhhc0xhYmVsOiBib29sZWFuO1xuICBoYXNJY29uOiBib29sZWFuO1xufTtcblxuZXhwb3J0IGNvbnN0IGNvbnRhaW5lciA9IGNzc2BcbiAgZGlzcGxheTogaW5saW5lLWZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xuXG5leHBvcnQgY29uc3Qgc2VnbWVudGVkQnV0dG9uID0gKFxuICB7IHR5cGVTY2FsZVNpemVzLCBzZWdtZW50ZWRCdXR0b25zIH06IFRoZW1lLFxuICB7IGlzU2VsZWN0ZWQsIGlzRmlyc3QsIGlzTGFzdCwgaGFzTGFiZWwsIGhhc0ljb24gfTogU2VnbWVudGVkQnV0dG9uQXR0cnMsXG4pOiBTZXJpYWxpemVkU3R5bGVzID0+IHtcbiAgY29uc3Qgc3RhdGUgPSBpc1NlbGVjdGVkID8gc2VnbWVudGVkQnV0dG9ucy5hY3RpdmUgOiBzZWdtZW50ZWRCdXR0b25zLmRlZmF1bHQ7XG4gIGNvbnN0IGljb25Pbmx5ID0gaGFzSWNvbiAmJiAhaGFzTGFiZWw7XG4gIGNvbnN0IGljb25Bbm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bG93ZWQ7XG4gICAgfVxuICBgO1xufTtcbiJdfQ== */",
|
|
19
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
|
+
};
|
|
21
|
+
var segmentedButton = function segmentedButton(_ref, _ref2) {
|
|
22
|
+
var typeScaleSizes = _ref.typeScaleSizes,
|
|
23
|
+
segmentedButtons = _ref.segmentedButtons;
|
|
24
|
+
var isSelected = _ref2.isSelected,
|
|
25
|
+
isFirst = _ref2.isFirst,
|
|
26
|
+
isLast = _ref2.isLast,
|
|
27
|
+
hasLabel = _ref2.hasLabel,
|
|
28
|
+
hasIcon = _ref2.hasIcon;
|
|
29
|
+
var state = isSelected ? segmentedButtons.active : segmentedButtons["default"];
|
|
30
|
+
var iconOnly = hasIcon && !hasLabel;
|
|
31
|
+
var iconAndLabel = hasIcon && hasLabel;
|
|
32
|
+
var horizontalPadding = iconOnly ? "0.5rem" : iconAndLabel ? "0.75rem" : "1.5rem";
|
|
33
|
+
return /*#__PURE__*/ /*#__PURE__*/css("display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;height:2.5rem;min-width:2.5rem;padding:0 ", horizontalPadding, ";background:", state.background, ";border:1px solid ", state.borderColor, ";border-inline-start-width:", isFirst ? "1px" : "0", ";border-start-start-radius:", isFirst ? "5px" : "0", ";border-end-start-radius:", isFirst ? "5px" : "0", ";border-start-end-radius:", isLast ? "5px" : "0", ";border-end-end-radius:", isLast ? "5px" : "0", ";color:", state.color, ";font-family:inherit;font-size:", typeScaleSizes.sm, ";font-weight:700;line-height:1;cursor:pointer;transition:background-color 0.2s ease-in,color 0.2s ease-in,border-color 0.2s ease-in;.segmented-buttons__icon{color:currentColor;flex-shrink:0;}&:hover:not(:disabled):not(.segmented-buttons__button--selected){background:", segmentedButtons.hover.background, ";border-color:", segmentedButtons.hover.borderColor, ";color:", segmentedButtons.hover.color, ";}&:focus-visible{outline:1px solid ", segmentedButtons.hover.borderColor, ";outline-offset:2px;}&:disabled{background:", segmentedButtons.disabled.background, ";border-color:", segmentedButtons.disabled.borderColor, ";color:", segmentedButtons.disabled.color, ";cursor:not-allowed;}" + (process.env.NODE_ENV === "production" ? "" : ";label:segmentedButton;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QlkiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBUaGVtZSwgU2VyaWFsaXplZFN0eWxlcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG50eXBlIFNlZ21lbnRlZEJ1dHRvbkF0dHJzID0ge1xuICBpc1NlbGVjdGVkOiBib29sZWFuO1xuICBpc0ZpcnN0OiBib29sZWFuO1xuICBpc0xhc3Q6IGJvb2xlYW47XG4gIGhhc0xhYmVsOiBib29sZWFuO1xuICBoYXNJY29uOiBib29sZWFuO1xufTtcblxuZXhwb3J0IGNvbnN0IGNvbnRhaW5lciA9IGNzc2BcbiAgZGlzcGxheTogaW5saW5lLWZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xuXG5leHBvcnQgY29uc3Qgc2VnbWVudGVkQnV0dG9uID0gKFxuICB7IHR5cGVTY2FsZVNpemVzLCBzZWdtZW50ZWRCdXR0b25zIH06IFRoZW1lLFxuICB7IGlzU2VsZWN0ZWQsIGlzRmlyc3QsIGlzTGFzdCwgaGFzTGFiZWwsIGhhc0ljb24gfTogU2VnbWVudGVkQnV0dG9uQXR0cnMsXG4pOiBTZXJpYWxpemVkU3R5bGVzID0+IHtcbiAgY29uc3Qgc3RhdGUgPSBpc1NlbGVjdGVkID8gc2VnbWVudGVkQnV0dG9ucy5hY3RpdmUgOiBzZWdtZW50ZWRCdXR0b25zLmRlZmF1bHQ7XG4gIGNvbnN0IGljb25Pbmx5ID0gaGF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pc2FibGVkLmNvbG9yfTtcbiAgICAgIGN1cnNvcjogbm90LWFsbG93ZWQ7XG4gICAgfVxuICBgO1xufTtcbiJdfQ== */", process.env.NODE_ENV === "production" ? "" : ";label:segmentedButton;");
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { container, segmentedButton };
|
|
37
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../src/components/SegmentedButtons/styles.ts"],"sourcesContent":["import { css, Theme, SerializedStyles } from \"@emotion/react\";\n\ntype SegmentedButtonAttrs = {\n isSelected: boolean;\n isFirst: boolean;\n isLast: boolean;\n hasLabel: boolean;\n hasIcon: boolean;\n};\n\nexport const container = css`\n display: inline-flex;\n align-items: center;\n`;\n\nexport const segmentedButton = (\n { typeScaleSizes, segmentedButtons }: Theme,\n { isSelected, isFirst, isLast, hasLabel, hasIcon }: SegmentedButtonAttrs,\n): SerializedStyles => {\n const state = isSelected ? segmentedButtons.active : segmentedButtons.default;\n const iconOnly = hasIcon && !hasLabel;\n const iconAndLabel = hasIcon && hasLabel;\n\n const horizontalPadding = iconOnly ? \"0.5rem\" : iconAndLabel ? \"0.75rem\" : \"1.5rem\";\n\n return css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n height: 2.5rem;\n min-width: 2.5rem;\n padding: 0 ${horizontalPadding};\n background: ${state.background};\n border: 1px solid ${state.borderColor};\n border-inline-start-width: ${isFirst ? \"1px\" : \"0\"};\n border-start-start-radius: ${isFirst ? \"5px\" : \"0\"};\n border-end-start-radius: ${isFirst ? \"5px\" : \"0\"};\n border-start-end-radius: ${isLast ? \"5px\" : \"0\"};\n border-end-end-radius: ${isLast ? \"5px\" : \"0\"};\n color: ${state.color};\n font-family: inherit;\n font-size: ${typeScaleSizes.sm};\n font-weight: 700;\n line-height: 1;\n cursor: pointer;\n transition: background-color 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in;\n\n .segmented-buttons__icon {\n color: currentColor;\n flex-shrink: 0;\n }\n\n &:hover:not(:disabled):not(.segmented-buttons__button--selected) {\n background: ${segmentedButtons.hover.background};\n border-color: ${segmentedButtons.hover.borderColor};\n color: ${segmentedButtons.hover.color};\n }\n\n &:focus-visible {\n outline: 1px solid ${segmentedButtons.hover.borderColor};\n outline-offset: 2px;\n }\n\n &:disabled {\n background: ${segmentedButtons.disabled.background};\n border-color: ${segmentedButtons.disabled.borderColor};\n color: ${segmentedButtons.disabled.color};\n cursor: not-allowed;\n }\n `;\n};\n"],"names":["container","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","segmentedButton","_ref","_ref2","typeScaleSizes","segmentedButtons","isSelected","isFirst","isLast","hasLabel","hasIcon","state","active","iconOnly","iconAndLabel","horizontalPadding","css","background","borderColor","color","sm","hover","disabled"],"mappings":";;;;;;;;;;;IAUaA,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAA;EAAAC,IAAA,EAAA,QAAA;EAAAC,MAAA,EAAA,wCAAA;AAAA,CAAA,GAAA;EAAAD,IAAA,EAAA,kBAAA;EAAAC,MAAA,EAAA,yDAAA;EAAAC,GAAA,EAAA,isGAAA;AAAAC,EAAAA,QAAA,EAAAC,gCAAAA;AAAA,EAGrB;AAEM,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAAAC,KAAA,EAGL;AAAA,EAAA,IAFnBC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB,CAAA;AAAA,EAAA,IAChCC,UAAU,GAAAH,KAAA,CAAVG,UAAU;IAAEC,OAAO,GAAAJ,KAAA,CAAPI,OAAO;IAAEC,MAAM,GAAAL,KAAA,CAANK,MAAM;IAAEC,QAAQ,GAAAN,KAAA,CAARM,QAAQ;IAAEC,OAAO,GAAAP,KAAA,CAAPO,OAAO,CAA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