colibri-ui 0.7.9 → 0.7.10
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/Image/index.js +66 -0
- package/Image/package.json +6 -0
- package/Image/styles.js +18 -0
- package/components/Image/index.d.ts +4 -0
- package/components/Image/index.props.d.ts +9 -0
- package/components/Image/styles.d.ts +5 -0
- package/{esm → components}/index.d.ts +1 -0
- package/esm/Image/index.js +62 -0
- package/esm/Image/styles.js +12 -0
- package/esm/components/Image/index.d.ts +4 -0
- package/esm/components/Image/index.props.d.ts +9 -0
- package/esm/components/Image/styles.d.ts +5 -0
- package/{index.d.ts → esm/components/index.d.ts} +1 -0
- package/esm/helpers/generateUniqID.d.ts +2 -0
- package/esm/helpers/generateUniqID.js +6 -0
- package/esm/index.js +1 -0
- package/helpers/generateUniqID.d.ts +2 -0
- package/helpers/generateUniqID.js +10 -0
- package/index.js +14 -12
- package/package.json +2 -1
- /package/{Button → components/Button}/index.d.ts +0 -0
- /package/{Button → components/Button}/index.props.d.ts +0 -0
- /package/{Button → components/Button}/styles.d.ts +0 -0
- /package/{Checkbox → components/Checkbox}/index.d.ts +0 -0
- /package/{Checkbox → components/Checkbox}/index.props.d.ts +0 -0
- /package/{Checkbox → components/Checkbox}/styles.d.ts +0 -0
- /package/{DotsLoader → components/DotsLoader}/index.d.ts +0 -0
- /package/{DotsLoader → components/DotsLoader}/styles.d.ts +0 -0
- /package/{Grid → components/Grid}/Item/index.d.ts +0 -0
- /package/{Grid → components/Grid}/Item/index.props.d.ts +0 -0
- /package/{Grid → components/Grid}/Item/styles.d.ts +0 -0
- /package/{Grid → components/Grid}/index.d.ts +0 -0
- /package/{Grid → components/Grid}/index.props.d.ts +0 -0
- /package/{Grid → components/Grid}/styles.d.ts +0 -0
- /package/{Icons → components/Icons}/Chevron.d.ts +0 -0
- /package/{Icons → components/Icons}/Close.d.ts +0 -0
- /package/{Icons → components/Icons}/EyeClosed.d.ts +0 -0
- /package/{Icons → components/Icons}/EyeOpen.d.ts +0 -0
- /package/{Icons → components/Icons}/Help.d.ts +0 -0
- /package/{Icons → components/Icons}/Info.d.ts +0 -0
- /package/{Icons → components/Icons}/More.d.ts +0 -0
- /package/{Icons → components/Icons}/User.d.ts +0 -0
- /package/{Icons → components/Icons}/index.d.ts +0 -0
- /package/{Input → components/Input}/index.d.ts +0 -0
- /package/{Input → components/Input}/index.props.d.ts +0 -0
- /package/{Skeleton → components/Skeleton}/index.d.ts +0 -0
- /package/{Skeleton → components/Skeleton}/index.props.d.ts +0 -0
- /package/{Skeleton → components/Skeleton}/styles.d.ts +0 -0
- /package/{Switch → components/Switch}/index.d.ts +0 -0
- /package/{Switch → components/Switch}/index.props.d.ts +0 -0
- /package/{Switch → components/Switch}/styles.d.ts +0 -0
- /package/{Theme → components/Theme}/breakpoints.d.ts +0 -0
- /package/{Theme → components/Theme}/color.d.ts +0 -0
- /package/{Theme → components/Theme}/global.d.ts +0 -0
- /package/{Theme → components/Theme}/index.d.ts +0 -0
- /package/{Theme → components/Theme}/index.props.d.ts +0 -0
- /package/{Theme → components/Theme}/themes/buenos_aires.d.ts +0 -0
- /package/{Theme → components/Theme}/themes/default.d.ts +0 -0
- /package/{Typography → components/Typography}/index.d.ts +0 -0
- /package/{Typography → components/Typography}/index.props.d.ts +0 -0
- /package/{Typography → components/Typography}/styles.d.ts +0 -0
- /package/{base → components/base}/FormField/index.d.ts +0 -0
- /package/{base → components/base}/FormField/index.props.d.ts +0 -0
- /package/{base → components/base}/FormField/styles.d.ts +0 -0
- /package/{base → components/base}/InputRoot/index.d.ts +0 -0
- /package/{base → components/base}/InputRoot/index.props.d.ts +0 -0
- /package/{base → components/base}/InputRoot/styles.d.ts +0 -0
- /package/esm/{Button → components/Button}/index.d.ts +0 -0
- /package/esm/{Button → components/Button}/index.props.d.ts +0 -0
- /package/esm/{Button → components/Button}/styles.d.ts +0 -0
- /package/esm/{Checkbox → components/Checkbox}/index.d.ts +0 -0
- /package/esm/{Checkbox → components/Checkbox}/index.props.d.ts +0 -0
- /package/esm/{Checkbox → components/Checkbox}/styles.d.ts +0 -0
- /package/esm/{DotsLoader → components/DotsLoader}/index.d.ts +0 -0
- /package/esm/{DotsLoader → components/DotsLoader}/styles.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/Item/index.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/Item/index.props.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/Item/styles.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/index.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/index.props.d.ts +0 -0
- /package/esm/{Grid → components/Grid}/styles.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/Chevron.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/Close.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/EyeClosed.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/EyeOpen.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/Help.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/Info.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/More.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/User.d.ts +0 -0
- /package/esm/{Icons → components/Icons}/index.d.ts +0 -0
- /package/esm/{Input → components/Input}/index.d.ts +0 -0
- /package/esm/{Input → components/Input}/index.props.d.ts +0 -0
- /package/esm/{Skeleton → components/Skeleton}/index.d.ts +0 -0
- /package/esm/{Skeleton → components/Skeleton}/index.props.d.ts +0 -0
- /package/esm/{Skeleton → components/Skeleton}/styles.d.ts +0 -0
- /package/esm/{Switch → components/Switch}/index.d.ts +0 -0
- /package/esm/{Switch → components/Switch}/index.props.d.ts +0 -0
- /package/esm/{Switch → components/Switch}/styles.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/breakpoints.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/color.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/global.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/index.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/index.props.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/themes/buenos_aires.d.ts +0 -0
- /package/esm/{Theme → components/Theme}/themes/default.d.ts +0 -0
- /package/esm/{Typography → components/Typography}/index.d.ts +0 -0
- /package/esm/{Typography → components/Typography}/index.props.d.ts +0 -0
- /package/esm/{Typography → components/Typography}/styles.d.ts +0 -0
- /package/esm/{base → components/base}/FormField/index.d.ts +0 -0
- /package/esm/{base → components/base}/FormField/index.props.d.ts +0 -0
- /package/esm/{base → components/base}/FormField/styles.d.ts +0 -0
- /package/esm/{base → components/base}/InputRoot/index.d.ts +0 -0
- /package/esm/{base → components/base}/InputRoot/index.props.d.ts +0 -0
- /package/esm/{base → components/base}/InputRoot/styles.d.ts +0 -0
package/Image/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var generateUniqID = require('../helpers/generateUniqID.js');
|
|
9
|
+
var styles = require('./styles.js');
|
|
10
|
+
|
|
11
|
+
var emptyImage = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=";
|
|
12
|
+
var Image = /*#__PURE__*/react.forwardRef(function (_a, ref) {
|
|
13
|
+
var className = _a.className,
|
|
14
|
+
_b = _a.loading,
|
|
15
|
+
loading = _b === void 0 ? "lazy" : _b,
|
|
16
|
+
src = _a.src,
|
|
17
|
+
fallbackSrc = _a.fallbackSrc,
|
|
18
|
+
onClick = _a.onClick,
|
|
19
|
+
srcSet = _a.srcSet,
|
|
20
|
+
sizes = _a.sizes,
|
|
21
|
+
ariaLabel = _a.ariaLabel,
|
|
22
|
+
_c = _a.sources,
|
|
23
|
+
sources = _c === void 0 ? [] : _c,
|
|
24
|
+
testId = _a["data-testid"],
|
|
25
|
+
_d = _a.alt,
|
|
26
|
+
alt = _d === void 0 ? src : _d,
|
|
27
|
+
width = _a.width,
|
|
28
|
+
height = _a.height,
|
|
29
|
+
props = tslib.__rest(_a, ["className", "loading", "src", "fallbackSrc", "onClick", "srcSet", "sizes", "ariaLabel", "sources", "data-testid", "alt", "width", "height"]);
|
|
30
|
+
var _e = react.useState(false),
|
|
31
|
+
isFailed = _e[0],
|
|
32
|
+
setFailed = _e[1];
|
|
33
|
+
var imageSrc = src || emptyImage;
|
|
34
|
+
var imageSrcSet = srcSet;
|
|
35
|
+
var sizeAttrs = {};
|
|
36
|
+
if (width !== undefined) {
|
|
37
|
+
sizeAttrs.width = width;
|
|
38
|
+
}
|
|
39
|
+
if (height !== undefined) {
|
|
40
|
+
sizeAttrs.height = height;
|
|
41
|
+
}
|
|
42
|
+
var handleError = react.useCallback(function () {
|
|
43
|
+
setFailed(true);
|
|
44
|
+
}, []);
|
|
45
|
+
return jsxRuntime.jsxs(styles.BasePicture, {
|
|
46
|
+
"data-testid": testId,
|
|
47
|
+
ref: ref,
|
|
48
|
+
children: [!!sources.length && sources.map(function (source, index) {
|
|
49
|
+
return jsxRuntime.jsx("source", tslib.__assign({}, source), generateUniqID.default(index));
|
|
50
|
+
}), jsxRuntime.jsx("img", tslib.__assign({
|
|
51
|
+
alt: alt,
|
|
52
|
+
style: sizeAttrs,
|
|
53
|
+
className: className,
|
|
54
|
+
loading: loading,
|
|
55
|
+
"aria-hidden": ariaLabel ? "false" : "true",
|
|
56
|
+
"aria-label": ariaLabel,
|
|
57
|
+
onClick: onClick,
|
|
58
|
+
onError: handleError,
|
|
59
|
+
src: isFailed && fallbackSrc ? fallbackSrc : imageSrc,
|
|
60
|
+
srcSet: imageSrcSet,
|
|
61
|
+
sizes: sizes
|
|
62
|
+
}, props))]
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
exports.default = Image;
|
package/Image/styles.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _styled = require('@emotion/styled/base');
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
9
|
+
|
|
10
|
+
var BasePicture = /*#__PURE__*/_styled__default.default("picture", process.env.NODE_ENV === "production" ? {
|
|
11
|
+
target: "e17t3ew60"
|
|
12
|
+
} : {
|
|
13
|
+
target: "e17t3ew60",
|
|
14
|
+
label: "BasePicture"
|
|
15
|
+
})(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n\n visibility: visible;\n\n font: 0/0 a;\n\n border: 0;\n\n object-fit: cover;\n text-indent: -100rem;\n\n :-moz-broken {\n opacity: 0;\n }\n }\n" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgX19tYWtlVGVtcGxhdGVPYmplY3QgfSBmcm9tIFwidHNsaWJcIjtcbmltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuZXhwb3J0IHZhciBCYXNlUGljdHVyZSA9IHN0eWxlZC5waWN0dXJlKHRlbXBsYXRlT2JqZWN0XzEgfHwgKHRlbXBsYXRlT2JqZWN0XzEgPSBfX21ha2VUZW1wbGF0ZU9iamVjdChbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdLCBbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdKSkpO1xudmFyIHRlbXBsYXRlT2JqZWN0XzE7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1zdHlsZXMuanMubWFwIl19 */")], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n\n visibility: visible;\n\n font: 0/0 a;\n\n border: 0;\n\n object-fit: cover;\n text-indent: -100rem;\n\n :-moz-broken {\n opacity: 0;\n }\n }\n" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgX19tYWtlVGVtcGxhdGVPYmplY3QgfSBmcm9tIFwidHNsaWJcIjtcbmltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuZXhwb3J0IHZhciBCYXNlUGljdHVyZSA9IHN0eWxlZC5waWN0dXJlKHRlbXBsYXRlT2JqZWN0XzEgfHwgKHRlbXBsYXRlT2JqZWN0XzEgPSBfX21ha2VUZW1wbGF0ZU9iamVjdChbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdLCBbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdKSkpO1xudmFyIHRlbXBsYXRlT2JqZWN0XzE7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1zdHlsZXMuanMubWFwIl19 */")])));
|
|
16
|
+
var templateObject_1;
|
|
17
|
+
|
|
18
|
+
exports.BasePicture = BasePicture;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface BaseImageContainerProps {
|
|
3
|
+
fallbackSrc?: string;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
sources?: React.SourceHTMLAttributes<HTMLSourceElement>[];
|
|
6
|
+
"data-testid"?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ImageProps extends BaseImageContainerProps, React.ImgHTMLAttributes<HTMLImageElement> {
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const BasePicture: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
@@ -2,6 +2,7 @@ export { default as Button } from "./Button";
|
|
|
2
2
|
export { default as Checkbox } from "./Checkbox";
|
|
3
3
|
export { default as DotsLoader } from "./DotsLoader";
|
|
4
4
|
export { default as Grid } from "./Grid";
|
|
5
|
+
export { default as Image } from "./Image";
|
|
5
6
|
export { default as Input } from "./Input";
|
|
6
7
|
export { SkeletonText, SkeletonRect } from "./Skeleton";
|
|
7
8
|
export { default as Switch } from "./Switch";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
4
|
+
import generateUniqID from '../helpers/generateUniqID.js';
|
|
5
|
+
import { BasePicture } from './styles.js';
|
|
6
|
+
|
|
7
|
+
var emptyImage = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=";
|
|
8
|
+
var Image = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
9
|
+
var className = _a.className,
|
|
10
|
+
_b = _a.loading,
|
|
11
|
+
loading = _b === void 0 ? "lazy" : _b,
|
|
12
|
+
src = _a.src,
|
|
13
|
+
fallbackSrc = _a.fallbackSrc,
|
|
14
|
+
onClick = _a.onClick,
|
|
15
|
+
srcSet = _a.srcSet,
|
|
16
|
+
sizes = _a.sizes,
|
|
17
|
+
ariaLabel = _a.ariaLabel,
|
|
18
|
+
_c = _a.sources,
|
|
19
|
+
sources = _c === void 0 ? [] : _c,
|
|
20
|
+
testId = _a["data-testid"],
|
|
21
|
+
_d = _a.alt,
|
|
22
|
+
alt = _d === void 0 ? src : _d,
|
|
23
|
+
width = _a.width,
|
|
24
|
+
height = _a.height,
|
|
25
|
+
props = __rest(_a, ["className", "loading", "src", "fallbackSrc", "onClick", "srcSet", "sizes", "ariaLabel", "sources", "data-testid", "alt", "width", "height"]);
|
|
26
|
+
var _e = useState(false),
|
|
27
|
+
isFailed = _e[0],
|
|
28
|
+
setFailed = _e[1];
|
|
29
|
+
var imageSrc = src || emptyImage;
|
|
30
|
+
var imageSrcSet = srcSet;
|
|
31
|
+
var sizeAttrs = {};
|
|
32
|
+
if (width !== undefined) {
|
|
33
|
+
sizeAttrs.width = width;
|
|
34
|
+
}
|
|
35
|
+
if (height !== undefined) {
|
|
36
|
+
sizeAttrs.height = height;
|
|
37
|
+
}
|
|
38
|
+
var handleError = useCallback(function () {
|
|
39
|
+
setFailed(true);
|
|
40
|
+
}, []);
|
|
41
|
+
return jsxs(BasePicture, {
|
|
42
|
+
"data-testid": testId,
|
|
43
|
+
ref: ref,
|
|
44
|
+
children: [!!sources.length && sources.map(function (source, index) {
|
|
45
|
+
return jsx("source", __assign({}, source), generateUniqID(index));
|
|
46
|
+
}), jsx("img", __assign({
|
|
47
|
+
alt: alt,
|
|
48
|
+
style: sizeAttrs,
|
|
49
|
+
className: className,
|
|
50
|
+
loading: loading,
|
|
51
|
+
"aria-hidden": ariaLabel ? "false" : "true",
|
|
52
|
+
"aria-label": ariaLabel,
|
|
53
|
+
onClick: onClick,
|
|
54
|
+
onError: handleError,
|
|
55
|
+
src: isFailed && fallbackSrc ? fallbackSrc : imageSrc,
|
|
56
|
+
srcSet: imageSrcSet,
|
|
57
|
+
sizes: sizes
|
|
58
|
+
}, props))]
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { Image as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { __makeTemplateObject } from 'tslib';
|
|
3
|
+
|
|
4
|
+
var BasePicture = /*#__PURE__*/_styled("picture", process.env.NODE_ENV === "production" ? {
|
|
5
|
+
target: "e17t3ew60"
|
|
6
|
+
} : {
|
|
7
|
+
target: "e17t3ew60",
|
|
8
|
+
label: "BasePicture"
|
|
9
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n\n visibility: visible;\n\n font: 0/0 a;\n\n border: 0;\n\n object-fit: cover;\n text-indent: -100rem;\n\n :-moz-broken {\n opacity: 0;\n }\n }\n" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgX19tYWtlVGVtcGxhdGVPYmplY3QgfSBmcm9tIFwidHNsaWJcIjtcbmltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuZXhwb3J0IHZhciBCYXNlUGljdHVyZSA9IHN0eWxlZC5waWN0dXJlKHRlbXBsYXRlT2JqZWN0XzEgfHwgKHRlbXBsYXRlT2JqZWN0XzEgPSBfX21ha2VUZW1wbGF0ZU9iamVjdChbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdLCBbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdKSkpO1xudmFyIHRlbXBsYXRlT2JqZWN0XzE7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1zdHlsZXMuanMubWFwIl19 */")], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n\n visibility: visible;\n\n font: 0/0 a;\n\n border: 0;\n\n object-fit: cover;\n text-indent: -100rem;\n\n :-moz-broken {\n opacity: 0;\n }\n }\n" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgX19tYWtlVGVtcGxhdGVPYmplY3QgfSBmcm9tIFwidHNsaWJcIjtcbmltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuZXhwb3J0IHZhciBCYXNlUGljdHVyZSA9IHN0eWxlZC5waWN0dXJlKHRlbXBsYXRlT2JqZWN0XzEgfHwgKHRlbXBsYXRlT2JqZWN0XzEgPSBfX21ha2VUZW1wbGF0ZU9iamVjdChbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdLCBbXCJcXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcXG4gIHRvcDogMDtcXG4gIGxlZnQ6IDA7XFxuICB3aWR0aDogMTAwJTtcXG4gIGhlaWdodDogMTAwJTtcXG5cXG4gIGltZyB7XFxuICAgIHdpZHRoOiAxMDAlO1xcbiAgICBoZWlnaHQ6IDEwMCU7XFxuXFxuICAgIHZpc2liaWxpdHk6IHZpc2libGU7XFxuXFxuICAgIGZvbnQ6IDAvMCBhO1xcblxcbiAgICBib3JkZXI6IDA7XFxuXFxuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xcbiAgICB0ZXh0LWluZGVudDogLTEwMHJlbTtcXG5cXG4gICAgOi1tb3otYnJva2VuIHtcXG4gICAgICBvcGFjaXR5OiAwO1xcbiAgICB9XFxuICB9XFxuXCJdKSkpO1xudmFyIHRlbXBsYXRlT2JqZWN0XzE7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1zdHlsZXMuanMubWFwIl19 */")])));
|
|
10
|
+
var templateObject_1;
|
|
11
|
+
|
|
12
|
+
export { BasePicture };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface BaseImageContainerProps {
|
|
3
|
+
fallbackSrc?: string;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
sources?: React.SourceHTMLAttributes<HTMLSourceElement>[];
|
|
6
|
+
"data-testid"?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ImageProps extends BaseImageContainerProps, React.ImgHTMLAttributes<HTMLImageElement> {
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const BasePicture: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
@@ -2,6 +2,7 @@ export { default as Button } from "./Button";
|
|
|
2
2
|
export { default as Checkbox } from "./Checkbox";
|
|
3
3
|
export { default as DotsLoader } from "./DotsLoader";
|
|
4
4
|
export { default as Grid } from "./Grid";
|
|
5
|
+
export { default as Image } from "./Image";
|
|
5
6
|
export { default as Input } from "./Input";
|
|
6
7
|
export { SkeletonText, SkeletonRect } from "./Skeleton";
|
|
7
8
|
export { default as Switch } from "./Switch";
|
package/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as Button } from './Button/index.js';
|
|
|
2
2
|
export { default as Checkbox } from './Checkbox/index.js';
|
|
3
3
|
export { default as DotsLoader } from './DotsLoader/index.js';
|
|
4
4
|
export { default as Grid } from './Grid/index.js';
|
|
5
|
+
export { default as Image } from './Image/index.js';
|
|
5
6
|
export { default as Input } from './Input/index.js';
|
|
6
7
|
export { SkeletonRect, SkeletonText } from './Skeleton/index.js';
|
|
7
8
|
export { default as Switch } from './Switch/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var generateUniqID = function generateUniqID(index) {
|
|
6
|
+
var rand = Math.pow(index + 1, 2) + 77;
|
|
7
|
+
return "uniq-id-".concat(Math.floor(rand));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
exports.default = generateUniqID;
|
package/index.js
CHANGED
|
@@ -4,11 +4,12 @@ var index = require('./Button/index.js');
|
|
|
4
4
|
var index$1 = require('./Checkbox/index.js');
|
|
5
5
|
var index$2 = require('./DotsLoader/index.js');
|
|
6
6
|
var index$3 = require('./Grid/index.js');
|
|
7
|
-
var index$4 = require('./
|
|
8
|
-
var index$5 = require('./
|
|
9
|
-
var index$6 = require('./
|
|
10
|
-
var index$7 = require('./
|
|
11
|
-
var index$8 = require('./
|
|
7
|
+
var index$4 = require('./Image/index.js');
|
|
8
|
+
var index$5 = require('./Input/index.js');
|
|
9
|
+
var index$6 = require('./Skeleton/index.js');
|
|
10
|
+
var index$7 = require('./Switch/index.js');
|
|
11
|
+
var index$8 = require('./Theme/index.js');
|
|
12
|
+
var index$9 = require('./Typography/index.js');
|
|
12
13
|
require('./Icons/index.js');
|
|
13
14
|
var Chevron = require('./Icons/Chevron.js');
|
|
14
15
|
var Close = require('./Icons/Close.js');
|
|
@@ -25,13 +26,14 @@ exports.Button = index.default;
|
|
|
25
26
|
exports.Checkbox = index$1.default;
|
|
26
27
|
exports.DotsLoader = index$2.default;
|
|
27
28
|
exports.Grid = index$3.default;
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
29
|
+
exports.Image = index$4.default;
|
|
30
|
+
exports.Input = index$5.default;
|
|
31
|
+
exports.SkeletonRect = index$6.SkeletonRect;
|
|
32
|
+
exports.SkeletonText = index$6.SkeletonText;
|
|
33
|
+
exports.Switch = index$7.default;
|
|
34
|
+
exports.THEMES = index$8.THEMES;
|
|
35
|
+
exports.ThemeProvider = index$8.ThemeProvider;
|
|
36
|
+
exports.Typography = index$9.default;
|
|
35
37
|
exports.Chevron = Chevron.default;
|
|
36
38
|
exports.Close = Close.default;
|
|
37
39
|
exports.EyeOpen = EyeOpen.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "colibri-ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "React UI components library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {},
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@rollup/plugin-babel": "6.0.4",
|
|
39
39
|
"@rollup/plugin-commonjs": "25.0.7",
|
|
40
40
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
41
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
41
42
|
"@rollup/plugin-typescript": "11.1.6",
|
|
42
43
|
"@rollup/plugin-url": "8.0.2",
|
|
43
44
|
"@storybook/addon-essentials": "8.0.10",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|