@wireapp/react-ui-kit 8.9.0 → 8.10.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +3 -2
  3. package/src/Form/Checkbox.js +9 -7
  4. package/src/Form/Checkbox.js.map +1 -1
  5. package/src/Form/Checkbox.md +4 -2
  6. package/src/Form/RangeInput.d.js +2 -0
  7. package/src/Form/RangeInput.d.js.map +1 -0
  8. package/src/Form/RangeInput.d.ts +11 -0
  9. package/src/Form/RangeInput.js +75 -0
  10. package/src/Form/RangeInput.js.map +1 -0
  11. package/src/Form/RangeInput.md +27 -0
  12. package/src/Form/RangeInput.styles.d.js +2 -0
  13. package/src/Form/RangeInput.styles.d.js.map +1 -0
  14. package/src/Form/RangeInput.styles.d.ts +9 -0
  15. package/src/Form/RangeInput.styles.js +76 -0
  16. package/src/Form/RangeInput.styles.js.map +1 -0
  17. package/src/Form/Select.d.js +4 -0
  18. package/src/Form/Select.d.ts +14 -15
  19. package/src/Form/Select.js +42 -319
  20. package/src/Form/Select.js.map +1 -1
  21. package/src/Form/Select.md +25 -26
  22. package/src/Form/SelectComponents.d.js +2 -0
  23. package/src/Form/SelectComponents.d.js.map +1 -0
  24. package/src/Form/SelectComponents.d.ts +12 -0
  25. package/src/Form/SelectComponents.js +176 -0
  26. package/src/Form/SelectComponents.js.map +1 -0
  27. package/src/Form/SelectStyles.d.js +2 -0
  28. package/src/Form/SelectStyles.d.js.map +1 -0
  29. package/src/Form/SelectStyles.d.ts +925 -0
  30. package/src/Form/SelectStyles.js +133 -0
  31. package/src/Form/SelectStyles.js.map +1 -0
  32. package/src/Form/index.d.js +13 -0
  33. package/src/Form/index.d.js.map +1 -1
  34. package/src/Form/index.d.ts +2 -0
  35. package/src/Form/index.js +13 -0
  36. package/src/Form/index.js.map +1 -1
  37. package/src/Icon/ArrowDown.d.js +2 -0
  38. package/src/Icon/ArrowDown.d.js.map +1 -0
  39. package/src/Icon/ArrowDown.d.ts +2 -0
  40. package/src/Icon/ArrowDown.js +45 -0
  41. package/src/Icon/ArrowDown.js.map +1 -0
  42. package/src/Layout/Theme.d.ts +1 -0
  43. package/src/Layout/Theme.js +4 -2
  44. package/src/Layout/Theme.js.map +1 -1
  45. package/src/util.d.ts +2 -0
  46. package/src/util.js +10 -1
  47. package/src/util.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.10.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/compare/@wireapp/react-ui-kit@8.9.0...@wireapp/react-ui-kit@8.10.0) (2022-07-25)
7
+
8
+
9
+ ### Features
10
+
11
+ * **react-ui-kit:** add custom RangeInput component (#SQSERVICES-758) ([#4342](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/issues/4342)) ([ff81011](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/commit/ff810113075b131f49a5362a0e270541aeb21973)), closes [#SQSERVICES-758](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/issues/SQSERVICES-758)
12
+ * **react-ui-kit:** add multiselect option to Select component ([#4326](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/issues/4326)) ([b08e8c6](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/commit/b08e8c6a7c25318217705a843a36825d34d48015))
13
+
14
+
15
+
16
+
17
+
6
18
  # [8.9.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/compare/@wireapp/react-ui-kit@8.8.4...@wireapp/react-ui-kit@8.9.0) (2022-07-19)
7
19
 
8
20
 
package/package.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "bazinga64": "5.10.0",
6
6
  "color": "3.1.3",
7
7
  "emotion-normalize": "11.0.1",
8
+ "react-select": "5.4.0",
8
9
  "react-transition-group": "4.4.2"
9
10
  },
10
11
  "devDependencies": {
@@ -69,6 +70,6 @@
69
70
  "test:update": "yarn test --updateSnapshot",
70
71
  "test:project": "yarn dist && yarn test"
71
72
  },
72
- "version": "8.9.0",
73
- "gitHead": "a53453a02b71cffb5639ad27f2e4da51635adfd3"
73
+ "version": "8.10.0",
74
+ "gitHead": "bd794e434b48bb978ea2ec071d4a772ca30f0964"
74
75
  }
@@ -25,7 +25,7 @@ var _util = require("../util");
25
25
 
26
26
  var _Input = require("./Input");
27
27
 
28
- var _excluded = ["id", "children", "style", "disabled"],
28
+ var _excluded = ["id", "children", "style", "disabled", "wrapperCSS"],
29
29
  _excluded2 = ["color"];
30
30
 
31
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -96,10 +96,12 @@ var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref)
96
96
  children = _ref2.children,
97
97
  style = _ref2.style,
98
98
  disabled = _ref2.disabled,
99
+ _ref2$wrapperCSS = _ref2.wrapperCSS,
100
+ wrapperCSS = _ref2$wrapperCSS === void 0 ? {} : _ref2$wrapperCSS,
99
101
  props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
