@wireapp/react-ui-kit 8.14.8 → 8.14.9

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/package.json CHANGED
@@ -72,6 +72,6 @@
72
72
  "test:update": "yarn test --updateSnapshot",
73
73
  "test:project": "yarn dist && yarn test"
74
74
  },
75
- "version": "8.14.8",
76
- "gitHead": "4a21776530619f27531a3b1b22c068c0367d361b"
75
+ "version": "8.14.9",
76
+ "gitHead": "5fa7b30429e5e5a48af9724413c79ae7e85db79f"
77
77
  }
@@ -2,42 +2,45 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.CheckboxLabel = exports.Checkbox = void 0;
9
11
 
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
 
16
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
+
16
18
  var _react = require("@emotion/react");
17
19
 
18
- var _react2 = _interopRequireDefault(require("react"));
20
+ var _react2 = _interopRequireWildcard(require("react"));
19
21
 
20
22
  var _Text = require("../Text");
21
23
 
22
- var _util = require("../util");
23
-
24
24
  var _Input = require("./Input");
25
25
 
26
- var _excluded = ["id", "children", "style", "disabled", "wrapperCSS"];
26
+ var _excluded = ["disabled", "markInvalid", "aligncenter", "children"],
27
+ _excluded2 = ["id", "children", "style", "disabled", "wrapperCSS", "markInvalid", "aligncenter"];
28
+
29
+ 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); }
30
+
31
+ 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; }
27
32
 
28
33
  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; }
29
34
 
30
35
  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; }
31
36
 
32
- var filterStyledLabelProps = function filterStyledLabelProps(props) {
33
- return (0, _util.filterProps)(props, ['markInvalid']);
34
- };
35
-
36
- var StyledLabel = function StyledLabel(props) {
37
- var disabled = props.disabled,
38
- markInvalid = props.markInvalid,
39
- _props$aligncenter = props.aligncenter,
40
- aligncenter = _props$aligncenter === void 0 ? false : _props$aligncenter;
37
+ var StyledLabel = function StyledLabel(_ref) {
38
+ var disabled = _ref.disabled,
39
+ markInvalid = _ref.markInvalid,
40
+ _ref$aligncenter = _ref.aligncenter,
41
+ aligncenter = _ref$aligncenter === void 0 ? false : _ref$aligncenter,
42
+ children = _ref.children,
43
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
41
44
  return (0, _react.jsx)("label", (0, _extends2["default"])({
42
45
  css: function css(theme) {
43
46
  var _objectSpread2, _objectSpread3;
@@ -72,7 +75,7 @@ var StyledLabel = function StyledLabel(props) {
72
75
  color: theme.general.color
73
76
  })), (0, _defineProperty2["default"])(_objectSpread3, "position", 'relative'), (0, _defineProperty2["default"])(_objectSpread3, "margin", '0 0 0 -16px'), (0, _defineProperty2["default"])(_objectSpread3, "width", aligncenter ? 'auto' : '100%'), (0, _defineProperty2["default"])(_objectSpread3, "lineHeight", 1.4), (0, _defineProperty2["default"])(_objectSpread3, "display", 'flex'), (0, _defineProperty2["default"])(_objectSpread3, "opacity", disabled ? 0.56 : 1), (0, _defineProperty2["default"])(_objectSpread3, "cursor", disabled ? 'not-allowed' : 'pointer'), (0, _defineProperty2["default"])(_objectSpread3, "borderRadius", '4px'), _objectSpread3));
74
77
  }
75
- }, filterStyledLabelProps(props)), props.children, (0, _react.jsx)("svg", {
78
+ }, props), children, (0, _react.jsx)("svg", {
76
79
  width: "15",
77
80
  height: "13",
78
81
  viewBox: "0 0 16 13",
@@ -82,20 +85,17 @@ var StyledLabel = function StyledLabel(props) {
82
85
  })));
83
86
  };
84
87
 
