@doist/reactist 15.1.0 → 15.3.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/dist/reactist.cjs.development.js +90 -73
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/components/color-picker/color-picker.js +10 -10
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +4 -4
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-dropdown/dropdown.js +9 -9
- package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/es/components/deprecated-input/input.js +3 -3
- package/es/components/deprecated-input/input.js.map +1 -1
- package/es/components/deprecated-select/select.js +3 -3
- package/es/components/deprecated-select/select.js.map +1 -1
- package/es/components/icons/CloseIcon.svg.js +3 -3
- package/es/components/icons/CloseIcon.svg.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +2 -2
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/notification/notification.js +9 -9
- package/es/components/notification/notification.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js +4 -4
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/time/time.js +5 -5
- package/es/components/time/time.js.map +1 -1
- package/es/components/tooltip/tooltip.js +10 -10
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/new-components/avatar/avatar.js +2 -2
- package/es/new-components/avatar/avatar.js.map +1 -1
- package/es/new-components/badge/badge.js +22 -0
- package/es/new-components/badge/badge.js.map +1 -0
- package/es/new-components/badge/badge.module.css.js +4 -0
- package/es/new-components/badge/badge.module.css.js.map +1 -0
- package/es/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/es/new-components/loading/loading.js +3 -3
- package/es/new-components/loading/loading.js.map +1 -1
- package/lib/components/color-picker/color-picker.d.ts +1 -1
- package/lib/components/color-picker/color-picker.js +1 -1
- package/lib/components/color-picker/color-picker.js.map +1 -1
- package/lib/components/deprecated-button/deprecated-button.d.ts +1 -1
- package/lib/components/deprecated-button/deprecated-button.js +1 -1
- package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
- package/lib/components/deprecated-dropdown/dropdown.d.ts +1 -1
- package/lib/components/deprecated-dropdown/dropdown.js +1 -1
- package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/lib/components/deprecated-input/input.d.ts +1 -1
- package/lib/components/deprecated-input/input.js +1 -1
- package/lib/components/deprecated-input/input.js.map +1 -1
- package/lib/components/deprecated-select/select.js +1 -1
- package/lib/components/deprecated-select/select.js.map +1 -1
- package/lib/components/icons/CloseIcon.svg.js +1 -1
- package/lib/components/icons/CloseIcon.svg.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +1 -1
- package/lib/components/key-capturer/key-capturer.js +1 -1
- package/lib/components/key-capturer/key-capturer.js.map +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/menu/menu.js.map +1 -1
- package/lib/components/notification/notification.d.ts +1 -1
- package/lib/components/notification/notification.js +1 -1
- package/lib/components/notification/notification.js.map +1 -1
- package/lib/components/progress-bar/progress-bar.js +1 -1
- package/lib/components/progress-bar/progress-bar.js.map +1 -1
- package/lib/components/time/time.d.ts +1 -1
- package/lib/components/time/time.js +1 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/components/tooltip/tooltip.d.ts +1 -1
- package/lib/components/tooltip/tooltip.js +1 -1
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/new-components/avatar/avatar.js +1 -1
- package/lib/new-components/avatar/avatar.js.map +1 -1
- package/lib/new-components/badge/badge.d.ts +7 -0
- package/lib/new-components/badge/badge.js +2 -0
- package/lib/new-components/badge/badge.js.map +1 -0
- package/lib/new-components/badge/badge.module.css.js +2 -0
- package/lib/new-components/badge/badge.module.css.js.map +1 -0
- package/lib/new-components/badge/index.d.ts +1 -0
- package/lib/new-components/box/box.js +1 -1
- package/lib/new-components/box/box.js.map +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.d.ts +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/new-components/deprecated-modal/modal.js +1 -1
- package/lib/new-components/deprecated-modal/modal.js.map +1 -1
- package/lib/new-components/loading/loading.js +1 -1
- package/lib/new-components/loading/loading.js.map +1 -1
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/modal/modal.js.map +1 -1
- package/lib/new-components/stack/stack.js +1 -1
- package/lib/new-components/stack/stack.js.map +1 -1
- package/lib/new-components/tabs/tabs.js +1 -1
- package/lib/new-components/tabs/tabs.js.map +1 -1
- package/package.json +1 -1
- package/styles/badge.css +5 -0
- package/styles/badge.module.css.css +1 -0
- package/styles/modal.css +1 -1
- package/styles/modal.module.css.css +1 -1
- package/styles/reactist.css +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sources":["../../../src/components/time/time.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Tooltip } from '../tooltip'\nimport { TimeUtils, TimeConfig } from './time-utils'\n\nimport './time.less'\n\nconst DELAY = 60000\n\ntype Props = {\n /** UNIX timestamp of the time to display. */\n time?: number\n /** Configuration for localization. */\n config?: TimeConfig\n /** Additional css class applied to the time element. */\n className?: string\n tooltipOnHover?: boolean\n /** Refresh the component every DELAY seconds. */\n refresh?: boolean\n /** If you don't want to use the default time format on the tooltip use this prop to supply a custom text */\n tooltip?: React.ReactNode\n /** When hovering over time it expands to short absolute version. */\n expandOnHover?: boolean\n /** When hovering over time it expands to the full absolute version. */\n expandFullyOnHover?: boolean\n}\n\ntype State = {\n hovered: boolean\n mouseX?: number\n mouseY?: number\n}\n\nclass Time extends React.Component<Props, State> {\n public static displayName: string\n public static defaultProps: Props\n\n constructor(props: Props) {\n super(props)\n this.refreshInterval = undefined\n\n this.state = {\n hovered: false,\n mouseX: undefined,\n mouseY: undefined,\n }\n }\n\n componentDidMount() {\n if (this.props.refresh) {\n this._refresh()\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!prevProps.refresh && this.props.refresh) {\n this._refresh()\n }\n\n if (prevProps.refresh && !this.props.refresh) {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n }\n\n componentWillUnmount() {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n\n refreshInterval?: ReturnType<typeof setTimeout>\n\n _setHovered(hovered: boolean, event: React.MouseEvent) {\n const { mouseX, mouseY } = this.state\n const { clientX, clientY } = event\n if (clientX !== mouseX || clientY !== mouseY) {\n // mouse has moved\n this.setState(() => ({\n hovered,\n mouseX: clientX,\n mouseY: clientY,\n }))\n }\n }\n\n _renderTime(config: Props['config']) {\n if (!this.props.time) {\n return\n }\n if (this.state.hovered) {\n if (this.props.expandFullyOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTimeLong(this.props.time, config)\n }\n if (this.props.expandOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTime(this.props.time, config)\n }\n }\n return TimeUtils.timeAgo(this.props.time, config)\n }\n\n _refresh() {\n this.refreshInterval = setInterval(() => {\n this.forceUpdate()\n }, DELAY)\n }\n\n render() {\n let className = 'reactist_time'\n if (this.props.className) {\n className = this.props.className\n }\n\n const timeComponent = this._renderTime(this.props.config)\n\n return (\n <time\n className={className}\n onMouseEnter={(event) => this._setHovered(true, event)}\n onMouseLeave={(event) => this._setHovered(false, event)}\n >\n {this.props.tooltipOnHover ? (\n <Tooltip\n content={\n this.props.tooltip ||\n (this.props.time &&\n TimeUtils.formatTimeLong(this.props.time, this.props.config))\n }\n >\n <span>{timeComponent}</span>\n </Tooltip>\n ) : (\n timeComponent\n )}\n </time>\n )\n }\n}\nTime.displayName = 'Time'\n\nTime.defaultProps = {\n expandOnHover: false,\n expandFullyOnHover: false,\n tooltipOnHover: false,\n refresh: true,\n config: {\n locale: 'en',\n daysSuffix: 'd',\n hoursSuffix: 'h',\n minutesSuffix: 'm',\n momentsAgo: 'moments ago',\n },\n}\n\nexport { Time }\n"],"names":["DELAY","Time","React","
|
|
1
|
+
{"version":3,"file":"time.js","sources":["../../../src/components/time/time.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Tooltip } from '../tooltip'\nimport { TimeUtils, TimeConfig } from './time-utils'\n\nimport './time.less'\n\nconst DELAY = 60000\n\ntype Props = {\n /** UNIX timestamp of the time to display. */\n time?: number\n /** Configuration for localization. */\n config?: TimeConfig\n /** Additional css class applied to the time element. */\n className?: string\n tooltipOnHover?: boolean\n /** Refresh the component every DELAY seconds. */\n refresh?: boolean\n /** If you don't want to use the default time format on the tooltip use this prop to supply a custom text */\n tooltip?: React.ReactNode\n /** When hovering over time it expands to short absolute version. */\n expandOnHover?: boolean\n /** When hovering over time it expands to the full absolute version. */\n expandFullyOnHover?: boolean\n}\n\ntype State = {\n hovered: boolean\n mouseX?: number\n mouseY?: number\n}\n\nclass Time extends React.Component<Props, State> {\n public static displayName: string\n public static defaultProps: Props\n\n constructor(props: Props) {\n super(props)\n this.refreshInterval = undefined\n\n this.state = {\n hovered: false,\n mouseX: undefined,\n mouseY: undefined,\n }\n }\n\n componentDidMount() {\n if (this.props.refresh) {\n this._refresh()\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!prevProps.refresh && this.props.refresh) {\n this._refresh()\n }\n\n if (prevProps.refresh && !this.props.refresh) {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n }\n\n componentWillUnmount() {\n if (this.refreshInterval) {\n clearTimeout(this.refreshInterval)\n }\n }\n\n refreshInterval?: ReturnType<typeof setTimeout>\n\n _setHovered(hovered: boolean, event: React.MouseEvent) {\n const { mouseX, mouseY } = this.state\n const { clientX, clientY } = event\n if (clientX !== mouseX || clientY !== mouseY) {\n // mouse has moved\n this.setState(() => ({\n hovered,\n mouseX: clientX,\n mouseY: clientY,\n }))\n }\n }\n\n _renderTime(config: Props['config']) {\n if (!this.props.time) {\n return\n }\n if (this.state.hovered) {\n if (this.props.expandFullyOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTimeLong(this.props.time, config)\n }\n if (this.props.expandOnHover && !this.props.tooltipOnHover) {\n return TimeUtils.formatTime(this.props.time, config)\n }\n }\n return TimeUtils.timeAgo(this.props.time, config)\n }\n\n _refresh() {\n this.refreshInterval = setInterval(() => {\n this.forceUpdate()\n }, DELAY)\n }\n\n render() {\n let className = 'reactist_time'\n if (this.props.className) {\n className = this.props.className\n }\n\n const timeComponent = this._renderTime(this.props.config)\n\n return (\n <time\n className={className}\n onMouseEnter={(event) => this._setHovered(true, event)}\n onMouseLeave={(event) => this._setHovered(false, event)}\n >\n {this.props.tooltipOnHover ? (\n <Tooltip\n content={\n this.props.tooltip ||\n (this.props.time &&\n TimeUtils.formatTimeLong(this.props.time, this.props.config))\n }\n >\n <span>{timeComponent}</span>\n </Tooltip>\n ) : (\n timeComponent\n )}\n </time>\n )\n }\n}\nTime.displayName = 'Time'\n\nTime.defaultProps = {\n expandOnHover: false,\n expandFullyOnHover: false,\n tooltipOnHover: false,\n refresh: true,\n config: {\n locale: 'en',\n daysSuffix: 'd',\n hoursSuffix: 'h',\n minutesSuffix: 'm',\n momentsAgo: 'moments ago',\n },\n}\n\nexport { Time }\n"],"names":["DELAY","Time","React","constructor","props","refreshInterval","undefined","state","hovered","mouseX","mouseY","componentDidMount","refresh","_refresh","componentDidUpdate","prevProps","clearTimeout","componentWillUnmount","_setHovered","event","clientX","clientY","setState","_renderTime","config","time","expandFullyOnHover","tooltipOnHover","TimeUtils","formatTimeLong","expandOnHover","formatTime","timeAgo","setInterval","forceUpdate","render","className","timeComponent","onMouseEnter","onMouseLeave","Tooltip","content","tooltip","displayName","defaultProps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,MAArD;KAJZ,eAOItB,aAAA,OAAA,MAAA,EAAOmC,aAAP,CAPJ,CADH,GAWGA,aAhBR,CADJ;;;;;AAnFFpC,KACY0C;AADZ1C,KAEY2C;AAwGlB3C,IAAI,CAAC0C,WAAL,GAAmB,MAAnB;AAEA1C,IAAI,CAAC2C,YAAL,GAAoB;EAChBd,aAAa,EAAE,KADC;EAEhBJ,kBAAkB,EAAE,KAFJ;EAGhBC,cAAc,EAAE,KAHA;EAIhBf,OAAO,EAAE,IAJO;EAKhBY,MAAM,EAAE;IACJqB,MAAM,EAAE,IADJ;IAEJC,UAAU,EAAE,GAFR;IAGJC,WAAW,EAAE,GAHT;IAIJC,aAAa,EAAE,GAJX;IAKJC,UAAU,EAAE;;AAVA,CAApB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { useMemo, Children, createElement, Fragment, cloneElement, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { TooltipAnchor, Tooltip as Tooltip$1, useTooltipState } from 'ariakit/tooltip';
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ const HIDE_DELAY = 100;
|
|
|
11
11
|
function useDelayedTooltipState(initialState) {
|
|
12
12
|
const tooltipState = useTooltipState(initialState);
|
|
13
13
|
const delay = useDelay();
|
|
14
|
-
return
|
|
14
|
+
return useMemo(() => _objectSpread2(_objectSpread2({}, tooltipState), {}, {
|
|
15
15
|
show: delay(() => tooltipState.show(), SHOW_DELAY),
|
|
16
16
|
hide: delay(() => tooltipState.hide(), HIDE_DELAY)
|
|
17
17
|
}), [delay, tooltipState]);
|
|
@@ -31,7 +31,7 @@ function Tooltip(_ref) {
|
|
|
31
31
|
placement: position,
|
|
32
32
|
gutter: gapSize
|
|
33
33
|
});
|
|
34
|
-
const child =
|
|
34
|
+
const child = Children.only(children);
|
|
35
35
|
|
|
36
36
|
if (!content || !child) {
|
|
37
37
|
return child;
|
|
@@ -71,7 +71,7 @@ function Tooltip(_ref) {
|
|
|
71
71
|
child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.onFocus == null ? void 0 : _child$props.onFocus(event);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
return /*#__PURE__*/
|
|
74
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(TooltipAnchor, {
|
|
75
75
|
state: state,
|
|
76
76
|
ref: child.ref,
|
|
77
77
|
onFocus: handleFocus
|
|
@@ -79,8 +79,8 @@ function Tooltip(_ref) {
|
|
|
79
79
|
// Let child props override anchor props so user can specify attributes like tabIndex
|
|
80
80
|
// Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems
|
|
81
81
|
// by applying the replacement component/element twice
|
|
82
|
-
return /*#__PURE__*/
|
|
83
|
-
}), state.visible ? /*#__PURE__*/
|
|
82
|
+
return /*#__PURE__*/cloneElement(child, _objectSpread2(_objectSpread2({}, anchorProps), child.props));
|
|
83
|
+
}), state.visible ? /*#__PURE__*/createElement(Tooltip$1, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
84
84
|
state: state,
|
|
85
85
|
className: classNames('reactist_tooltip', className)
|
|
86
86
|
}), typeof content === 'function' ? content() : content) : null);
|
|
@@ -100,15 +100,15 @@ function Tooltip(_ref) {
|
|
|
100
100
|
*/
|
|
101
101
|
|
|
102
102
|
function useDelay() {
|
|
103
|
-
const timeoutRef =
|
|
104
|
-
const clearTimeouts =
|
|
103
|
+
const timeoutRef = useRef();
|
|
104
|
+
const clearTimeouts = useCallback(function clearTimeouts() {
|
|
105
105
|
if (timeoutRef.current != null) {
|
|
106
106
|
clearTimeout(timeoutRef.current);
|
|
107
107
|
}
|
|
108
108
|
}, []); // Runs clearTimeouts when the component is unmounted
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
return
|
|
110
|
+
useEffect(() => clearTimeouts, [clearTimeouts]);
|
|
111
|
+
return useCallback(function delay(fn, delay) {
|
|
112
112
|
return () => {
|
|
113
113
|
clearTimeouts();
|
|
114
114
|
timeoutRef.current = setTimeout(fn, delay);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport {\n useTooltipState as useAriakitTooltipState,\n TooltipStateProps as AriakitTooltipStateProps,\n Tooltip as AriakitTooltip,\n TooltipProps as AriakitTooltipProps,\n TooltipAnchor,\n TooltipAnchorProps,\n} from 'ariakit/tooltip'\nimport type { PopoverState } from 'ariakit/popover'\n\nimport './tooltip.less'\n\ntype TooltipProps = Omit<AriakitTooltipProps, 'children' | 'state'> & {\n children: React.ReactNode\n content: React.ReactNode | (() => React.ReactNode)\n position?: PopoverState['placement']\n gapSize?: number\n}\n\n// These are exported to be used in the tests, they are not meant to be exported publicly\nexport const SHOW_DELAY = 500\nexport const HIDE_DELAY = 100\n\nfunction useDelayedTooltipState(initialState: AriakitTooltipStateProps) {\n const tooltipState = useAriakitTooltipState(initialState)\n const delay = useDelay()\n return React.useMemo(\n () => ({\n ...tooltipState,\n show: delay(() => tooltipState.show(), SHOW_DELAY),\n hide: delay(() => tooltipState.hide(), HIDE_DELAY),\n }),\n [delay, tooltipState],\n )\n}\n\nfunction Tooltip({\n children,\n content,\n position = 'top',\n gapSize = 3,\n className,\n ...props\n}: TooltipProps) {\n const state = useDelayedTooltipState({ placement: position, gutter: gapSize })\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!content || !child) {\n return child\n }\n\n if (typeof child.ref === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n /**\n * Prevents the tooltip from automatically firing on focus all the time. This is to prevent\n * tooltips from showing when the trigger element is focused back after a popover or dialog that\n * it opened was closed. See link below for more details.\n * @see https://github.com/reakit/reakit/discussions/749\n */\n function handleFocus(event: React.FocusEvent<HTMLDivElement>) {\n // If focus is not followed by a key up event, does it mean that it's not\n // an intentional keyboard focus? Not sure but it seems to work.\n // This may be resolved soon in an upcoming version of reakit:\n // https://github.com/reakit/reakit/issues/750\n function handleKeyUp(e: Event) {\n const eventKey = (e as KeyboardEvent).key\n if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {\n state.show()\n }\n }\n event.currentTarget.addEventListener('keyup', handleKeyUp, { once: true })\n // Prevent tooltip.show from being called by TooltipReference\n event.preventDefault()\n child?.props?.onFocus?.(event)\n }\n\n return (\n <>\n <TooltipAnchor state={state} ref={child.ref} onFocus={handleFocus}>\n {(anchorProps: TooltipAnchorProps) => {\n // Let child props override anchor props so user can specify attributes like tabIndex\n // Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems\n // by applying the replacement component/element twice\n return React.cloneElement(child, { ...anchorProps, ...child.props })\n }}\n </TooltipAnchor>\n {state.visible ? (\n <AriakitTooltip\n {...props}\n state={state}\n className={classNames('reactist_tooltip', className)}\n >\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n}\n\nexport type { TooltipProps }\nexport { Tooltip }\n\n//\n// Internal helpers\n//\n\n/**\n * Returns a function offering the same interface as setTimeout, but cleans up on unmount.\n *\n * The timeout state is shared, and only one delayed function can be active at any given time. If\n * a new delayed function is called while another one was waiting for its time to run, that older\n * invocation is cleared and it never runs.\n *\n * This is suitable for our use case here, but probably not the most intuitive thing in general.\n * That's why this is not made a shared util or something like it.\n */\nfunction useDelay() {\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>()\n\n const clearTimeouts = React.useCallback(function clearTimeouts() {\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current)\n }\n }, [])\n\n // Runs clearTimeouts when the component is unmounted\n React.useEffect(() => clearTimeouts, [clearTimeouts])\n\n return React.useCallback(\n function delay(fn: () => void, delay: number) {\n return () => {\n clearTimeouts()\n timeoutRef.current = setTimeout(fn, delay)\n }\n },\n [clearTimeouts],\n )\n}\n"],"names":["SHOW_DELAY","HIDE_DELAY","useDelayedTooltipState","initialState","tooltipState","useAriakitTooltipState","delay","useDelay","React","
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport {\n useTooltipState as useAriakitTooltipState,\n TooltipStateProps as AriakitTooltipStateProps,\n Tooltip as AriakitTooltip,\n TooltipProps as AriakitTooltipProps,\n TooltipAnchor,\n TooltipAnchorProps,\n} from 'ariakit/tooltip'\nimport type { PopoverState } from 'ariakit/popover'\n\nimport './tooltip.less'\n\ntype TooltipProps = Omit<AriakitTooltipProps, 'children' | 'state'> & {\n children: React.ReactNode\n content: React.ReactNode | (() => React.ReactNode)\n position?: PopoverState['placement']\n gapSize?: number\n}\n\n// These are exported to be used in the tests, they are not meant to be exported publicly\nexport const SHOW_DELAY = 500\nexport const HIDE_DELAY = 100\n\nfunction useDelayedTooltipState(initialState: AriakitTooltipStateProps) {\n const tooltipState = useAriakitTooltipState(initialState)\n const delay = useDelay()\n return React.useMemo(\n () => ({\n ...tooltipState,\n show: delay(() => tooltipState.show(), SHOW_DELAY),\n hide: delay(() => tooltipState.hide(), HIDE_DELAY),\n }),\n [delay, tooltipState],\n )\n}\n\nfunction Tooltip({\n children,\n content,\n position = 'top',\n gapSize = 3,\n className,\n ...props\n}: TooltipProps) {\n const state = useDelayedTooltipState({ placement: position, gutter: gapSize })\n\n const child = React.Children.only(\n children as React.FunctionComponentElement<JSX.IntrinsicElements['div']> | null,\n )\n\n if (!content || !child) {\n return child\n }\n\n if (typeof child.ref === 'string') {\n throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded')\n }\n\n /**\n * Prevents the tooltip from automatically firing on focus all the time. This is to prevent\n * tooltips from showing when the trigger element is focused back after a popover or dialog that\n * it opened was closed. See link below for more details.\n * @see https://github.com/reakit/reakit/discussions/749\n */\n function handleFocus(event: React.FocusEvent<HTMLDivElement>) {\n // If focus is not followed by a key up event, does it mean that it's not\n // an intentional keyboard focus? Not sure but it seems to work.\n // This may be resolved soon in an upcoming version of reakit:\n // https://github.com/reakit/reakit/issues/750\n function handleKeyUp(e: Event) {\n const eventKey = (e as KeyboardEvent).key\n if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {\n state.show()\n }\n }\n event.currentTarget.addEventListener('keyup', handleKeyUp, { once: true })\n // Prevent tooltip.show from being called by TooltipReference\n event.preventDefault()\n child?.props?.onFocus?.(event)\n }\n\n return (\n <>\n <TooltipAnchor state={state} ref={child.ref} onFocus={handleFocus}>\n {(anchorProps: TooltipAnchorProps) => {\n // Let child props override anchor props so user can specify attributes like tabIndex\n // Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems\n // by applying the replacement component/element twice\n return React.cloneElement(child, { ...anchorProps, ...child.props })\n }}\n </TooltipAnchor>\n {state.visible ? (\n <AriakitTooltip\n {...props}\n state={state}\n className={classNames('reactist_tooltip', className)}\n >\n {typeof content === 'function' ? content() : content}\n </AriakitTooltip>\n ) : null}\n </>\n )\n}\n\nexport type { TooltipProps }\nexport { Tooltip }\n\n//\n// Internal helpers\n//\n\n/**\n * Returns a function offering the same interface as setTimeout, but cleans up on unmount.\n *\n * The timeout state is shared, and only one delayed function can be active at any given time. If\n * a new delayed function is called while another one was waiting for its time to run, that older\n * invocation is cleared and it never runs.\n *\n * This is suitable for our use case here, but probably not the most intuitive thing in general.\n * That's why this is not made a shared util or something like it.\n */\nfunction useDelay() {\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout>>()\n\n const clearTimeouts = React.useCallback(function clearTimeouts() {\n if (timeoutRef.current != null) {\n clearTimeout(timeoutRef.current)\n }\n }, [])\n\n // Runs clearTimeouts when the component is unmounted\n React.useEffect(() => clearTimeouts, [clearTimeouts])\n\n return React.useCallback(\n function delay(fn: () => void, delay: number) {\n return () => {\n clearTimeouts()\n timeoutRef.current = setTimeout(fn, delay)\n }\n },\n [clearTimeouts],\n )\n}\n"],"names":["SHOW_DELAY","HIDE_DELAY","useDelayedTooltipState","initialState","tooltipState","useAriakitTooltipState","delay","useDelay","React","show","hide","Tooltip","children","content","position","gapSize","className","props","state","placement","gutter","child","only","ref","Error","handleFocus","event","handleKeyUp","e","eventKey","key","currentTarget","addEventListener","once","preventDefault","onFocus","TooltipAnchor","anchorProps","visible","AriakitTooltip","classNames","timeoutRef","clearTimeouts","current","clearTimeout","fn","setTimeout"],"mappings":";;;;;;;MAuBaA,UAAU,GAAG;MACbC,UAAU,GAAG;;AAE1B,SAASC,sBAAT,CAAgCC,YAAhC;EACI,MAAMC,YAAY,GAAGC,eAAsB,CAACF,YAAD,CAA3C;EACA,MAAMG,KAAK,GAAGC,QAAQ,EAAtB;EACA,OAAOC,OAAA,CACH,wCACOJ,YADP;IAEIK,IAAI,EAAEH,KAAK,CAAC,MAAMF,YAAY,CAACK,IAAb,EAAP,EAA4BT,UAA5B,CAFf;IAGIU,IAAI,EAAEJ,KAAK,CAAC,MAAMF,YAAY,CAACM,IAAb,EAAP,EAA4BT,UAA5B;IAJZ,EAMH,CAACK,KAAD,EAAQF,YAAR,CANG,CAAP;AAQH;;AAED,SAASO,OAAT;MAAiB;IACbC,QADa;IAEbC,OAFa;IAGbC,QAAQ,GAAG,KAHE;IAIbC,OAAO,GAAG,CAJG;IAKbC;;MACGC;;EAEH,MAAMC,KAAK,GAAGhB,sBAAsB,CAAC;IAAEiB,SAAS,EAAEL,QAAb;IAAuBM,MAAM,EAAEL;GAAhC,CAApC;EAEA,MAAMM,KAAK,GAAGb,QAAA,CAAec,IAAf,CACVV,QADU,CAAd;;EAIA,IAAI,CAACC,OAAD,IAAY,CAACQ,KAAjB,EAAwB;IACpB,OAAOA,KAAP;;;EAGJ,IAAI,OAAOA,KAAK,CAACE,GAAb,KAAqB,QAAzB,EAAmC;IAC/B,MAAM,IAAIC,KAA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AU,CAACE,OAAZ,CAAZ;;GAFc,EAInB,EAJmB,CAAtB;;EAOAnC,SAAA,CAAgB,MAAMkC,aAAtB,EAAqC,CAACA,aAAD,CAArC;EAEA,OAAOlC,WAAA,CACH,SAASF,KAAT,CAAeuC,EAAf,EAA+BvC,KAA/B;IACI,OAAO;MACHoC,aAAa;MACbD,UAAU,CAACE,OAAX,GAAqBG,UAAU,CAACD,EAAD,EAAKvC,KAAL,CAA/B;KAFJ;GAFD,EAOH,CAACoC,aAAD,CAPG,CAAP;AASH;;;;"}
|
package/es/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { SwitchField } from './new-components/switch-field/switch-field.js';
|
|
|
21
21
|
export { TextArea } from './new-components/text-area/text-area.js';
|
|
22
22
|
export { TextField } from './new-components/text-field/text-field.js';
|
|
23
23
|
export { Avatar } from './new-components/avatar/avatar.js';
|
|
24
|
+
export { Badge } from './new-components/badge/badge.js';
|
|
24
25
|
export { Modal, ModalActions, ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from './new-components/modal/modal.js';
|
|
25
26
|
export { usePrevious } from './hooks/use-previous/use-previous.js';
|
|
26
27
|
export { Tab, TabAwareSlot, TabList, TabPanel, Tabs } from './new-components/tabs/tabs.js';
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { createElement } from 'react';
|
|
3
3
|
import { getClassNames } from '../responsive-props.js';
|
|
4
4
|
import { Box } from '../box/box.js';
|
|
5
5
|
import { getInitials, emailToIndex } from './utils.js';
|
|
@@ -29,7 +29,7 @@ function Avatar(_ref) {
|
|
|
29
29
|
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
30
30
|
};
|
|
31
31
|
const sizeClassName = getClassNames(styles, 'size', avatarSize);
|
|
32
|
-
return /*#__PURE__*/
|
|
32
|
+
return /*#__PURE__*/createElement(Box, _objectSpread2({
|
|
33
33
|
className: [className, styles.avatar, sizeClassName, exceptionallySetClassName],
|
|
34
34
|
style: style
|
|
35
35
|
}, props), userInitials);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sources":["../../../src/new-components/avatar/avatar.tsx"],"sourcesContent":["import React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n exceptionallySetClassName?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","Box","avatar","displayName"],"mappings":";;;;;;;;AAQA,MAAMA,aAAa,GAAG,CAClB,SADkB,EAElB,SAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,SALkB,EAMlB,SANkB,EAOlB,SAPkB,EAQlB,SARkB,EASlB,SATkB,EAUlB,SAVkB,EAWlB,SAXkB,EAYlB,SAZkB,EAalB,SAbkB,EAclB,SAdkB,EAelB,SAfkB,EAgBlB,SAhBkB,EAiBlB,SAjBkB,EAkBlB,SAlBkB,CAAtB;;AAkCA,SAASC,MAAT;MAAgB;IACZC,IADY;IAEZC,SAFY;IAGZC,IAAI,GAAG,GAHK;IAIZC,SAJY;IAKZC,SAAS,GAAGN,aALA;IAMZO;;MACGC;;EAEH,MAAMC,YAAY,GAAGC,WAAW,CAACR,IAAI,CAACS,IAAN,CAAX,IAA0BD,WAAW,CAACR,IAAI,CAACU,KAAN,CAA1D;EACA,MAAMC,UAAU,GAAGT,IAAI,GAAGA,IAAH,GAAU,GAAjC;EAEA,MAAMU,KAAK,GAAGX,SAAS,GACjB;IACIY,eAAe,WAASZ,SAAT,MADnB;IAEIa,UAAU,EAAE,SAFhB;;GADiB,GAKjB;IACIC,eAAe,EAAEX,SAAS,CAACY,YAAY,CAAChB,IAAI,CAACU,KAAN,EAAaN,SAAS,CAACa,MAAvB,CAAb;GANpC;EASA,MAAMC,aAAa,GAAGC,aAAa,CAACC,MAAD,EAAS,MAAT,EAAiBT,UAAjB,CAAnC;EAEA,oBACIU,
|
|
1
|
+
{"version":3,"file":"avatar.js","sources":["../../../src/new-components/avatar/avatar.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n exceptionallySetClassName?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","Box","avatar","displayName"],"mappings":";;;;;;;;AAQA,MAAMA,aAAa,GAAG,CAClB,SADkB,EAElB,SAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,SALkB,EAMlB,SANkB,EAOlB,SAPkB,EAQlB,SARkB,EASlB,SATkB,EAUlB,SAVkB,EAWlB,SAXkB,EAYlB,SAZkB,EAalB,SAbkB,EAclB,SAdkB,EAelB,SAfkB,EAgBlB,SAhBkB,EAiBlB,SAjBkB,EAkBlB,SAlBkB,CAAtB;;AAkCA,SAASC,MAAT;MAAgB;IACZC,IADY;IAEZC,SAFY;IAGZC,IAAI,GAAG,GAHK;IAIZC,SAJY;IAKZC,SAAS,GAAGN,aALA;IAMZO;;MACGC;;EAEH,MAAMC,YAAY,GAAGC,WAAW,CAACR,IAAI,CAACS,IAAN,CAAX,IAA0BD,WAAW,CAACR,IAAI,CAACU,KAAN,CAA1D;EACA,MAAMC,UAAU,GAAGT,IAAI,GAAGA,IAAH,GAAU,GAAjC;EAEA,MAAMU,KAAK,GAAGX,SAAS,GACjB;IACIY,eAAe,WAASZ,SAAT,MADnB;IAEIa,UAAU,EAAE,SAFhB;;GADiB,GAKjB;IACIC,eAAe,EAAEX,SAAS,CAACY,YAAY,CAAChB,IAAI,CAACU,KAAN,EAAaN,SAAS,CAACa,MAAvB,CAAb;GANpC;EASA,MAAMC,aAAa,GAAGC,aAAa,CAACC,MAAD,EAAS,MAAT,EAAiBT,UAAjB,CAAnC;EAEA,oBACIU,aAAA,CAACC,GAAD;IACInB,SAAS,EAAE,CAACA,SAAD,EAAYiB,MAAM,CAACG,MAAnB,EAA2BL,aAA3B,EAA0Cb,yBAA1C,CADf;IAEIO,KAAK,EAAEA;KACHN,KAHR,GAKKC,YALL,CADJ;AASH;;AACDR,MAAM,CAACyB,WAAP,GAAqB,QAArB;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { Box } from '../box/box.js';
|
|
4
|
+
import styles from './badge.module.css.js';
|
|
5
|
+
|
|
6
|
+
const _excluded = ["variant", "children"];
|
|
7
|
+
|
|
8
|
+
function Badge(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
variant = 'neutral',
|
|
11
|
+
children
|
|
12
|
+
} = _ref,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
|
|
15
|
+
const variantClassName = styles["badge-" + variant];
|
|
16
|
+
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
17
|
+
className: [styles.badge, variantClassName]
|
|
18
|
+
}), children);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Badge };
|
|
22
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../../src/new-components/badge/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Box } from '../box'\n\nimport type { PropsWithChildren } from 'react'\n\nimport styles from './badge.module.css'\n\ntype Props = {\n variant: 'neutral' | 'positive' | 'color'\n 'aria-label'?: string\n}\n\nfunction Badge({ variant = 'neutral', children, ...rest }: PropsWithChildren<Props>) {\n const variantClassName = styles[`badge-${variant}`]\n\n return (\n <Box {...rest} className={[styles.badge, variantClassName]}>\n {children}\n </Box>\n )\n}\n\nexport { Badge }\n"],"names":["Badge","variant","children","rest","variantClassName","styles","React","Box","className","badge"],"mappings":";;;;;;;AAaA,SAASA,KAAT;MAAe;IAAEC,OAAO,GAAG,SAAZ;IAAuBC;;MAAaC;;EAC/C,MAAMC,gBAAgB,GAAGC,MAAM,YAAUJ,OAAV,CAA/B;EAEA,oBACIK,aAAA,CAACC,GAAD,oCAASJ,IAAT;IAAeK,SAAS,EAAE,CAACH,MAAM,CAACI,KAAR,EAAeL,gBAAf;MACrBF,QADL,CADJ;AAKH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-field.js","sources":["../../../src/new-components/checkbox-field/checkbox-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useForkRef } from 'ariakit-utils'\nimport { Box } from '../box'\nimport { Text } from '../text'\nimport { CheckboxIcon } from './checkbox-icon'\n\nimport styles from './checkbox-field.module.css'\n\ntype CheckboxFieldProps = Omit<\n JSX.IntrinsicElements['input'],\n | 'type'\n | 'className'\n | 'disabled'\n | 'aria-controls'\n | 'aria-describedby'\n | 'aria-label'\n | 'aria-labelledby'\n> & {\n 'aria-checked'?: never\n /** Identifies the set of checkboxes controlled by the mixed checkbox for assistive technologies. */\n 'aria-controls'?: string\n /** Identifies the element (or elements) that describes the checkbox for assistive technologies. */\n 'aria-describedby'?: string\n /** Defines a string value that labels the current checkbox for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current checkbox for assistive technologies. */\n 'aria-labelledby'?: string\n /** Defines whether or not the checkbox is disabled. */\n disabled?: boolean\n /** The label for the checkbox element. */\n label?:
|
|
1
|
+
{"version":3,"file":"checkbox-field.js","sources":["../../../src/new-components/checkbox-field/checkbox-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useForkRef } from 'ariakit-utils'\nimport { Box } from '../box'\nimport { Text } from '../text'\nimport { CheckboxIcon } from './checkbox-icon'\n\nimport styles from './checkbox-field.module.css'\n\ntype CheckboxFieldProps = Omit<\n JSX.IntrinsicElements['input'],\n | 'type'\n | 'className'\n | 'disabled'\n | 'aria-controls'\n | 'aria-describedby'\n | 'aria-label'\n | 'aria-labelledby'\n> & {\n 'aria-checked'?: never\n /** Identifies the set of checkboxes controlled by the mixed checkbox for assistive technologies. */\n 'aria-controls'?: string\n /** Identifies the element (or elements) that describes the checkbox for assistive technologies. */\n 'aria-describedby'?: string\n /** Defines a string value that labels the current checkbox for assistive technologies. */\n 'aria-label'?: string\n /** Identifies the element (or elements) that labels the current checkbox for assistive technologies. */\n 'aria-labelledby'?: string\n /** Defines whether or not the checkbox is disabled. */\n disabled?: boolean\n /** The label for the checkbox element. */\n label?: React.ReactNode\n /** Defines whether or not the checkbox can be of a `mixed` state. */\n indeterminate?: boolean\n}\n\nconst CheckboxField = React.forwardRef<HTMLInputElement, CheckboxFieldProps>(function CheckboxField(\n { label, disabled, indeterminate, defaultChecked, onChange, ...props },\n ref,\n) {\n const isControlledComponent = typeof props.checked === 'boolean'\n if (typeof indeterminate === 'boolean' && !isControlledComponent) {\n // eslint-disable-next-line no-console\n console.warn('Cannot use indeterminate on an uncontrolled checkbox')\n indeterminate = undefined\n }\n\n if (!label && !props['aria-label'] && !props['aria-labelledby']) {\n // eslint-disable-next-line no-console\n console.warn('A Checkbox needs a label')\n }\n\n const [keyFocused, setKeyFocused] = React.useState(false)\n const [checkedState, setChecked] = React.useState(props.checked ?? defaultChecked ?? false)\n const isChecked = props.checked ?? checkedState\n\n const internalRef = React.useRef<HTMLInputElement>(null)\n const combinedRef = useForkRef(internalRef, ref)\n React.useEffect(\n function setIndeterminate() {\n if (internalRef.current && typeof indeterminate === 'boolean') {\n internalRef.current.indeterminate = indeterminate\n }\n },\n [indeterminate],\n )\n\n return (\n <Box\n as=\"label\"\n display=\"flex\"\n alignItems=\"center\"\n className={[\n styles.container,\n disabled ? styles.disabled : null,\n isChecked ? styles.checked : null,\n keyFocused ? styles.keyFocused : null,\n ]}\n >\n <input\n {...props}\n ref={combinedRef}\n type=\"checkbox\"\n aria-checked={indeterminate ? 'mixed' : isChecked}\n checked={isChecked}\n disabled={disabled}\n onChange={(event) => {\n onChange?.(event)\n if (!event.defaultPrevented) {\n setChecked(event.currentTarget.checked)\n }\n }}\n onBlur={(event) => {\n setKeyFocused(false)\n props?.onBlur?.(event)\n }}\n onKeyUp={(event) => {\n setKeyFocused(true)\n props?.onKeyUp?.(event)\n }}\n />\n <CheckboxIcon\n checked={isChecked}\n disabled={disabled}\n indeterminate={indeterminate}\n aria-hidden\n />\n {label ? <Text>{label}</Text> : null}\n </Box>\n )\n})\n\nexport { CheckboxField }\nexport type { CheckboxFieldProps }\n"],"names":["CheckboxField","React","ref","label","disabled","indeterminate","defaultChecked","onChange","props","isControlledComponent","checked","console","warn","undefined","keyFocused","setKeyFocused","checkedState","setChecked","isChecked","internalRef","combinedRef","useForkRef","setIndeterminate","current","Box","as","display","alignItems","className","styles","container","type","event","defaultPrevented","currentTarget","onBlur","onKeyUp","CheckboxIcon","Text"],"mappings":";;;;;;;;;MAmCMA,aAAa,gBAAGC,UAAA,CAAuD,SAASD,aAAT,OAEzEE,GAFyE;;;MACzE;IAAEC,KAAF;IAASC,QAAT;IAAmBC,aAAnB;IAAkCC,cAAlC;IAAkDC;;MAAaC;;EAG/D,MAAMC,qBAAqB,GAAG,OAAOD,KAAK,CAACE,OAAb,KAAyB,SAAvD;;EACA,IAAI,OAAOL,aAAP,KAAyB,SAAzB,IAAsC,CAACI,qBAA3C,EAAkE;;IAE9DE,OAAO,CAACC,IAAR,CAAa,sDAAb;IACAP,aAAa,GAAGQ,SAAhB;;;EAGJ,IAAI,CAACV,KAAD,IAAU,CAACK,KAAK,CAAC,YAAD,CAAhB,IAAkC,CAACA,KAAK,CAAC,iBAAD,CAA5C,EAAiE;;IAE7DG,OAAO,CAACC,IAAR,CAAa,0BAAb;;;EAGJ,MAAM,CAACE,UAAD,EAAaC,aAAb,IAA8Bd,QAAA,CAAe,KAAf,CAApC;EACA,MAAM,CAACe,YAAD,EAAeC,UAAf,IAA6BhB,QAAA,4BAAeO,KAAK,CAACE,OAArB,6BAAgCJ,cAAhC,oBAAkD,KAAlD,CAAnC;EACA,MAAMY,SAAS,sBAAGV,KAAK,CAACE,OAAT,8BAAoBM,YAAnC;EAEA,MAAMG,WAAW,GAAGlB,MAAA,CAA+B,IAA/B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OAAP,CAAiBJ,KAAjB;;KA9BZ,eAiCI/B,aAAA,CAACoC,YAAD;IACI3B,OAAO,EAAEQ;IACTd,QAAQ,EAAEA;IACVC,aAAa,EAAEA;;GAHnB,CAjCJ,EAuCKF,KAAK,gBAAGF,aAAA,CAACqC,IAAD,MAAA,EAAOnC,KAAP,CAAH,GAA0B,IAvCpC,CADJ;AA2CH,CA1EqB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { createElement } from 'react';
|
|
3
3
|
import { Box } from '../box/box.js';
|
|
4
4
|
import { Spinner } from '../spinner/spinner.js';
|
|
5
5
|
|
|
@@ -22,14 +22,14 @@ function Loading(_ref) {
|
|
|
22
22
|
|
|
23
23
|
const numericSize = (_sizeMapping$size = sizeMapping[size]) != null ? _sizeMapping$size : sizeMapping.small;
|
|
24
24
|
const ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
|
|
25
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
26
26
|
"aria-label": ariaLabel,
|
|
27
27
|
className: exceptionallySetClassName,
|
|
28
28
|
display: "flex",
|
|
29
29
|
alignItems: "center",
|
|
30
30
|
justifyContent: "center",
|
|
31
31
|
role: "progressbar"
|
|
32
|
-
}), /*#__PURE__*/
|
|
32
|
+
}), /*#__PURE__*/createElement(Spinner, {
|
|
33
33
|
size: numericSize,
|
|
34
34
|
"aria-hidden": true
|
|
35
35
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'xsmall' | 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-describedby' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Identifies the element (or elements) that describes the loading component for assistive technologies. */\n 'aria-describedby'?: string\n} & (\n | {\n /** Defines a string value that labels the current loading component for assistive technologies. */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /** Identifies the element (or elements) that labels the current loading component for assistive technologies. */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n xsmall: 16,\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n const ariaLabel = props['aria-label']\n ? props['aria-label']\n : !props['aria-labelledby']\n ? 'Loading…'\n : undefined\n\n return (\n <Box\n {...props}\n aria-label={ariaLabel}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} aria-hidden />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","xsmall","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","ariaLabel","undefined","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;;AAoCA,MAAMA,WAAW,GAAyB;EACtCC,MAAM,EAAE,EAD8B;EAEtCC,KAAK,EAAE,EAF+B;EAGtCC,MAAM,EAAE,EAH8B;EAItCC,KAAK,EAAE;AAJ+B,CAA1C;;AAOA,SAASC,OAAT;;;MAAiB;IAAEC,IAAI,GAAG,OAAT;IAAkBC;;MAA8BC;;EAC7D,MAAMC,WAAW,wBAAGT,WAAW,CAACM,IAAD,CAAd,gCAAwBN,WAAW,CAACE,KAArD;EACA,MAAMQ,SAAS,GAAGF,KAAK,CAAC,YAAD,CAAL,GACZA,KAAK,CAAC,YAAD,CADO,GAEZ,CAACA,KAAK,CAAC,iBAAD,CAAN,GACA,UADA,GAEAG,SAJN;EAMA,oBACIC,
|
|
1
|
+
{"version":3,"file":"loading.js","sources":["../../../src/new-components/loading/loading.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\n\ntype Size = 'xsmall' | 'small' | 'medium' | 'large'\n\ntype NativeProps = Omit<\n JSX.IntrinsicElements['div'],\n 'className' | 'aria-describedby' | 'aria-label' | 'aria-labelledby' | 'role' | 'size'\n>\n\ntype LoadingProps = NativeProps & {\n /**\n * The size of the loading spinner.\n * @default 'small'\n */\n size?: Size\n /**\n * A escape hatch in case you need to provide a custom class name to the container element.\n */\n exceptionallySetClassName?: string\n /** Identifies the element (or elements) that describes the loading component for assistive technologies. */\n 'aria-describedby'?: string\n} & (\n | {\n /** Defines a string value that labels the current loading component for assistive technologies. */\n 'aria-label': string\n 'aria-labelledby'?: never\n }\n | {\n /** Identifies the element (or elements) that labels the current loading component for assistive technologies. */\n 'aria-labelledby': string\n 'aria-label'?: never\n }\n )\n\nconst sizeMapping: Record<Size, number> = {\n xsmall: 16,\n small: 24,\n medium: 36,\n large: 48,\n}\n\nfunction Loading({ size = 'small', exceptionallySetClassName, ...props }: LoadingProps) {\n const numericSize = sizeMapping[size] ?? sizeMapping.small\n const ariaLabel = props['aria-label']\n ? props['aria-label']\n : !props['aria-labelledby']\n ? 'Loading…'\n : undefined\n\n return (\n <Box\n {...props}\n aria-label={ariaLabel}\n className={exceptionallySetClassName}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n role=\"progressbar\"\n >\n <Spinner size={numericSize} aria-hidden />\n </Box>\n )\n}\n\nexport { Loading }\nexport type { LoadingProps }\n"],"names":["sizeMapping","xsmall","small","medium","large","Loading","size","exceptionallySetClassName","props","numericSize","ariaLabel","undefined","React","Box","className","display","alignItems","justifyContent","role","Spinner"],"mappings":";;;;;;AAoCA,MAAMA,WAAW,GAAyB;EACtCC,MAAM,EAAE,EAD8B;EAEtCC,KAAK,EAAE,EAF+B;EAGtCC,MAAM,EAAE,EAH8B;EAItCC,KAAK,EAAE;AAJ+B,CAA1C;;AAOA,SAASC,OAAT;;;MAAiB;IAAEC,IAAI,GAAG,OAAT;IAAkBC;;MAA8BC;;EAC7D,MAAMC,WAAW,wBAAGT,WAAW,CAACM,IAAD,CAAd,gCAAwBN,WAAW,CAACE,KAArD;EACA,MAAMQ,SAAS,GAAGF,KAAK,CAAC,YAAD,CAAL,GACZA,KAAK,CAAC,YAAD,CADO,GAEZ,CAACA,KAAK,CAAC,iBAAD,CAAN,GACA,UADA,GAEAG,SAJN;EAMA,oBACIC,aAAA,CAACC,GAAD,oCACQL,KADR;kBAEgBE,SAFhB;IAGII,SAAS,EAAEP,yBAHf;IAIIQ,OAAO,EAAC,MAJZ;IAKIC,UAAU,EAAC,QALf;IAMIC,cAAc,EAAC,QANnB;IAOIC,IAAI,EAAC;mBAELN,aAAA,CAACO,OAAD;IAASb,IAAI,EAAEG;;GAAf,CATJ,CADJ;AAaH;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),o=(e=require("classnames"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("../tooltip/tooltip.js"),l=require("../deprecated-dropdown/index.js");const c=["#606060","#4A90E2","#03B3B2","#008299","#82BA00","#D24726","#AC193D","#DC4FAD","#3BD5FB","#74E8D3","#FFCC00","#FB886E","#CCCCCC"],n=e=>"string"!=typeof e;function a({color:e=0,small:r,onChange:a,colorList:s=c}){return t.createElement(l.default.Box,{right:!0,className:"reactist_color_picker"},t.createElement(l.default.Trigger,null,(()=>{const l=((e,t)=>e[t>=e.length?0:t])(s,e);return t.createElement("span",{className:o("color_trigger",{small:r}),style:{backgroundColor:n(l)?l.color:l}},t.createElement("span",{className:"color_trigger--inner_ring"}))})()),t.createElement(l.default.Body,null,t.createElement("div",{className:"color_options"},s.reduce((o,r,l)=>(o.push(t.createElement(i,{isActive:e>=s.length?0===l:l===e,key:l,color:n(r)?r.color:r,colorIndex:l,onClick:a,tooltip:n(r)?r.name:null})),o),[]))))}function i({color:e,colorIndex:o,isActive:l,onClick:c,tooltip:n}){const a=t.createElement("span",{"data-testid":"reactist-color-item",className:"reactist color_item"+(l?" active":""),style:{backgroundColor:e},onClick:()=>null==c?void 0:c(o)},t.createElement("span",{className:"color_item--inner_ring"}));return n?t.createElement(r.Tooltip,{content:n},a):a}a.displayName="ColorPicker",i.displayName="ColorItem",exports.COLORS=c,exports.ColorItem=i,exports.ColorPicker=a;
|
|
2
2
|
//# sourceMappingURL=color-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","sources":["../../../src/components/color-picker/color-picker.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\n\nimport DeprecatedDropdown from '../deprecated-dropdown'\nimport { Tooltip } from '../tooltip'\n\nimport './color-picker.less'\n\ntype NamedColor = { name: string; color: string }\n\nconst COLORS = [\n '#606060',\n '#4A90E2',\n '#03B3B2',\n '#008299',\n '#82BA00',\n '#D24726',\n '#AC193D',\n '#DC4FAD',\n '#3BD5FB',\n '#74E8D3',\n '#FFCC00',\n '#FB886E',\n '#CCCCCC',\n]\n\nconst _isNamedColor = (color: string | NamedColor | undefined): color is NamedColor =>\n typeof color !== 'string'\n\nconst _getColor = (colorList: (string | NamedColor)[], colorIndex: number) => {\n const index = colorIndex >= colorList.length ? 0 : colorIndex\n return colorList[index]\n}\n\ntype Props = {\n small?: boolean\n color?: number\n onChange?: (color: number) => void\n colorList?: (string | NamedColor)[]\n}\n\nfunction ColorPicker({ color = 0, small, onChange, colorList = COLORS }: Props) {\n return (\n <DeprecatedDropdown.Box right className=\"reactist_color_picker\">\n <DeprecatedDropdown.Trigger>\n {(() => {\n const backgroundColor = _getColor(colorList, color)\n\n return (\n <span\n className={classnames('color_trigger', { small })}\n style={{\n backgroundColor: _isNamedColor(backgroundColor)\n ? backgroundColor.color\n : backgroundColor,\n }}\n >\n <span className=\"color_trigger--inner_ring\" />\n </span>\n )\n })()}\n </DeprecatedDropdown.Trigger>\n <DeprecatedDropdown.Body>\n <div className=\"color_options\">\n {colorList.reduce<React.ReactNode[]>((items, currentColor, currentIndex) => {\n items.push(\n <ColorItem\n isActive={\n color >= colorList.length\n ? currentIndex === 0\n : currentIndex === color\n }\n key={currentIndex}\n color={\n _isNamedColor(currentColor) ? currentColor.color : currentColor\n }\n colorIndex={currentIndex}\n onClick={onChange}\n tooltip={_isNamedColor(currentColor) ? currentColor.name : null}\n />,\n )\n return items\n }, [])}\n </div>\n </DeprecatedDropdown.Body>\n </DeprecatedDropdown.Box>\n )\n}\nColorPicker.displayName = 'ColorPicker'\n\ntype ColorItemProps = {\n color: string\n colorIndex: number\n isActive?: boolean\n onClick?: (colorIndex: number) => void\n tooltip?: React.ReactNode\n}\n\nfunction ColorItem({ color, colorIndex, isActive, onClick, tooltip }: ColorItemProps) {\n const item = (\n <span\n data-testid=\"reactist-color-item\"\n className={'reactist color_item' + (isActive ? ' active' : '')}\n style={{ backgroundColor: color }}\n onClick={() => onClick?.(colorIndex)}\n >\n <span className=\"color_item--inner_ring\" />\n </span>\n )\n\n return tooltip ? <Tooltip content={tooltip}>{item}</Tooltip> : item\n}\nColorItem.displayName = 'ColorItem'\n\nexport { ColorPicker, ColorItem, COLORS }\n"],"names":["COLORS","_isNamedColor","color","ColorPicker","small","onChange","colorList","React","DeprecatedDropdown","Box","right","className","Trigger","backgroundColor","colorIndex","length","_getColor","classnames","style","Body","reduce","items","currentColor","currentIndex","push","ColorItem","isActive","key","onClick","tooltip","name","item","Tooltip","content","displayName"],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-picker.js","sources":["../../../src/components/color-picker/color-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport classnames from 'classnames'\n\nimport DeprecatedDropdown from '../deprecated-dropdown'\nimport { Tooltip } from '../tooltip'\n\nimport './color-picker.less'\n\ntype NamedColor = { name: string; color: string }\n\nconst COLORS = [\n '#606060',\n '#4A90E2',\n '#03B3B2',\n '#008299',\n '#82BA00',\n '#D24726',\n '#AC193D',\n '#DC4FAD',\n '#3BD5FB',\n '#74E8D3',\n '#FFCC00',\n '#FB886E',\n '#CCCCCC',\n]\n\nconst _isNamedColor = (color: string | NamedColor | undefined): color is NamedColor =>\n typeof color !== 'string'\n\nconst _getColor = (colorList: (string | NamedColor)[], colorIndex: number) => {\n const index = colorIndex >= colorList.length ? 0 : colorIndex\n return colorList[index]\n}\n\ntype Props = {\n small?: boolean\n color?: number\n onChange?: (color: number) => void\n colorList?: (string | NamedColor)[]\n}\n\nfunction ColorPicker({ color = 0, small, onChange, colorList = COLORS }: Props) {\n return (\n <DeprecatedDropdown.Box right className=\"reactist_color_picker\">\n <DeprecatedDropdown.Trigger>\n {(() => {\n const backgroundColor = _getColor(colorList, color)\n\n return (\n <span\n className={classnames('color_trigger', { small })}\n style={{\n backgroundColor: _isNamedColor(backgroundColor)\n ? backgroundColor.color\n : backgroundColor,\n }}\n >\n <span className=\"color_trigger--inner_ring\" />\n </span>\n )\n })()}\n </DeprecatedDropdown.Trigger>\n <DeprecatedDropdown.Body>\n <div className=\"color_options\">\n {colorList.reduce<React.ReactNode[]>((items, currentColor, currentIndex) => {\n items.push(\n <ColorItem\n isActive={\n color >= colorList.length\n ? currentIndex === 0\n : currentIndex === color\n }\n key={currentIndex}\n color={\n _isNamedColor(currentColor) ? currentColor.color : currentColor\n }\n colorIndex={currentIndex}\n onClick={onChange}\n tooltip={_isNamedColor(currentColor) ? currentColor.name : null}\n />,\n )\n return items\n }, [])}\n </div>\n </DeprecatedDropdown.Body>\n </DeprecatedDropdown.Box>\n )\n}\nColorPicker.displayName = 'ColorPicker'\n\ntype ColorItemProps = {\n color: string\n colorIndex: number\n isActive?: boolean\n onClick?: (colorIndex: number) => void\n tooltip?: React.ReactNode\n}\n\nfunction ColorItem({ color, colorIndex, isActive, onClick, tooltip }: ColorItemProps) {\n const item = (\n <span\n data-testid=\"reactist-color-item\"\n className={'reactist color_item' + (isActive ? ' active' : '')}\n style={{ backgroundColor: color }}\n onClick={() => onClick?.(colorIndex)}\n >\n <span className=\"color_item--inner_ring\" />\n </span>\n )\n\n return tooltip ? <Tooltip content={tooltip}>{item}</Tooltip> : item\n}\nColorItem.displayName = 'ColorItem'\n\nexport { ColorPicker, ColorItem, COLORS }\n"],"names":["COLORS","_isNamedColor","color","ColorPicker","small","onChange","colorList","React","DeprecatedDropdown","Box","right","className","Trigger","backgroundColor","colorIndex","length","_getColor","classnames","style","Body","reduce","items","currentColor","currentIndex","push","ColorItem","isActive","key","onClick","tooltip","name","item","Tooltip","content","displayName"],"mappings":"8PAUMA,EAAS,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGEC,EAAiBC,GACF,iBAAVA,EAcX,SAASC,GAAYD,MAAEA,EAAQ,EAAVE,MAAaA,EAAbC,SAAoBA,EAApBC,UAA8BA,EAAYN,IAC3D,OACIO,gBAACC,UAAmBC,KAAIC,SAAMC,UAAU,yBACpCJ,gBAACC,UAAmBI,aACf,MACG,MAAMC,EAjBR,EAACP,EAAoCQ,IAE5CR,EADOQ,GAAcR,EAAUS,OAAS,EAAID,GAgBXE,CAAUV,EAAWJ,GAE7C,OACIK,wBACII,UAAWM,EAAW,gBAAiB,CAAEb,MAAAA,IACzCc,MAAO,CACHL,gBAAiBZ,EAAcY,GACzBA,EAAgBX,MAChBW,IAGVN,wBAAMI,UAAU,gCAZ3B,IAiBLJ,gBAACC,UAAmBW,UAChBZ,uBAAKI,UAAU,iBACVL,EAAUc,OAA0B,CAACC,EAAOC,EAAcC,KACvDF,EAAMG,KACFjB,gBAACkB,GACGC,SACIxB,GAASI,EAAUS,OACI,IAAjBQ,EACAA,IAAiBrB,EAE3ByB,IAAKJ,EACLrB,MACID,EAAcqB,GAAgBA,EAAapB,MAAQoB,EAEvDR,WAAYS,EACZK,QAASvB,EACTwB,QAAS5B,EAAcqB,GAAgBA,EAAaQ,KAAO,QAG5DT,GACR,OAgBvB,SAASI,GAAUvB,MAAEA,EAAFY,WAASA,EAATY,SAAqBA,EAArBE,QAA+BA,UAASC,IACvD,MAAME,EACFxB,sCACgB,sBACZI,UAAW,uBAAyBe,EAAW,UAAY,IAC3DR,MAAO,CAAEL,gBAAiBX,GAC1B0B,QAAS,UAAMA,SAAAA,EAAUd,IAEzBP,wBAAMI,UAAU,4BAIxB,OAAOkB,EAAUtB,gBAACyB,WAAQC,QAASJ,GAAUE,GAAkBA,EAtBnE5B,EAAY+B,YAAc,cAwB1BT,EAAUS,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=require("react"),l=(t=require("classnames"))&&"object"==typeof t&&"default"in t?t.default:t,a=require("../tooltip/tooltip.js");const i=["type","variant","size","loading","disabled","tooltip","onClick","children"],r=o.forwardRef((function(t,r){let{type:n="button",variant:s,size:u="default",loading:d=!1,disabled:c=!1,tooltip:p,onClick:b,children:f}=t,_=e.objectWithoutProperties(t,i);const j=l("reactist_button",s?"reactist_button--"+s:null,"default"!==u?"reactist_button--"+u:null,{"reactist_button--loading":d},_.className),m=o.createElement("button",e.objectSpread2(e.objectSpread2({},_),{},{ref:r,type:n,className:j,"aria-disabled":c||d,onClick:c||d?void 0:b}),f);return p?o.createElement(a.Tooltip,{content:p},m):m}));r.displayName="Button",r.defaultProps={size:"default",loading:!1,disabled:!1},exports.Button=r;
|
|
2
2
|
//# sourceMappingURL=deprecated-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated-button.js","sources":["../../../src/components/deprecated-button/deprecated-button.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport { Tooltip } from '../tooltip'\n\nimport './deprecated-button.less'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\n/** @deprecated */\nexport type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'link'\n\n/** @deprecated */\nexport type ButtonSize = 'default' | 'small' | 'large'\n\n/** @deprecated */\nexport type ButtonProps = Omit<NativeButtonProps, 'title' | 'ref'> & {\n /**\n * Loading style. When true it disables the button, but it also adds a visual indication of\n * some in-progress operation going on.\n */\n loading?: boolean\n /**\n * Controls visually how the button shows up from a predefined set of kinds of buttons.\n */\n variant?: ButtonVariant\n /**\n * The size of the button. If not provided it shows up in a normal size.\n */\n size?: ButtonSize\n /**\n * Tooltip that is displayed on hover.\n *\n * This replaces `title` which is not supported for these buttons to avoid confusion.\n */\n tooltip?: React.ReactNode\n}\n\n/**\n * @deprecated\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n type = 'button',\n variant,\n size = 'default',\n loading = false,\n disabled = false,\n tooltip,\n onClick,\n children,\n ...props\n },\n ref,\n) {\n const className = classNames(\n 'reactist_button',\n variant ? `reactist_button--${variant}` : null,\n size !== 'default' ? `reactist_button--${size}` : null,\n { 'reactist_button--loading': loading },\n props.className,\n )\n\n const button = (\n <button\n {...props}\n ref={ref}\n type={type}\n className={className}\n aria-disabled={disabled || loading}\n onClick={disabled || loading ? undefined : onClick}\n >\n {children}\n </button>\n )\n\n return tooltip ? <Tooltip content={tooltip}>{button}</Tooltip> : button\n})\n\nButton.displayName = 'Button'\n\nButton.defaultProps = {\n size: 'default',\n loading: false,\n disabled: false,\n}\n\nexport { Button }\n"],"names":["Button","React","
|
|
1
|
+
{"version":3,"file":"deprecated-button.js","sources":["../../../src/components/deprecated-button/deprecated-button.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport { Tooltip } from '../tooltip'\n\nimport './deprecated-button.less'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\n/** @deprecated */\nexport type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'link'\n\n/** @deprecated */\nexport type ButtonSize = 'default' | 'small' | 'large'\n\n/** @deprecated */\nexport type ButtonProps = Omit<NativeButtonProps, 'title' | 'ref'> & {\n /**\n * Loading style. When true it disables the button, but it also adds a visual indication of\n * some in-progress operation going on.\n */\n loading?: boolean\n /**\n * Controls visually how the button shows up from a predefined set of kinds of buttons.\n */\n variant?: ButtonVariant\n /**\n * The size of the button. If not provided it shows up in a normal size.\n */\n size?: ButtonSize\n /**\n * Tooltip that is displayed on hover.\n *\n * This replaces `title` which is not supported for these buttons to avoid confusion.\n */\n tooltip?: React.ReactNode\n}\n\n/**\n * @deprecated\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n type = 'button',\n variant,\n size = 'default',\n loading = false,\n disabled = false,\n tooltip,\n onClick,\n children,\n ...props\n },\n ref,\n) {\n const className = classNames(\n 'reactist_button',\n variant ? `reactist_button--${variant}` : null,\n size !== 'default' ? `reactist_button--${size}` : null,\n { 'reactist_button--loading': loading },\n props.className,\n )\n\n const button = (\n <button\n {...props}\n ref={ref}\n type={type}\n className={className}\n aria-disabled={disabled || loading}\n onClick={disabled || loading ? undefined : onClick}\n >\n {children}\n </button>\n )\n\n return tooltip ? <Tooltip content={tooltip}>{button}</Tooltip> : button\n})\n\nButton.displayName = 'Button'\n\nButton.defaultProps = {\n size: 'default',\n loading: false,\n disabled: false,\n}\n\nexport { Button }\n"],"names":["Button","React","ref","type","variant","size","loading","disabled","tooltip","onClick","children","props","className","classNames","reactist_button--loading","button","undefined","Tooltip","content","displayName","defaultProps"],"mappings":"0VA4CMA,EAASC,cAAiD,WAY5DC,OAXAC,KACIA,EAAO,SADXC,QAEIA,EAFJC,KAGIA,EAAO,UAHXC,QAIIA,GAAU,EAJdC,SAKIA,GAAW,UACXC,EANJC,QAOIA,EAPJC,SAQIA,KACGC,iCAIP,MAAMC,EAAYC,EACd,kBACAT,sBAA8BA,EAAY,KACjC,YAATC,sBAAyCA,EAAS,KAClD,CAAES,2BAA4BR,GAC9BK,EAAMC,WAGJG,EACFd,4DACQU,OACJT,IAAKA,EACLC,KAAMA,EACNS,UAAWA,kBACIL,GAAYD,EAC3BG,QAASF,GAAYD,OAAUU,EAAYP,IAE1CC,GAIT,OAAOF,EAAUP,gBAACgB,WAAQC,QAASV,GAAUO,GAAoBA,KAGrEf,EAAOmB,YAAc,SAErBnB,EAAOoB,aAAe,CAClBf,KAAM,UACNC,SAAS,EACTC,UAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=
|
|
1
|
+
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),o=require("react"),i=t(require("classnames")),s=t(require("react-dom")),n=require("../deprecated-button/index.js");const r=["children","onClick","tooltip","className"];class d extends o.Component{constructor(t,e){super(t,e),this._timeout=void 0,this._handleClickOutside=t=>{const e=s.findDOMNode(this);e&&!e.contains(t.target)?this._toggleShowBody():this.props.allowBodyInteractions||(this._timeout=setTimeout(()=>{this.state.showBody&&this._toggleShowBody()},100))},this._toggleShowBody=()=>{this.state.showBody?(this.props.onHideBody&&this.props.onHideBody(),document.removeEventListener("click",this._handleClickOutside,!0)):(this.props.onShowBody&&this.props.onShowBody(),document.addEventListener("click",this._handleClickOutside,!0)),this.setState({showBody:!this.state.showBody})},this._setPosition=t=>{if(t){const e=document.getElementById(this.props.scrolling_parent?this.props.scrolling_parent:"");if(e){const o=s.findDOMNode(this);if(!o)return;const i=s.findDOMNode(this).offsetTop,n=o.querySelector(".trigger");if(!n)return;const r=e.clientHeight+e.scrollTop-i-n.clientHeight<t.clientHeight;r!==this.state.top&&this.setState({top:r})}}},this.state={showBody:!1,top:t.top||!1},this._timeout=void 0}componentWillUnmount(){document.removeEventListener("click",this._handleClickOutside,!0),this._timeout&&clearTimeout(this._timeout)}_getTriggerComponent(){var t;const e=null==(t=this.props.children)?void 0:t[0];return e?o.cloneElement(e,{onClick:this._toggleShowBody}):void 0}_getBodyComponent(){if(!this.state.showBody)return null;const{top:t}=this.state,{right:e=!1,children:s}=this.props,n={top:t,right:e,setPosition:this._setPosition},r=i({body_wrapper:!0,with_arrow:!0,top:t,bottom:!t}),d=null==s?void 0:s[1],l="function"==typeof d?d(n):d?o.cloneElement(d,n):void 0;return o.createElement("div",{className:r,style:{position:"relative"}},l)}render(){const t=i("reactist_dropdown",this.props.className),{top:e}=this.state;return o.createElement("div",{style:{display:"inline-block"},className:t,"data-testid":"reactist-dropdown-box"},e&&this._getBodyComponent(),this._getTriggerComponent(),!e&&this._getBodyComponent())}}d.displayName=void 0,d.displayName="Dropdown.Box";const l=o.forwardRef((function(t,s){let{children:d,onClick:l,tooltip:a,className:c}=t,p=e.objectWithoutProperties(t,r);return o.createElement(n.default,e.objectSpread2(e.objectSpread2({},p),{},{className:i("trigger",c),onClick:function(t){t.preventDefault(),t.stopPropagation(),l&&l(t)},tooltip:a,ref:s}),d)}));function a({top:t,right:e,children:i,setPosition:s}){const n={position:"absolute",right:0,top:0};return t&&(n.top="auto",n.bottom=0),e&&(n.right="auto",n.left=0),o.createElement("div",{ref:s,style:n,className:"body",id:"reactist-dropdown-body","data-testid":"reactist-dropdown-body"},i)}l.displayName="Dropdown.Trigger",a.displayName="Dropdown.Body",exports.Dropdown={Box:d,Trigger:l,Body:a};
|
|
2
2
|
//# sourceMappingURL=dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sources":["../../../src/components/deprecated-dropdown/dropdown.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classNames from 'classnames'\n\nimport Button from '../deprecated-button'\n\nimport './dropdown.less'\n\ntype BoxProps = {\n onShowBody?: () => void\n onHideBody?: () => void\n allowBodyInteractions?: boolean\n top?: boolean\n right?: boolean\n scrolling_parent?: string\n children?: [\n React.ReactElement<TriggerProps>,\n React.ReactElement<BodyProps> | ((props: BodyProps) => JSX.Element),\n ]\n className?: string\n}\n\ntype BoxState = {\n top: boolean\n showBody: boolean\n}\n\nclass Box extends React.Component<React.PropsWithChildren<BoxProps>, BoxState> {\n public static displayName: string\n\n constructor(props: BoxProps, context: React.Context<unknown>) {\n super(props, context)\n this.state = {\n showBody: false,\n top: props.top || false,\n }\n\n this._timeout = undefined\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this._handleClickOutside, true)\n if (this._timeout) {\n clearTimeout(this._timeout)\n }\n }\n _timeout?: ReturnType<typeof setTimeout>\n\n _handleClickOutside = (event: MouseEvent) => {\n const dropdownDOMNode = ReactDOM.findDOMNode(this)\n\n if (dropdownDOMNode && !dropdownDOMNode.contains(event.target as Node))\n this._toggleShowBody()\n else if (!this.props.allowBodyInteractions) {\n // won't close when body interactions are allowed\n this._timeout = setTimeout(() => {\n if (this.state.showBody) {\n this._toggleShowBody()\n }\n }, 100)\n }\n }\n\n _toggleShowBody = () => {\n if (!this.state.showBody) {\n // will show\n if (this.props.onShowBody) this.props.onShowBody()\n document.addEventListener('click', this._handleClickOutside, true)\n } else {\n // will hide\n if (this.props.onHideBody) this.props.onHideBody()\n document.removeEventListener('click', this._handleClickOutside, true)\n }\n\n this.setState({\n showBody: !this.state.showBody,\n })\n }\n\n _getTriggerComponent() {\n const _trigger = this.props.children?.[0]\n return _trigger\n ? React.cloneElement(_trigger, { onClick: this._toggleShowBody })\n : undefined\n }\n\n // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components\n _setPosition = (body: HTMLElement | null) => {\n if (body) {\n const scrollingParent = document.getElementById(\n this.props.scrolling_parent ? this.props.scrolling_parent : '',\n )\n\n if (scrollingParent) {\n const dropdown = ReactDOM.findDOMNode(this)\n if (!dropdown) {\n return\n }\n const dropdownVerticalPosition = (ReactDOM.findDOMNode(this) as HTMLElement)\n .offsetTop\n const dropdownTrigger = (dropdown as Element).querySelector('.trigger')\n if (!dropdownTrigger) {\n return\n }\n const dropdownTriggerHeight = dropdownTrigger.clientHeight\n const dropdownBodyHeight = body.clientHeight\n\n const scrollingParentHeight = scrollingParent.clientHeight\n const scrollingParentOffset = scrollingParent.scrollTop\n\n const bottomOffset =\n scrollingParentHeight +\n scrollingParentOffset -\n dropdownVerticalPosition -\n dropdownTriggerHeight\n\n const top = bottomOffset < dropdownBodyHeight\n\n if (top !== this.state.top) {\n this.setState({ top })\n }\n }\n }\n }\n\n _getBodyComponent() {\n if (!this.state.showBody) {\n return null\n }\n const { top } = this.state\n const { right = false, children } = this.props\n const props = { top, right, setPosition: this._setPosition }\n\n const className = classNames({\n body_wrapper: true,\n with_arrow: true,\n top: top,\n bottom: !top,\n })\n\n const body = children?.[1]\n\n const contentMarkup =\n typeof body === 'function'\n ? body(props)\n : body\n ? React.cloneElement(body, props)\n : undefined\n return (\n <div className={className} style={{ position: 'relative' }}>\n {contentMarkup}\n </div>\n )\n }\n\n render() {\n const className = classNames('reactist_dropdown', this.props.className)\n const { top } = this.state\n\n return (\n <div\n style={{ display: 'inline-block' }}\n className={className}\n data-testid=\"reactist-dropdown-box\"\n >\n {top && this._getBodyComponent()}\n {this._getTriggerComponent()}\n {!top && this._getBodyComponent()}\n </div>\n )\n }\n}\n\nBox.displayName = 'Dropdown.Box'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\ntype TriggerProps = Omit<NativeButtonProps, 'title' | 'onClick'> & {\n tooltip?: React.ReactNode\n /**\n * @private the onClick prop is not to be used externally\n */\n onClick?: NativeButtonProps['onClick']\n}\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger(\n { children, onClick, tooltip, className, ...props },\n ref,\n) {\n function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {\n event.preventDefault()\n event.stopPropagation()\n if (onClick) onClick(event)\n }\n\n return (\n <Button\n {...props}\n className={classNames('trigger', className)}\n onClick={handleClick}\n tooltip={tooltip}\n ref={ref}\n >\n {children}\n </Button>\n )\n})\n\nTrigger.displayName = 'Dropdown.Trigger'\n\ntype BodyProps = {\n setPosition?: React.Ref<HTMLDivElement>\n children?: React.ReactNode\n top?: boolean\n right?: boolean\n}\n\nfunction Body({ top, right, children, setPosition }: BodyProps) {\n const style: React.CSSProperties = { position: 'absolute', right: 0, top: 0 }\n\n if (top) {\n style.top = 'auto'\n style.bottom = 0\n }\n\n if (right) {\n style.right = 'auto'\n style.left = 0\n }\n\n return (\n <div\n ref={setPosition}\n style={style}\n className=\"body\"\n id=\"reactist-dropdown-body\"\n data-testid=\"reactist-dropdown-body\"\n >\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dropdown.Body'\n\nconst Dropdown = {\n Box,\n Trigger,\n Body,\n}\n\nexport { Dropdown }\n"],"names":["Box","React","Component","constructor","props","context","super","_timeout","_handleClickOutside","event","dropdownDOMNode","ReactDOM","findDOMNode","this","contains","target","_toggleShowBody","allowBodyInteractions","setTimeout","state","showBody","onHideBody","document","removeEventListener","onShowBody","addEventListener","setState","_setPosition","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","top","clientHeight","scrollTop","undefined","componentWillUnmount","clearTimeout","_getTriggerComponent","_trigger","children","_this$props$children","cloneElement","onClick","_getBodyComponent","right","setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","displayName","Trigger","forwardRef","ref","tooltip","Button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WAAYT,MAAO,EAAGb,IAAK,GAY1E,OAVIA,IACAqB,EAAMrB,IAAM,OACZqB,EAAMF,OAAS,GAGfN,IACAQ,EAAMR,MAAQ,OACdQ,EAAMa,KAAO,GAIbtE,uBACIgE,IAAKd,EACLO,MAAOA,EACPN,UAAU,OACVoB,GAAG,uCACS,0BAEX3B,GA9BbkB,EAAQD,YAAc,mBAmCtBQ,EAAKR,YAAc,iCAEF,CACb9D,IAAAA,EACA+D,QAAAA,EACAO,KAAAA"}
|
|
1
|
+
{"version":3,"file":"dropdown.js","sources":["../../../src/components/deprecated-dropdown/dropdown.tsx"],"sourcesContent":["import * as React from 'react'\nimport ReactDOM from 'react-dom'\nimport classNames from 'classnames'\n\nimport Button from '../deprecated-button'\n\nimport './dropdown.less'\n\ntype BoxProps = {\n onShowBody?: () => void\n onHideBody?: () => void\n allowBodyInteractions?: boolean\n top?: boolean\n right?: boolean\n scrolling_parent?: string\n children?: [\n React.ReactElement<TriggerProps>,\n React.ReactElement<BodyProps> | ((props: BodyProps) => JSX.Element),\n ]\n className?: string\n}\n\ntype BoxState = {\n top: boolean\n showBody: boolean\n}\n\nclass Box extends React.Component<React.PropsWithChildren<BoxProps>, BoxState> {\n public static displayName: string\n\n constructor(props: BoxProps, context: React.Context<unknown>) {\n super(props, context)\n this.state = {\n showBody: false,\n top: props.top || false,\n }\n\n this._timeout = undefined\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this._handleClickOutside, true)\n if (this._timeout) {\n clearTimeout(this._timeout)\n }\n }\n _timeout?: ReturnType<typeof setTimeout>\n\n _handleClickOutside = (event: MouseEvent) => {\n const dropdownDOMNode = ReactDOM.findDOMNode(this)\n\n if (dropdownDOMNode && !dropdownDOMNode.contains(event.target as Node))\n this._toggleShowBody()\n else if (!this.props.allowBodyInteractions) {\n // won't close when body interactions are allowed\n this._timeout = setTimeout(() => {\n if (this.state.showBody) {\n this._toggleShowBody()\n }\n }, 100)\n }\n }\n\n _toggleShowBody = () => {\n if (!this.state.showBody) {\n // will show\n if (this.props.onShowBody) this.props.onShowBody()\n document.addEventListener('click', this._handleClickOutside, true)\n } else {\n // will hide\n if (this.props.onHideBody) this.props.onHideBody()\n document.removeEventListener('click', this._handleClickOutside, true)\n }\n\n this.setState({\n showBody: !this.state.showBody,\n })\n }\n\n _getTriggerComponent() {\n const _trigger = this.props.children?.[0]\n return _trigger\n ? React.cloneElement(_trigger, { onClick: this._toggleShowBody })\n : undefined\n }\n\n // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components\n _setPosition = (body: HTMLElement | null) => {\n if (body) {\n const scrollingParent = document.getElementById(\n this.props.scrolling_parent ? this.props.scrolling_parent : '',\n )\n\n if (scrollingParent) {\n const dropdown = ReactDOM.findDOMNode(this)\n if (!dropdown) {\n return\n }\n const dropdownVerticalPosition = (ReactDOM.findDOMNode(this) as HTMLElement)\n .offsetTop\n const dropdownTrigger = (dropdown as Element).querySelector('.trigger')\n if (!dropdownTrigger) {\n return\n }\n const dropdownTriggerHeight = dropdownTrigger.clientHeight\n const dropdownBodyHeight = body.clientHeight\n\n const scrollingParentHeight = scrollingParent.clientHeight\n const scrollingParentOffset = scrollingParent.scrollTop\n\n const bottomOffset =\n scrollingParentHeight +\n scrollingParentOffset -\n dropdownVerticalPosition -\n dropdownTriggerHeight\n\n const top = bottomOffset < dropdownBodyHeight\n\n if (top !== this.state.top) {\n this.setState({ top })\n }\n }\n }\n }\n\n _getBodyComponent() {\n if (!this.state.showBody) {\n return null\n }\n const { top } = this.state\n const { right = false, children } = this.props\n const props = { top, right, setPosition: this._setPosition }\n\n const className = classNames({\n body_wrapper: true,\n with_arrow: true,\n top: top,\n bottom: !top,\n })\n\n const body = children?.[1]\n\n const contentMarkup =\n typeof body === 'function'\n ? body(props)\n : body\n ? React.cloneElement(body, props)\n : undefined\n return (\n <div className={className} style={{ position: 'relative' }}>\n {contentMarkup}\n </div>\n )\n }\n\n render() {\n const className = classNames('reactist_dropdown', this.props.className)\n const { top } = this.state\n\n return (\n <div\n style={{ display: 'inline-block' }}\n className={className}\n data-testid=\"reactist-dropdown-box\"\n >\n {top && this._getBodyComponent()}\n {this._getTriggerComponent()}\n {!top && this._getBodyComponent()}\n </div>\n )\n }\n}\n\nBox.displayName = 'Dropdown.Box'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\ntype TriggerProps = Omit<NativeButtonProps, 'title' | 'onClick'> & {\n tooltip?: React.ReactNode\n /**\n * @private the onClick prop is not to be used externally\n */\n onClick?: NativeButtonProps['onClick']\n}\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger(\n { children, onClick, tooltip, className, ...props },\n ref,\n) {\n function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {\n event.preventDefault()\n event.stopPropagation()\n if (onClick) onClick(event)\n }\n\n return (\n <Button\n {...props}\n className={classNames('trigger', className)}\n onClick={handleClick}\n tooltip={tooltip}\n ref={ref}\n >\n {children}\n </Button>\n )\n})\n\nTrigger.displayName = 'Dropdown.Trigger'\n\ntype BodyProps = {\n setPosition?: React.Ref<HTMLDivElement>\n children?: React.ReactNode\n top?: boolean\n right?: boolean\n}\n\nfunction Body({ top, right, children, setPosition }: BodyProps) {\n const style: React.CSSProperties = { position: 'absolute', right: 0, top: 0 }\n\n if (top) {\n style.top = 'auto'\n style.bottom = 0\n }\n\n if (right) {\n style.right = 'auto'\n style.left = 0\n }\n\n return (\n <div\n ref={setPosition}\n style={style}\n className=\"body\"\n id=\"reactist-dropdown-body\"\n data-testid=\"reactist-dropdown-body\"\n >\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dropdown.Body'\n\nconst Dropdown = {\n Box,\n Trigger,\n Body,\n}\n\nexport { Dropdown }\n"],"names":["Box","React","constructor","props","context","super","_timeout","_handleClickOutside","event","dropdownDOMNode","ReactDOM","findDOMNode","this","contains","target","_toggleShowBody","allowBodyInteractions","setTimeout","state","showBody","onHideBody","document","removeEventListener","onShowBody","addEventListener","setState","_setPosition","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","top","clientHeight","scrollTop","undefined","componentWillUnmount","clearTimeout","_getTriggerComponent","_trigger","children","_this$props$children","onClick","_getBodyComponent","right","setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","displayName","Trigger","ref","tooltip","Button","preventDefault","stopPropagation","Body","left","id"],"mappings":"+WA2BA,MAAMA,UAAYC,YAGdC,YAAYC,EAAiBC,GACzBC,MAAMF,EAAOC,QAejBE,qBAEAC,oBAAuBC,IACnB,MAAMC,EAAkBC,EAASC,YAAYC,MAEzCH,IAAoBA,EAAgBI,SAASL,EAAMM,QACnDF,KAAKG,kBACCH,KAAKT,MAAMa,wBAEjBJ,KAAKN,SAAWW,WAAW,KACnBL,KAAKM,MAAMC,UACXP,KAAKG,mBAEV,YAIXA,gBAAkB,KACTH,KAAKM,MAAMC,UAMRP,KAAKT,MAAMiB,YAAYR,KAAKT,MAAMiB,aACtCC,SAASC,oBAAoB,QAASV,KAAKL,qBAAqB,KAL5DK,KAAKT,MAAMoB,YAAYX,KAAKT,MAAMoB,aACtCF,SAASG,iBAAiB,QAASZ,KAAKL,qBAAqB,IAOjEK,KAAKa,SAAS,CACVN,UAAWP,KAAKM,MAAMC,iBAY9BO,aAAgBC,IACZ,GAAIA,EAAM,CACN,MAAMC,EAAkBP,SAASQ,eAC7BjB,KAAKT,MAAM2B,iBAAmBlB,KAAKT,MAAM2B,iBAAmB,IAGhE,GAAIF,EAAiB,CACjB,MAAMG,EAAWrB,EAASC,YAAYC,MACtC,IAAKmB,EACD,OAEJ,MAAMC,EAA4BtB,EAASC,YAAYC,MAClDqB,UACCC,EAAmBH,EAAqBI,cAAc,YAC5D,IAAKD,EACD,OAEJ,MAYME,EATwBR,EAAgBS,aAChBT,EAAgBU,UAK1CN,EAT0BE,EAAgBG,a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gBAAC+D,6CACO7D,OACJ+C,UAAWC,EAAW,UAAWD,GACjCJ,QAVR,SAAqBtC,GACjBA,EAAMyD,iBACNzD,EAAM0D,kBACFpB,GAASA,EAAQtC,IAQjBuD,QAASA,EACTD,IAAKA,IAEJlB,MAcb,SAASuB,GAAK/B,IAAEA,EAAFY,MAAOA,EAAPJ,SAAcA,EAAdK,YAAwBA,IAClC,MAAMO,EAA6B,CAAEC,SAAU,WAAYT,MAAO,EAAGZ,IAAK,GAY1E,OAVIA,IACAoB,EAAMpB,IAAM,OACZoB,EAAMF,OAAS,GAGfN,IACAQ,EAAMR,MAAQ,OACdQ,EAAMY,KAAO,GAIbnE,uBACI6D,IAAKb,EACLO,MAAOA,EACPN,UAAU,OACVmB,GAAG,uCACS,0BAEXzB,GA9BbiB,EAAQD,YAAc,mBAmCtBO,EAAKP,YAAc,iCAEF,CACb5D,IAAAA,EACA6D,QAAAA,EACAM,KAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),a=(e=require("classnames"))&&"object"==typeof e&&"default"in e?e.default:e;const s=t.forwardRef((e,s)=>{const u=a("reactist_input",e.className);return t.createElement("input",r.objectSpread2(r.objectSpread2({},e),{},{className:u,ref:s}))});s.displayName="Input",exports.Input=s;
|
|
2
2
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../src/components/deprecated-input/input.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './input.less'\n\ntype InputProps = {\n /** Additional css class applied to the input. */\n className?: string\n ref?: React.Ref<HTMLInputElement>\n}\n\ntype Props = InputProps & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input: React.FC<React.PropsWithRef<Props>> = React.forwardRef(\n (props: Props, ref: React.Ref<HTMLInputElement>) => {\n const className = classNames('reactist_input', props.className)\n return <input {...props} className={className} ref={ref} />\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"names":["Input","React","
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../src/components/deprecated-input/input.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport './input.less'\n\ntype InputProps = {\n /** Additional css class applied to the input. */\n className?: string\n ref?: React.Ref<HTMLInputElement>\n}\n\ntype Props = InputProps & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input: React.FC<React.PropsWithRef<Props>> = React.forwardRef(\n (props: Props, ref: React.Ref<HTMLInputElement>) => {\n const className = classNames('reactist_input', props.className)\n return <input {...props} className={className} ref={ref} />\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"names":["Input","React","props","ref","className","classNames","displayName"],"mappings":"uOAaMA,EAA6CC,aAC/C,CAACC,EAAcC,KACX,MAAMC,EAAYC,EAAW,iBAAkBH,EAAME,WACrD,OAAOH,2DAAWC,OAAOE,UAAWA,EAAWD,IAAKA,OAG5DH,EAAMM,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("../../_virtual/_rollupPluginBabelHelpers.js"),l=require("react"),t=(e=require("classnames"))&&"object"==typeof e&&"default"in e?e.default:e;const s=["value","options","onChange","disabled","className","defaultValue"];function u(e){let{value:u,options:o=[],onChange:d,disabled:i=!0,className:r="",defaultValue:n}=e,c=a.objectWithoutProperties(e,s);const p=t("reactist_select",{disabled:i},r);return l.createElement("select",a.objectSpread2({className:p,value:u,onChange:e=>d?d(e.target.value):void 0,disabled:i,defaultValue:n},c),null==o?void 0:o.map(e=>l.createElement("option",{key:e.key||e.value,value:e.value,disabled:e.disabled},e.text)))}u.displayName="Select",u.defaultProps={options:[],disabled:!1},exports.Select=u;
|
|
2
2
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../../src/components/deprecated-select/select.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './select.less'\n\ntype Option = {\n /** Optional key for each option. If not provided `value` is used. */\n key?: string | number\n /** Value of the option. */\n value: string | number\n /** Text to display for the option. */\n text?: string | number\n /** Whether the options is disabled or not. */\n disabled?: boolean\n}\n\ntype Props = {\n className?: string\n disabled?: boolean\n /** Currently selected value. */\n value?: string | number\n /** Callback for the change event. Will be called with the next value (not the full event). */\n onChange?: (value: string) => void\n /** Options that are rendered in the select. */\n options?: Option[]\n /** Value to initially be set */\n defaultValue?: string | number\n}\n\nfunction Select({\n value,\n options = [],\n onChange,\n disabled = true,\n className = '',\n defaultValue,\n ...otherProps\n}: Props) {\n const selectClassName = classNames('reactist_select', { disabled }, className)\n return (\n <select\n className={selectClassName}\n value={value}\n onChange={(event) => (onChange ? onChange(event.target.value) : undefined)}\n disabled={disabled}\n defaultValue={defaultValue}\n {...otherProps}\n >\n {options?.map((option) => (\n <option\n key={option.key || option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.text}\n </option>\n ))}\n </select>\n )\n}\nSelect.displayName = 'Select'\nSelect.defaultProps = {\n options: [],\n disabled: false,\n}\n\nexport { Select }\n"],"names":["Select","value","options","onChange","disabled","className","defaultValue","otherProps","selectClassName","classNames","React","event","target","undefined","map","option","key","text","displayName","defaultProps"],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../../../src/components/deprecated-select/select.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport './select.less'\n\ntype Option = {\n /** Optional key for each option. If not provided `value` is used. */\n key?: string | number\n /** Value of the option. */\n value: string | number\n /** Text to display for the option. */\n text?: string | number\n /** Whether the options is disabled or not. */\n disabled?: boolean\n}\n\ntype Props = {\n className?: string\n disabled?: boolean\n /** Currently selected value. */\n value?: string | number\n /** Callback for the change event. Will be called with the next value (not the full event). */\n onChange?: (value: string) => void\n /** Options that are rendered in the select. */\n options?: Option[]\n /** Value to initially be set */\n defaultValue?: string | number\n}\n\nfunction Select({\n value,\n options = [],\n onChange,\n disabled = true,\n className = '',\n defaultValue,\n ...otherProps\n}: Props) {\n const selectClassName = classNames('reactist_select', { disabled }, className)\n return (\n <select\n className={selectClassName}\n value={value}\n onChange={(event) => (onChange ? onChange(event.target.value) : undefined)}\n disabled={disabled}\n defaultValue={defaultValue}\n {...otherProps}\n >\n {options?.map((option) => (\n <option\n key={option.key || option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.text}\n </option>\n ))}\n </select>\n )\n}\nSelect.displayName = 'Select'\nSelect.defaultProps = {\n options: [],\n disabled: false,\n}\n\nexport { Select }\n"],"names":["Select","value","options","onChange","disabled","className","defaultValue","otherProps","selectClassName","classNames","React","event","target","undefined","map","option","key","text","displayName","defaultProps"],"mappings":"8SA6BA,SAASA,SAAOC,MACZA,EADYC,QAEZA,EAAU,GAFEC,SAGZA,EAHYC,SAIZA,GAAW,EAJCC,UAKZA,EAAY,GALAC,aAMZA,KACGC,iCAEH,MAAMC,EAAkBC,EAAW,kBAAmB,CAAEL,SAAAA,GAAYC,GACpE,OACIK,0CACIL,UAAWG,EACXP,MAAOA,EACPE,SAAWQ,GAAWR,EAAWA,EAASQ,EAAMC,OAAOX,YAASY,EAChET,SAAUA,EACVE,aAAcA,GACVC,SAEHL,SAAAA,EAASY,IAAKC,GACXL,0BACIM,IAAKD,EAAOC,KAAOD,EAAOd,MAC1BA,MAAOc,EAAOd,MACdG,SAAUW,EAAOX,UAEhBW,EAAOE,QAM5BjB,EAAOkB,YAAc,SACrBlB,EAAOmB,aAAe,CAClBjB,QAAS,GACTE,UAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.default=()=>e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24"},e.createElement("path",{fill:"gray",fillRule:"evenodd",d:"M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z"}));
|
|
2
2
|
//# sourceMappingURL=CloseIcon.svg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseIcon.svg.js","sources":["../../../src/components/icons/CloseIcon.svg.tsx"],"sourcesContent":["import React from 'react'\n\nconst CloseIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path\n fill=\"gray\"\n fillRule=\"evenodd\"\n d=\"M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z\"\n />\n </svg>\n)\n\nexport default CloseIcon\n"],"names":["React","width","height","viewBox","fill","fillRule","d"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CloseIcon.svg.js","sources":["../../../src/components/icons/CloseIcon.svg.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst CloseIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path\n fill=\"gray\"\n fillRule=\"evenodd\"\n d=\"M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z\"\n />\n </svg>\n)\n\nexport default CloseIcon\n"],"names":["React","width","height","viewBox","fill","fillRule","d"],"mappings":"2GAEkB,IACdA,uBAAKC,MAAM,KAAKC,OAAO,KAAKC,QAAQ,aAChCH,wBACII,KAAK,OACLC,SAAS,UACTC,EAAE"}
|