100
102
  return (0, _react.jsx)("div", {
101
103
  css: function css(theme) {
102
- return (0, _defineProperty2["default"])({
104
+ return _objectSpread((0, _defineProperty2["default"])({
103
105
  alignItems: 'center',
104
106
  display: 'flex',
105
107
  justifyContent: 'flex-start',
@@ -108,7 +110,7 @@ var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref)
108
110
  }, ".".concat(_Input.INPUT_CLASSNAME, ":focus-visible + label"), {
109
111
  outline: "1px solid ".concat(theme.general.primaryColor),
110
112
  outlineOffset: '0.4rem'
111
- });
113
+ }), wrapperCSS);
112
114
  },
113
115
  style: style
114
116
  }, (0, _react.jsx)("input", (0, _extends2["default"])({
@@ -134,10 +136,10 @@ var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref)
134
136
 
135
137
  exports.Checkbox = Checkbox;
136
138
 
137
- var CheckboxLabel = function CheckboxLabel(_ref4) {
138
- var _ref4$color = _ref4.color,
139
- color = _ref4$color === void 0 ? _Identity.COLOR.TEXT : _ref4$color,
140
- props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded2);
139
+ var CheckboxLabel = function CheckboxLabel(_ref3) {
140
+ var _ref3$color = _ref3.color,
141
+ color = _ref3$color === void 0 ? _Identity.COLOR.TEXT : _ref3$color,
142
+ props = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
141
143
  return (0, _react.jsx)(_Text.Text, (0, _extends2["default"])({
142
144
  css: function css(theme) {
143
145
  return _objectSpread(_objectSpread({}, (0, _Text.textStyle)(theme, _objectSpread({
@@ -1 +1 @@
1
- {"version":3,"sources":["Checkbox.tsx"],"names":["filterStyledLabelProps","props","StyledLabel","disabled","markInvalid","aligncenter","theme","INPUT_CLASSNAME","background","Checkbox","disablecheckedBgColor","general","primaryColor","borderColor","fill","backgroundColor","position","left","top","disableBgColor","border","invalidBorderColor","disableBorderColor","borderRadius","boxSizing","content","display","width","height","lineHeight","margin","color","children","filterCheckboxProps","React","forwardRef","ref","id","Math","random","toString","style","alignItems","justifyContent","outline","outlineOffset","marginBottom","opacity","cursor","CheckboxLabel","COLOR","TEXT","a","LINK","textDecoration"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;;AAQA,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD;AAAA,SAA6B,uBAAYA,KAAZ,EAAmB,CAAC,aAAD,CAAnB,CAA7B;AAAA,CAA/B;;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACD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AA,GAAG,EAAE,aAACK,KAAD;AAAA,6CACA,qBAAUA,KAAV;AACDyB,QAAAA,KAAK,EAALA;AADC,SAEE9B,KAFF,EADA;AAKHmD,QAAAA,CAAC,EAAE;AACDrB,UAAAA,KAAK,EAAEmB,gBAAMG,IADZ;AAEDC,UAAAA,cAAc,EAAE;AAFf;AALA;AAAA;AADP,KAWMrD,KAXN,EAD2B;AAAA,CAAtB","sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport React from 'react';\n\nimport {COLOR} from '../Identity';\nimport {Theme} from '../Layout';\nimport {Text, TextProps, textStyle, textLinkStyle} from '../Text';\nimport {filterProps} from '../util';\nimport {INPUT_CLASSNAME, InputProps} from './Input';\n\nexport interface StyledLabelProps<T = HTMLLabelElement> extends React.HTMLProps<T> {\n disabled?: boolean;\n markInvalid?: boolean;\n aligncenter?: boolean;\n}\n\nconst filterStyledLabelProps = (props: StyledLabelProps) => filterProps(props, ['markInvalid']);\n\nconst StyledLabel = (props: StyledLabelProps) => {\n const {disabled, markInvalid, aligncenter = false} = props;\n return (\n <label\n css={(theme: Theme) => ({\n [`.${INPUT_CLASSNAME}:checked + &::before`]: {\n background: `${disabled ? theme.Checkbox.disablecheckedBgColor : theme.general.primaryColor}`,\n borderColor: theme.general.primaryColor,\n },\n [`.${INPUT_CLASSNAME}:checked + & > svg`]: {\n fill: theme.general.backgroundColor,\n },\n [`.${INPUT_CLASSNAME} + & > svg`]: {\n fill: 'none',\n position: 'absolute',\n left: '0.25rem',\n top: '0.25rem',\n },\n ...(!disabled && {\n [`.${INPUT_CLASSNAME}:hover + &::before`]: {\n borderColor: theme.general.primaryColor,\n },\n }),\n [`.${INPUT_CLASSNAME} + &::before`]: {\n background: disabled ? theme.Checkbox.disableBgColor : theme.Checkbox.background,\n ...(!disabled\n ? {\n border: markInvalid\n ? `1.5px solid ${theme.Checkbox.invalidBorderColor}`\n : `1.5px solid ${theme.Checkbox.border}`,\n }\n : {\n border: `1.5px solid ${theme.Checkbox.disableBorderColor}`,\n }),\n borderRadius: '3px',\n boxSizing: 'border-box',\n content: '\"\"',\n display: 'inline-block',\n width: '22px',\n height: '22px',\n lineHeight: 1.4,\n margin: '0 8px 0 0px',\n color: theme.general.color,\n },\n a: {\n ...textLinkStyle(theme, {}),\n },\n position: 'relative',\n margin: '0 0 0 -16px',\n width: aligncenter ? 'auto' : '100%',\n lineHeight: 1.4,\n display: 'flex',\n opacity: disabled ? 0.56 : 1,\n cursor: disabled ? 'not-allowed' : 'pointer',\n })}\n {...filterStyledLabelProps(props)}\n >\n {props.children}\n <svg width=\"15\" height=\"13\" viewBox=\"0 0 16 13\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.65685 12.0711L15.9842 1.62738L14.57 0.213167L5.65685 9.24264L1.41421 5L0 6.41421L5.65685 12.0711Z\" />\n </svg>\n </label>\n );\n};\n\ninterface CheckboxProps<T = HTMLInputElement> extends InputProps<T> {\n id?: string;\n aligncenter?: boolean;\n}\n\nconst filterCheckboxProps = (props: CheckboxProps) => filterProps(props, ['markInvalid']);\n\n// We use Math.random..., because some of apps doesn't migrated to newest version of React.\nexport const Checkbox: React.FC<CheckboxProps<HTMLInputElement>> = React.forwardRef<\n HTMLInputElement,\n CheckboxProps<HTMLInputElement>\n>(({id = Math.random().toString(), children, style, disabled, ...props}, ref) => (\n <div\n css={(theme: Theme) => ({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'flex-start',\n position: 'relative',\n left: '-0.3rem',\n [`.${INPUT_CLASSNAME}:focus-visible + label`]: {\n outline: `1px solid ${theme.general.primaryColor}`,\n outlineOffset: '0.4rem',\n },\n })}\n style={style}\n >\n <input\n type=\"checkbox\"\n id={id}\n style={{\n height: '22px',\n marginBottom: '0',\n opacity: 0,\n width: '22px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n }}\n disabled={disabled}\n ref={ref}\n className={INPUT_CLASSNAME}\n {...filterCheckboxProps(props)}\n />\n\n <StyledLabel htmlFor={id} disabled={disabled} markInvalid={props.markInvalid} aligncenter={props.aligncenter}>\n {children}\n </StyledLabel>\n </div>\n));\n\nexport type CheckboxLabelProps<T = HTMLSpanElement> = TextProps<T>;\n\nexport const CheckboxLabel = ({color = COLOR.TEXT, ...props}: CheckboxLabelProps) => (\n <Text\n css={(theme: Theme) => ({\n ...textStyle(theme, {\n color,\n ...props,\n }),\n a: {\n color: COLOR.LINK,\n textDecoration: 'none',\n },\n })}\n {...props}\n />\n);\n"],"file":"Checkbox.js"}
1
+ {"version":3,"sources":["Checkbox.tsx"],"names":["filterStyledLabelProps","props","StyledLabel","disabled","markInvalid","aligncenter","theme","INPUT_CLASSNAME","background","Checkbox","disablecheckedBgColor","general","primaryColor","borderColor","fill","backgroundColor","position","left","top","disableBgColor","border","invalidBorderColor","disableBorderColor","borderRadius","boxSizing","content","display","width","height","lineHeight","margin","color","children","filterCheckboxProps","React","forwardRef","ref","id","Math","random","toString","style","wrapperCSS","alignItems","justifyContent","outline","outlineOffset","marginBottom","opacity","cursor","CheckboxLabel","COLOR","TEXT","a","LINK","textDecoration"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;;AAQA,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD;AAAA,SAA6B,uBAAYA,KAAZ,EAAmB,CAAC,aAAD,CAAnB,CAA7B;AAAA,CAA/B;;AAEA,IAAMC,WAAW,GAAG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MAAEA,KAAF,4BAAUoB,gBAAMC,IAAhB;AAAA,MAAyBnD,KAAzB;AAAA,SAC3B,gBAAC,UAAD;AACE,IAAA,GAAG,EAAE,aAACK,KAAD;AAAA,6CACA,qBAAUA,KAAV;AACDyB,QAAAA,KAAK,EAALA;AADC,SAEE9B,KAFF,EADA;AAKHoD,QAAAA,CAAC,EAAE;AACDtB,UAAAA,KAAK,EAAEoB,gBAAMG,IADZ;AAEDC,UAAAA,cAAc,EAAE;AAFf;AALA;AAAA;AADP,KAWMtD,KAXN,EAD2B;AAAA,CAAtB","sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport React from 'react';\n\nimport {COLOR} from '../Identity';\nimport {Theme} from '../Layout';\nimport {Text, TextProps, textStyle, textLinkStyle} from '../Text';\nimport {filterProps} from '../util';\nimport {INPUT_CLASSNAME, InputProps} from './Input';\n\nexport interface StyledLabelProps<T = HTMLLabelElement> extends React.HTMLProps<T> {\n disabled?: boolean;\n markInvalid?: boolean;\n aligncenter?: boolean;\n}\n\nconst filterStyledLabelProps = (props: StyledLabelProps) => filterProps(props, ['markInvalid']);\n\nconst StyledLabel = (props: StyledLabelProps) => {\n const {disabled, markInvalid, aligncenter = false} = props;\n return (\n <label\n css={(theme: Theme) => ({\n [`.${INPUT_CLASSNAME}:checked + &::before`]: {\n background: `${disabled ? theme.Checkbox.disablecheckedBgColor : theme.general.primaryColor}`,\n borderColor: theme.general.primaryColor,\n },\n [`.${INPUT_CLASSNAME}:checked + & > svg`]: {\n fill: theme.general.backgroundColor,\n },\n [`.${INPUT_CLASSNAME} + & > svg`]: {\n fill: 'none',\n position: 'absolute',\n left: '0.25rem',\n top: '0.25rem',\n },\n ...(!disabled && {\n [`.${INPUT_CLASSNAME}:hover + &::before`]: {\n borderColor: theme.general.primaryColor,\n },\n }),\n [`.${INPUT_CLASSNAME} + &::before`]: {\n background: disabled ? theme.Checkbox.disableBgColor : theme.Checkbox.background,\n ...(!disabled\n ? {\n border: markInvalid\n ? `1.5px solid ${theme.Checkbox.invalidBorderColor}`\n : `1.5px solid ${theme.Checkbox.border}`,\n }\n : {\n border: `1.5px solid ${theme.Checkbox.disableBorderColor}`,\n }),\n borderRadius: '3px',\n boxSizing: 'border-box',\n content: '\"\"',\n display: 'inline-block',\n width: '22px',\n height: '22px',\n lineHeight: 1.4,\n margin: '0 8px 0 0px',\n color: theme.general.color,\n },\n a: {\n ...textLinkStyle(theme, {}),\n },\n position: 'relative',\n margin: '0 0 0 -16px',\n width: aligncenter ? 'auto' : '100%',\n lineHeight: 1.4,\n display: 'flex',\n opacity: disabled ? 0.56 : 1,\n cursor: disabled ? 'not-allowed' : 'pointer',\n })}\n {...filterStyledLabelProps(props)}\n >\n {props.children}\n <svg width=\"15\" height=\"13\" viewBox=\"0 0 16 13\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.65685 12.0711L15.9842 1.62738L14.57 0.213167L5.65685 9.24264L1.41421 5L0 6.41421L5.65685 12.0711Z\" />\n </svg>\n </label>\n );\n};\n\ninterface CheckboxProps<T = HTMLInputElement> extends InputProps<T> {\n id?: string;\n aligncenter?: boolean;\n}\n\nconst filterCheckboxProps = (props: CheckboxProps) => filterProps(props, ['markInvalid']);\n\n// We use Math.random..., because some of apps doesn't migrated to newest version of React.\nexport const Checkbox: React.FC<CheckboxProps<HTMLInputElement>> = React.forwardRef<\n HTMLInputElement,\n CheckboxProps<HTMLInputElement>\n>(({id = Math.random().toString(), children, style, disabled, wrapperCSS = {}, ...props}, ref) => (\n <div\n css={(theme: Theme) => ({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'flex-start',\n position: 'relative',\n left: '-0.3rem',\n [`.${INPUT_CLASSNAME}:focus-visible + label`]: {\n outline: `1px solid ${theme.general.primaryColor}`,\n outlineOffset: '0.4rem',\n },\n ...wrapperCSS,\n })}\n style={style}\n >\n <input\n type=\"checkbox\"\n id={id}\n style={{\n height: '22px',\n marginBottom: '0',\n opacity: 0,\n width: '22px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n }}\n disabled={disabled}\n ref={ref}\n className={INPUT_CLASSNAME}\n {...filterCheckboxProps(props)}\n />\n\n <StyledLabel htmlFor={id} disabled={disabled} markInvalid={props.markInvalid} aligncenter={props.aligncenter}>\n {children}\n </StyledLabel>\n </div>\n));\n\nexport type CheckboxLabelProps<T = HTMLSpanElement> = TextProps<T>;\n\nexport const CheckboxLabel = ({color = COLOR.TEXT, ...props}: CheckboxLabelProps) => (\n <Text\n css={(theme: Theme) => ({\n ...textStyle(theme, {\n color,\n ...props,\n }),\n a: {\n color: COLOR.LINK,\n textDecoration: 'none',\n },\n })}\n {...props}\n />\n);\n"],"file":"Checkbox.js"}
@@ -1,14 +1,16 @@
1
1
  Demo:
2
2
 
3
3
  ```js
4
- import {Fragment} from 'react';
4
+ import {Fragment, useState} from 'react';
5
5
  import {Column, Columns, Checkbox, CheckboxLabel, Link} from '@wireapp/react-ui-kit';
6
6
 
7
+ const [isChecked, setIsChecked] = useState(true);
8
+
7
9
  <Fragment>
8
10
  <Columns>
9
11
  <Column>Checkbox</Column>
10
12
  <Column>
11
- <Checkbox id="ToU" checked>
13
+ <Checkbox id="ToU" checked={isChecked} onChange={ev => setIsChecked(ev.target.checked)}>
12
14
  <CheckboxLabel>{'ToU'}</CheckboxLabel>
13
15
  </Checkbox>
14
16
  </Column>
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RangeInput.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"RangeInput.d.js"}
@@ -0,0 +1,11 @@
1
+ /** @jsx jsx */
2
+ import { CSSObject } from '@emotion/react';
3
+ import { FC } from 'react';
4
+ import { TextProps } from '../Text';
5
+ export interface RangeInputProps<T = HTMLInputElement> extends TextProps<T> {
6
+ label?: string;
7
+ minValueLabel?: string;
8
+ maxValueLabel?: string;
9
+ wrapperCSS?: CSSObject;
10
+ }
11
+ export declare const RangeInput: FC<RangeInputProps>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.RangeInput = void 0;
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _react = require("@emotion/react");
17
+
18
+ var _react2 = _interopRequireWildcard(require("react"));
19
+
20
+ var _InputLabel = _interopRequireDefault(require("./InputLabel"));
21
+
22
+ var _RangeInput = require("./RangeInput.styles");
23
+
24
+ var _excluded = ["ref", "id", "label", "minValueLabel", "maxValueLabel", "min", "max", "value", "onChange", "wrapperCSS"];
25
+
26
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
+
28
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
+
30
+ var RangeInput = /*#__PURE__*/(0, _react2.forwardRef)(function (_ref) {
31
+ var ref = _ref.ref,
32
+ _ref$id = _ref.id,
33
+ id = _ref$id === void 0 ? Math.random().toString() : _ref$id,
34
+ label = _ref.label,
35
+ minValueLabel = _ref.minValueLabel,
36
+ maxValueLabel = _ref.maxValueLabel,
37
+ _ref$min = _ref.min,
38
+ min = _ref$min === void 0 ? '0' : _ref$min,
39
+ _ref$max = _ref.max,
40
+ max = _ref$max === void 0 ? '100' : _ref$max,
41
+ _ref$value = _ref.value,
42
+ value = _ref$value === void 0 ? '0' : _ref$value,
43
+ onChange = _ref.onChange,
44
+ wrapperCSS = _ref.wrapperCSS,
45
+ inputProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
46
+ var minNum = Number(min);
47
+ var maxNum = Number(max);
48
+ var valueNum = Number(value);
49
+ var backgroundSize = "".concat((valueNum - minNum) * 100 / (maxNum - minNum), "% 100%");
50
+ return (0, _react.jsx)("div", {
51
+ css: wrapperCSS
52
+ }, label && (0, _react.jsx)(_InputLabel["default"], {
53
+ htmlFor: id
54
+ }, label), (0, _react.jsx)("div", {
55
+ css: _RangeInput.rangeInputWrapperStyles
56
+ }, minValueLabel && (0, _react.jsx)("span", {
57
+ css: (0, _RangeInput.getValueLabelStyles)(_RangeInput.ValueLabelPosition.LEFT)
58
+ }, minValueLabel), maxValueLabel && (0, _react.jsx)("span", {
59
+ css: (0, _RangeInput.getValueLabelStyles)(_RangeInput.ValueLabelPosition.RIGHT)
60
+ }, maxValueLabel), (0, _react.jsx)("input", (0, _extends2["default"])({
61
+ ref: ref,
62
+ css: function css(theme) {
63
+ return (0, _RangeInput.getImageCropZoomInputStyles)(theme, backgroundSize);
64
+ },
65
+ id: id,
66
+ name: id,
67
+ min: min,
68
+ max: max,
69
+ value: value,
70
+ onChange: onChange,
71
+ type: "range"
72
+ }, inputProps))));
73
+ });
74
+ exports.RangeInput = RangeInput;
75
+ //# sourceMappingURL=RangeInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RangeInput.tsx"],"names":["RangeInput","ref","id","Math","random","toString","label","minValueLabel","maxValueLabel","min","max","value","onChange","wrapperCSS","inputProps","minNum","Number","maxNum","valueNum","backgroundSize","rangeInputWrapperStyles","ValueLabelPosition","LEFT","RIGHT","theme"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAGA;;AACA;;;;;;;;AAcO,IAAMA,UAA+B,gBAAG,wBAC7C,gBAYM;AAAA,MAXJC,GAWI,QAXJA,GAWI;AAAA,qBAVJC,EAUI;AAAA,MAVJA,EAUI,wBAVCC,IAAI,CAACC,MAAL,GAAcC,QAAd,EAUD;AAAA,MATJC,KASI,QATJA,KASI;AAAA,MARJC,aAQI,QARJA,aAQI;AAAA,MAPJC,aAOI,QAPJA,aAOI;AAAA,sBANJC,GAMI;AAAA,MANJA,GAMI,yBANE,GAMF;AAAA,sBALJC,GAKI;AAAA,MALJA,GAKI,yBALE,KAKF;AAAA,wBAJJC,KAII;AAAA,MAJJA,KAII,2BAJI,GAIJ;AAAA,MAHJC,QAGI,QAHJA,QAGI;AAAA,MAFJC,UAEI,QAFJA,UAEI;AAAA,MADDC,UACC;AACJ,MAAMC,MAAM,GAAGC,MAAM,CAACP,GAAD,CAArB;AACA,MAAMQ,MAAM,GAAGD,MAAM,CAACN,GAAD,CAArB;AACA,MAAMQ,QAAQ,GAAGF,MAAM,CAACL,KAAD,CAAvB;AAEA,MAAMQ,cAAc,aAAO,CAACD,QAAQ,GAAGH,MAAZ,IAAsB,GAAvB,IAA+BE,MAAM,GAAGF,MAAxC,CAAN,WAApB;AAEA,SACE;AAAK,IAAA,GAAG,EAAEF;AAAV,KACGP,KAAK,IAAI,gBAAC,sBAAD;AAAY,IAAA,OAAO,EAAEJ;AAArB,KAA0BI,KAA1B,CADZ,EAEE;AAAK,IAAA,GAAG,EAAEc;AAAV,KACGb,aAAa,IAAI;AAAM,IAAA,GAAG,EAAE,qCAAoBc,+BAAmBC,IAAvC;AAAX,KAA0Df,aAA1D,CADpB,EAEGC,aAAa,IAAI;AAAM,IAAA,GAAG,EAAE,qCAAoBa,+BAAmBE,KAAvC;AAAX,KAA2Df,aAA3D,CAFpB,EAGE;AACE,IAAA,GAAG,EAAEP,GADP;AAEE,IAAA,GAAG,EAAE,aAACuB,KAAD;AAAA,aAAkB,6CAA4BA,KAA5B,EAAmCL,cAAnC,CAAlB;AAAA,KAFP;AAGE,IAAA,EAAE,EAAEjB,EAHN;AAIE,IAAA,IAAI,EAAEA,EAJR;AAKE,IAAA,GAAG,EAAEO,GALP;AAME,IAAA,GAAG,EAAEC,GANP;AAOE,IAAA,KAAK,EAAEC,KAPT;AAQE,IAAA,QAAQ,EAAEC,QARZ;AASE,IAAA,IAAI,EAAC;AATP,KAUME,UAVN,EAHF,CAFF,CADF;AAqBD,CAzC4C,CAAxC","sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\nimport React, {FC, forwardRef} from 'react';\nimport {TextProps} from '../Text';\nimport {Theme} from '../Layout';\nimport InputLabel from './InputLabel';\nimport {\n getImageCropZoomInputStyles,\n getValueLabelStyles,\n rangeInputWrapperStyles,\n ValueLabelPosition,\n} from './RangeInput.styles';\n\nexport interface RangeInputProps<T = HTMLInputElement> extends TextProps<T> {\n label?: string;\n minValueLabel?: string;\n maxValueLabel?: string;\n wrapperCSS?: CSSObject;\n}\n\nexport const RangeInput: FC<RangeInputProps> = forwardRef<HTMLInputElement, RangeInputProps<HTMLInputElement>>(\n ({\n ref,\n id = Math.random().toString(),\n label,\n minValueLabel,\n maxValueLabel,\n min = '0',\n max = '100',\n value = '0',\n onChange,\n wrapperCSS,\n ...inputProps\n }) => {\n const minNum = Number(min);\n const maxNum = Number(max);\n const valueNum = Number(value);\n\n const backgroundSize = `${((valueNum - minNum) * 100) / (maxNum - minNum)}% 100%` as const;\n\n return (\n <div css={wrapperCSS}>\n {label && <InputLabel htmlFor={id}>{label}</InputLabel>}\n <div css={rangeInputWrapperStyles}>\n {minValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.LEFT)}>{minValueLabel}</span>}\n {maxValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.RIGHT)}>{maxValueLabel}</span>}\n <input\n ref={ref}\n css={(theme: Theme) => getImageCropZoomInputStyles(theme, backgroundSize)}\n id={id}\n name={id}\n min={min}\n max={max}\n value={value}\n onChange={onChange}\n type=\"range\"\n {...inputProps}\n />\n </div>\n </div>\n );\n },\n);\n"],"file":"RangeInput.js"}
@@ -0,0 +1,27 @@
1
+ Demo:
2
+
3
+ ```js
4
+ import {Columns, Column, RangeInput} from '@wireapp/react-ui-kit';
5
+ import {useState} from 'react';
6
+
7
+ const [zoom, setZoom] = useState(1);
8
+
9
+ const handleChange = e => {
10
+ setZoom(+e.target.value);
11
+ };
12
+
13
+ <>
14
+ <div>
15
+ <RangeInput
16
+ label={'Zoom'}
17
+ minValueLabel="-"
18
+ maxValueLabel="+"
19
+ onChange={handleChange}
20
+ value={zoom}
21
+ min={1}
22
+ max={3}
23
+ step={0.1}
24
+ />
25
+ </div>
26
+ </>;
27
+ ```
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RangeInput.styles.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"RangeInput.styles.d.js"}
@@ -0,0 +1,9 @@
1
+ import { CSSObject } from '@emotion/react';
2
+ import { Theme } from '../Layout';
3
+ export declare const rangeInputWrapperStyles: CSSObject;
4
+ export declare const getImageCropZoomInputStyles: (theme: Theme, backgroundSize: `${number}% ${number}%`) => CSSObject;
5
+ export declare enum ValueLabelPosition {
6
+ LEFT = "left",
7
+ RIGHT = "right"
8
+ }
9
+ export declare const getValueLabelStyles: (position: ValueLabelPosition) => CSSObject;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getValueLabelStyles = exports.ValueLabelPosition = exports.getImageCropZoomInputStyles = exports.rangeInputWrapperStyles = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _Identity = require("../Identity");
13
+
14
+ var _util = require("../util");
15
+
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
+
20
+ var rangeInputWrapperStyles = {
21
+ position: 'relative',
22
+ marginTop: '19px'
23
+ };
24
+ exports.rangeInputWrapperStyles = rangeInputWrapperStyles;
25
+ var thumbSelectors = ['&::-webkit-slider-thumb', '&::-moz-range-thumb', '&::-ms-thumb'];
26
+ var sliderSelectors = ['&::-webkit-slider-runnable-track', '&::-moz-range-track', '&::-ms-track'];
27
+
28
+ var getImageCropZoomInputStyles = function getImageCropZoomInputStyles(theme, backgroundSize) {
29
+ return _objectSpread(_objectSpread({
30
+ display: 'block',
31
+ '-webkit-appearance': 'none',
32
+ width: '100%',
33
+ height: '8px',
34
+ background: _Identity.COLOR_V2.GRAY_60,
35
+ borderRadius: '4px',
36
+ backgroundImage: "linear-gradient(".concat(theme.general.primaryColor, ", ").concat(theme.general.primaryColor, ")"),
37
+ backgroundSize: backgroundSize || '0% 100%',
38
+ backgroundRepeat: 'no-repeat'
39
+ }, (0, _util.manySelectors)(thumbSelectors, {
40
+ '-webkit-appearance': 'none',
41
+ height: '18px',
42
+ width: '18px',
43
+ borderRadius: '50%',
44
+ background: _Identity.COLOR_V2.GRAY_80,
45
+ cursor: 'pointer',
46
+ border: 'none',
47
+ boxShadow: 'none'
48
+ })), (0, _util.manySelectors)(sliderSelectors, {
49
+ '-webkit-appearance': 'none',
50
+ boxShadow: 'none',
51
+ border: 'none',
52
+ background: 'transparent'
53
+ }));
54
+ };
55
+
56
+ exports.getImageCropZoomInputStyles = getImageCropZoomInputStyles;
57
+ var ValueLabelPosition;
58
+ exports.ValueLabelPosition = ValueLabelPosition;
59
+
60
+ (function (ValueLabelPosition) {
61
+ ValueLabelPosition["LEFT"] = "left";
62
+ ValueLabelPosition["RIGHT"] = "right";
63
+ })(ValueLabelPosition || (exports.ValueLabelPosition = ValueLabelPosition = {}));
64
+
65
+ var getValueLabelStyles = function getValueLabelStyles(position) {
66
+ return (0, _defineProperty2["default"])({
67
+ pointerEvents: 'none',
68
+ bottom: '100%',
69
+ fontSize: '16px',
70
+ fontWeight: 300,
71
+ position: 'absolute'
72
+ }, position, '4px');
73
+ };
74
+
75
+ exports.getValueLabelStyles = getValueLabelStyles;
76
+ //# sourceMappingURL=RangeInput.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RangeInput.styles.ts"],"names":["rangeInputWrapperStyles","position","marginTop","thumbSelectors","sliderSelectors","getImageCropZoomInputStyles","theme","backgroundSize","display","width","height","background","COLOR_V2","GRAY_60","borderRadius","backgroundImage","general","primaryColor","backgroundRepeat","GRAY_80","cursor","border","boxShadow","ValueLabelPosition","getValueLabelStyles","pointerEvents","bottom","fontSize","fontWeight"],"mappings":";;;;;;;;;;;AAqBA;;AACA;;;;;;AAEO,IAAMA,uBAAkC,GAAG;AAChDC,EAAAA,QAAQ,EAAE,UADsC;AAEhDC,EAAAA,SAAS,EAAE;AAFqC,CAA3C;;AAKP,IAAMC,cAAc,GAAG,CAAC,yBAAD,EAA4B,qBAA5B,EAAmD,cAAnD,CAAvB;AACA,IAAMC,eAAe,GAAG,CAAC,kCAAD,EAAqC,qBAArC,EAA4D,cAA5D,CAAxB;;AAEO,IAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAACC,KAAD,EAAeC,cAAf;AAAA;AACzCC,IAAAA,OAAO,EAAE,OADgC;AAEzC,0BAAsB,MAFmB;AAGzCC,IAAAA,KAAK,EAAE,MAHkC;AAIzCC,IAAAA,MAAM,EAAE,KAJiC;AAKzCC,IAAAA,UAAU,EAAEC,mBAASC,OALoB;AAMzCC,IAAAA,YAAY,EAAE,KAN2B;AAOzCC,IAAAA,eAAe,4BAAqBT,KAAK,CAACU,OAAN,CAAcC,YAAnC,eAAoDX,KAAK,CAACU,OAAN,CAAcC,YAAlE,MAP0B;AAQzCV,IAAAA,cAAc,EAAEA,cAAc,IAAI,SARO;AASzCW,IAAAA,gBAAgB,EAAE;AATuB,KAWtC,yBAAcf,cAAd,EAA8B;AAC/B,0BAAsB,MADS;AAE/BO,IAAAA,MAAM,EAAE,MAFuB;AAG/BD,IAAAA,KAAK,EAAE,MAHwB;AAI/BK,IAAAA,YAAY,EAAE,KAJiB;AAK/BH,IAAAA,UAAU,EAAEC,mBAASO,OALU;AAM/BC,IAAAA,MAAM,EAAE,SANuB;AAO/BC,IAAAA,MAAM,EAAE,MAPuB;AAQ/BC,IAAAA,SAAS,EAAE;AARoB,GAA9B,CAXsC,GAsBtC,yBAAclB,eAAd,EAA+B;AAChC,0BAAsB,MADU;AAEhCkB,IAAAA,SAAS,EAAE,MAFqB;AAGhCD,IAAAA,MAAM,EAAE,MAHwB;AAIhCV,IAAAA,UAAU,EAAE;AAJoB,GAA/B,CAtBsC;AAAA,CAApC;;;IA8BKY,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB;;AAKL,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACvB,QAAD;AAAA;AACjCwB,IAAAA,aAAa,EAAE,MADkB;AAEjCC,IAAAA,MAAM,EAAE,MAFyB;AAGjCC,IAAAA,QAAQ,EAAE,MAHuB;AAIjCC,IAAAA,UAAU,EAAE,GAJqB;AAKjC3B,IAAAA,QAAQ,EAAE;AALuB,KAMhCA,QANgC,EAMrB,KANqB;AAAA,CAA5B","sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {CSSObject} from '@emotion/react';\nimport {Theme} from '../Layout';\nimport {COLOR_V2} from '../Identity';\nimport {manySelectors} from '../util';\n\nexport const rangeInputWrapperStyles: CSSObject = {\n position: 'relative',\n marginTop: '19px',\n};\n\nconst thumbSelectors = ['&::-webkit-slider-thumb', '&::-moz-range-thumb', '&::-ms-thumb'];\nconst sliderSelectors = ['&::-webkit-slider-runnable-track', '&::-moz-range-track', '&::-ms-track'];\n\nexport const getImageCropZoomInputStyles = (theme: Theme, backgroundSize: `${number}% ${number}%`): CSSObject => ({\n display: 'block',\n '-webkit-appearance': 'none',\n width: '100%',\n height: '8px',\n background: COLOR_V2.GRAY_60,\n borderRadius: '4px',\n backgroundImage: `linear-gradient(${theme.general.primaryColor}, ${theme.general.primaryColor})`,\n backgroundSize: backgroundSize || '0% 100%',\n backgroundRepeat: 'no-repeat',\n\n ...manySelectors(thumbSelectors, {\n '-webkit-appearance': 'none',\n height: '18px',\n width: '18px',\n borderRadius: '50%',\n background: COLOR_V2.GRAY_80,\n cursor: 'pointer',\n border: 'none',\n boxShadow: 'none',\n }),\n\n ...manySelectors(sliderSelectors, {\n '-webkit-appearance': 'none',\n boxShadow: 'none',\n border: 'none',\n background: 'transparent',\n }),\n});\n\nexport enum ValueLabelPosition {\n LEFT = 'left',\n RIGHT = 'right',\n}\n\nexport const getValueLabelStyles = (position: ValueLabelPosition): CSSObject => ({\n pointerEvents: 'none',\n bottom: '100%',\n fontSize: '16px',\n fontWeight: 300,\n position: 'absolute',\n [position]: '4px',\n});\n"],"file":"RangeInput.styles.js"}
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
2
6
  //# sourceMappingURL=Select.d.js.map
@@ -1,25 +1,24 @@
1
1
  /** @jsx jsx */
2
- import { CSSObject, jsx } from '@emotion/react';
3
- import type { Theme } from '../Layout';
4
- import { ReactElement } from 'react';
5
- export declare type SelectOption = {
2
+ import { CSSObject } from '@emotion/react';
3
+ import { FC, ReactElement } from 'react';
4
+ import { StateManagerProps } from 'react-select/dist/declarations/src/useStateManager';
5
+ export declare type Option = {
6
6
  value: string | number;
7
7
  label: string;
8
8
  description?: string;
9
+ isDisabled?: boolean;
9
10
  };
10
- export interface SelectProps<T extends SelectOption = SelectOption> {
11
+ interface SelectProps extends StateManagerProps<Option> {
11
12
  id: string;
12
- onChange: (selectedOption: T['value']) => void;
13
13
  dataUieName: string;
14
- options: T[];
15
- value?: T | null;
16
- helperText?: string;
14
+ options: Option[];
15
+ wrapperCSS?: CSSObject;
17
16
  label?: string;
18
- disabled?: boolean;
19
- required?: boolean;
20
- markInvalid?: boolean;
17
+ helperText?: string;
21
18
  error?: ReactElement;
22
- wrapperCSS?: CSSObject;
19
+ markInvalid?: boolean;
20
+ required?: boolean;
21
+ isMulti?: boolean;
23
22
  }
24
- export declare const selectStyle: <T>(theme: Theme, props: any, error?: boolean) => CSSObject;
25
- export declare const Select: <T extends SelectOption = SelectOption>({ id, label, error, helperText, options, value, onChange, required, markInvalid, dataUieName, wrapperCSS, ...props }: SelectProps<T>) => jsx.JSX.Element;
23
+ export declare const Select: FC<SelectProps>;
24
+ export {};