@homecode/ui 5.20.21 → 5.20.23
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/esm/index.js +1 -0
- package/dist/esm/src/components/Autocomplete/Autocomplete.js +1 -0
- package/dist/esm/src/components/Img/Img.js +26 -0
- package/dist/esm/src/components/Img/Img.styl.js +20 -0
- package/dist/esm/src/components/InputFile/InputFile.js +1 -0
- package/dist/esm/src/components/ThinkingOutline/ThinkingOutline.js +24 -3
- package/dist/esm/src/components/ThinkingOutline/ThinkingOutline.styl.js +2 -2
- package/dist/esm/types/src/components/Img/Img.d.ts +7 -0
- package/dist/esm/types/src/components/Img/Img.test.d.ts +1 -0
- package/dist/esm/types/src/components/Img/Img.types.d.ts +10 -0
- package/dist/esm/types/src/components/ThinkingOutline/ThinkingOutline.d.ts +3 -3
- package/dist/esm/types/src/components/ThinkingOutline/ThinkingOutline.types.d.ts +12 -0
- package/dist/esm/types/src/components/ThinkingOutline/index.d.ts +1 -1
- package/dist/esm/types/src/components/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { Gallery, normalizeGalleryItem } from './src/components/Gallery/Gallery.
|
|
|
30
30
|
export { GridLayout } from './src/components/GridLayout/GridLayout.js';
|
|
31
31
|
export { Heading } from './src/components/Heading/Heading.js';
|
|
32
32
|
export { Icon } from './src/components/Icon/Icon.js';
|
|
33
|
+
export { Img } from './src/components/Img/Img.js';
|
|
33
34
|
export { Input } from './src/components/Input/Input.js';
|
|
34
35
|
export { InputFile } from './src/components/InputFile/InputFile.js';
|
|
35
36
|
export { Label } from './src/components/Label/Label.js';
|
|
@@ -64,6 +64,7 @@ import '../VideoPlayer/VideoPlayer.styl.js';
|
|
|
64
64
|
import '../Gallery/Gallery.styl.js';
|
|
65
65
|
import '../GridLayout/GridLayout.styl.js';
|
|
66
66
|
import '../Heading/Heading.js';
|
|
67
|
+
import '../Img/Img.styl.js';
|
|
67
68
|
import '../InputFile/InputFile.styl.js';
|
|
68
69
|
import '../InputFile/Item/Item.styl.js';
|
|
69
70
|
import '@tiptap/core';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Icon } from '../Icon/Icon.js';
|
|
5
|
+
import S from './Img.styl.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `<img>` that never shows the browser's broken-image glyph or its alt text:
|
|
9
|
+
* when loading fails it renders `fallback` (a broken-image icon by default).
|
|
10
|
+
*/
|
|
11
|
+
function Img({ src, alt = '', fallback, fallbackClassName, className, onError, ...rest }) {
|
|
12
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
13
|
+
// Keyed by src, so a new src gets a fresh attempt.
|
|
14
|
+
const isFailed = !src || failedSrc === src;
|
|
15
|
+
if (isFailed) {
|
|
16
|
+
if (fallback !== undefined)
|
|
17
|
+
return jsx(Fragment, { children: fallback });
|
|
18
|
+
return (jsx("span", { className: cn(S.fallback, className, fallbackClassName), role: "img", "aria-label": alt || undefined, children: jsx(Icon, { type: "brokenImage", className: S.fallbackIcon }) }));
|
|
19
|
+
}
|
|
20
|
+
return (jsx("img", { ...rest, src: src, alt: alt, className: className, onError: event => {
|
|
21
|
+
setFailedSrc(src);
|
|
22
|
+
onError?.(event);
|
|
23
|
+
} }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Img };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var css_248z = ".Img_fallback__crzoQ{align-items:center;color:currentColor;display:inline-flex;justify-content:center}.Img_fallbackIcon__oyxkV{height:50%;max-height:48px;max-width:48px;opacity:.4;width:50%}";
|
|
2
|
+
var S = {"fallback":"Img_fallback__crzoQ","fallbackIcon":"Img_fallbackIcon__oyxkV"};
|
|
3
|
+
if (typeof document !== 'undefined') {
|
|
4
|
+
var __uilibHead = document.head || document.getElementsByTagName('head')[0];
|
|
5
|
+
if (__uilibHead) {
|
|
6
|
+
var __uilibStyle = document.createElement('style');
|
|
7
|
+
__uilibStyle.setAttribute('data-uilib-css', '');
|
|
8
|
+
__uilibStyle.appendChild(document.createTextNode(css_248z));
|
|
9
|
+
var __uilibLink = __uilibHead.querySelector('link[rel="stylesheet"]');
|
|
10
|
+
var __uilibInline = __uilibHead.querySelector('style:not([data-uilib-css])');
|
|
11
|
+
var __uilibAnchor = __uilibLink || __uilibInline;
|
|
12
|
+
if (__uilibLink && __uilibInline && (__uilibLink.compareDocumentPosition(__uilibInline) & 4) === 0) {
|
|
13
|
+
__uilibAnchor = __uilibInline;
|
|
14
|
+
}
|
|
15
|
+
if (__uilibAnchor) __uilibHead.insertBefore(__uilibStyle, __uilibAnchor);
|
|
16
|
+
else __uilibHead.appendChild(__uilibStyle);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { S as default };
|
|
@@ -66,6 +66,7 @@ import '../VideoPlayer/VideoPlayer.styl.js';
|
|
|
66
66
|
import '../Gallery/Gallery.styl.js';
|
|
67
67
|
import '../GridLayout/GridLayout.styl.js';
|
|
68
68
|
import '../Heading/Heading.js';
|
|
69
|
+
import '../Img/Img.styl.js';
|
|
69
70
|
import '../LightBox/LightBox.styl.js';
|
|
70
71
|
import '../NestedMenu/NestedMenu.js';
|
|
71
72
|
import '../Notifications/store.js';
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import S from './ThinkingOutline.styl.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const BASE_DURATION = 3.5; // seconds per lap at speed 1
|
|
6
|
+
const DEFAULT_GRADIENTS = [{}];
|
|
7
|
+
const toSize = (size) => typeof size === 'number' ? `${size}px` : size;
|
|
8
|
+
// Unset values stay undefined so the stylesheet defaults (and the root's vars) apply
|
|
9
|
+
const glowVars = (thickness, spread) => ({
|
|
10
|
+
'--tol-thickness': thickness,
|
|
11
|
+
'--tol-spread': toSize(spread),
|
|
12
|
+
});
|
|
13
|
+
function getLayerStyle({ color, speed = 1, reverse, phase = 0, thickness, spread, }) {
|
|
14
|
+
const duration = BASE_DURATION / (speed > 0 ? speed : 1);
|
|
15
|
+
return {
|
|
16
|
+
...glowVars(thickness, spread),
|
|
17
|
+
'--tol-color': color,
|
|
18
|
+
'--tol-color-soft': color && `color-mix(in srgb, ${color} 30%, transparent)`,
|
|
19
|
+
'--tol-duration': speed !== 1 ? `${duration}s` : undefined,
|
|
20
|
+
// Negative delay starts the orbit part-way through a lap
|
|
21
|
+
'--tol-delay': phase ? `${-phase * duration}s` : undefined,
|
|
22
|
+
'--tol-direction': reverse ? 'reverse' : undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function ThinkingOutline({ active, gradients, thickness, spread, className, }) {
|
|
6
26
|
const isControlled = active !== undefined;
|
|
7
|
-
|
|
27
|
+
const layers = gradients?.length ? gradients : DEFAULT_GRADIENTS;
|
|
28
|
+
return (jsx("div", { className: cn(S.root, isControlled && active && S.active, !isControlled && S.interactive, className), style: glowVars(thickness, spread), children: layers.map((gradient, i) => (jsxs("div", { className: S.layer, style: getLayerStyle(gradient), children: [jsx("div", { className: S.halo }), jsx("div", { className: S.bloom })] }, i))) }));
|
|
8
29
|
}
|
|
9
30
|
|
|
10
31
|
export { ThinkingOutline };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var css_248z = "@property --promptGlowAngle{syntax:\"<angle>\";inherits:true;initial-value:0deg}.ThinkingOutline_root__rvvBG{
|
|
2
|
-
var S = {"root":"ThinkingOutline_root__rvvBG","
|
|
1
|
+
var css_248z = "@property --promptGlowAngle{syntax:\"<angle>\";inherits:true;initial-value:0deg}.ThinkingOutline_root__rvvBG{border-radius:inherit;inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .5s ease-out}.ThinkingOutline_root__rvvBG.ThinkingOutline_interactive__3jMCg{pointer-events:auto}.ThinkingOutline_root__rvvBG.ThinkingOutline_active__-66iV,.ThinkingOutline_root__rvvBG.ThinkingOutline_interactive__3jMCg:hover{opacity:1}.ThinkingOutline_root__rvvBG.ThinkingOutline_active__-66iV .ThinkingOutline_layer__lDYzJ,.ThinkingOutline_root__rvvBG.ThinkingOutline_interactive__3jMCg:hover .ThinkingOutline_layer__lDYzJ{animation-play-state:running}.ThinkingOutline_layer__lDYzJ{--tol-source:calc(6px*var(--tol-thickness, 1));--tol-outset:calc(var(--tol-source) - 6px);--tol-halo:calc(3px*var(--tol-thickness, 1));animation:ThinkingOutline_orbitGlow__3bK-F 3.5s linear infinite;animation:ThinkingOutline_orbitGlow__3bK-F var(--tol-duration,3.5s) linear infinite;animation-delay:0s;animation-delay:var(--tol-delay,0s);animation-direction:normal;animation-direction:var(--tol-direction,normal);animation-play-state:paused;border-radius:inherit;inset:0;position:absolute}.ThinkingOutline_layer__lDYzJ:before{background:conic-gradient(from var(--promptGlowAngle),var(--tol-color,var(--active-color)) 0deg,var(--tol-color-soft,var(--active-color-alpha-300)) 48deg,transparent 80deg,transparent 100deg,var(--tol-color-soft,var(--active-color-alpha-300)) 132deg,var(--tol-color,var(--active-color)) 180deg,var(--tol-color-soft,var(--active-color-alpha-300)) 228deg,transparent 260deg,transparent 280deg,var(--tol-color-soft,var(--active-color-alpha-300)) 312deg,var(--tol-color,var(--active-color)) 1turn);border-radius:inherit;content:\"\";inset:0;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1.5px;padding:var(--tol-line,1.5px);position:absolute}.ThinkingOutline_bloom__XKYD5{border-radius:inherit;filter:blur(20px);filter:blur(var(--tol-spread,20px));inset:0;opacity:min(1,.55);opacity:min(1,calc(var(--tol-thickness, 1)*.55));position:absolute}.ThinkingOutline_bloom__XKYD5:before{background:conic-gradient(from var(--promptGlowAngle),var(--tol-color,var(--active-color)) 0deg,var(--tol-color-soft,var(--active-color-alpha-300)) 48deg,transparent 80deg,transparent 100deg,var(--tol-color-soft,var(--active-color-alpha-300)) 132deg,var(--tol-color,var(--active-color)) 180deg,var(--tol-color-soft,var(--active-color-alpha-300)) 228deg,transparent 260deg,transparent 280deg,var(--tol-color-soft,var(--active-color-alpha-300)) 312deg,var(--tol-color,var(--active-color)) 1turn);border-radius:inherit;content:\"\";inset:calc(var(--tol-outset)*-1);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:var(--tol-source);position:absolute}.ThinkingOutline_halo__tD2oJ{border-radius:inherit;filter:blur(6px);filter:blur(calc(var(--tol-spread, 20px)*.3));inset:0;opacity:clamp(0,0,1);opacity:clamp(0,calc((var(--tol-thickness, 1) - 1)*.5),1);position:absolute}.ThinkingOutline_halo__tD2oJ:before{background:conic-gradient(from var(--promptGlowAngle),var(--tol-color,var(--active-color)) 0deg,var(--tol-color-soft,var(--active-color-alpha-300)) 48deg,transparent 80deg,transparent 100deg,var(--tol-color-soft,var(--active-color-alpha-300)) 132deg,var(--tol-color,var(--active-color)) 180deg,var(--tol-color-soft,var(--active-color-alpha-300)) 228deg,transparent 260deg,transparent 280deg,var(--tol-color-soft,var(--active-color-alpha-300)) 312deg,var(--tol-color,var(--active-color)) 1turn);border-radius:inherit;content:\"\";inset:calc(var(--tol-halo)*-1);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:calc(var(--tol-halo) + 1.5px);position:absolute}@media (prefers-reduced-motion:reduce){.ThinkingOutline_layer__lDYzJ{animation:none}}@keyframes ThinkingOutline_orbitGlow__3bK-F{0%{--promptGlowAngle:-30deg}25%{--promptGlowAngle:30deg}50%{--promptGlowAngle:150deg}75%{--promptGlowAngle:210deg}to{--promptGlowAngle:330deg}}";
|
|
2
|
+
var S = {"root":"ThinkingOutline_root__rvvBG","interactive":"ThinkingOutline_interactive__3jMCg","active":"ThinkingOutline_active__-66iV","layer":"ThinkingOutline_layer__lDYzJ","orbitGlow":"ThinkingOutline_orbitGlow__3bK-F","bloom":"ThinkingOutline_bloom__XKYD5","halo":"ThinkingOutline_halo__tD2oJ"};
|
|
3
3
|
if (typeof document !== 'undefined') {
|
|
4
4
|
var __uilibHead = document.head || document.getElementsByTagName('head')[0];
|
|
5
5
|
if (__uilibHead) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as T from './Img.types';
|
|
2
|
+
export type ImgProps = T.Props;
|
|
3
|
+
/**
|
|
4
|
+
* `<img>` that never shows the browser's broken-image glyph or its alt text:
|
|
5
|
+
* when loading fails it renders `fallback` (a broken-image icon by default).
|
|
6
|
+
*/
|
|
7
|
+
export declare function Img({ src, alt, fallback, fallbackClassName, className, onError, ...rest }: T.Props): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type Props = ImgHTMLAttributes<HTMLImageElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* Rendered instead of the image when it fails to load. Defaults to a
|
|
5
|
+
* broken-image icon. Pass `null` to render nothing.
|
|
6
|
+
*/
|
|
7
|
+
fallback?: ReactNode;
|
|
8
|
+
/** Class for the default fallback wrapper. */
|
|
9
|
+
fallbackClassName?: string;
|
|
10
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ThinkingOutlineProps } from './ThinkingOutline.types';
|
|
2
|
-
export type { ThinkingOutlineProps };
|
|
3
|
-
export declare function ThinkingOutline({ active, className }: ThinkingOutlineProps): import("react").JSX.Element;
|
|
1
|
+
import { ThinkingOutlineGradient, ThinkingOutlineProps, ThinkingOutlineSize } from './ThinkingOutline.types';
|
|
2
|
+
export type { ThinkingOutlineGradient, ThinkingOutlineProps, ThinkingOutlineSize, };
|
|
3
|
+
export declare function ThinkingOutline({ active, gradients, thickness, spread, className, }: ThinkingOutlineProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export type ThinkingOutlineSize = number | string;
|
|
2
|
+
export type ThinkingOutlineGradient = {
|
|
3
|
+
color?: string;
|
|
4
|
+
speed?: number;
|
|
5
|
+
reverse?: boolean;
|
|
6
|
+
phase?: number;
|
|
7
|
+
thickness?: number;
|
|
8
|
+
spread?: ThinkingOutlineSize;
|
|
9
|
+
};
|
|
1
10
|
export type ThinkingOutlineProps = {
|
|
2
11
|
active?: boolean;
|
|
12
|
+
gradients?: ThinkingOutlineGradient[];
|
|
13
|
+
thickness?: number;
|
|
14
|
+
spread?: ThinkingOutlineSize;
|
|
3
15
|
className?: string;
|
|
4
16
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ThinkingOutline } from './ThinkingOutline';
|
|
2
|
-
export type { ThinkingOutlineProps } from './ThinkingOutline';
|
|
2
|
+
export type { ThinkingOutlineGradient, ThinkingOutlineProps, ThinkingOutlineSize, } from './ThinkingOutline';
|
|
@@ -24,6 +24,7 @@ export * from './Gallery/Gallery';
|
|
|
24
24
|
export * from './GridLayout/GridLayout';
|
|
25
25
|
export * from './Heading/Heading';
|
|
26
26
|
export * from './Icon/Icon';
|
|
27
|
+
export * from './Img/Img';
|
|
27
28
|
export * from './Input/Input';
|
|
28
29
|
export * from './InputFile/InputFile';
|
|
29
30
|
export * from './Label/Label';
|