85
- var filterCheckboxProps = function filterCheckboxProps(props) {
86
- return (0, _util.filterProps)(props, ['markInvalid']);
87
- }; // We use Math.random..., because some of apps doesn't migrated to newest version of React.
88
-
89
-
90
- var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref) {
91
- var _ref2$id = _ref2.id,
92
- id = _ref2$id === void 0 ? Math.random().toString() : _ref2$id,
93
- children = _ref2.children,
94
- style = _ref2.style,
95
- disabled = _ref2.disabled,
96
- _ref2$wrapperCSS = _ref2.wrapperCSS,
97
- wrapperCSS = _ref2$wrapperCSS === void 0 ? {} : _ref2$wrapperCSS,
98
- props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
88
+ var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref3, ref) {
89
+ var _ref3$id = _ref3.id,
90
+ id = _ref3$id === void 0 ? (0, _react2.useId)() : _ref3$id,
91
+ children = _ref3.children,
92
+ style = _ref3.style,
93
+ disabled = _ref3.disabled,
94
+ _ref3$wrapperCSS = _ref3.wrapperCSS,
95
+ wrapperCSS = _ref3$wrapperCSS === void 0 ? {} : _ref3$wrapperCSS,
96
+ markInvalid = _ref3.markInvalid,
97
+ aligncenter = _ref3.aligncenter,
98
+ props = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
99
99
  return (0, _react.jsx)("div", {
100
100
  css: function css(theme) {
101
101
  return _objectSpread((0, _defineProperty2["default"])({
@@ -123,18 +123,18 @@ var Checkbox = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref)
123
123
  disabled: disabled,
124
124
  ref: ref,
125
125
  className: _Input.INPUT_CLASSNAME
126
- }, filterCheckboxProps(props))), (0, _react.jsx)(StyledLabel, {
126
+ }, props)), (0, _react.jsx)(StyledLabel, {
127
127
  htmlFor: id,
128
128
  disabled: disabled,
129
- markInvalid: props.markInvalid,
130
- aligncenter: props.aligncenter
129
+ markInvalid: markInvalid,
130
+ aligncenter: aligncenter
131
131
  }, children));
132
132
  });
133
133
 
134
134
  exports.Checkbox = Checkbox;
135
135
 
