@uncinc/uncinc-react-kitchen-sink 2.6.5 → 2.6.6
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/components/Tag/index.d.ts +12 -0
- package/dist/components/Tag/index.js +43 -0
- package/dist/components/Tag/style.scss +27 -0
- package/dist/config/i18next/locales/en.json +5 -0
- package/dist/config/i18next/locales/nl.json +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/styles/assets/_mixins.scss +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
export interface TagProps {
|
|
4
|
+
name: string;
|
|
5
|
+
removable?: boolean;
|
|
6
|
+
stretchClickableArea?: boolean;
|
|
7
|
+
deleteButtonAriaLabel?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
onDelete?: (name: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const Tag: React.FC<TagProps>;
|
|
12
|
+
export default Tag;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _reactI18next = require("react-i18next");
|
|
10
|
+
require("./style.scss");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var Tag = function Tag(props) {
|
|
13
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
14
|
+
t = _useTranslation.t;
|
|
15
|
+
var name = props.name,
|
|
16
|
+
removable = props.removable,
|
|
17
|
+
stretchClickableArea = props.stretchClickableArea,
|
|
18
|
+
deleteButtonAriaLabel = props.deleteButtonAriaLabel,
|
|
19
|
+
className = props.className,
|
|
20
|
+
onDelete = props.onDelete;
|
|
21
|
+
var classNames = (0, _classnames.default)('Tag', {
|
|
22
|
+
'Tag--stretch-clickable-area': stretchClickableArea
|
|
23
|
+
}, className);
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: classNames
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
27
|
+
className: "Tag__name"
|
|
28
|
+
}, name), removable && onDelete && /*#__PURE__*/_react.default.createElement("button", {
|
|
29
|
+
className: "Tag__delete-button icon-after icon-cross icon-variant-1",
|
|
30
|
+
type: "button",
|
|
31
|
+
"aria-label": deleteButtonAriaLabel || t('atoms.tag.delete'),
|
|
32
|
+
onClick: function onClick() {
|
|
33
|
+
return onDelete(name);
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
Tag.defaultProps = {
|
|
38
|
+
removable: true,
|
|
39
|
+
stretchClickableArea: true,
|
|
40
|
+
onDelete: function onDelete() {}
|
|
41
|
+
};
|
|
42
|
+
var _default = Tag;
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../../styles/assets/mixins';
|
|
2
|
+
|
|
3
|
+
.Tag {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex-wrap: nowrap;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
&__delete-button {
|
|
10
|
+
// Expanding the clickable area by adding padding,
|
|
11
|
+
// and compensating this, using negative margin.
|
|
12
|
+
margin: -10px;
|
|
13
|
+
border: 0;
|
|
14
|
+
padding: 10px;
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&--stretch-clickable-area .Tag__delete-button {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
|
|
23
|
+
&:before {
|
|
24
|
+
@include block-content;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as Image } from "./components/Image";
|
|
|
8
8
|
export { default as ImageBackground } from "./components/Image/Background";
|
|
9
9
|
export { default as Lottie } from "./components/Lottie";
|
|
10
10
|
export { default as LottieAnimationWithMousePosition } from "./components/Lottie/LottieAnimationWithMousePosition";
|
|
11
|
+
export { default as Tag } from "./components/Tag";
|
|
11
12
|
export { default as WysiwygField } from "./components/WysiwygField";
|
|
12
13
|
export { default as CallToAction } from "./components/CallToAction";
|
|
13
14
|
export { default as ChipFacet } from "./components/SearchKit/Facets/ChipFacet";
|
package/dist/index.js
CHANGED
|
@@ -345,6 +345,12 @@ Object.defineProperty(exports, "TableRender", {
|
|
|
345
345
|
return _TableRender.default;
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
+
Object.defineProperty(exports, "Tag", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function get() {
|
|
351
|
+
return _Tag.default;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
348
354
|
Object.defineProperty(exports, "Text", {
|
|
349
355
|
enumerable: true,
|
|
350
356
|
get: function get() {
|
|
@@ -469,6 +475,7 @@ var _Image = _interopRequireDefault(require("./components/Image"));
|
|
|
469
475
|
var _Background = _interopRequireDefault(require("./components/Image/Background"));
|
|
470
476
|
var _Lottie = _interopRequireDefault(require("./components/Lottie"));
|
|
471
477
|
var _LottieAnimationWithMousePosition = _interopRequireDefault(require("./components/Lottie/LottieAnimationWithMousePosition"));
|
|
478
|
+
var _Tag = _interopRequireDefault(require("./components/Tag"));
|
|
472
479
|
var _WysiwygField = _interopRequireDefault(require("./components/WysiwygField"));
|
|
473
480
|
var _CallToAction = _interopRequireDefault(require("./components/CallToAction"));
|
|
474
481
|
var _ChipFacet = _interopRequireDefault(require("./components/SearchKit/Facets/ChipFacet"));
|
|
@@ -103,3 +103,12 @@
|
|
|
103
103
|
line-height: $desktop--line-height--body--large;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
// Other mixins
|
|
108
|
+
|
|
109
|
+
// Useful for stretching the clickable area of links or buttons around its parent block.
|
|
110
|
+
@mixin block-content {
|
|
111
|
+
content: '';
|
|
112
|
+
position: absolute;
|
|
113
|
+
inset: 0;
|
|
114
|
+
}
|