@sb1/ffe-chips-react 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/es/Chip.js +41 -0
- package/es/ChipRemovable.js +20 -0
- package/es/ChipSelectable.js +35 -0
- package/es/fixedForwardRef.js +2 -0
- package/es/index.js +3 -0
- package/es/tsconfig.esm.tsbuildinfo +1 -0
- package/es/types.js +1 -0
- package/lib/Chip.js +47 -0
- package/lib/ChipRemovable.js +26 -0
- package/lib/ChipSelectable.js +41 -0
- package/lib/fixedForwardRef.js +5 -0
- package/lib/index.js +9 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/types.js +2 -0
- package/package.json +48 -0
- package/types/Chip.d.ts +21 -0
- package/types/ChipRemovable.d.ts +4 -0
- package/types/ChipSelectable.d.ts +7 -0
- package/types/fixedForwardRef.d.ts +4 -0
- package/types/index.d.ts +3 -0
- package/types/tsconfig.types.tsbuildinfo +1 -0
- package/types/types.d.ts +8 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 SpareBank 1
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/es/Chip.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
26
|
+
function ChipWithForwardRef(props, ref) {
|
|
27
|
+
var _a = props.as, Comp = _a === void 0 ? 'button' : _a, className = props.className, size = props.size, leftIcon = props.leftIcon, rightIcon = props.rightIcon, children = props.children, onColoredBg = props.onColoredBg, rest = __rest(props, ["as", "className", "size", "leftIcon", "rightIcon", "children", "onColoredBg"]);
|
|
28
|
+
var wrappedChildren = (React.createElement("span", { className: classNames('ffe-chip__label', size === 'sm' ? 'ffe-small-text' : 'ffe-body-paragraph') }, children));
|
|
29
|
+
return (React.createElement(Comp, __assign({ className: classNames('ffe-chip', {
|
|
30
|
+
'ffe-chip--on-colored-bg': onColoredBg,
|
|
31
|
+
'ffe-chip--sm': size === 'sm',
|
|
32
|
+
'ffe-chip--md': size === 'md',
|
|
33
|
+
'ffe-chip--lg': size === 'lg',
|
|
34
|
+
'ffe-chip--icon-left': !!leftIcon,
|
|
35
|
+
'ffe-chip--icon-right': !!rightIcon,
|
|
36
|
+
}, className) }, rest, { ref: ref }),
|
|
37
|
+
leftIcon,
|
|
38
|
+
wrappedChildren,
|
|
39
|
+
rightIcon));
|
|
40
|
+
}
|
|
41
|
+
export var Chip = fixedForwardRef(ChipWithForwardRef);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Chip } from './Chip';
|
|
14
|
+
import { Icon } from '@sb1/ffe-icons-react';
|
|
15
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
16
|
+
var closeOpen400Sm = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00ODAtNDI5IDMxNi0yNjVxLTExIDExLTI1IDEwLjVUMjY2LTI2NnEtMTEtMTEtMTEtMjUuNXQxMS0yNS41bDE2My0xNjMtMTY0LTE2NHEtMTEtMTEtMTAuNS0yNS41VDI2Ni02OTVxMTEtMTEgMjUuNS0xMXQyNS41IDExbDE2MyAxNjQgMTY0LTE2NHExMS0xMSAyNS41LTExdDI1LjUgMTFxMTEgMTEgMTEgMjUuNVQ2OTUtNjQ0TDUzMS00ODBsMTY0IDE2NHExMSAxMSAxMSAyNXQtMTEgMjVxLTExIDExLTI1LjUgMTFUNjQ0LTI2Nkw0ODAtNDI5WiIvPjwvc3ZnPg==';
|
|
17
|
+
function ChipRemovableForwardRef(props, ref) {
|
|
18
|
+
return (React.createElement(Chip, __assign({ ref: ref, rightIcon: React.createElement(Icon, { size: "sm", fileUrl: closeOpen400Sm }) }, props)));
|
|
19
|
+
}
|
|
20
|
+
export var ChipRemovable = fixedForwardRef(ChipRemovableForwardRef);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { Chip } from './Chip';
|
|
25
|
+
import { Icon } from '@sb1/ffe-icons-react';
|
|
26
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
27
|
+
import classNames from 'classnames';
|
|
28
|
+
var checkOpen400Sm = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zODktMzY5IDI5OS0yOTlxMTAuOTA5LTExIDI1LjQ1NS0xMVE3MjgtNjc5IDczOS02NjhxMTEgMTEgMTEgMjUuNTgyIDAgMTQuNTgzLTEwLjYwNyAyNS4xODhMNDE1LTI5MnEtMTAuOTA5IDExLTI1LjQ1NSAxMVEzNzUtMjgxIDM2NC0yOTJMMjIxLTQzNXEtMTEtMTEtMTEtMjUuNXQxMS0yNS41cTExLTExIDI1LjY2Ny0xMSAxNC42NjYgMCAyNS4zMzMgMTFsMTE3IDExN1oiLz48L3N2Zz4=';
|
|
29
|
+
function ChipSelectableForwardRef(props, ref) {
|
|
30
|
+
var className = props.className, isSelected = props.isSelected, rest = __rest(props, ["className", "isSelected"]);
|
|
31
|
+
return (React.createElement(Chip, __assign({ ref: ref, leftIcon: isSelected ? React.createElement(Icon, { size: "sm", fileUrl: checkOpen400Sm }) : null, className: classNames(className, {
|
|
32
|
+
'ffe-chip--selected': isSelected,
|
|
33
|
+
}) }, rest)));
|
|
34
|
+
}
|
|
35
|
+
export var ChipSelectable = fixedForwardRef(ChipSelectableForwardRef);
|
package/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/Chip.tsx","../src/ChipRemovable.tsx","../src/ChipSelectable.tsx","../src/fixedForwardRef.tsx","../src/index.ts","../src/types.ts"],"version":"5.6.3"}
|
package/es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/Chip.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.Chip = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
32
|
+
function ChipWithForwardRef(props, ref) {
|
|
33
|
+
var _a = props.as, Comp = _a === void 0 ? 'button' : _a, className = props.className, size = props.size, leftIcon = props.leftIcon, rightIcon = props.rightIcon, children = props.children, onColoredBg = props.onColoredBg, rest = __rest(props, ["as", "className", "size", "leftIcon", "rightIcon", "children", "onColoredBg"]);
|
|
34
|
+
var wrappedChildren = (react_1.default.createElement("span", { className: (0, classnames_1.default)('ffe-chip__label', size === 'sm' ? 'ffe-small-text' : 'ffe-body-paragraph') }, children));
|
|
35
|
+
return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)('ffe-chip', {
|
|
36
|
+
'ffe-chip--on-colored-bg': onColoredBg,
|
|
37
|
+
'ffe-chip--sm': size === 'sm',
|
|
38
|
+
'ffe-chip--md': size === 'md',
|
|
39
|
+
'ffe-chip--lg': size === 'lg',
|
|
40
|
+
'ffe-chip--icon-left': !!leftIcon,
|
|
41
|
+
'ffe-chip--icon-right': !!rightIcon,
|
|
42
|
+
}, className) }, rest, { ref: ref }),
|
|
43
|
+
leftIcon,
|
|
44
|
+
wrappedChildren,
|
|
45
|
+
rightIcon));
|
|
46
|
+
}
|
|
47
|
+
exports.Chip = (0, fixedForwardRef_1.fixedForwardRef)(ChipWithForwardRef);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ChipRemovable = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var Chip_1 = require("./Chip");
|
|
20
|
+
var ffe_icons_react_1 = require("@sb1/ffe-icons-react");
|
|
21
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
22
|
+
var closeOpen400Sm = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00ODAtNDI5IDMxNi0yNjVxLTExIDExLTI1IDEwLjVUMjY2LTI2NnEtMTEtMTEtMTEtMjUuNXQxMS0yNS41bDE2My0xNjMtMTY0LTE2NHEtMTEtMTEtMTAuNS0yNS41VDI2Ni02OTVxMTEtMTEgMjUuNS0xMXQyNS41IDExbDE2MyAxNjQgMTY0LTE2NHExMS0xMSAyNS41LTExdDI1LjUgMTFxMTEgMTEgMTEgMjUuNVQ2OTUtNjQ0TDUzMS00ODBsMTY0IDE2NHExMSAxMSAxMSAyNXQtMTEgMjVxLTExIDExLTI1LjUgMTFUNjQ0LTI2Nkw0ODAtNDI5WiIvPjwvc3ZnPg==';
|
|
23
|
+
function ChipRemovableForwardRef(props, ref) {
|
|
24
|
+
return (react_1.default.createElement(Chip_1.Chip, __assign({ ref: ref, rightIcon: react_1.default.createElement(ffe_icons_react_1.Icon, { size: "sm", fileUrl: closeOpen400Sm }) }, props)));
|
|
25
|
+
}
|
|
26
|
+
exports.ChipRemovable = (0, fixedForwardRef_1.fixedForwardRef)(ChipRemovableForwardRef);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ChipSelectable = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var Chip_1 = require("./Chip");
|
|
31
|
+
var ffe_icons_react_1 = require("@sb1/ffe-icons-react");
|
|
32
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
33
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
34
|
+
var checkOpen400Sm = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zODktMzY5IDI5OS0yOTlxMTAuOTA5LTExIDI1LjQ1NS0xMVE3MjgtNjc5IDczOS02NjhxMTEgMTEgMTEgMjUuNTgyIDAgMTQuNTgzLTEwLjYwNyAyNS4xODhMNDE1LTI5MnEtMTAuOTA5IDExLTI1LjQ1NSAxMVEzNzUtMjgxIDM2NC0yOTJMMjIxLTQzNXEtMTEtMTEtMTEtMjUuNXQxMS0yNS41cTExLTExIDI1LjY2Ny0xMSAxNC42NjYgMCAyNS4zMzMgMTFsMTE3IDExN1oiLz48L3N2Zz4=';
|
|
35
|
+
function ChipSelectableForwardRef(props, ref) {
|
|
36
|
+
var className = props.className, isSelected = props.isSelected, rest = __rest(props, ["className", "isSelected"]);
|
|
37
|
+
return (react_1.default.createElement(Chip_1.Chip, __assign({ ref: ref, leftIcon: isSelected ? react_1.default.createElement(ffe_icons_react_1.Icon, { size: "sm", fileUrl: checkOpen400Sm }) : null, className: (0, classnames_1.default)(className, {
|
|
38
|
+
'ffe-chip--selected': isSelected,
|
|
39
|
+
}) }, rest)));
|
|
40
|
+
}
|
|
41
|
+
exports.ChipSelectable = (0, fixedForwardRef_1.fixedForwardRef)(ChipSelectableForwardRef);
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChipSelectable = exports.ChipRemovable = exports.Chip = void 0;
|
|
4
|
+
var Chip_1 = require("./Chip");
|
|
5
|
+
Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return Chip_1.Chip; } });
|
|
6
|
+
var ChipRemovable_1 = require("./ChipRemovable");
|
|
7
|
+
Object.defineProperty(exports, "ChipRemovable", { enumerable: true, get: function () { return ChipRemovable_1.ChipRemovable; } });
|
|
8
|
+
var ChipSelectable_1 = require("./ChipSelectable");
|
|
9
|
+
Object.defineProperty(exports, "ChipSelectable", { enumerable: true, get: function () { return ChipSelectable_1.ChipSelectable; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/Chip.tsx","../src/ChipRemovable.tsx","../src/ChipSelectable.tsx","../src/fixedForwardRef.tsx","../src/index.ts","../src/types.ts"],"version":"5.6.3"}
|
package/lib/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sb1/ffe-chips-react",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "React implementation of ffe-chips component",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ffe"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "SpareBank 1",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"es",
|
|
13
|
+
"types"
|
|
14
|
+
],
|
|
15
|
+
"main": "lib/index.js",
|
|
16
|
+
"module": "es/index.js",
|
|
17
|
+
"types": "types/index.d.ts",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "ssh://git@github.com:SpareBank1/designsystem.git"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "ffe-buildtool tsc",
|
|
25
|
+
"build:es": "ffe-buildtool tsc --es",
|
|
26
|
+
"lint": "eslint src --ext ts,tsx",
|
|
27
|
+
"lint:fix": "eslint src --fix --ext ts,tsx",
|
|
28
|
+
"test": "ffe-buildtool jest",
|
|
29
|
+
"test:watch": "ffe-buildtool jest --watch"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@sb1/ffe-chips": "^1.1.0",
|
|
33
|
+
"@sb1/ffe-core": "^29.1.3",
|
|
34
|
+
"@sb1/ffe-icons-react": "^11.0.9"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@sb1/ffe-buildtool": "^0.9.0",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"react-dom": "^18.2.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": ">=18.2.0"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "1390475cc0a1d33df73fda6b73168c2e5d4b2c9b"
|
|
48
|
+
}
|
package/types/Chip.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import { ComponentAsPropParams } from './types';
|
|
3
|
+
type LeftIcon = {
|
|
4
|
+
/** Icon on left side */
|
|
5
|
+
leftIcon?: React.ReactNode;
|
|
6
|
+
rightIcon?: never;
|
|
7
|
+
};
|
|
8
|
+
type RightIcon = {
|
|
9
|
+
/** Icon on right side */
|
|
10
|
+
rightIcon?: React.ReactNode;
|
|
11
|
+
leftIcon?: never;
|
|
12
|
+
};
|
|
13
|
+
type LeftOrRightIcon = LeftIcon | RightIcon;
|
|
14
|
+
export type ChipProps<As extends ElementType = 'button'> = ComponentAsPropParams<As> & {
|
|
15
|
+
/** Size of chip*/
|
|
16
|
+
size: 'sm' | 'md' | 'lg';
|
|
17
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
18
|
+
onColoredBg?: boolean;
|
|
19
|
+
} & LeftOrRightIcon;
|
|
20
|
+
export declare const Chip: <As extends ElementType>(props: ChipProps<As> & React.RefAttributes<any>) => React.JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import { type ChipProps } from './Chip';
|
|
3
|
+
export type ChipRemovableProps<As extends ElementType = 'button'> = ChipProps<As>;
|
|
4
|
+
export declare const ChipRemovable: <As extends ElementType>(props: ChipRemovableProps<As> & React.RefAttributes<any>) => React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import { type ChipProps } from './Chip';
|
|
3
|
+
export type ChipSelectableProps<As extends ElementType = 'button'> = ChipProps<As> & {
|
|
4
|
+
/** Whether this chips is selected */
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const ChipSelectable: <As extends ElementType>(props: ChipSelectableProps<As> & React.RefAttributes<any>) => React.JSX.Element;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/Chip.tsx","../src/ChipRemovable.tsx","../src/ChipSelectable.tsx","../src/fixedForwardRef.tsx","../src/index.ts","../src/types.ts"],"version":"5.6.3"}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ElementType, ForwardedRef } from 'react';
|
|
2
|
+
export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
|
|
3
|
+
export type ComponentAsPropParams<As extends ElementType> = {
|
|
4
|
+
as?: As;
|
|
5
|
+
} & DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? 'button' : As>, 'as' & {
|
|
6
|
+
ref: ForwardedRef<any>;
|
|
7
|
+
}>;
|
|
8
|
+
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|