etudes 0.53.0 → 0.54.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/lib/ExtractChild.d.ts +2 -1
- package/lib/ExtractChild.js.map +1 -1
- package/lib/ExtractChildren.d.ts +2 -1
- package/lib/ExtractChildren.js.map +1 -1
- package/lib/Map.d.ts +1 -2
- package/lib/Map.js.map +1 -1
- package/lib/Repeat.d.ts +1 -2
- package/lib/Repeat.js.map +1 -1
- package/lib/RotatingGallery.d.ts +1 -2
- package/lib/RotatingGallery.js.map +1 -1
- package/lib/TextField.d.ts +7 -1
- package/lib/TextField.js.map +1 -1
- package/lib/WithTooltip.d.ts +1 -2
- package/lib/WithTooltip.js.map +1 -1
- package/package.json +1 -1
package/lib/ExtractChild.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
|
+
export declare type Props = PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
2
3
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
3
4
|
children?: React.ReactNode;
|
|
4
5
|
} & React.RefAttributes<HTMLElement>>;
|
package/lib/ExtractChild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtractChild.js","sourceRoot":"/","sources":["ExtractChild.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,kDAAsB;AACtB,6CAAoH;AAIpH;;;GAGG;AACH,kBAAe,IAAA,kBAAU,EAAqB,UAAC,EAI9C,EAAE,GAAG;IAHJ,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACN,KAAK,cAHqC,yBAI9C,CADS;IAER,IAAI,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACvB,yCAAyC;QACzC,OAAO,CAAC,KAAK,CAAC,uEAAgE,QAAQ,CAAC,MAAM,sEAAmE,CAAC,CAAA;KAClK;IAED,OAAO,CACL,8DACG,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,GAAG;QACjC,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;QAE7B,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE;YACzB,OAAO,IAAA,oBAAY,EAAC,KAAK,sBAAI,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAK,KAAK,KAAE,GAAG,KAAA,IAAG,CAAA;SACvG;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import classNames from 'classnames'\nimport _ from 'lodash'\nimport React, { Children, cloneElement, forwardRef, HTMLAttributes, isValidElement, PropsWithChildren } from 'react'\n\
|
|
1
|
+
{"version":3,"file":"ExtractChild.js","sourceRoot":"/","sources":["ExtractChild.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,kDAAsB;AACtB,6CAAoH;AAIpH;;;GAGG;AACH,kBAAe,IAAA,kBAAU,EAAqB,UAAC,EAI9C,EAAE,GAAG;IAHJ,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACN,KAAK,cAHqC,yBAI9C,CADS;IAER,IAAI,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACvB,yCAAyC;QACzC,OAAO,CAAC,KAAK,CAAC,uEAAgE,QAAQ,CAAC,MAAM,sEAAmE,CAAC,CAAA;KAClK;IAED,OAAO,CACL,8DACG,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,GAAG;QACjC,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;QAE7B,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE;YACzB,OAAO,IAAA,oBAAY,EAAC,KAAK,sBAAI,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAK,KAAK,KAAE,GAAG,KAAA,IAAG,CAAA;SACvG;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import classNames from 'classnames'\nimport _ from 'lodash'\nimport React, { Children, cloneElement, forwardRef, HTMLAttributes, isValidElement, PropsWithChildren } from 'react'\n\nexport type Props = PropsWithChildren<HTMLAttributes<HTMLElement>>\n\n/**\n * Extracts a single child of a parent component into its own component. If the parent component has\n * multiple children, only the first one will be extracted, the rest will be ignored.\n */\nexport default forwardRef<HTMLElement, Props>(({\n children,\n className,\n ...props\n}, ref) => {\n if (_.isArray(children)) {\n /* eslint-disable-next-line no-console */\n console.error(`[etudes::ExtractChild] Only one child is expected, but found ${children.length}. Only the first child is extracted while the rest are discarded.`)\n }\n\n return (\n <>\n {Children.map(children, (child, idx) => {\n if (idx > 0) return undefined\n\n if (isValidElement(child)) {\n return cloneElement(child, { className: classNames(className, child.props.className), ...props, ref })\n }\n\n return child\n })}\n </>\n )\n})\n"]}
|
package/lib/ExtractChildren.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
|
+
export declare type Props = PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
2
3
|
/**
|
|
3
4
|
* Extracts all children of a parent component into its own component.
|
|
4
5
|
*/
|
|
5
|
-
export default function ExtractChildren({ children, className, ...props }:
|
|
6
|
+
export default function ExtractChildren({ children, className, ...props }: Props): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtractChildren.js","sourceRoot":"/","sources":["ExtractChildren.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAAwG;
|
|
1
|
+
{"version":3,"file":"ExtractChildren.js","sourceRoot":"/","sources":["ExtractChildren.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,6CAAwG;AAIxG;;GAEG;AACH,SAAwB,eAAe,CAAC,EAIhC;IAHN,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACN,KAAK,cAH8B,yBAIvC,CADS;IAER,OAAO,CACL,8DACG,gBAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,GAAG;QACjC,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE;YACzB,OAAO,IAAA,oBAAY,EAAC,KAAK,aAAI,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAK,KAAK,EAAG,CAAA;SAClG;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAhBD,kCAgBC","sourcesContent":["import classNames from 'classnames'\nimport React, { Children, cloneElement, HTMLAttributes, isValidElement, PropsWithChildren } from 'react'\n\nexport type Props = PropsWithChildren<HTMLAttributes<HTMLElement>>\n\n/**\n * Extracts all children of a parent component into its own component.\n */\nexport default function ExtractChildren({\n children,\n className,\n ...props\n}: Props) {\n return (\n <>\n {Children.map(children, (child, idx) => {\n if (isValidElement(child)) {\n return cloneElement(child, { className: classNames(className, child.props.className), ...props })\n }\n\n return child\n })}\n </>\n )\n}\n"]}
|
package/lib/Map.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Props<T> = {
|
|
2
|
+
export declare type Props<T> = {
|
|
3
3
|
children: JSX.Element | ((value: T, index: number) => JSX.Element);
|
|
4
4
|
array?: T[];
|
|
5
5
|
};
|
|
6
6
|
export default function Map<T>({ array, children, }: Props<T>): JSX.Element;
|
|
7
|
-
export {};
|
package/lib/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"/","sources":["Map.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAOvC,SAAwB,GAAG,CAAI,EAGpB;QAFT,KAAK,WAAA,EACL,QAAQ,cAAA;IAER,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,gDAAyC,KAAK,CAAE,CAAC,CAAA;IAEhG,OAAO,CACL,8DACG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CACnB,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAClD,CACZ,EAJoB,CAIpB,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAfD,sBAeC","sourcesContent":["import React, { Fragment } from 'react'\n\
|
|
1
|
+
{"version":3,"file":"Map.js","sourceRoot":"/","sources":["Map.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAOvC,SAAwB,GAAG,CAAI,EAGpB;QAFT,KAAK,WAAA,EACL,QAAQ,cAAA;IAER,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,gDAAyC,KAAK,CAAE,CAAC,CAAA;IAEhG,OAAO,CACL,8DACG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CACnB,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAClD,CACZ,EAJoB,CAIpB,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAfD,sBAeC","sourcesContent":["import React, { Fragment } from 'react'\n\nexport type Props<T> = {\n children: JSX.Element | ((value: T, index: number) => JSX.Element)\n array?: T[]\n}\n\nexport default function Map<T>({\n array,\n children,\n}: Props<T>) {\n if (!(array instanceof Array)) throw TypeError(`Provided collection must be an array: ${array}`)\n\n return (\n <>\n {array.map((v, i) => (\n <Fragment key={`element-${i}`}>\n {typeof children === 'function' ? children(v, i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
|
package/lib/Repeat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Props = {
|
|
2
|
+
export declare type Props = {
|
|
3
3
|
children: JSX.Element | ((index: number) => JSX.Element);
|
|
4
4
|
count?: number;
|
|
5
5
|
};
|
|
@@ -7,4 +7,3 @@ declare type Props = {
|
|
|
7
7
|
* A tag-less component that repeats its children, automatically assigning each a unique key.
|
|
8
8
|
*/
|
|
9
9
|
export default function Repeat({ count, children, }: Props): JSX.Element;
|
|
10
|
-
export {};
|
package/lib/Repeat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAOvC;;GAEG;AACH,SAAwB,MAAM,CAAC,EAGvB;QAFN,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,QAAQ,cAAA;IAER,OAAO,CACL,8DACG,yBAAI,KAAK,CAAC,KAAK,CAAC,UAAE,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAC/B,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAC/C,CACZ,EAJgC,CAIhC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAbD,yBAaC","sourcesContent":["import React, { Fragment } from 'react'\n\
|
|
1
|
+
{"version":3,"file":"Repeat.js","sourceRoot":"/","sources":["Repeat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAOvC;;GAEG;AACH,SAAwB,MAAM,CAAC,EAGvB;QAFN,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EACT,QAAQ,cAAA;IAER,OAAO,CACL,8DACG,yBAAI,KAAK,CAAC,KAAK,CAAC,UAAE,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAC/B,8BAAC,gBAAQ,IAAC,GAAG,EAAE,kBAAW,CAAC,CAAE,IAC1B,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAC/C,CACZ,EAJgC,CAIhC,CAAC,CACD,CACJ,CAAA;AACH,CAAC;AAbD,yBAaC","sourcesContent":["import React, { Fragment } from 'react'\n\nexport type Props = {\n children: JSX.Element | ((index: number) => JSX.Element)\n count?: number\n}\n\n/**\n * A tag-less component that repeats its children, automatically assigning each a unique key.\n */\nexport default function Repeat({\n count = 1,\n children,\n}: Props) {\n return (\n <>\n {[...Array(count)].map((_, i) => (\n <Fragment key={`element-${i}`}>\n {typeof children === 'function' ? children(i) : children}\n </Fragment>\n ))}\n </>\n )\n}\n"]}
|
package/lib/RotatingGallery.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { CSSProp } from 'styled-components';
|
|
3
|
-
declare type Props = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
export declare type Props = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
/**
|
|
5
5
|
* Current image index. An error is thrown if the index is invalid (must be between 0 and length
|
|
6
6
|
* of `srcs` - 1, inclusive). This prop supports two-way binding.
|
|
@@ -63,4 +63,3 @@ export declare const RotatingGalleryImage: import("styled-components").StyledCom
|
|
|
63
63
|
cssExiting: Props['cssExiting'];
|
|
64
64
|
cssExited: Props['cssExited'];
|
|
65
65
|
}, never>;
|
|
66
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotatingGallery.js","sourceRoot":"/","sources":["RotatingGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,iEAAmD;AACnD,qEAAwD;AACxD,oEAA6C;AA+D7C;;;;GAIG;AACH,SAAwB,eAAe,CAAC,EAmBhC;IAlBN,IAAA,aAAwB,EAAjB,aAAa,mBAAG,CAAC,KAAA,EACxB,aAAa,mBAAA,EACb,gBAAgB,sBAAA,EAChB,0BAAwB,EAAxB,kBAAkB,mBAAG,GAAG,KAAA,EACxB,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA,EACT,kBAGC,EAHD,UAAU,uBAAG,uBAAG,wJAAA,oFAGf,SAAA,EACD,mBAEC,EAFD,WAAW,uBAAG,uBAAG,2FAAA,uBAEhB,SAAA,EACD,UAAU,gBAAA,EACV,kBAEC,EAFD,UAAU,uBAAG,uBAAG,2FAAA,uBAEf,SAAA,EACD,SAAS,eAAA,EACN,KAAK,cAlB8B,kJAmBvC,CADS;IAEF,IAAA,KAAA,OAAoB,IAAA,gBAAQ,EAAC,aAAa,CAAC,IAAA,EAA1C,KAAK,QAAA,EAAE,QAAQ,QAA2B,CAAA;IAEjD,IAAA,qBAAW,EAAC;QACV,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,EAA0B,8BAI1B,EAAyB,8BAIzB,EAAyB,6BAIzB,EAAwB,SAE7B,KAjBG,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,GAAG,EAAT,CAAS,EAGhB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,WAAW,EAAjB,CAAiB,EAI1B,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,UAAU,EAAhB,CAAgB,EAIzB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,UAAU,EAAhB,CAAgB,EAIzB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,SAAS,EAAf,CAAe,EAE7B;AAED,IAAM,UAAU,GAAG,2BAAM,CAAC,GAAG,+HAAA,4DAI5B,IAAA,CAAA","sourcesContent":["import React, { HTMLAttributes, useEffect, useState } from 'react'\nimport { Transition } from 'react-transition-group'\nimport styled, { css, CSSProp } from 'styled-components'\nimport useInterval from './hooks/useInterval'\n\
|
|
1
|
+
{"version":3,"file":"RotatingGallery.js","sourceRoot":"/","sources":["RotatingGallery.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,iEAAmD;AACnD,qEAAwD;AACxD,oEAA6C;AA+D7C;;;;GAIG;AACH,SAAwB,eAAe,CAAC,EAmBhC;IAlBN,IAAA,aAAwB,EAAjB,aAAa,mBAAG,CAAC,KAAA,EACxB,aAAa,mBAAA,EACb,gBAAgB,sBAAA,EAChB,0BAAwB,EAAxB,kBAAkB,mBAAG,GAAG,KAAA,EACxB,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA,EACT,kBAGC,EAHD,UAAU,uBAAG,uBAAG,wJAAA,oFAGf,SAAA,EACD,mBAEC,EAFD,WAAW,uBAAG,uBAAG,2FAAA,uBAEhB,SAAA,EACD,UAAU,gBAAA,EACV,kBAEC,EAFD,UAAU,uBAAG,uBAAG,2FAAA,uBAEf,SAAA,EACD,SA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MAAG;SAC/B,GACD,CACH,EAbS,CAaT,CACU,CACd,EAjBuB,CAiBvB,CAAC,CACS,CACd,CAAA;AACH,CAAC;AAzDD,kCAyDC;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,GAAG,4VAK5C,mJASE,EAAkB,0BAGhB,EAA0B,8BAI1B,EAAyB,8BAIzB,EAAyB,6BAIzB,EAAwB,SAE7B,KAjBG,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,GAAG,EAAT,CAAS,EAGhB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,WAAW,EAAjB,CAAiB,EAI1B,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,UAAU,EAAhB,CAAgB,EAIzB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,UAAU,EAAhB,CAAgB,EAIzB,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,SAAS,EAAf,CAAe,EAE7B;AAED,IAAM,UAAU,GAAG,2BAAM,CAAC,GAAG,+HAAA,4DAI5B,IAAA,CAAA","sourcesContent":["import React, { HTMLAttributes, useEffect, useState } from 'react'\nimport { Transition } from 'react-transition-group'\nimport styled, { css, CSSProp } from 'styled-components'\nimport useInterval from './hooks/useInterval'\n\nexport type Props = HTMLAttributes<HTMLDivElement> & {\n /**\n * Current image index. An error is thrown if the index is invalid (must be between 0 and length\n * of `srcs` - 1, inclusive). This prop supports two-way binding.\n */\n index?: number\n\n /**\n * An array of image paths.\n */\n srcs?: string[]\n\n /**\n * The duration of one rotation in milliseconds (how long one image stays before transitioning to\n * the next). Specifying `NaN` or a negative number will prevent the component from automatically\n * rotating.\n */\n rotationDuration?: number\n\n /**\n * The duration of an image transition in milliseconds.\n */\n transitionDuration?: number\n\n /**\n * The default CSS of the image container.\n */\n cssDefault?: CSSProp<any>\n\n /**\n * The CSS of the image container (a `<div>` element containing the image) when the image is\n * entering into view. This CSS lasts for `transitionDuration` milliseconds.\n */\n cssEntering?: CSSProp<any>\n\n /**\n * The CSS of the image container (a `<div>` element containing the image) after the image has\n * entered into view.\n */\n cssEntered?: CSSProp<any>\n\n /**\n * The CSS of the image container (a `<div>` element containing the image) when the image is\n * exiting out of view. This CSS lasts for `transitionDuration` milliseconds.\n */\n cssExiting?: CSSProp<any>\n\n /**\n * The CSS of the image container (a `<div>` element containing the image) after the image has\n * exited out of view.\n */\n cssExited?: CSSProp<any>\n\n /**\n * Handler invoked when the image index changes.\n *\n * @param index - The current image index.\n */\n onIndexChange?: (index: number) => void\n}\n\n/**\n * A component displaying rotating images.\n *\n * @exports RotatingGalleryImage - Component for each rotating image.\n */\nexport default function RotatingGallery({\n index: externalIndex = 0,\n onIndexChange,\n rotationDuration,\n transitionDuration = 500,\n srcs = [],\n cssDefault = css`\n transition-property: opacity;\n transition-timing-function: ease-out;\n `,\n cssEntering = css`\n opacity: 1;\n `,\n cssEntered,\n cssExiting = css`\n opacity: 0;\n `,\n cssExited,\n ...props\n}: Props) {\n const [index, setIndex] = useState(externalIndex)\n\n useInterval(() => {\n setIndex((index + 1) % srcs.length)\n }, rotationDuration)\n\n useEffect(() => {\n if (externalIndex === index) return\n setIndex(externalIndex)\n }, [externalIndex])\n\n useEffect(() => {\n onIndexChange?.(index)\n }, [index])\n\n return (\n <StyledRoot {...props}>\n {srcs.map((src, idx) => (\n <Transition key={src} in={idx === index} timeout={transitionDuration}>\n {state => (\n <RotatingGalleryImage\n className={state}\n css={cssDefault}\n cssEntering={cssEntering ?? cssEntered}\n cssEntered={cssEntered ?? cssEntering}\n cssExiting={cssExiting ?? cssExited}\n cssExited={cssExited ?? cssExiting}\n style={{\n transitionDuration: `${transitionDuration}ms`,\n backgroundImage: `url(${src})`,\n }}\n />\n )}\n </Transition>\n ))}\n </StyledRoot>\n )\n}\n\nexport const RotatingGalleryImage = styled.div<{\n cssEntering: Props['cssEntering']\n cssEntered: Props['cssEntered']\n cssExiting: Props['cssExiting']\n cssExited: Props['cssExited']\n}>`\n background-repeat: no-repeat;\n background-size: cover;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n\n ${props => props.css}\n\n &.entering {\n ${props => props.cssEntering}\n }\n\n &.entered {\n ${props => props.cssEntered}\n }\n\n &.exiting {\n ${props => props.cssExiting}\n }\n\n &.exited {\n ${props => props.cssExited}\n }\n`\n\nconst StyledRoot = styled.div`\n height: 100%;\n position: relative;\n width: 100%;\n`\n"]}
|
package/lib/TextField.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export declare type Props = HTMLAttributes<HTMLInputElement> & {
|
|
3
|
+
value?: string;
|
|
4
|
+
onFocus?: (value: string) => void;
|
|
5
|
+
onUnfocus?: (value: string) => void;
|
|
6
|
+
onValueChange?: (value: string) => void;
|
|
7
|
+
};
|
|
2
8
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLInputElement> & {
|
|
3
9
|
value?: string | undefined;
|
|
4
10
|
onFocus?: ((value: string) => void) | undefined;
|
package/lib/TextField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"/","sources":["TextField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkF;AAClF,wEAAsC;AAStC,kBAAe,IAAA,kBAAU,EAA0B,UAAC,EAMnD,EAAE,GAAG;IALJ,IAAA,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,OAAO,aAAA,EACP,SAAS,eAAA,EACT,aAAa,mBAAA,EACV,KAAK,cAL0C,kDAMnD,CADS;IACC,OAAA,CACT,8BAAC,UAAU,eACL,KAAK,IACT,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,UAAC,EAAyC;gBAAvC,MAAM,YAAA;YAAsC,OAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,MAAM,CAAC,KAAK,CAAC;QAA7B,CAA6B,EACtF,OAAO,EAAE,UAAC,EAAwC;gBAAtC,MAAM,YAAA;YAAqC,OAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,MAAM,CAAC,KAAK,CAAC;QAAvB,CAAuB,EAC9E,MAAM,EAAE,UAAC,EAAwC;gBAAtC,MAAM,YAAA;YAAqC,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,MAAM,CAAC,KAAK,CAAC;QAAzB,CAAyB,EAC/E,KAAK,EAAE,KAAK,IACZ,CACH,CAAA;CAAA,CAAC,CAAA;AAEF,IAAM,UAAU,GAAG,2BAAM,CAAC,KAAK,qOAAA,kKAS9B,IAAA,CAAA","sourcesContent":["import React, { ChangeEvent, FocusEvent, forwardRef, HTMLAttributes } from 'react'\nimport styled from 'styled-components'\n\
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"/","sources":["TextField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkF;AAClF,wEAAsC;AAStC,kBAAe,IAAA,kBAAU,EAA0B,UAAC,EAMnD,EAAE,GAAG;IALJ,IAAA,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,OAAO,aAAA,EACP,SAAS,eAAA,EACT,aAAa,mBAAA,EACV,KAAK,cAL0C,kDAMnD,CADS;IACC,OAAA,CACT,8BAAC,UAAU,eACL,KAAK,IACT,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,UAAC,EAAyC;gBAAvC,MAAM,YAAA;YAAsC,OAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,MAAM,CAAC,KAAK,CAAC;QAA7B,CAA6B,EACtF,OAAO,EAAE,UAAC,EAAwC;gBAAtC,MAAM,YAAA;YAAqC,OAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,MAAM,CAAC,KAAK,CAAC;QAAvB,CAAuB,EAC9E,MAAM,EAAE,UAAC,EAAwC;gBAAtC,MAAM,YAAA;YAAqC,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,MAAM,CAAC,KAAK,CAAC;QAAzB,CAAyB,EAC/E,KAAK,EAAE,KAAK,IACZ,CACH,CAAA;CAAA,CAAC,CAAA;AAEF,IAAM,UAAU,GAAG,2BAAM,CAAC,KAAK,qOAAA,kKAS9B,IAAA,CAAA","sourcesContent":["import React, { ChangeEvent, FocusEvent, forwardRef, HTMLAttributes } from 'react'\nimport styled from 'styled-components'\n\nexport type Props = HTMLAttributes<HTMLInputElement> & {\n value?: string\n onFocus?: (value: string) => void\n onUnfocus?: (value: string) => void\n onValueChange?: (value: string) => void\n}\n\nexport default forwardRef<HTMLInputElement, Props>(({\n value = '',\n onFocus,\n onUnfocus,\n onValueChange,\n ...props\n}, ref) => (\n <StyledRoot\n {...props}\n ref={ref}\n type='text'\n onChange={({ target }: ChangeEvent<HTMLInputElement>) => onValueChange?.(target.value)}\n onFocus={({ target }: FocusEvent<HTMLInputElement>) => onFocus?.(target.value)}\n onBlur={({ target }: FocusEvent<HTMLInputElement>) => onUnfocus?.(target.value)}\n value={value}\n />\n))\n\nconst StyledRoot = styled.input`\n background: #fff;\n box-sizing: border-box;\n color: #000;\n display: block;\n height: 40px;\n padding: 0 1rem;\n text-align: left;\n width: 100px;\n`\n"]}
|
package/lib/WithTooltip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
2
|
import { CSSProp } from 'styled-components';
|
|
3
|
-
declare type Props = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
3
|
+
export declare type Props = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
4
4
|
/**
|
|
5
5
|
* The height of the arrow. The width (longest edge) of the arrow is always twice its height.
|
|
6
6
|
*/
|
|
@@ -37,4 +37,3 @@ declare type Props = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
|
37
37
|
cssDialog?: CSSProp<any>;
|
|
38
38
|
};
|
|
39
39
|
export default function WithTooltip({ arrowHeight, backgroundColor, cssDialog, disabledOnTouch, hint, gap, textColor, threshold, ...props }: Props): JSX.Element;
|
|
40
|
-
export {};
|
package/lib/WithTooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithTooltip.js","sourceRoot":"/","sources":["WithTooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoH;AACpH,+BAAkC;AAClC,qEAAwD;AACxD,gEAAyC;AAgDzC,SAAwB,WAAW,CAAC,EAU5B;IATN,IAAA,mBAAe,EAAf,WAAW,mBAAG,CAAC,KAAA,EACf,uBAAwB,EAAxB,eAAe,mBAAG,MAAM,KAAA,EACxB,SAAS,eAAA,EACT,uBAAsB,EAAtB,eAAe,mBAAG,IAAI,KAAA,EACtB,IAAI,UAAA,EACJ,WAAO,EAAP,GAAG,mBAAG,CAAC,KAAA,EACP,iBAAkB,EAAlB,SAAS,mBAAG,MAAM,KAAA,EAClB,iBAAe,EAAf,SAAS,mBAAG,GAAG,KAAA,EACZ,KAAK,cAT0B,2GAUnC,CADS;IAER,IAAM,gBAAgB,GAAG,UAAC,MAAe,EAAE,SAAiB;QAC1D,IAAM,KAAK,GAAG,YAAI,CAAC,YAAY,EAAE,CAAA;QACjC,IAAM,IAAI,GAAG,YAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QAEtC,IAAI,IAAI,EAAE;YACR,IAAM,SAAS,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;YACtD,IAAM,UAAU,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YACzD,IAAM,QAAQ,GA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{ HTMLAttributes, MouseEvent, PropsWithChildren, RefObject, useEffect, useRef, useState } from 'react'\nimport { Rect, Size } from 'spase'\nimport styled, { css, CSSProp } from 'styled-components'\nimport ExtractChild from './ExtractChild'\n\ntype Props = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * The height of the arrow. The width (longest edge) of the arrow is always twice its height.\n */\n arrowHeight?: number\n\n /**\n * Color of the dialog background, same format as a CSS color string (i.e. '#000').\n */\n backgroundColor?: string\n\n /**\n * Specifies if the tooltip should be disabled in touch devices (i.e. `html` has class `.touch`).\n */\n disabledOnTouch?: boolean\n\n /**\n * The hint string to display in the tooltip.\n */\n hint: string\n\n /**\n * The gap (in pixels) between the target element and the tooltip, defaults to zero.\n */\n gap?: number\n\n /**\n * Color of the dialog text, same format as a CSS color string (i.e. '#000').\n */\n textColor?: string\n\n /**\n * The minimum space (in pixels) between the target element and the edge of the window required to\n * trigger an alignment change, defaults to `100px`.\n */\n threshold?: number\n\n /**\n * Custom CSS provided to the dialog. Not all CSS rules will take effect as they will be\n * overridden by internal rules.\n */\n cssDialog?: CSSProp<any>\n}\n\ntype Alignment = 'tl' | 'tc' | 'tr' | 'cl' | 'cr' | 'bl' | 'bc' | 'br'\n\nexport default function WithTooltip({\n arrowHeight = 8,\n backgroundColor = '#000',\n cssDialog,\n disabledOnTouch = true,\n hint,\n gap = 5,\n textColor = '#fff',\n threshold = 100,\n ...props\n}: Props) {\n const computeAlignment = (target: Element, threshold: number): Alignment => {\n const vrect = Rect.fromViewport()\n const rect = Rect.intersecting(target)\n\n if (rect) {\n const leftBound = (rect.left - vrect.left) < threshold\n const rightBound = (vrect.right - rect.right) < threshold\n const topBound = (rect.top - vrect.top) < threshold\n const bottomBound = (vrect.bottom - rect.bottom) < threshold\n\n if (leftBound && topBound) return 'br'\n if (leftBound && bottomBound) return 'tr'\n if (rightBound && topBound) return 'bl'\n if (rightBound && bottomBound) return 'tl'\n if (leftBound) return 'cr'\n if (rightBound) return 'cl'\n if (bottomBound) return 'tc'\n }\n\n return 'bc'\n }\n\n const computeTextSize = (target: Element, threshold: number): Size => {\n const computedStyle = window.getComputedStyle(target, '::after')\n const div = document.createElement('div')\n div.innerHTML = hint\n div.style.fontFamily = computedStyle.getPropertyValue('font-family')\n div.style.fontSize = computedStyle.getPropertyValue('font-size')\n div.style.fontStyle = computedStyle.getPropertyValue('font-style')\n div.style.fontVariant = computedStyle.getPropertyValue('font-variant')\n div.style.fontWeight = computedStyle.getPropertyValue('font-weight')\n div.style.left = '0'\n div.style.position = 'absolute'\n div.style.top = '0'\n div.style.visibility = 'hidden'\n div.style.whiteSpace = 'pre'\n\n document.body.appendChild(div)\n\n // Add 1px as buffer to mitigate precision discrepancies.\n const width = div.clientWidth + 1\n const height = div.clientHeight + 1\n\n document.body.removeChild(div)\n\n return new Size([width, height])\n }\n\n const onMouseOver = (event: MouseEvent) => {\n setAlignment(computeAlignment(event.currentTarget, threshold))\n setTextSize(computeTextSize(event.currentTarget, threshold))\n }\n\n const [textSize, setTextSize] = useState<Size | undefined>(new Size())\n const [alignment, setAlignment] = useState<Alignment | undefined>(undefined)\n\n const childRef = useRef<HTMLElement>(null)\n\n useEffect(() => {\n const childNode = childRef.current\n if (!childNode) return\n setAlignment(computeAlignment(childNode, threshold))\n setTextSize(computeTextSize(childNode, threshold))\n }, [])\n\n return (\n <StyledRoot\n arrowHeight={arrowHeight}\n backgroundColor={backgroundColor}\n ref={childRef}\n cssDialog={cssDialog}\n disabledOnTouch={disabledOnTouch}\n hint={hint}\n gap={gap}\n onMouseOver={event => onMouseOver(event)}\n alignment={alignment}\n textColor={textColor}\n textSize={textSize}\n {...props}\n />\n )\n}\n\nfunction makeDisplacementCSS(alignment: Alignment, arrowHeight: number, gap: number): CSSProp {\n switch (alignment) {\n case 'tl': return css`top: ${-arrowHeight}px; left: calc(50% + ${arrowHeight*2.5}px);`\n case 'tc': return css`top: ${-arrowHeight}px; left: 50%;`\n case 'tr': return css`top: ${-arrowHeight}px; right: calc(50% + ${arrowHeight*2.5}px);`\n case 'cl': return css`top: 50%; left: ${-arrowHeight}px;`\n case 'cr': return css`top: 50%; right: ${-arrowHeight}px;`\n case 'bl': return css`bottom: ${-arrowHeight}px; left: calc(50% + ${arrowHeight*2.5}px);`\n case 'bc': return css`bottom: ${-arrowHeight}px; left: 50%;`\n case 'br': return css`bottom: ${-arrowHeight}px; right: calc(50% + ${arrowHeight*2.5}px);`\n }\n}\n\nfunction makeDialogPositionCSS(alignment: Alignment, arrowHeight: number, gap: number): CSSProp {\n switch (alignment) {\n case 'tl': return css`transform: translate3d(calc(-100% - ${gap}px), calc(-100% - ${gap}px), 0);`\n case 'tc': return css`transform: translate3d(-50%, calc(-100% - ${gap}px), 0);`\n case 'tr': return css`transform: translate3d(calc(100% + ${gap}px), calc(-100% - ${gap}px), 0);`\n case 'cl': return css`transform: translate3d(calc(-100% - ${gap}px), -50%, 0);`\n case 'cr': return css`transform: translate3d(calc(100% + ${gap}px), -50%, 0);`\n case 'bl': return css`transform: translate3d(calc(-100% - ${gap}px), calc(100% + ${gap}px), 0);`\n case 'bc': return css`transform: translate3d(-50%, calc(100% + ${gap}px), 0);`\n case 'br': return css`transform: translate3d(calc(100% + ${gap}px), calc(100% + ${gap}px), 0);`\n }\n}\n\nfunction makeArrowPositionCSS(alignment: Alignment, arrowHeight: number, gap: number, color: string): CSSProp {\n return css`\n ${() => {\n switch (alignment) {\n case 'tl': return css`border-color: ${color} transparent transparent transparent;`\n case 'tc': return css`border-color: ${color} transparent transparent transparent;`\n case 'tr': return css`border-color: ${color} transparent transparent transparent;`\n case 'cl': return css`border-color: transparent transparent transparent ${color};`\n case 'cr': return css`border-color: transparent ${color} transparent transparent;`\n case 'bl': return css`border-color: transparent transparent ${color} transparent;`\n case 'bc': return css`border-color: transparent transparent ${color} transparent;`\n case 'br': return css`border-color: transparent transparent ${color} transparent;`\n }\n }}\n\n ${() => {\n switch (alignment) {\n case 'tl': return css`transform: translate3d(calc(0% - ${gap}px - ${arrowHeight*3}px), calc(0% - ${gap}px), 0);`\n case 'tc': return css`transform: translate3d(-50%, calc(0% - ${gap}px), 0);`\n case 'tr': return css`transform: translate3d(calc(100% + ${gap}px + ${arrowHeight}px), calc(0% - ${gap}px), 0);`\n case 'cl': return css`transform: translate3d(calc(0% - ${gap}px), -50%, 0);`\n case 'cr': return css`transform: translate3d(calc(0% + ${gap}px), -50%, 0);`\n case 'bl': return css`transform: translate3d(calc(0% - ${gap}px - ${arrowHeight*3}px), calc(0% + ${gap}px), 0);`\n case 'bc': return css`transform: translate3d(-50%, calc(0% + ${gap}px), 0);`\n case 'br': return css`transform: translate3d(calc(100% + ${gap}px + ${arrowHeight}px), calc(0% + ${gap}px), 0);`\n }\n }}\n `\n}\n\nconst StyledRoot = styled(ExtractChild)<{\n arrowHeight: number\n backgroundColor: string\n ref: RefObject<HTMLElement>\n cssDialog?: CSSProp\n disabledOnTouch: boolean\n hint: string\n gap: number\n alignment?: Alignment\n textColor: string\n textSize?: Size\n}>`\n cursor: pointer;\n position: relative;\n\n &::before {\n border-style: solid;\n border-width: ${props => props.arrowHeight}px;\n content: '';\n height: 0;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: opacity 200ms ease-out;\n width: 0;\n z-index: 10001;\n\n ${props => props.alignment && props.textSize && css`\n ${makeDisplacementCSS(props.alignment, props.arrowHeight, props.gap)}\n ${makeArrowPositionCSS(props.alignment, props.arrowHeight, props.gap, props.backgroundColor)}\n ${props.disabledOnTouch ? 'html.touch & { display: none; }' : ''}\n `}\n }\n\n &::after {\n box-sizing: content-box;\n font-size: 12px;\n max-width: 200px;\n padding: 10px 14px;\n text-align: left;\n\n ${props => props.cssDialog}\n\n background: ${props => props.backgroundColor};\n color: ${props => props.textColor};\n content: '${props => props.hint}';\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n position: absolute;\n transform: translate3d(0, 0, 0);\n transition: opacity 200ms ease-out;\n z-index: 10000;\n\n ${props => props.alignment && props.textSize && css`\n width: ${props.textSize.width > 0 ? `${props.textSize.width}px` : 'auto'};\n ${makeDisplacementCSS(props.alignment, props.arrowHeight, props.gap)}\n ${makeDialogPositionCSS(props.alignment, props.arrowHeight, props.gap)}\n ${props.disabledOnTouch ? 'html.touch & { display: none; }' : ''}\n `}\n }\n\n ${props => props.disabledOnTouch ? 'html:not(.touch) &:hover' : '&:hover'} {\n &::before { opacity: 1; }\n &::after { opacity: 1; }\n }\n`\n"]}
|
|
1
|
+
{"version":3,"file":"WithTooltip.js","sourceRoot":"/","sources":["WithTooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoH;AACpH,+BAAkC;AAClC,qEAAwD;AACxD,gEAAyC;AAgDzC,SAAwB,WAAW,CAAC,EAU5B;IATN,IAAA,mBAAe,EAAf,WAAW,mBAAG,CAAC,KAAA,EACf,uBAAwB,EAAxB,eAAe,mBAAG,MAAM,KAAA,EACxB,SAAS,eAAA,EACT,uBAAsB,EAAtB,eAAe,mBAAG,IAAI,KAAA,EACtB,IAAI,UAAA,EACJ,WAAO,EAAP,GAAG,mBAAG,CAAC,KAAA,EACP,iBAAkB,EAAlB,SAAS,mBAAG,MAAM,KAAA,EAClB,iBAAe,EAAf,SAAS,mBAAG,GAAG,KAAA,EACZ,KAAK,cAT0B,2GAUnC,CADS;IAER,IAAM,gBAAgB,GAAG,UAAC,MAAe,EAAE,SAAiB;QAC1D,IAAM,KAAK,GAAG,YAAI,CAAC,YAAY,EAAE,CAAA;QACjC,IAAM,IAAI,GAAG,YAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QAEtC,IAAI,IAAI,EAAE;YACR,IAAM,SAAS,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;YACtD,IAAM,UAAU,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC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EAA9D,CAA8D,CAI1E,CAAA","sourcesContent":["import React, { HTMLAttributes, MouseEvent, PropsWithChildren, RefObject, useEffect, useRef, useState } from 'react'\nimport { Rect, Size } from 'spase'\nimport styled, { css, CSSProp } from 'styled-components'\nimport ExtractChild from './ExtractChild'\n\nexport type Props = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * The height of the arrow. The width (longest edge) of the arrow is always twice its height.\n */\n arrowHeight?: number\n\n /**\n * Color of the dialog background, same format as a CSS color string (i.e. '#000').\n */\n backgroundColor?: string\n\n /**\n * Specifies if the tooltip should be disabled in touch devices (i.e. `html` has class `.touch`).\n */\n disabledOnTouch?: boolean\n\n /**\n * The hint string to display in the tooltip.\n */\n hint: string\n\n /**\n * The gap (in pixels) between the target element and the tooltip, defaults to zero.\n */\n gap?: number\n\n /**\n * Color of the dialog text, same format as a CSS color string (i.e. '#000').\n */\n textColor?: string\n\n /**\n * The minimum space (in pixels) between the target element and the edge of the window required to\n * trigger an alignment change, defaults to `100px`.\n */\n threshold?: number\n\n /**\n * Custom CSS provided to the dialog. Not all CSS rules will take effect as they will be\n * overridden by internal rules.\n */\n cssDialog?: CSSProp<any>\n}\n\ntype Alignment = 'tl' | 'tc' | 'tr' | 'cl' | 'cr' | 'bl' | 'bc' | 'br'\n\nexport default function WithTooltip({\n arrowHeight = 8,\n backgroundColor = '#000',\n cssDialog,\n disabledOnTouch = true,\n hint,\n gap = 5,\n textColor = '#fff',\n threshold = 100,\n ...props\n}: Props) {\n const computeAlignment = (target: Element, threshold: number): Alignment => {\n const vrect = Rect.fromViewport()\n const rect = Rect.intersecting(target)\n\n if (rect) {\n const leftBound = (rect.left - vrect.left) < threshold\n const rightBound = (vrect.right - rect.right) < threshold\n const topBound = (rect.top - vrect.top) < threshold\n const bottomBound = (vrect.bottom - rect.bottom) < threshold\n\n if (leftBound && topBound) return 'br'\n if (leftBound && bottomBound) return 'tr'\n if (rightBound && topBound) return 'bl'\n if (rightBound && bottomBound) return 'tl'\n if (leftBound) return 'cr'\n if (rightBound) return 'cl'\n if (bottomBound) return 'tc'\n }\n\n return 'bc'\n }\n\n const computeTextSize = (target: Element, threshold: number): Size => {\n const computedStyle = window.getComputedStyle(target, '::after')\n const div = document.createElement('div')\n div.innerHTML = hint\n div.style.fontFamily = computedStyle.getPropertyValue('font-family')\n div.style.fontSize = computedStyle.getPropertyValue('font-size')\n div.style.fontStyle = computedStyle.getPropertyValue('font-style')\n div.style.fontVariant = computedStyle.getPropertyValue('font-variant')\n div.style.fontWeight = computedStyle.getPropertyValue('font-weight')\n div.style.left = '0'\n div.style.position = 'absolute'\n div.style.top = '0'\n div.style.visibility = 'hidden'\n div.style.whiteSpace = 'pre'\n\n document.body.appendChild(div)\n\n // Add 1px as buffer to mitigate precision discrepancies.\n const width = div.clientWidth + 1\n const height = div.clientHeight + 1\n\n document.body.removeChild(div)\n\n return new Size([width, height])\n }\n\n const onMouseOver = (event: MouseEvent) => {\n setAlignment(computeAlignment(event.currentTarget, threshold))\n setTextSize(computeTextSize(event.currentTarget, threshold))\n }\n\n const [textSize, setTextSize] = useState<Size | undefined>(new Size())\n const [alignment, setAlignment] = useState<Alignment | undefined>(undefined)\n\n const childRef = useRef<HTMLElement>(null)\n\n useEffect(() => {\n const childNode = childRef.current\n if (!childNode) return\n setAlignment(computeAlignment(childNode, threshold))\n setTextSize(computeTextSize(childNode, threshold))\n }, [])\n\n return (\n <StyledRoot\n arrowHeight={arrowHeight}\n backgroundColor={backgroundColor}\n ref={childRef}\n cssDialog={cssDialog}\n disabledOnTouch={disabledOnTouch}\n hint={hint}\n gap={gap}\n onMouseOver={event => onMouseOver(event)}\n alignment={alignment}\n textColor={textColor}\n textSize={textSize}\n {...props}\n />\n )\n}\n\nfunction makeDisplacementCSS(alignment: Alignment, arrowHeight: number, gap: number): CSSProp {\n switch (alignment) {\n case 'tl': return css`top: ${-arrowHeight}px; left: calc(50% + ${arrowHeight*2.5}px);`\n case 'tc': return css`top: ${-arrowHeight}px; left: 50%;`\n case 'tr': return css`top: ${-arrowHeight}px; right: calc(50% + ${arrowHeight*2.5}px);`\n case 'cl': return css`top: 50%; left: ${-arrowHeight}px;`\n case 'cr': return css`top: 50%; right: ${-arrowHeight}px;`\n case 'bl': return css`bottom: ${-arrowHeight}px; left: calc(50% + ${arrowHeight*2.5}px);`\n case 'bc': return css`bottom: ${-arrowHeight}px; left: 50%;`\n case 'br': return css`bottom: ${-arrowHeight}px; right: calc(50% + ${arrowHeight*2.5}px);`\n }\n}\n\nfunction makeDialogPositionCSS(alignment: Alignment, arrowHeight: number, gap: number): CSSProp {\n switch (alignment) {\n case 'tl': return css`transform: translate3d(calc(-100% - ${gap}px), calc(-100% - ${gap}px), 0);`\n case 'tc': return css`transform: translate3d(-50%, calc(-100% - ${gap}px), 0);`\n case 'tr': return css`transform: translate3d(calc(100% + ${gap}px), calc(-100% - ${gap}px), 0);`\n case 'cl': return css`transform: translate3d(calc(-100% - ${gap}px), -50%, 0);`\n case 'cr': return css`transform: translate3d(calc(100% + ${gap}px), -50%, 0);`\n case 'bl': return css`transform: translate3d(calc(-100% - ${gap}px), calc(100% + ${gap}px), 0);`\n case 'bc': return css`transform: translate3d(-50%, calc(100% + ${gap}px), 0);`\n case 'br': return css`transform: translate3d(calc(100% + ${gap}px), calc(100% + ${gap}px), 0);`\n }\n}\n\nfunction makeArrowPositionCSS(alignment: Alignment, arrowHeight: number, gap: number, color: string): CSSProp {\n return css`\n ${() => {\n switch (alignment) {\n case 'tl': return css`border-color: ${color} transparent transparent transparent;`\n case 'tc': return css`border-color: ${color} transparent transparent transparent;`\n case 'tr': return css`border-color: ${color} transparent transparent transparent;`\n case 'cl': return css`border-color: transparent transparent transparent ${color};`\n case 'cr': return css`border-color: transparent ${color} transparent transparent;`\n case 'bl': return css`border-color: transparent transparent ${color} transparent;`\n case 'bc': return css`border-color: transparent transparent ${color} transparent;`\n case 'br': return css`border-color: transparent transparent ${color} transparent;`\n }\n }}\n\n ${() => {\n switch (alignment) {\n case 'tl': return css`transform: translate3d(calc(0% - ${gap}px - ${arrowHeight*3}px), calc(0% - ${gap}px), 0);`\n case 'tc': return css`transform: translate3d(-50%, calc(0% - ${gap}px), 0);`\n case 'tr': return css`transform: translate3d(calc(100% + ${gap}px + ${arrowHeight}px), calc(0% - ${gap}px), 0);`\n case 'cl': return css`transform: translate3d(calc(0% - ${gap}px), -50%, 0);`\n case 'cr': return css`transform: translate3d(calc(0% + ${gap}px), -50%, 0);`\n case 'bl': return css`transform: translate3d(calc(0% - ${gap}px - ${arrowHeight*3}px), calc(0% + ${gap}px), 0);`\n case 'bc': return css`transform: translate3d(-50%, calc(0% + ${gap}px), 0);`\n case 'br': return css`transform: translate3d(calc(100% + ${gap}px + ${arrowHeight}px), calc(0% + ${gap}px), 0);`\n }\n }}\n `\n}\n\nconst StyledRoot = styled(ExtractChild)<{\n arrowHeight: number\n backgroundColor: string\n ref: RefObject<HTMLElement>\n cssDialog?: CSSProp\n disabledOnTouch: boolean\n hint: string\n gap: number\n alignment?: Alignment\n textColor: string\n textSize?: Size\n}>`\n cursor: pointer;\n position: relative;\n\n &::before {\n border-style: solid;\n border-width: ${props => props.arrowHeight}px;\n content: '';\n height: 0;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: opacity 200ms ease-out;\n width: 0;\n z-index: 10001;\n\n ${props => props.alignment && props.textSize && css`\n ${makeDisplacementCSS(props.alignment, props.arrowHeight, props.gap)}\n ${makeArrowPositionCSS(props.alignment, props.arrowHeight, props.gap, props.backgroundColor)}\n ${props.disabledOnTouch ? 'html.touch & { display: none; }' : ''}\n `}\n }\n\n &::after {\n box-sizing: content-box;\n font-size: 12px;\n max-width: 200px;\n padding: 10px 14px;\n text-align: left;\n\n ${props => props.cssDialog}\n\n background: ${props => props.backgroundColor};\n color: ${props => props.textColor};\n content: '${props => props.hint}';\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n position: absolute;\n transform: translate3d(0, 0, 0);\n transition: opacity 200ms ease-out;\n z-index: 10000;\n\n ${props => props.alignment && props.textSize && css`\n width: ${props.textSize.width > 0 ? `${props.textSize.width}px` : 'auto'};\n ${makeDisplacementCSS(props.alignment, props.arrowHeight, props.gap)}\n ${makeDialogPositionCSS(props.alignment, props.arrowHeight, props.gap)}\n ${props.disabledOnTouch ? 'html.touch & { display: none; }' : ''}\n `}\n }\n\n ${props => props.disabledOnTouch ? 'html:not(.touch) &:hover' : '&:hover'} {\n &::before { opacity: 1; }\n &::after { opacity: 1; }\n }\n`\n"]}
|