@activecollab/components 1.0.146 → 1.0.147
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/components/Chip/Chip.js +28 -4
- package/dist/cjs/components/Chip/Chip.js.map +1 -1
- package/dist/cjs/components/Chip/Styles.js +14 -2
- package/dist/cjs/components/Chip/Styles.js.map +1 -1
- package/dist/esm/components/Chip/Chip.d.ts +2 -0
- package/dist/esm/components/Chip/Chip.d.ts.map +1 -1
- package/dist/esm/components/Chip/Chip.js +23 -4
- package/dist/esm/components/Chip/Chip.js.map +1 -1
- package/dist/esm/components/Chip/Styles.d.ts +4 -1
- package/dist/esm/components/Chip/Styles.d.ts.map +1 -1
- package/dist/esm/components/Chip/Styles.js +14 -2
- package/dist/esm/components/Chip/Styles.js.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.Chip = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _Styles = require("./Styles");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _Typography = require("../Typography/Typography");
|
|
15
|
+
|
|
16
|
+
var _excluded = ["leftAdornment", "label", "onClose", "size"];
|
|
17
|
+
|
|
18
|
+
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); }
|
|
13
19
|
|
|
14
|
-
function
|
|
20
|
+
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; }
|
|
15
21
|
|
|
16
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
23
|
|
|
@@ -23,13 +29,31 @@ var Chip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
23
29
|
var leftAdornment = _ref.leftAdornment,
|
|
24
30
|
label = _ref.label,
|
|
25
31
|
onClose = _ref.onClose,
|
|
32
|
+
_ref$size = _ref.size,
|
|
33
|
+
size = _ref$size === void 0 ? "regular" : _ref$size,
|
|
26
34
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
35
|
|
|
28
36
|
var showClose = typeof onClose === "function";
|
|
37
|
+
var variant = (0, _react.useMemo)(function () {
|
|
38
|
+
switch (size) {
|
|
39
|
+
case "regular":
|
|
40
|
+
return "Body 2";
|
|
41
|
+
|
|
42
|
+
case "big":
|
|
43
|
+
return "Body 1";
|
|
44
|
+
|
|
45
|
+
default:
|
|
46
|
+
return "Caption 1";
|
|
47
|
+
}
|
|
48
|
+
}, [size]);
|
|
29
49
|
return /*#__PURE__*/_react.default.createElement(_Styles.ChipContainer, _extends({}, rest, {
|
|
30
50
|
ref: ref,
|
|
51
|
+
$size: size,
|
|
31
52
|
$showClose: showClose
|
|
32
|
-
}), leftAdornment, /*#__PURE__*/_react.default.createElement(
|
|
53
|
+
}), leftAdornment, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
|
|
54
|
+
variant: variant
|
|
55
|
+
}, label), showClose ? /*#__PURE__*/_react.default.createElement(_Styles.ChipTrigger, {
|
|
56
|
+
$size: size,
|
|
33
57
|
onClick: onClose
|
|
34
58
|
}, /*#__PURE__*/_react.default.createElement(_Styles.ChipCloseIcon, {
|
|
35
59
|
fill: "currentColor"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Chip/Chip.tsx"],"names":["Chip","React","forwardRef","ref","leftAdornment","label","onClose","rest","showClose","displayName"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Chip/Chip.tsx"],"names":["Chip","React","forwardRef","ref","leftAdornment","label","onClose","size","rest","showClose","variant","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;AASO,IAAMA,IAAI,gBAAGC,eAAMC,UAAN,CAGlB,gBAA+DC,GAA/D,EAAuE;AAAA,MAApEC,aAAoE,QAApEA,aAAoE;AAAA,MAArDC,KAAqD,QAArDA,KAAqD;AAAA,MAA9CC,OAA8C,QAA9CA,OAA8C;AAAA,uBAArCC,IAAqC;AAAA,MAArCA,IAAqC,0BAA9B,SAA8B;AAAA,MAAhBC,IAAgB;;AACvE,MAAMC,SAAS,GAAG,OAAOH,OAAP,KAAmB,UAArC;AACA,MAAMI,OAAO,GAAG,oBAAQ,YAAM;AAC5B,YAAQH,IAAR;AACE,WAAK,SAAL;AACE,eAAO,QAAP;;AACF,WAAK,KAAL;AACE,eAAO,QAAP;;AACF;AACE,eAAO,WAAP;AANJ;AAQD,GATe,EASb,CAACA,IAAD,CATa,CAAhB;AAUA,sBACE,6BAAC,qBAAD,eAAmBC,IAAnB;AAAyB,IAAA,GAAG,EAAEL,GAA9B;AAAmC,IAAA,KAAK,EAAEI,IAA1C;AAAgD,IAAA,UAAU,EAAEE;AAA5D,MACGL,aADH,eAEE,6BAAC,sBAAD;AAAY,IAAA,OAAO,EAAEM;AAArB,KAA+BL,KAA/B,CAFF,EAGGI,SAAS,gBACR,6BAAC,mBAAD;AAAa,IAAA,KAAK,EAAEF,IAApB;AAA0B,IAAA,OAAO,EAAED;AAAnC,kBACE,6BAAC,qBAAD;AAAe,IAAA,IAAI,EAAC;AAApB,IADF,CADQ,GAIN,IAPN,CADF;AAWD,CA1BmB,CAAb;;;AA4BPN,IAAI,CAACW,WAAL,GAAmB,MAAnB","sourcesContent":["import React, { ReactNode, useMemo } from \"react\";\nimport { ChipCloseIcon, ChipContainer, ChipTrigger } from \"./Styles\";\nimport { InputSize } from \"../Input/types\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport interface ChipProps {\n label: string;\n onClose?: React.MouseEventHandler<HTMLButtonElement>;\n leftAdornment?: ReactNode;\n size?: InputSize;\n}\n\nexport const Chip = React.forwardRef<\n HTMLDivElement,\n ChipProps & Omit<React.ComponentPropsWithoutRef<\"div\">, keyof ChipProps>\n>(({ leftAdornment, label, onClose, size = \"regular\", ...rest }, ref) => {\n const showClose = typeof onClose === \"function\";\n const variant = useMemo(() => {\n switch (size) {\n case \"regular\":\n return \"Body 2\";\n case \"big\":\n return \"Body 1\";\n default:\n return \"Caption 1\";\n }\n }, [size]);\n return (\n <ChipContainer {...rest} ref={ref} $size={size} $showClose={showClose}>\n {leftAdornment}\n <Typography variant={variant}>{label}</Typography>\n {showClose ? (\n <ChipTrigger $size={size} onClick={onClose}>\n <ChipCloseIcon fill=\"currentColor\" />\n </ChipTrigger>\n ) : null}\n </ChipContainer>\n );\n});\n\nChip.displayName = \"Chip\";\n"],"file":"Chip.js"}
|
|
@@ -24,7 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
24
24
|
var ChipContainer = _styledComponents.default.div.withConfig({
|
|
25
25
|
displayName: "Styles__ChipContainer",
|
|
26
26
|
componentId: "sc-7s0bd1-0"
|
|
27
|
-
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
27
|
+
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
28
28
|
"height": "1.5rem"
|
|
29
29
|
}, {
|
|
30
30
|
"borderRadius": "0.25rem"
|
|
@@ -56,6 +56,12 @@ var ChipContainer = _styledComponents.default.div.withConfig({
|
|
|
56
56
|
return props.$showClose ? null : (0, _styledComponents.css)(["", ""], {
|
|
57
57
|
"paddingRight": "0.375rem"
|
|
58
58
|
});
|
|
59
|
+
}, function (props) {
|
|
60
|
+
return props.$size === "regular" && (0, _styledComponents.css)(["height:24px;"]);
|
|
61
|
+
}, function (props) {
|
|
62
|
+
return props.$size === "small" && (0, _styledComponents.css)(["height:18px;"]);
|
|
63
|
+
}, function (props) {
|
|
64
|
+
return props.$size === "big" && (0, _styledComponents.css)(["height:30px;"]);
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
exports.ChipContainer = ChipContainer;
|
|
@@ -77,7 +83,7 @@ ChipLabel.displayName = "ChipLabel";
|
|
|
77
83
|
var ChipTrigger = (0, _styledComponents.default)(_Trigger.Trigger).withConfig({
|
|
78
84
|
displayName: "Styles__ChipTrigger",
|
|
79
85
|
componentId: "sc-7s0bd1-2"
|
|
80
|
-
})(["", " ", " ", " &:hover{", "}"], {
|
|
86
|
+
})(["", " ", " ", " &:hover{", "}", " ", " ", ""], {
|
|
81
87
|
"display": "flex"
|
|
82
88
|
}, {
|
|
83
89
|
"alignItems": "center"
|
|
@@ -85,6 +91,12 @@ var ChipTrigger = (0, _styledComponents.default)(_Trigger.Trigger).withConfig({
|
|
|
85
91
|
"justifyContent": "center"
|
|
86
92
|
}, {
|
|
87
93
|
"backgroundColor": "var(--color-theme-transparent-400)"
|
|
94
|
+
}, function (props) {
|
|
95
|
+
return props.$size === "regular" && (0, _styledComponents.css)(["height:24px;width:24px;"]);
|
|
96
|
+
}, function (props) {
|
|
97
|
+
return props.$size === "small" && (0, _styledComponents.css)(["height:18px;width:18px;"]);
|
|
98
|
+
}, function (props) {
|
|
99
|
+
return props.$size === "big" && (0, _styledComponents.css)(["height:30px;width:30px;"]);
|
|
88
100
|
});
|
|
89
101
|
exports.ChipTrigger = ChipTrigger;
|
|
90
102
|
ChipTrigger.displayName = "ChipTrigger";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Chip/Styles.ts"],"names":["ChipContainer","styled","div","FontStyle","BoxSizingStyle","props","$showClose","css","displayName","ChipLabel","span","ChipTrigger","Trigger","ChipCloseIcon","CloseSmallIcon"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,aAAa,GAAGC,0BAAOC,GAAV;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Chip/Styles.ts"],"names":["ChipContainer","styled","div","FontStyle","BoxSizingStyle","props","$showClose","css","$size","displayName","ChipLabel","span","ChipTrigger","Trigger","ChipCloseIcon","CloseSmallIcon"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,aAAa,GAAGC,0BAAOC,GAAV;AAAA;AAAA;AAAA,2IAMpB;AAAA;AAAA,CANoB,EAOpB;AAAA;AAAA,CAPoB,EAQpB;AAAA;AAAA,CARoB,EASpB;AAAA;AAAA,CAToB,EAUpB;AAAA;AAAA,CAVoB,EAWpB;AAAA;AAAA,CAXoB,EAYpB;AAAA;AAAA,CAZoB,EAapB;AAAA;AAAA,CAboB,EAetBC,oBAfsB,EAgBtBC,8BAhBsB,EAmBpB;AAAA;AAAA,CAnBoB,EAoBpB;AAAA;AAAA,CApBoB,EAqBpB;AAAA;AAAA,CArBoB,EAsBpB;AAAA;AAAA,CAtBoB,EAuBpB;AAAA;AAAA,CAvBoB,EA0BpB;AAAA;AAAA,CA1BoB,EA4BtB,UAACC,KAAD;AAAA,SACAA,KAAK,CAACC,UAAN,GACI,IADJ,OAEIC,qBAFJ,YAGU;AAAA;AAAA,GAHV,CADA;AAAA,CA5BsB,EAmCtB,UAACF,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,SAAhB,QACAD,qBADA,mBADA;AAAA,CAnCsB,EAyCtB,UAACF,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,OAAhB,QACAD,qBADA,mBADA;AAAA,CAzCsB,EA+CtB,UAACF,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,KAAhB,QACAD,qBADA,mBADA;AAAA,CA/CsB,CAAnB;;;AAsDPP,aAAa,CAACS,WAAd,GAA4B,eAA5B;;AAEO,IAAMC,SAAS,GAAGT,0BAAOU,IAAV;AAAA;AAAA;AAAA,kBAChB;AAAA;AAAA,CADgB,EAEhB;AAAA;AAAA;AAAA;AAAA,CAFgB,CAAf;;;AAKPD,SAAS,CAACD,WAAV,GAAwB,WAAxB;AAEO,IAAMG,WAAW,GAAG,+BAAOC,gBAAP,CAAH;AAAA;AAAA;AAAA,mDAClB;AAAA;AAAA,CADkB,EAElB;AAAA;AAAA,CAFkB,EAGlB;AAAA;AAAA,CAHkB,EAMhB;AAAA;AAAA,CANgB,EASpB,UAACR,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,SAAhB,QACAD,qBADA,8BADA;AAAA,CAToB,EAgBpB,UAACF,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,OAAhB,QACAD,qBADA,8BADA;AAAA,CAhBoB,EAuBpB,UAACF,KAAD;AAAA,SACAA,KAAK,CAACG,KAAN,KAAgB,KAAhB,QACAD,qBADA,8BADA;AAAA,CAvBoB,CAAjB;;AA+BPK,WAAW,CAACH,WAAZ,GAA0B,aAA1B;AAEO,IAAMK,aAAa,GAAG,+BAAOC,qBAAP,CAAH;AAAA;AAAA;AAAA,aACpB;AAAA;AAAA,CADoB,CAAnB;;AAIPD,aAAa,CAACL,WAAd,GAA4B,eAA5B","sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\nimport { CloseSmallIcon } from \"../Icons\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { Trigger } from \"../Trigger\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const ChipContainer = styled.div<{\n $showClose?: boolean;\n $size?: string;\n}>`\n min-width: 80px;\n max-width: 220px;\n ${tw`tw-h-6`}\n ${tw`tw-rounded`}\n ${tw`tw-inline-flex`}\n ${tw`tw-items-center`}\n ${tw`tw-justify-center`}\n ${tw`tw-gap-1`}\n ${tw`tw-pl-1.5`}\n ${tw`tw-overflow-hidden`}\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n // font\n ${tw`tw-text-body-2`}\n ${tw`tw-text-theme-900`}\n ${tw`tw-leading-regular`}\n ${tw`tw-tracking-regular`}\n ${tw`tw-font-regular`}\n\n // background\n ${tw`tw-bg-theme-400`}\n\n ${(props) =>\n props.$showClose\n ? null\n : css`\n ${tw`tw-pr-1.5`}\n `}\n\n ${(props) =>\n props.$size === \"regular\" &&\n css`\n height: 24px;\n `}\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n height: 18px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 30px;\n `}\n`;\n\nChipContainer.displayName = \"ChipContainer\";\n\nexport const ChipLabel = styled.span`\n ${tw`tw-w-full`}\n ${tw`tw-truncate`}\n`;\n\nChipLabel.displayName = \"ChipLabel\";\n\nexport const ChipTrigger = styled(Trigger)<{ $size?: string }>`\n ${tw`tw-flex`}\n ${tw`tw-items-center`}\n ${tw`tw-justify-center`}\n\n &:hover {\n ${tw`tw-bg-theme-transparent-400`}\n }\n\n ${(props) =>\n props.$size === \"regular\" &&\n css`\n height: 24px;\n width: 24px;\n `}\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n height: 18px;\n width: 18px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 30px;\n width: 30px;\n `}\n`;\n\nChipTrigger.displayName = \"ChipTrigger\";\n\nexport const ChipCloseIcon = styled(CloseSmallIcon)`\n ${tw`tw-text-theme-700`}\n`;\n\nChipCloseIcon.displayName = \"ChipCloseIcon\";\n"],"file":"Styles.js"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import { InputSize } from "../Input/types";
|
|
2
3
|
export interface ChipProps {
|
|
3
4
|
label: string;
|
|
4
5
|
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
6
|
leftAdornment?: ReactNode;
|
|
7
|
+
size?: InputSize;
|
|
6
8
|
}
|
|
7
9
|
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, keyof ChipProps> & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,IAAI,mPA0Bf,CAAC"}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["leftAdornment", "label", "onClose"];
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { ChipCloseIcon, ChipContainer,
|
|
3
|
+
var _excluded = ["leftAdornment", "label", "onClose", "size"];
|
|
4
|
+
import React, { useMemo } from "react";
|
|
5
|
+
import { ChipCloseIcon, ChipContainer, ChipTrigger } from "./Styles";
|
|
6
|
+
import { Typography } from "../Typography/Typography";
|
|
6
7
|
export var Chip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
7
8
|
var leftAdornment = _ref.leftAdornment,
|
|
8
9
|
label = _ref.label,
|
|
9
10
|
onClose = _ref.onClose,
|
|
11
|
+
_ref$size = _ref.size,
|
|
12
|
+
size = _ref$size === void 0 ? "regular" : _ref$size,
|
|
10
13
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
11
14
|
|
|
12
15
|
var showClose = typeof onClose === "function";
|
|
16
|
+
var variant = useMemo(function () {
|
|
17
|
+
switch (size) {
|
|
18
|
+
case "regular":
|
|
19
|
+
return "Body 2";
|
|
20
|
+
|
|
21
|
+
case "big":
|
|
22
|
+
return "Body 1";
|
|
23
|
+
|
|
24
|
+
default:
|
|
25
|
+
return "Caption 1";
|
|
26
|
+
}
|
|
27
|
+
}, [size]);
|
|
13
28
|
return /*#__PURE__*/React.createElement(ChipContainer, _extends({}, rest, {
|
|
14
29
|
ref: ref,
|
|
30
|
+
$size: size,
|
|
15
31
|
$showClose: showClose
|
|
16
|
-
}), leftAdornment, /*#__PURE__*/React.createElement(
|
|
32
|
+
}), leftAdornment, /*#__PURE__*/React.createElement(Typography, {
|
|
33
|
+
variant: variant
|
|
34
|
+
}, label), showClose ? /*#__PURE__*/React.createElement(ChipTrigger, {
|
|
35
|
+
$size: size,
|
|
17
36
|
onClick: onClose
|
|
18
37
|
}, /*#__PURE__*/React.createElement(ChipCloseIcon, {
|
|
19
38
|
fill: "currentColor"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Chip/Chip.tsx"],"names":["React","ChipCloseIcon","ChipContainer","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Chip/Chip.tsx"],"names":["React","useMemo","ChipCloseIcon","ChipContainer","ChipTrigger","Typography","Chip","forwardRef","ref","leftAdornment","label","onClose","size","rest","showClose","variant","displayName"],"mappings":";;;AAAA,OAAOA,KAAP,IAA2BC,OAA3B,QAA0C,OAA1C;AACA,SAASC,aAAT,EAAwBC,aAAxB,EAAuCC,WAAvC,QAA0D,UAA1D;AAEA,SAASC,UAAT,QAA2B,0BAA3B;AASA,OAAO,IAAMC,IAAI,gBAAGN,KAAK,CAACO,UAAN,CAGlB,gBAA+DC,GAA/D,EAAuE;AAAA,MAApEC,aAAoE,QAApEA,aAAoE;AAAA,MAArDC,KAAqD,QAArDA,KAAqD;AAAA,MAA9CC,OAA8C,QAA9CA,OAA8C;AAAA,uBAArCC,IAAqC;AAAA,MAArCA,IAAqC,0BAA9B,SAA8B;AAAA,MAAhBC,IAAgB;;AACvE,MAAMC,SAAS,GAAG,OAAOH,OAAP,KAAmB,UAArC;AACA,MAAMI,OAAO,GAAGd,OAAO,CAAC,YAAM;AAC5B,YAAQW,IAAR;AACE,WAAK,SAAL;AACE,eAAO,QAAP;;AACF,WAAK,KAAL;AACE,eAAO,QAAP;;AACF;AACE,eAAO,WAAP;AANJ;AAQD,GATsB,EASpB,CAACA,IAAD,CAToB,CAAvB;AAUA,sBACE,oBAAC,aAAD,eAAmBC,IAAnB;AAAyB,IAAA,GAAG,EAAEL,GAA9B;AAAmC,IAAA,KAAK,EAAEI,IAA1C;AAAgD,IAAA,UAAU,EAAEE;AAA5D,MACGL,aADH,eAEE,oBAAC,UAAD;AAAY,IAAA,OAAO,EAAEM;AAArB,KAA+BL,KAA/B,CAFF,EAGGI,SAAS,gBACR,oBAAC,WAAD;AAAa,IAAA,KAAK,EAAEF,IAApB;AAA0B,IAAA,OAAO,EAAED;AAAnC,kBACE,oBAAC,aAAD;AAAe,IAAA,IAAI,EAAC;AAApB,IADF,CADQ,GAIN,IAPN,CADF;AAWD,CA1BmB,CAAb;AA4BPL,IAAI,CAACU,WAAL,GAAmB,MAAnB","sourcesContent":["import React, { ReactNode, useMemo } from \"react\";\nimport { ChipCloseIcon, ChipContainer, ChipTrigger } from \"./Styles\";\nimport { InputSize } from \"../Input/types\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport interface ChipProps {\n label: string;\n onClose?: React.MouseEventHandler<HTMLButtonElement>;\n leftAdornment?: ReactNode;\n size?: InputSize;\n}\n\nexport const Chip = React.forwardRef<\n HTMLDivElement,\n ChipProps & Omit<React.ComponentPropsWithoutRef<\"div\">, keyof ChipProps>\n>(({ leftAdornment, label, onClose, size = \"regular\", ...rest }, ref) => {\n const showClose = typeof onClose === \"function\";\n const variant = useMemo(() => {\n switch (size) {\n case \"regular\":\n return \"Body 2\";\n case \"big\":\n return \"Body 1\";\n default:\n return \"Caption 1\";\n }\n }, [size]);\n return (\n <ChipContainer {...rest} ref={ref} $size={size} $showClose={showClose}>\n {leftAdornment}\n <Typography variant={variant}>{label}</Typography>\n {showClose ? (\n <ChipTrigger $size={size} onClick={onClose}>\n <ChipCloseIcon fill=\"currentColor\" />\n </ChipTrigger>\n ) : null}\n </ChipContainer>\n );\n});\n\nChip.displayName = \"Chip\";\n"],"file":"Chip.js"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const ChipContainer: import("styled-components").StyledComponent<"div", any, {
|
|
3
3
|
$showClose?: boolean | undefined;
|
|
4
|
+
$size?: string | undefined;
|
|
4
5
|
}, never>;
|
|
5
6
|
export declare const ChipLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
|
-
export declare const ChipTrigger: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & import("react").RefAttributes<HTMLButtonElement>>, any, {
|
|
7
|
+
export declare const ChipTrigger: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & import("react").RefAttributes<HTMLButtonElement>>, any, {
|
|
8
|
+
$size?: string | undefined;
|
|
9
|
+
}, never>;
|
|
7
10
|
export declare const ChipCloseIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").SVGProps<SVGSVGElement>, "string" | "style" | "clipPath" | "filter" | "mask" | "path" | "key" | "name" | "type" | "className" | "id" | "lang" | "tabIndex" | "role" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "tw" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "height" | "max" | "media" | "method" | "min" | "target" | "width" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clip" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "display" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "end" | "exponent" | "externalResourcesRequired" | "fill" | "fillOpacity" | "fillRule" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "href" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "letterSpacing" | "lightingColor" | "limitingConeAngle" | "local" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "orientation" | "origin" | "overflow" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "to" | "transform" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "x" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "y" | "yChannelSelector" | "z" | "zoomAndPan"> & import("react").RefAttributes<SVGSVGElement>>, any, {}, never>;
|
|
8
11
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/Styles.ts"],"names":[],"mappings":";AAOA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/Styles.ts"],"names":[],"mappings":";AAOA,eAAO,MAAM,aAAa;;;SAoDzB,CAAC;AAIF,eAAO,MAAM,SAAS,qEAGrB,CAAC;AAIF,eAAO,MAAM,WAAW;;SA6BvB,CAAC;AAIF,eAAO,MAAM,aAAa,wqPAEzB,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { FontStyle } from "../FontStyle";
|
|
|
6
6
|
export var ChipContainer = styled.div.withConfig({
|
|
7
7
|
displayName: "Styles__ChipContainer",
|
|
8
8
|
componentId: "sc-7s0bd1-0"
|
|
9
|
-
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
9
|
+
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
10
10
|
"height": "1.5rem"
|
|
11
11
|
}, {
|
|
12
12
|
"borderRadius": "0.25rem"
|
|
@@ -38,6 +38,12 @@ export var ChipContainer = styled.div.withConfig({
|
|
|
38
38
|
return props.$showClose ? null : css(["", ""], {
|
|
39
39
|
"paddingRight": "0.375rem"
|
|
40
40
|
});
|
|
41
|
+
}, function (props) {
|
|
42
|
+
return props.$size === "regular" && css(["height:24px;"]);
|
|
43
|
+
}, function (props) {
|
|
44
|
+
return props.$size === "small" && css(["height:18px;"]);
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return props.$size === "big" && css(["height:30px;"]);
|
|
41
47
|
});
|
|
42
48
|
ChipContainer.displayName = "ChipContainer";
|
|
43
49
|
export var ChipLabel = styled.span.withConfig({
|
|
@@ -54,7 +60,7 @@ ChipLabel.displayName = "ChipLabel";
|
|
|
54
60
|
export var ChipTrigger = styled(Trigger).withConfig({
|
|
55
61
|
displayName: "Styles__ChipTrigger",
|
|
56
62
|
componentId: "sc-7s0bd1-2"
|
|
57
|
-
})(["", " ", " ", " &:hover{", "}"], {
|
|
63
|
+
})(["", " ", " ", " &:hover{", "}", " ", " ", ""], {
|
|
58
64
|
"display": "flex"
|
|
59
65
|
}, {
|
|
60
66
|
"alignItems": "center"
|
|
@@ -62,6 +68,12 @@ export var ChipTrigger = styled(Trigger).withConfig({
|
|
|
62
68
|
"justifyContent": "center"
|
|
63
69
|
}, {
|
|
64
70
|
"backgroundColor": "var(--color-theme-transparent-400)"
|
|
71
|
+
}, function (props) {
|
|
72
|
+
return props.$size === "regular" && css(["height:24px;width:24px;"]);
|
|
73
|
+
}, function (props) {
|
|
74
|
+
return props.$size === "small" && css(["height:18px;width:18px;"]);
|
|
75
|
+
}, function (props) {
|
|
76
|
+
return props.$size === "big" && css(["height:30px;width:30px;"]);
|
|
65
77
|
});
|
|
66
78
|
ChipTrigger.displayName = "ChipTrigger";
|
|
67
79
|
export var ChipCloseIcon = styled(CloseSmallIcon).withConfig({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Chip/Styles.ts"],"names":["styled","css","CloseSmallIcon","BoxSizingStyle","Trigger","FontStyle","ChipContainer","div","props","$showClose","displayName","ChipLabel","span","ChipTrigger","ChipCloseIcon"],"mappings":"AAAA,OAAOA,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AAEA,SAASC,cAAT,QAA+B,UAA/B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,OAAT,QAAwB,YAAxB;AACA,SAASC,SAAT,QAA0B,cAA1B;AAEA,OAAO,IAAMC,aAAa,GAAGN,MAAM,CAACO,GAAV;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Chip/Styles.ts"],"names":["styled","css","CloseSmallIcon","BoxSizingStyle","Trigger","FontStyle","ChipContainer","div","props","$showClose","$size","displayName","ChipLabel","span","ChipTrigger","ChipCloseIcon"],"mappings":"AAAA,OAAOA,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AAEA,SAASC,cAAT,QAA+B,UAA/B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,OAAT,QAAwB,YAAxB;AACA,SAASC,SAAT,QAA0B,cAA1B;AAEA,OAAO,IAAMC,aAAa,GAAGN,MAAM,CAACO,GAAV;AAAA;AAAA;AAAA,2IAMpB;AAAA;AAAA,CANoB,EAOpB;AAAA;AAAA,CAPoB,EAQpB;AAAA;AAAA,CARoB,EASpB;AAAA;AAAA,CAToB,EAUpB;AAAA;AAAA,CAVoB,EAWpB;AAAA;AAAA,CAXoB,EAYpB;AAAA;AAAA,CAZoB,EAapB;AAAA;AAAA,CAboB,EAetBF,SAfsB,EAgBtBF,cAhBsB,EAmBpB;AAAA;AAAA,CAnBoB,EAoBpB;AAAA;AAAA,CApBoB,EAqBpB;AAAA;AAAA,CArBoB,EAsBpB;AAAA;AAAA,CAtBoB,EAuBpB;AAAA;AAAA,CAvBoB,EA0BpB;AAAA;AAAA,CA1BoB,EA4BtB,UAACK,KAAD;AAAA,SACAA,KAAK,CAACC,UAAN,GACI,IADJ,GAEIR,GAFJ,WAGU;AAAA;AAAA,GAHV,CADA;AAAA,CA5BsB,EAmCtB,UAACO,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,SAAhB,IACAT,GADA,kBADA;AAAA,CAnCsB,EAyCtB,UAACO,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,OAAhB,IACAT,GADA,kBADA;AAAA,CAzCsB,EA+CtB,UAACO,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,KAAhB,IACAT,GADA,kBADA;AAAA,CA/CsB,CAAnB;AAsDPK,aAAa,CAACK,WAAd,GAA4B,eAA5B;AAEA,OAAO,IAAMC,SAAS,GAAGZ,MAAM,CAACa,IAAV;AAAA;AAAA;AAAA,kBAChB;AAAA;AAAA,CADgB,EAEhB;AAAA;AAAA;AAAA;AAAA,CAFgB,CAAf;AAKPD,SAAS,CAACD,WAAV,GAAwB,WAAxB;AAEA,OAAO,IAAMG,WAAW,GAAGd,MAAM,CAACI,OAAD,CAAT;AAAA;AAAA;AAAA,mDAClB;AAAA;AAAA,CADkB,EAElB;AAAA;AAAA,CAFkB,EAGlB;AAAA;AAAA,CAHkB,EAMhB;AAAA;AAAA,CANgB,EASpB,UAACI,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,SAAhB,IACAT,GADA,6BADA;AAAA,CAToB,EAgBpB,UAACO,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,OAAhB,IACAT,GADA,6BADA;AAAA,CAhBoB,EAuBpB,UAACO,KAAD;AAAA,SACAA,KAAK,CAACE,KAAN,KAAgB,KAAhB,IACAT,GADA,6BADA;AAAA,CAvBoB,CAAjB;AA+BPa,WAAW,CAACH,WAAZ,GAA0B,aAA1B;AAEA,OAAO,IAAMI,aAAa,GAAGf,MAAM,CAACE,cAAD,CAAT;AAAA;AAAA;AAAA,aACpB;AAAA;AAAA,CADoB,CAAnB;AAIPa,aAAa,CAACJ,WAAd,GAA4B,eAA5B","sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\nimport { CloseSmallIcon } from \"../Icons\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { Trigger } from \"../Trigger\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const ChipContainer = styled.div<{\n $showClose?: boolean;\n $size?: string;\n}>`\n min-width: 80px;\n max-width: 220px;\n ${tw`tw-h-6`}\n ${tw`tw-rounded`}\n ${tw`tw-inline-flex`}\n ${tw`tw-items-center`}\n ${tw`tw-justify-center`}\n ${tw`tw-gap-1`}\n ${tw`tw-pl-1.5`}\n ${tw`tw-overflow-hidden`}\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n // font\n ${tw`tw-text-body-2`}\n ${tw`tw-text-theme-900`}\n ${tw`tw-leading-regular`}\n ${tw`tw-tracking-regular`}\n ${tw`tw-font-regular`}\n\n // background\n ${tw`tw-bg-theme-400`}\n\n ${(props) =>\n props.$showClose\n ? null\n : css`\n ${tw`tw-pr-1.5`}\n `}\n\n ${(props) =>\n props.$size === \"regular\" &&\n css`\n height: 24px;\n `}\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n height: 18px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 30px;\n `}\n`;\n\nChipContainer.displayName = \"ChipContainer\";\n\nexport const ChipLabel = styled.span`\n ${tw`tw-w-full`}\n ${tw`tw-truncate`}\n`;\n\nChipLabel.displayName = \"ChipLabel\";\n\nexport const ChipTrigger = styled(Trigger)<{ $size?: string }>`\n ${tw`tw-flex`}\n ${tw`tw-items-center`}\n ${tw`tw-justify-center`}\n\n &:hover {\n ${tw`tw-bg-theme-transparent-400`}\n }\n\n ${(props) =>\n props.$size === \"regular\" &&\n css`\n height: 24px;\n width: 24px;\n `}\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n height: 18px;\n width: 18px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 30px;\n width: 30px;\n `}\n`;\n\nChipTrigger.displayName = \"ChipTrigger\";\n\nexport const ChipCloseIcon = styled(CloseSmallIcon)`\n ${tw`tw-text-theme-700`}\n`;\n\nChipCloseIcon.displayName = \"ChipCloseIcon\";\n"],"file":"Styles.js"}
|
package/dist/index.js
CHANGED
|
@@ -11315,7 +11315,7 @@
|
|
|
11315
11315
|
var ChipContainer = styled__default["default"].div.withConfig({
|
|
11316
11316
|
displayName: "Styles__ChipContainer",
|
|
11317
11317
|
componentId: "sc-7s0bd1-0"
|
|
11318
|
-
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
11318
|
+
})(["min-width:80px;max-width:220px;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], {
|
|
11319
11319
|
"height": "1.5rem"
|
|
11320
11320
|
}, {
|
|
11321
11321
|
"borderRadius": "0.25rem"
|
|
@@ -11347,6 +11347,12 @@
|
|
|
11347
11347
|
return props.$showClose ? null : styled.css(["", ""], {
|
|
11348
11348
|
"paddingRight": "0.375rem"
|
|
11349
11349
|
});
|
|
11350
|
+
}, function (props) {
|
|
11351
|
+
return props.$size === "regular" && styled.css(["height:24px;"]);
|
|
11352
|
+
}, function (props) {
|
|
11353
|
+
return props.$size === "small" && styled.css(["height:18px;"]);
|
|
11354
|
+
}, function (props) {
|
|
11355
|
+
return props.$size === "big" && styled.css(["height:30px;"]);
|
|
11350
11356
|
});
|
|
11351
11357
|
ChipContainer.displayName = "ChipContainer";
|
|
11352
11358
|
var ChipLabel = styled__default["default"].span.withConfig({
|
|
@@ -11363,7 +11369,7 @@
|
|
|
11363
11369
|
var ChipTrigger = styled__default["default"](Trigger).withConfig({
|
|
11364
11370
|
displayName: "Styles__ChipTrigger",
|
|
11365
11371
|
componentId: "sc-7s0bd1-2"
|
|
11366
|
-
})(["", " ", " ", " &:hover{", "}"], {
|
|
11372
|
+
})(["", " ", " ", " &:hover{", "}", " ", " ", ""], {
|
|
11367
11373
|
"display": "flex"
|
|
11368
11374
|
}, {
|
|
11369
11375
|
"alignItems": "center"
|
|
@@ -11371,6 +11377,12 @@
|
|
|
11371
11377
|
"justifyContent": "center"
|
|
11372
11378
|
}, {
|
|
11373
11379
|
"backgroundColor": "var(--color-theme-transparent-400)"
|
|
11380
|
+
}, function (props) {
|
|
11381
|
+
return props.$size === "regular" && styled.css(["height:24px;width:24px;"]);
|
|
11382
|
+
}, function (props) {
|
|
11383
|
+
return props.$size === "small" && styled.css(["height:18px;width:18px;"]);
|
|
11384
|
+
}, function (props) {
|
|
11385
|
+
return props.$size === "big" && styled.css(["height:30px;width:30px;"]);
|
|
11374
11386
|
});
|
|
11375
11387
|
ChipTrigger.displayName = "ChipTrigger";
|
|
11376
11388
|
var ChipCloseIcon = styled__default["default"](CloseSmallIcon$1).withConfig({
|
|
@@ -11381,18 +11393,36 @@
|
|
|
11381
11393
|
});
|
|
11382
11394
|
ChipCloseIcon.displayName = "ChipCloseIcon";
|
|
11383
11395
|
|
|
11384
|
-
var _excluded = ["leftAdornment", "label", "onClose"];
|
|
11396
|
+
var _excluded = ["leftAdornment", "label", "onClose", "size"];
|
|
11385
11397
|
var Chip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
11386
11398
|
var leftAdornment = _ref.leftAdornment,
|
|
11387
11399
|
label = _ref.label,
|
|
11388
11400
|
onClose = _ref.onClose,
|
|
11401
|
+
_ref$size = _ref.size,
|
|
11402
|
+
size = _ref$size === void 0 ? "regular" : _ref$size,
|
|
11389
11403
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
11390
11404
|
|
|
11391
11405
|
var showClose = typeof onClose === "function";
|
|
11406
|
+
var variant = React.useMemo(function () {
|
|
11407
|
+
switch (size) {
|
|
11408
|
+
case "regular":
|
|
11409
|
+
return "Body 2";
|
|
11410
|
+
|
|
11411
|
+
case "big":
|
|
11412
|
+
return "Body 1";
|
|
11413
|
+
|
|
11414
|
+
default:
|
|
11415
|
+
return "Caption 1";
|
|
11416
|
+
}
|
|
11417
|
+
}, [size]);
|
|
11392
11418
|
return /*#__PURE__*/React__default["default"].createElement(ChipContainer, _extends({}, rest, {
|
|
11393
11419
|
ref: ref,
|
|
11420
|
+
$size: size,
|
|
11394
11421
|
$showClose: showClose
|
|
11395
|
-
}), leftAdornment, /*#__PURE__*/React__default["default"].createElement(
|
|
11422
|
+
}), leftAdornment, /*#__PURE__*/React__default["default"].createElement(Typography, {
|
|
11423
|
+
variant: variant
|
|
11424
|
+
}, label), showClose ? /*#__PURE__*/React__default["default"].createElement(ChipTrigger, {
|
|
11425
|
+
$size: size,
|
|
11396
11426
|
onClick: onClose
|
|
11397
11427
|
}, /*#__PURE__*/React__default["default"].createElement(ChipCloseIcon, {
|
|
11398
11428
|
fill: "currentColor"
|