136
- var CheckboxLabel = function CheckboxLabel(_ref3) {
137
- var props = (0, _extends2["default"])({}, _ref3);
136
+ var CheckboxLabel = function CheckboxLabel(_ref4) {
137
+ var props = (0, _extends2["default"])({}, _ref4);
138
138
  return (0, _react.jsx)(_Text.Text, (0, _extends2["default"])({
139
139
  css: function css(theme) {
140
140
  return _objectSpread({}, (0, _Text.textStyle)(theme, _objectSpread({}, props)));
@@ -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","wrapperCSS","alignItems","justifyContent","outline","outlineOffset","marginBottom","opacity","cursor","CheckboxLabel"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAGA;;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,KAAD,EAA6B;AAC/C,MAAOE,QAAP,GAAqDF,KAArD,CAAOE,QAAP;AAAA,MAAiBC,WAAjB,GAAqDH,KAArD,CAAiBG,WAAjB;AAAA,2BAAqDH,KAArD,CAA8BI,WAA9B;AAAA,MAA8BA,WAA9B,mCAA4C,KAA5C;AACA,SACE;AACE,IAAA,GAAG,EAAE,aAACC,KAAD;AAAA;;AAAA,2HACEC,sBADF,2BAC0C;AAC3CC,QAAAA,UAAU,YAAKL,QAAQ,GAAGG,KAAK,CAACG,QAAN,CAAeC,qBAAlB,GAA0CJ,KAAK,CAACK,OAAN,CAAcC,YAArE,CADiC;AAE3CC,QAAAA,WAAW,EAAEP,KAAK,CAACK,OAAN,CAAcC;AAFgB,OAD1C,+DAKEL,sBALF,yBAKwC;AACzCO,QAAAA,IAAI,EAAER,KAAK,CAACK,OAAN,CAAcI;AADqB,OALxC,+DAQER,sBARF,iBAQgC;AACjCO,QAAAA,IAAI,EAAE,MAD2B;AAEjCE,Q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C,MAAAA,OAAO,EAAE,CAHJ;AAILrB,MAAAA,KAAK,EAAE,MAJF;AAKLsB,MAAAA,MAAM,EAAE9C,QAAQ,GAAG,aAAH,GAAmB;AAL9B,KAHT;AAUE,IAAA,QAAQ,EAAEA,QAVZ;AAWE,IAAA,GAAG,EAAEiC,GAXP;AAYE,IAAA,SAAS,EAAE7B;AAZb,KAaM0B,mBAAmB,CAAChC,KAAD,CAbzB,EAfF,EA+BE,gBAAC,WAAD;AAAa,IAAA,OAAO,EAAEoC,EAAtB;AAA0B,IAAA,QAAQ,EAAElC,QAApC;AAA8C,IAAA,WAAW,EAAEF,KAAK,CAACG,WAAjE;AAA8E,IAAA,WAAW,EAAEH,KAAK,CAACI;AAAjG,KACG2B,QADH,CA/BF,CADA;AAAA,CAHiE,CAA5D;;;;AA2CA,IAAMkB,aAAa,GAAG,SAAhBA,aAAgB;AAAA,MAAKjD,KAAL;AAAA,SAC3B,gBAAC,UAAD;AACE,IAAA,GAAG,EAAE,aAACK,KAAD;AAAA,+BACA,qBAAUA,KAAV,oBACEL,KADF,EADA;AAAA;AADP,KAMMA,KANN,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 {Theme} from '../Layout';\nimport {Text, TextProps, textStyle} 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 ? `2px solid ${theme.Checkbox.invalidBorderColor}`\n : `2px solid ${theme.Checkbox.border}`,\n }\n : {\n border: `2px 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 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 borderRadius: '4px',\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 = ({...props}: CheckboxLabelProps) => (\n <Text\n css={(theme: Theme) => ({\n ...textStyle(theme, {\n ...props,\n }),\n })}\n {...props}\n />\n);\n"],"file":"Checkbox.js"}
1
+ {"version":3,"sources":["Checkbox.tsx"],"names":["StyledLabel","disabled","markInvalid","aligncenter","children","props","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","React","forwardRef","ref","id","style","wrapperCSS","alignItems","justifyContent","outline","outlineOffset","marginBottom","opacity","cursor","CheckboxLabel"],"mappings":";;;;;;;;;;;;;;;;;AAoBA;;AACA;;AAGA;;AACA;;;;;;;;;;;;;AAQA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OAAwF;AAAA,MAAtFC,QAAsF,QAAtFA,QAAsF;AAAA,MAA5EC,WAA4E,QAA5EA,WAA4E;AAAA,8BAA/DC,WAA+D;AAAA,MAA/DA,WAA+D,iCAAjD,KAAiD;AAAA,MAA1CC,QAA0C,QAA1CA,QAA0C;AAAA,MAA7BC,KAA6B;AAC1G,SACE;AACE,IAAA,GAAG,EAAE,aAACC,KAAD;AAAA;;AAAA,2HACEC,sBADF,2BAC0C;AAC3CC,QAAAA,UAAU,YAAKP,QAAQ,GAAGK,KAAK,CAACG,QAAN,CAAeC,qBAAlB,GAA0CJ,KAAK,CAACK,OAAN,CAAcC,YAArE,CADiC;AAE3CC,QAAAA,WAAW,EAAEP,KAAK,CAACK,OAAN,CAAcC;AAFgB,OAD1C,+DAKEL,sBALF,yBAKwC;AACzCO,QAAAA,IAAI,EAAER,KAAK,CAACK,OAAN,CAAcI;AADqB,OALxC,+DAQER,sBARF,iBAQgC;AACjCO,QAAAA,IAAI,EAAE,MAD2B;AAEjCE,QAAAA,QAAQ,EAAE,UAFuB;AAGjCC,QAAAA,IAAI,EAAE,SAH2B;AAIjCC,QAAAA,GAAG,EAAE;AAJ4B,OARhC,oBAcC,CAACjB,QAAD,oDACGM,sBADH,yBACyC;AACzCM,QAAAA,WAAW,EAAEP,KAAK,CAACK,OAAN,CAAcC;AADc,OADzC,CAdD,yFAmBEL,sBAnBF;AAoBDC,QAAAA,UAAU,EAAEP,QAAQ,GAAGK,KAAK,CAACG,QAAN,CAAeU,cAAlB,GAAmCb,KAAK,CAACG,QAAN,CAAeD;AApBrE,SAqBG,CAACP,QAAD,GACA;AACEmB,QAAAA,MAAM,EAAElB,WAAW,uBACFI,KAAK,CAACG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AACC,KAAD;AAAA,+BACA,qBAAUA,KAAV,oBACED,KADF,EADA;AAAA;AADP,KAMMA,KANN,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, {useId} from 'react';\n\nimport {Theme} from '../Layout';\nimport {Text, TextProps, textStyle} from '../Text';\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 StyledLabel = ({disabled, markInvalid, aligncenter = false, children, ...props}: StyledLabelProps) => {\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 ? `2px solid ${theme.Checkbox.invalidBorderColor}`\n : `2px solid ${theme.Checkbox.border}`,\n }\n : {\n border: `2px 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 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 borderRadius: '4px',\n })}\n {...props}\n >\n {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\nexport const Checkbox: React.FC<CheckboxProps<HTMLInputElement>> = React.forwardRef<\n HTMLInputElement,\n CheckboxProps<HTMLInputElement>\n>(({id = useId(), children, style, disabled, wrapperCSS = {}, markInvalid, aligncenter, ...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 {...props}\n />\n\n <StyledLabel htmlFor={id} disabled={disabled} markInvalid={markInvalid} aligncenter={aligncenter}>\n {children}\n </StyledLabel>\n </div>\n));\n\nexport type CheckboxLabelProps<T = HTMLSpanElement> = TextProps<T>;\n\nexport const CheckboxLabel = ({...props}: CheckboxLabelProps) => (\n <Text\n css={(theme: Theme) => ({\n ...textStyle(theme, {\n ...props,\n }),\n })}\n {...props}\n />\n);\n"],"file":"Checkbox.js"}
@@ -12,4 +12,4 @@ export interface LinkProps<T = HTMLAnchorElement> extends TextProps<T> {
12
12
  }
13
13
  export declare const linkStyle: <T>(theme: Theme, props: LinkProps<T>) => CSSObject;
14
14
  export declare const filterLinkProps: (props: LinkProps) => Object;
15
- export declare const Link: (props: LinkProps) => jsx.JSX.Element;
15
+ export declare const Link: ({ targetBlank, ...props }: LinkProps) => jsx.JSX.Element;
package/src/Text/Link.js CHANGED
@@ -21,7 +21,8 @@ var _util = require("../util");
21
21
 
22
22
  var _Text = require("./Text");
23
23
 
24
- var _excluded = ["bold", "fontSize", "textTransform", "variant", "color"];
24
+ var _excluded = ["bold", "fontSize", "textTransform", "variant", "color"],
25
+ _excluded2 = ["targetBlank"];
25
26
 
26
27
  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; }
27
28
 
@@ -84,12 +85,14 @@ var filterLinkProps = function filterLinkProps(props) {
84
85
 
85
86
  exports.filterLinkProps = filterLinkProps;
86
87
 
87
- var Link = function Link(props) {
88
+ var Link = function Link(_ref2) {
89
+ var targetBlank = _ref2.targetBlank,
90
+ props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
88
91
  return (0, _react.jsx)("a", (0, _extends2["default"])({
89
92
  css: function css(theme) {
90
93
  return linkStyle(theme, props);
91
94
  },
92
- target: props.targetBlank && '_blank',
95
+ target: targetBlank && '_blank',
93
96
  rel: "noopener noreferrer"
94
97
  }, filterLinkProps(props)), props.children);
95
98
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["Link.tsx"],"names":["LinkVariant","linkStyle","theme","bold","fontSize","textTransform","variant","SECONDARY","color","general","props","cursor","textDecoration","PRIMARY","primaryColor","fontWeight","textUnderlineOffset","transition","defaultTransition","filter","filterLinkProps","Link","targetBlank","children"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAEA;;AACA;;;;;;;;IAEYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AAUL,IAAMC,SAA8D,GAAG,SAAjEA,SAAiE,CAC5EC,KAD4E,QAUzE;AAAA,uBAPDC,IAOC;AAAA,MAPDA,IAOC,0BAPM,IAON;AAAA,2BANDC,QAMC;AAAA,MANDA,QAMC,8BANU,MAMV;AAAA,gCALDC,aAKC;AAAA,MALDA,aAKC,mCALe,WAKf;AAAA,0BAJDC,OAIC;AAAA,MAJDA,OAIC,6BAJSN,WAAW,CAACO,SAIrB;AAAA,wBAHDC,KAGC;AAAA,MAHDA,KAGC,2BAHON,KAAK,CAACO,OAAN,CAAcD,KAGrB;AAAA,MAFEE,KAEF;AACH,uDACK,qBAAUR,KAAV;AAAkBC,IAAAA,IAAI,EAAJA,IAAlB;AAAwBK,IAAAA,KAAK,EAALA,KAAxB;AAA+BJ,IAAAA,QAAQ,EAARA,QAA/B;AAAyCC,IAAAA,aAAa,EAAbA;AAAzC,KAA2DK,KAA3D,EADL;AAEEF,IAAAA,KAAK,EAAEA,KAFT;AAGEG,IAAAA,MAAM,EAAE,SAHV;AAIEC,IAAAA,cAAc,EAAE,MAJlB;AAKE,mCAA+B;AAC7BJ,MAAAA,KAAK,EAAEA;AADsB;AALjC,KAQMF,OAAO,KAAKN,WAAW,CAACa,OAAxB,IAAmC;AACrC,iDAA6C;AAC3CL,MAAAA,KAAK,EAAEN,KAAK,CAACO,OAAN,CAAcK;AADsB,KADR;AAIrCV,IAAAA,QAAQ,EAAE,MAJ2B;AAKrCW,IAAAA,UAAU,EAAE,GALyB;AAMrCV,IAAAA,aAAa,EAAE,MANsB;AAOrCO,IAAAA,cAAc,EAAE,WAPqB;AAQrCI,IAAAA,mBAAmB,EAAE;AARgB,GARzC,GAkBMV,OAAO,KAAKN,WAAW,CAACO,SAAxB,IAAqC;AACvCU,IAAAA,UAAU,EAAEC,0BAD2B;AAEvC,eAAW;AACTC,MAAAA,MAAM,EAAE;AADC;AAF4B,GAlB3C;AAyBD,CApCM;;;;AAsCA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACV,KAAD;AAAA,SAAsB,uBAAY,2BAAgBA,KAAhB,CAAZ,EAAiD,EAAjD,CAAtB;AAAA,CAAxB;;;;AAEA,IAAMW,IAAI,GAAG,SAAPA,IAAO,CAACX,KAAD,EAAsB;AACxC,SACE;AACE,IAAA,GAAG,EAAE,aAACR,KAAD;AAAA,aAAkBD,SAAS,CAACC,KAAD,EAAQQ,KAAR,CAA3B;AAAA,KADP;AAEE,IAAA,MAAM,EAAEA,KAAK,CAACY,WAAN,IAAqB,QAF/B;AAGE,IAAA,GAAG,EAAC;AAHN,KAIMF,eAAe,CAACV,KAAD,CAJrB,GAMGA,KAAK,CAACa,QANT,CADF;AAUD,CAXM","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 {CSSObject, jsx} from '@emotion/react';\nimport {defaultTransition} from '../Identity/motions';\nimport {Theme} from '../Layout';\nimport {filterProps} from '../util';\nimport {TextProps, filterTextProps, textStyle} from './Text';\n\nexport enum LinkVariant {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\nexport interface LinkProps<T = HTMLAnchorElement> extends TextProps<T> {\n variant?: LinkVariant;\n targetBlank?: Boolean;\n}\n\nexport const linkStyle: <T>(theme: Theme, props: LinkProps<T>) => CSSObject = (\n theme,\n {\n bold = true,\n fontSize = '11px',\n textTransform = 'uppercase',\n variant = LinkVariant.SECONDARY,\n color = theme.general.color,\n ...props\n },\n) => {\n return {\n ...textStyle(theme, {bold, color, fontSize, textTransform, ...props}),\n color: color,\n cursor: 'pointer',\n textDecoration: 'none',\n '&:visited, &:link, &:active': {\n color: color,\n },\n ...(variant === LinkVariant.PRIMARY && {\n '&:hover, &:visited:hover, &:focus-visible': {\n color: theme.general.primaryColor,\n },\n fontSize: '16px',\n fontWeight: 400,\n textTransform: 'none',\n textDecoration: 'underline',\n textUnderlineOffset: '2px',\n }),\n ...(variant === LinkVariant.SECONDARY && {\n transition: defaultTransition,\n '&:hover': {\n filter: 'brightness(70%)',\n },\n }),\n };\n};\n\nexport const filterLinkProps = (props: LinkProps) => filterProps(filterTextProps(props) as LinkProps, []);\n\nexport const Link = (props: LinkProps) => {\n return (\n <a\n css={(theme: Theme) => linkStyle(theme, props)}\n target={props.targetBlank && '_blank'}\n rel=\"noopener noreferrer\"\n {...filterLinkProps(props)}\n >\n {props.children}\n </a>\n );\n};\n"],"file":"Link.js"}
1
+ {"version":3,"sources":["Link.tsx"],"names":["LinkVariant","linkStyle","theme","bold","fontSize","textTransform","variant","SECONDARY","color","general","props","cursor","textDecoration","PRIMARY","primaryColor","fontWeight","textUnderlineOffset","transition","defaultTransition","filter","filterLinkProps","Link","targetBlank","children"],"mappings":";;;;;;;;;;;;;;;AAoBA;;AACA;;AAEA;;AACA;;;;;;;;;IAEYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AAUL,IAAMC,SAA8D,GAAG,S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sB,uBAAY,2BAAgBA,KAAhB,CAAZ,EAAiD,EAAjD,CAAtB;AAAA,CAAxB;;;;AAEA,IAAMW,IAAI,GAAG,SAAPA,IAAO,QAAwC;AAAA,MAAtCC,WAAsC,SAAtCA,WAAsC;AAAA,MAAtBZ,KAAsB;AAC1D,SACE;AACE,IAAA,GAAG,EAAE,aAACR,KAAD;AAAA,aAAkBD,SAAS,CAACC,KAAD,EAAQQ,KAAR,CAA3B;AAAA,KADP;AAEE,IAAA,MAAM,EAAEY,WAAW,IAAI,QAFzB;AAGE,IAAA,GAAG,EAAC;AAHN,KAIMF,eAAe,CAACV,KAAD,CAJrB,GAMGA,KAAK,CAACa,QANT,CADF;AAUD,CAXM","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 {CSSObject, jsx} from '@emotion/react';\nimport {defaultTransition} from '../Identity/motions';\nimport {Theme} from '../Layout';\nimport {filterProps} from '../util';\nimport {TextProps, filterTextProps, textStyle} from './Text';\n\nexport enum LinkVariant {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\nexport interface LinkProps<T = HTMLAnchorElement> extends TextProps<T> {\n variant?: LinkVariant;\n targetBlank?: Boolean;\n}\n\nexport const linkStyle: <T>(theme: Theme, props: LinkProps<T>) => CSSObject = (\n theme,\n {\n bold = true,\n fontSize = '11px',\n textTransform = 'uppercase',\n variant = LinkVariant.SECONDARY,\n color = theme.general.color,\n ...props\n },\n) => {\n return {\n ...textStyle(theme, {bold, color, fontSize, textTransform, ...props}),\n color: color,\n cursor: 'pointer',\n textDecoration: 'none',\n '&:visited, &:link, &:active': {\n color: color,\n },\n ...(variant === LinkVariant.PRIMARY && {\n '&:hover, &:visited:hover, &:focus-visible': {\n color: theme.general.primaryColor,\n },\n fontSize: '16px',\n fontWeight: 400,\n textTransform: 'none',\n textDecoration: 'underline',\n textUnderlineOffset: '2px',\n }),\n ...(variant === LinkVariant.SECONDARY && {\n transition: defaultTransition,\n '&:hover': {\n filter: 'brightness(70%)',\n },\n }),\n };\n};\n\nexport const filterLinkProps = (props: LinkProps) => filterProps(filterTextProps(props) as LinkProps, []);\n\nexport const Link = ({targetBlank, ...props}: LinkProps) => {\n return (\n <a\n css={(theme: Theme) => linkStyle(theme, props)}\n target={targetBlank && '_blank'}\n rel=\"noopener noreferrer\"\n {...filterLinkProps(props)}\n >\n {props.children}\n </a>\n );\n};\n"],"file":"Link.js"}