@doist/reactist 15.2.0 → 16.0.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 +654 -201
- 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/{notification/notification.js → deprecated-notification/deprecated-notification.js} +12 -12
- package/es/components/deprecated-notification/deprecated-notification.js.map +1 -0
- 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/menu/menu.js +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 +5 -2
- 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/box/box.js.map +1 -1
- package/es/new-components/box/box.module.css.js +1 -1
- package/es/new-components/loading/loading.js +3 -3
- package/es/new-components/loading/loading.js.map +1 -1
- package/es/new-components/modal/modal.js +1 -1
- package/es/new-components/password-field/password-field.js +1 -1
- package/es/new-components/toast/static-toast.js +86 -0
- package/es/new-components/toast/static-toast.js.map +1 -0
- package/es/new-components/toast/toast-animation.js +175 -0
- package/es/new-components/toast/toast-animation.js.map +1 -0
- package/es/new-components/toast/toast.module.css.js +4 -0
- package/es/new-components/toast/toast.module.css.js.map +1 -0
- package/es/new-components/toast/use-toasts.js +195 -0
- package/es/new-components/toast/use-toasts.js.map +1 -0
- 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/{notification/notification.d.ts → deprecated-notification/deprecated-notification.d.ts} +5 -5
- package/lib/components/deprecated-notification/deprecated-notification.js +2 -0
- package/lib/components/deprecated-notification/deprecated-notification.js.map +1 -0
- package/lib/components/{notification/notification.test.d.ts → deprecated-notification/deprecated-notification.test.d.ts} +0 -0
- package/lib/components/deprecated-notification/index.d.ts +1 -0
- 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/menu/menu.js +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 +3 -1
- 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.d.ts +5 -3
- package/lib/new-components/box/box.js.map +1 -1
- package/lib/new-components/box/box.module.css.js +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/password-field/password-field.js +1 -1
- package/lib/new-components/test-helpers.d.ts +2 -1
- package/lib/new-components/toast/index.d.ts +4 -0
- package/lib/new-components/toast/static-toast.d.ts +61 -0
- package/lib/new-components/toast/static-toast.js +2 -0
- package/lib/new-components/toast/static-toast.js.map +1 -0
- package/lib/new-components/toast/toast-animation.d.ts +50 -0
- package/lib/new-components/toast/toast-animation.js +2 -0
- package/lib/new-components/toast/toast-animation.js.map +1 -0
- package/lib/new-components/toast/toast.module.css.js +2 -0
- package/lib/new-components/toast/toast.module.css.js.map +1 -0
- package/lib/new-components/toast/toast.test.d.ts +1 -0
- package/lib/new-components/toast/use-toasts.d.ts +128 -0
- package/lib/new-components/toast/use-toasts.js +2 -0
- package/lib/new-components/toast/use-toasts.js.map +1 -0
- package/package.json +1 -1
- package/styles/alert.css +1 -1
- package/styles/avatar.css +1 -1
- package/styles/badge.css +5 -0
- package/styles/badge.module.css.css +1 -0
- package/styles/base-button.css +1 -1
- package/styles/base-field.css +1 -1
- package/styles/box.css +1 -1
- package/styles/box.module.css.css +1 -1
- package/styles/checkbox-field.css +1 -1
- package/styles/columns.css +1 -1
- package/styles/{notification.css → deprecated-notification.css} +0 -0
- package/styles/divider.css +1 -1
- package/styles/heading.css +1 -1
- package/styles/hidden-visually.css +1 -1
- package/styles/hidden.css +1 -1
- package/styles/inline.css +1 -1
- package/styles/loading.css +1 -1
- package/styles/modal.css +2 -2
- package/styles/modal.module.css.css +1 -1
- package/styles/notice.css +1 -1
- package/styles/password-field.css +1 -1
- package/styles/progress-bar.css +1 -1
- package/styles/reactist.css +5 -3
- package/styles/select-field.css +1 -1
- package/styles/stack.css +1 -1
- package/styles/static-toast.css +11 -0
- package/styles/switch-field.css +1 -1
- package/styles/tabs.css +1 -1
- package/styles/text-area.css +1 -1
- package/styles/text-field.css +1 -1
- package/styles/text-link.css +1 -1
- package/styles/text.css +1 -1
- package/styles/toast.module.css.css +1 -0
- package/styles/use-toasts.css +11 -0
- package/es/components/notification/notification.js.map +0 -1
- package/lib/components/notification/notification.js +0 -2
- package/lib/components/notification/notification.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { Tooltip } from '../tooltip/tooltip.js';
|
|
4
4
|
import DeprecatedDropdown from '../deprecated-dropdown/index.js';
|
|
@@ -18,26 +18,26 @@ function ColorPicker({
|
|
|
18
18
|
onChange,
|
|
19
19
|
colorList = COLORS
|
|
20
20
|
}) {
|
|
21
|
-
return /*#__PURE__*/
|
|
21
|
+
return /*#__PURE__*/createElement(DeprecatedDropdown.Box, {
|
|
22
22
|
right: true,
|
|
23
23
|
className: "reactist_color_picker"
|
|
24
|
-
}, /*#__PURE__*/
|
|
24
|
+
}, /*#__PURE__*/createElement(DeprecatedDropdown.Trigger, null, (() => {
|
|
25
25
|
const backgroundColor = _getColor(colorList, color);
|
|
26
26
|
|
|
27
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/createElement("span", {
|
|
28
28
|
className: classNames('color_trigger', {
|
|
29
29
|
small
|
|
30
30
|
}),
|
|
31
31
|
style: {
|
|
32
32
|
backgroundColor: _isNamedColor(backgroundColor) ? backgroundColor.color : backgroundColor
|
|
33
33
|
}
|
|
34
|
-
}, /*#__PURE__*/
|
|
34
|
+
}, /*#__PURE__*/createElement("span", {
|
|
35
35
|
className: "color_trigger--inner_ring"
|
|
36
36
|
}));
|
|
37
|
-
})()), /*#__PURE__*/
|
|
37
|
+
})()), /*#__PURE__*/createElement(DeprecatedDropdown.Body, null, /*#__PURE__*/createElement("div", {
|
|
38
38
|
className: "color_options"
|
|
39
39
|
}, colorList.reduce((items, currentColor, currentIndex) => {
|
|
40
|
-
items.push( /*#__PURE__*/
|
|
40
|
+
items.push( /*#__PURE__*/createElement(ColorItem, {
|
|
41
41
|
isActive: color >= colorList.length ? currentIndex === 0 : currentIndex === color,
|
|
42
42
|
key: currentIndex,
|
|
43
43
|
color: _isNamedColor(currentColor) ? currentColor.color : currentColor,
|
|
@@ -58,17 +58,17 @@ function ColorItem({
|
|
|
58
58
|
onClick,
|
|
59
59
|
tooltip
|
|
60
60
|
}) {
|
|
61
|
-
const item = /*#__PURE__*/
|
|
61
|
+
const item = /*#__PURE__*/createElement("span", {
|
|
62
62
|
"data-testid": "reactist-color-item",
|
|
63
63
|
className: 'reactist color_item' + (isActive ? ' active' : ''),
|
|
64
64
|
style: {
|
|
65
65
|
backgroundColor: color
|
|
66
66
|
},
|
|
67
67
|
onClick: () => onClick == null ? void 0 : onClick(colorIndex)
|
|
68
|
-
}, /*#__PURE__*/
|
|
68
|
+
}, /*#__PURE__*/createElement("span", {
|
|
69
69
|
className: "color_item--inner_ring"
|
|
70
70
|
}));
|
|
71
|
-
return tooltip ? /*#__PURE__*/
|
|
71
|
+
return tooltip ? /*#__PURE__*/createElement(Tooltip, {
|
|
72
72
|
content: tooltip
|
|
73
73
|
}, item) : item;
|
|
74
74
|
}
|
|
@@ -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","_getColor","colorList","colorIndex","index","length","ColorPicker","small","onChange","React","DeprecatedDropdown","Box","right","className","Trigger","backgroundColor","classnames","style","Body","reduce","items","currentColor","currentIndex","push","ColorItem","isActive","key","onClick","tooltip","name","displayName","item","Tooltip","content"],"mappings":";;;;;MAUMA,MAAM,GAAG,CACX,SADW,EAEX,SAFW,EAGX,SAHW,EAIX,SAJW,EAKX,SALW,EAMX,SANW,EAOX,SAPW,EAQX,SARW,EASX,SATW,EAUX,SAVW,EAWX,SAXW,EAYX,SAZW,EAaX,SAbW;;AAgBf,MAAMC,aAAa,GAAIC,KAAD,IAClB,OAAOA,KAAP,KAAiB,QADrB;;AAGA,MAAMC,SAAS,GAAG,CAACC,SAAD,EAAqCC,UAArC;EACd,MAAMC,KAAK,GAAGD,UAAU,IAAID,SAAS,CAACG,MAAxB,GAAiC,CAAjC,GAAqCF,UAAnD;EACA,OAAOD,SAAS,CAACE,KAAD,CAAhB;AACH,CAHD;;AAYA,SAASE,WAAT,CAAqB;EAAEN,KAAK,GAAG,CAAV;EAAaO,KAAb;EAAoBC,QAApB;EAA8BN,SAAS,GAAGJ;AAA1C,CAArB;EACI,oBACIW,
|
|
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","_getColor","colorList","colorIndex","index","length","ColorPicker","small","onChange","React","DeprecatedDropdown","Box","right","className","Trigger","backgroundColor","classnames","style","Body","reduce","items","currentColor","currentIndex","push","ColorItem","isActive","key","onClick","tooltip","name","displayName","item","Tooltip","content"],"mappings":";;;;;MAUMA,MAAM,GAAG,CACX,SADW,EAEX,SAFW,EAGX,SAHW,EAIX,SAJW,EAKX,SALW,EAMX,SANW,EAOX,SAPW,EAQX,SARW,EASX,SATW,EAUX,SAVW,EAWX,SAXW,EAYX,SAZW,EAaX,SAbW;;AAgBf,MAAMC,aAAa,GAAIC,KAAD,IAClB,OAAOA,KAAP,KAAiB,QADrB;;AAGA,MAAMC,SAAS,GAAG,CAACC,SAAD,EAAqCC,UAArC;EACd,MAAMC,KAAK,GAAGD,UAAU,IAAID,SAAS,CAACG,MAAxB,GAAiC,CAAjC,GAAqCF,UAAnD;EACA,OAAOD,SAAS,CAACE,KAAD,CAAhB;AACH,CAHD;;AAYA,SAASE,WAAT,CAAqB;EAAEN,KAAK,GAAG,CAAV;EAAaO,KAAb;EAAoBC,QAApB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AAqBsB,QAArB;EAA+BE,OAA/B;EAAwCC;AAAxC,CAAnB;EACI,MAAMG,IAAI,gBACNtB,aAAA,OAAA;mBACgB;IACZI,SAAS,EAAE,yBAAyBY,QAAQ,GAAG,SAAH,GAAe,EAAhD;IACXR,KAAK,EAAE;MAAEF,eAAe,EAAEf;;IAC1B2B,OAAO,EAAE,MAAMA,OAAN,oBAAMA,OAAO,CAAGxB,UAAH;GAJ1B,eAMIM,aAAA,OAAA;IAAMI,SAAS,EAAC;GAAhB,CANJ,CADJ;EAWA,OAAOe,OAAO,gBAAGnB,aAAA,CAACuB,OAAD;IAASC,OAAO,EAAEL;GAAlB,EAA4BG,IAA5B,CAAH,GAAiDA,IAA/D;AACH;;AACDP,SAAS,CAACM,WAAV,GAAwB,WAAxB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { forwardRef, createElement } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Tooltip } from '../tooltip/tooltip.js';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ const _excluded = ["type", "variant", "size", "loading", "disabled", "tooltip",
|
|
|
8
8
|
* @deprecated
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const Button = /*#__PURE__*/
|
|
11
|
+
const Button = /*#__PURE__*/forwardRef(function Button(_ref, ref) {
|
|
12
12
|
let {
|
|
13
13
|
type = 'button',
|
|
14
14
|
variant,
|
|
@@ -24,14 +24,14 @@ const Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref)
|
|
|
24
24
|
const className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
25
25
|
'reactist_button--loading': loading
|
|
26
26
|
}, props.className);
|
|
27
|
-
const button = /*#__PURE__*/
|
|
27
|
+
const button = /*#__PURE__*/createElement("button", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
28
28
|
ref: ref,
|
|
29
29
|
type: type,
|
|
30
30
|
className: className,
|
|
31
31
|
"aria-disabled": disabled || loading,
|
|
32
32
|
onClick: disabled || loading ? undefined : onClick
|
|
33
33
|
}), children);
|
|
34
|
-
return tooltip ? /*#__PURE__*/
|
|
34
|
+
return tooltip ? /*#__PURE__*/createElement(Tooltip, {
|
|
35
35
|
content: tooltip
|
|
36
36
|
}, button) : button;
|
|
37
37
|
});
|
|
@@ -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","button","undefined","Tooltip","content","displayName","defaultProps"],"mappings":";;;;;;AAyCA;;;;MAGMA,MAAM,gBAAGC,UAAA,CAAiD,SAASD,MAAT,OAY5DE,GAZ4D;MAC5D;IACIC,IAAI,GAAG,QADX;IAEIC,OAFJ;IAGIC,IAAI,GAAG,SAHX;IAIIC,OAAO,GAAG,KAJd;IAKIC,QAAQ,GAAG,KALf;IAMIC,OANJ;IAOIC,OAPJ;IAQIC;;MACGC;;EAIP,MAAMC,SAAS,GAAGC,UAAU,CACxB,iBADwB,EAExBT,OAAO,yBAAuBA,OAAvB,GAAmC,IAFlB,EAGxBC,IAAI,KAAK,SAAT,yBAAyCA,IAAzC,GAAkD,IAH1B,EAIxB;IAAE,4BAA4BC;GAJN,EAKxBK,KAAK,CAACC,SALkB,CAA5B;EAQA,MAAME,MAAM,gBACRb,aAAA,SAAA,oCACQU,KADR;IAEIT,GAAG,EAAEA,GAFT;IAGIC,IAAI,EAAEA,IAHV;IAIIS,SAAS,EAAEA,SAJf;qBAKmBL,QAAQ,IAAID,OAL/B;IAMIG,OAAO,EAAEF,QAAQ,IAAID,OAAZ,GAAsBS,SAAtB,GAAkCN;MAE1CC,QARL,CADJ;EAaA,OAAOF,OAAO,gBAAGP,aAAA,CAACe,OAAD;IAASC,OAAO,EAAET;GAAlB,EAA4BM,MAA5B,CAAH,GAAmDA,MAAjE;AACH,CApCc;AAsCfd,MAAM,CAACkB,WAAP,GAAqB,QAArB;AAEAlB,MAAM,CAACmB,YAAP,GAAsB;EAClBd,IAAI,EAAE,SADY;EAElBC,OAAO,EAAE,KAFS;EAGlBC,QAAQ,EAAE;AAHQ,CAAtB;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { Component, cloneElement, createElement, forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import Button from '../deprecated-button/index.js';
|
|
6
6
|
|
|
7
7
|
const _excluded = ["children", "onClick", "tooltip", "className"];
|
|
8
8
|
|
|
9
|
-
class Box extends
|
|
9
|
+
class Box extends Component {
|
|
10
10
|
constructor(props, context) {
|
|
11
11
|
super(props, context);
|
|
12
12
|
this._timeout = void 0;
|
|
@@ -93,7 +93,7 @@ class Box extends React__default.Component {
|
|
|
93
93
|
|
|
94
94
|
const _trigger = (_this$props$children = this.props.children) == null ? void 0 : _this$props$children[0];
|
|
95
95
|
|
|
96
|
-
return _trigger ? /*#__PURE__*/
|
|
96
|
+
return _trigger ? /*#__PURE__*/cloneElement(_trigger, {
|
|
97
97
|
onClick: this._toggleShowBody
|
|
98
98
|
}) : undefined;
|
|
99
99
|
} // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components
|
|
@@ -123,8 +123,8 @@ class Box extends React__default.Component {
|
|
|
123
123
|
bottom: !top
|
|
124
124
|
});
|
|
125
125
|
const body = children == null ? void 0 : children[1];
|
|
126
|
-
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/
|
|
127
|
-
return /*#__PURE__*/
|
|
126
|
+
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/cloneElement(body, props) : undefined;
|
|
127
|
+
return /*#__PURE__*/createElement("div", {
|
|
128
128
|
className: className,
|
|
129
129
|
style: {
|
|
130
130
|
position: 'relative'
|
|
@@ -137,7 +137,7 @@ class Box extends React__default.Component {
|
|
|
137
137
|
const {
|
|
138
138
|
top
|
|
139
139
|
} = this.state;
|
|
140
|
-
return /*#__PURE__*/
|
|
140
|
+
return /*#__PURE__*/createElement("div", {
|
|
141
141
|
style: {
|
|
142
142
|
display: 'inline-block'
|
|
143
143
|
},
|
|
@@ -150,7 +150,7 @@ class Box extends React__default.Component {
|
|
|
150
150
|
|
|
151
151
|
Box.displayName = void 0;
|
|
152
152
|
Box.displayName = 'Dropdown.Box';
|
|
153
|
-
const Trigger = /*#__PURE__*/
|
|
153
|
+
const Trigger = /*#__PURE__*/forwardRef(function Trigger(_ref, ref) {
|
|
154
154
|
let {
|
|
155
155
|
children,
|
|
156
156
|
onClick,
|
|
@@ -165,7 +165,7 @@ const Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, re
|
|
|
165
165
|
if (onClick) onClick(event);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
return /*#__PURE__*/
|
|
168
|
+
return /*#__PURE__*/createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
169
169
|
className: classNames('trigger', className),
|
|
170
170
|
onClick: handleClick,
|
|
171
171
|
tooltip: tooltip,
|
|
@@ -196,7 +196,7 @@ function Body({
|
|
|
196
196
|
style.left = 0;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
return /*#__PURE__*/
|
|
199
|
+
return /*#__PURE__*/createElement("div", {
|
|
200
200
|
ref: setPosition,
|
|
201
201
|
style: style,
|
|
202
202
|
className: "body",
|
|
@@ -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","_timeout","_handleClickOutside","event","dropdownDOMNode","ReactDOM","findDOMNode","contains","target","_toggleShowBody","allowBodyInteractions","setTimeout","state","showBody","onShowBody","document","addEventListener","onHideBody","removeEventListener","setState","_setPosition","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","dropdownTriggerHeight","clientHeight","dropdownBodyHeight","scrollingParentHeight","scrollingParentOffset","scrollTop","bottomOffset","top","undefined","componentWillUnmount","clearTimeout","_getTriggerComponent","_trigger","children","cloneElement","onClick","_getBodyComponent","right","setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","displayName","Trigger","forwardRef","ref","tooltip","handleClick","preventDefault","stopPropagation","Button","Body","left","id","Dropdown"],"mappings":";;;;;;;;AA2BA,MAAMA,GAAN,SAAkBC,cAAK,CAACC,SAAxB;EAGIC,YAAYC,OAAiBC;IACzB,MAAMD,KAAN,EAAaC,OAAb;SAeJC;;SAEAC,sBAAuBC,KAAD;MAClB,MAAMC,eAAe,GAAGC,QAAQ,CA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;MAAclD;;EAG5C,SAASiE,WAAT,CAAqB7D,KAArB;IACIA,KAAK,CAAC8D,cAAN;IACA9D,KAAK,CAAC+D,eAAN;IACA,IAAIrB,OAAJ,EAAaA,OAAO,CAAC1C,KAAD,CAAP;;;EAGjB,oBACIP,4BAAA,CAACuE,MAAD,oCACQpE,KADR;IAEIkD,SAAS,EAAEC,UAAU,CAAC,SAAD,EAAYD,SAAZ,CAFzB;IAGIJ,OAAO,EAAEmB,WAHb;IAIID,OAAO,EAAEA,OAJb;IAKID,GAAG,EAAEA;MAEJnB,QAPL,CADJ;AAWH,CArBe,CAAhB;AAuBAiB,OAAO,CAACD,WAAR,GAAsB,kBAAtB;;AASA,SAASS,IAAT,CAAc;EAAE/B,GAAF;EAAOU,KAAP;EAAcJ,QAAd;EAAwBK;AAAxB,CAAd;EACI,MAAMO,KAAK,GAAwB;IAAEC,QAAQ,EAAE,UAAZ;IAAwBT,KAAK,EAAE,CAA/B;IAAkCV,GAAG,EAAE;GAA1E;;EAEA,IAAIA,GAAJ,EAAS;IACLkB,KAAK,CAAClB,GAAN,GAAY,MAAZ;IACAkB,KAAK,CAACF,MAAN,GAAe,CAAf;;;EAGJ,IAAIN,KAAJ,EAAW;IACPQ,KAAK,CAACR,KAAN,GAAc,MAAd;IACAQ,KAAK,CAACc,IAAN,GAAa,CAAb;;;EAGJ,oBACIzE,4BAAA,MAAA;IACIkE,GAAG,EAAEd;IACLO,KAAK,EAAEA;IACPN,SAAS,EAAC;IACVqB,EAAE,EAAC;mBACS;GALhB,EAOK3B,QAPL,CADJ;AAWH;;AAEDyB,IAAI,CAACT,WAAL,GAAmB,eAAnB;MAEMY,QAAQ,GAAG;EACb5E,GADa;EAEbiE,OAFa;EAGbQ;AAHa;;;;"}
|
|
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","_timeout","_handleClickOutside","event","dropdownDOMNode","ReactDOM","findDOMNode","contains","target","_toggleShowBody","allowBodyInteractions","setTimeout","state","showBody","onShowBody","document","addEventListener","onHideBody","removeEventListener","setState","_setPosition","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","dropdownTriggerHeight","clientHeight","dropdownBodyHeight","scrollingParentHeight","scrollingParentOffset","scrollTop","bottomOffset","top","undefined","componentWillUnmount","clearTimeout","_getTriggerComponent","_trigger","children","onClick","_getBodyComponent","right","setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","displayName","Trigger","ref","tooltip","handleClick","preventDefault","stopPropagation","Button","Body","left","id","Dropdown"],"mappings":";;;;;;;;AA2BA,MAAMA,GAAN,SAAkBC,SAAlB;EAGIC,YAAYC,OAAiBC;IACzB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
2
|
-
import
|
|
2
|
+
import { forwardRef, createElement } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
const Input = /*#__PURE__*/
|
|
5
|
+
const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
6
6
|
const className = classNames('reactist_input', props.className);
|
|
7
|
-
return /*#__PURE__*/
|
|
7
|
+
return /*#__PURE__*/createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
8
8
|
className: className,
|
|
9
9
|
ref: ref
|
|
10
10
|
}));
|
|
@@ -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":";;;;MAaMA,KAAK,gBAAwCC,UAAA,CAC/C,CAACC,KAAD,EAAeC,GAAf;EACI,MAAMC,SAAS,GAAGC,UAAU,CAAC,gBAAD,EAAmBH,KAAK,CAACE,SAAzB,CAA5B;EACA,oBAAOH,aAAA,QAAA,oCAAWC,KAAX;IAAkBE,SAAS,EAAEA,SAA7B;IAAwCD,GAAG,EAAEA;KAApD;AACH,CAJ8C;AAMnDH,KAAK,CAACM,WAAN,GAAoB,OAApB;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { createElement, Fragment } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import CloseIcon from '../icons/CloseIcon.svg.js';
|
|
5
5
|
|
|
6
6
|
const _excluded = ["id", "icon", "title", "subtitle", "children", "customCloseButton", "onClick", "onClose", "closeAltText", "className", "aria-live"];
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function DeprecatedNotification(_ref) {
|
|
9
9
|
let {
|
|
10
10
|
id,
|
|
11
11
|
icon,
|
|
@@ -41,17 +41,17 @@ function Notification(_ref) {
|
|
|
41
41
|
const ariaDescribedBy = subtitleId && !children ? {
|
|
42
42
|
'aria-describedby': subtitleId
|
|
43
43
|
} : null;
|
|
44
|
-
const notificationContent = /*#__PURE__*/
|
|
44
|
+
const notificationContent = /*#__PURE__*/createElement("div", _objectSpread2({
|
|
45
45
|
className: "reactist-notification__content"
|
|
46
|
-
}, contentIdAttribute), children != null ? children : /*#__PURE__*/
|
|
46
|
+
}, contentIdAttribute), children != null ? children : /*#__PURE__*/createElement(Fragment, null, title ? /*#__PURE__*/createElement("h3", _objectSpread2({
|
|
47
47
|
className: "reactist-notification__title"
|
|
48
|
-
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/
|
|
48
|
+
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/createElement("p", _objectSpread2({
|
|
49
49
|
className: "reactist-notification__subtitle"
|
|
50
50
|
}, subtitleIdAttribute), subtitle) : null));
|
|
51
|
-
const notificationBody = /*#__PURE__*/
|
|
51
|
+
const notificationBody = /*#__PURE__*/createElement("div", {
|
|
52
52
|
className: "reactist-notification__icon-content-group"
|
|
53
53
|
}, icon != null ? icon : null, notificationContent);
|
|
54
|
-
return /*#__PURE__*/
|
|
54
|
+
return /*#__PURE__*/createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
55
55
|
id: id,
|
|
56
56
|
role: "alert",
|
|
57
57
|
className: classNames('reactist-notification', className, {
|
|
@@ -59,15 +59,15 @@ function Notification(_ref) {
|
|
|
59
59
|
'reactist-notification--with-close-button': Boolean(onClose)
|
|
60
60
|
}),
|
|
61
61
|
"aria-live": ariaLive
|
|
62
|
-
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/
|
|
62
|
+
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/createElement("button", {
|
|
63
63
|
className: "reactist-notification__button",
|
|
64
64
|
onClick: onClick
|
|
65
|
-
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/
|
|
65
|
+
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/createElement("button", {
|
|
66
66
|
className: "reactist-notification__close-button",
|
|
67
67
|
onClick: onClose,
|
|
68
68
|
"aria-label": closeAltText
|
|
69
|
-
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/
|
|
69
|
+
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/createElement(CloseIcon, null)) : null);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export {
|
|
73
|
-
//# sourceMappingURL=notification.js.map
|
|
72
|
+
export { DeprecatedNotification };
|
|
73
|
+
//# sourceMappingURL=deprecated-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated-notification.js","sources":["../../../src/components/deprecated-notification/deprecated-notification.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport CloseIcon from '../icons/CloseIcon.svg'\nimport './deprecated-notification.less'\n\ntype DeprecatedNotificationProps = {\n id: string\n icon?: React.ReactNode\n title?: React.ReactNode\n subtitle?: React.ReactNode\n children?: React.ReactNode\n customCloseButton?: React.ReactNode\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n onClose?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n closeAltText?: string\n className?: string\n /** Indicates that the notification will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */\n 'aria-live'?: 'off' | 'polite' | 'assertive'\n} & Omit<JSX.IntrinsicElements['div'], 'aria-live'>\n\nfunction DeprecatedNotification({\n id,\n icon,\n title,\n subtitle,\n children,\n customCloseButton,\n onClick,\n onClose,\n closeAltText = 'Close',\n className,\n 'aria-live': ariaLive = 'polite',\n ...rest\n}: DeprecatedNotificationProps) {\n const titleId = title ? `${id}-title` : null\n const titleIdAttribute = titleId ? { id: titleId } : null\n const subtitleId = subtitle ? `${id}-subtitle` : null\n const subtitleIdAttribute = subtitleId ? { id: subtitleId } : null\n const contentId = children ? `${id}-content` : null\n const contentIdAttribute = children ? { id: `${id}-content` } : null\n const ariaLabelledBy = contentId\n ? { 'aria-labelledby': contentId }\n : titleId\n ? { 'aria-labelledby': titleId }\n : null\n const ariaDescribedBy = subtitleId && !children ? { 'aria-describedby': subtitleId } : null\n\n const notificationContent = (\n <div className=\"reactist-notification__content\" {...contentIdAttribute}>\n {children ?? (\n <>\n {title ? (\n <h3 className=\"reactist-notification__title\" {...titleIdAttribute}>\n {title}\n </h3>\n ) : null}\n {subtitle ? (\n <p className=\"reactist-notification__subtitle\" {...subtitleIdAttribute}>\n {subtitle}\n </p>\n ) : null}\n </>\n )}\n </div>\n )\n const notificationBody = (\n <div className=\"reactist-notification__icon-content-group\">\n {icon ?? null}\n {notificationContent}\n </div>\n )\n\n return (\n <div\n id={id}\n role=\"alert\"\n className={classNames('reactist-notification', className, {\n 'reactist-notification--with-button': Boolean(onClick),\n 'reactist-notification--with-close-button': Boolean(onClose),\n })}\n aria-live={ariaLive}\n {...ariaLabelledBy}\n {...ariaDescribedBy}\n {...rest}\n >\n {onClick ? (\n <button className=\"reactist-notification__button\" onClick={onClick}>\n {notificationBody}\n </button>\n ) : (\n notificationBody\n )}\n\n {onClose ? (\n <button\n className=\"reactist-notification__close-button\"\n onClick={onClose}\n aria-label={closeAltText}\n >\n {customCloseButton ?? <CloseIcon />}\n </button>\n ) : null}\n </div>\n )\n}\n\nexport { DeprecatedNotification }\n"],"names":["DeprecatedNotification","id","icon","title","subtitle","children","customCloseButton","onClick","onClose","closeAltText","className","ariaLive","rest","titleId","titleIdAttribute","subtitleId","subtitleIdAttribute","contentId","contentIdAttribute","ariaLabelledBy","ariaDescribedBy","notificationContent","React","notificationBody","role","classNames","Boolean","CloseIcon"],"mappings":";;;;;;;AAoBA,SAASA,sBAAT;MAAgC;IAC5BC,EAD4B;IAE5BC,IAF4B;IAG5BC,KAH4B;IAI5BC,QAJ4B;IAK5BC,QAL4B;IAM5BC,iBAN4B;IAO5BC,OAP4B;IAQ5BC,OAR4B;IAS5BC,YAAY,GAAG,OATa;IAU5BC,SAV4B;IAW5B,aAAaC,QAAQ,GAAG;;MACrBC;;EAEH,MAAMC,OAAO,GAAGV,KAAK,GAAMF,EAAN,cAAmB,IAAxC;EACA,MAAMa,gBAAgB,GAAGD,OAAO,GAAG;IAAEZ,EAAE,EAAEY;GAAT,GAAqB,IAArD;EACA,MAAME,UAAU,GAAGX,QAAQ,GAAMH,EAAN,iBAAsB,IAAjD;EACA,MAAMe,mBAAmB,GAAGD,UAAU,GAAG;IAAEd,EAAE,EAAEc;GAAT,GAAwB,IAA9D;EACA,MAAME,SAAS,GAAGZ,QAAQ,GAAMJ,EAAN,gBAAqB,IAA/C;EACA,MAAMiB,kBAAkB,GAAGb,QAAQ,GAAG;IAAEJ,EAAE,EAAKA,EAAL;GAAP,GAA6B,IAAhE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IA5BR,CADJ;AAgCH;;;;"}
|
|
@@ -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 classNames from 'classnames';
|
|
4
4
|
|
|
5
5
|
const _excluded = ["value", "options", "onChange", "disabled", "className", "defaultValue"];
|
|
@@ -18,13 +18,13 @@ function Select(_ref) {
|
|
|
18
18
|
const selectClassName = classNames('reactist_select', {
|
|
19
19
|
disabled
|
|
20
20
|
}, className);
|
|
21
|
-
return /*#__PURE__*/
|
|
21
|
+
return /*#__PURE__*/createElement("select", _objectSpread2({
|
|
22
22
|
className: selectClassName,
|
|
23
23
|
value: value,
|
|
24
24
|
onChange: event => onChange ? onChange(event.target.value) : undefined,
|
|
25
25
|
disabled: disabled,
|
|
26
26
|
defaultValue: defaultValue
|
|
27
|
-
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/
|
|
27
|
+
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/createElement("option", {
|
|
28
28
|
key: option.key || option.value,
|
|
29
29
|
value: option.value,
|
|
30
30
|
disabled: option.disabled
|
|
@@ -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":";;;;;;AA6BA,SAASA,MAAT;MAAgB;IACZC,KADY;IAEZC,OAAO,GAAG,EAFE;IAGZC,QAHY;IAIZC,QAAQ,GAAG,IAJC;IAKZC,SAAS,GAAG,EALA;IAMZC;;MACGC;;EAEH,MAAMC,eAAe,GAAGC,UAAU,CAAC,iBAAD,EAAoB;IAAEL;GAAtB,EAAkCC,SAAlC,CAAlC;EACA,oBACIK,
|
|
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":";;;;;;AA6BA,SAASA,MAAT;MAAgB;IACZC,KADY;IAEZC,OAAO,GAAG,EAFE;IAGZC,QAHY;IAIZC,QAAQ,GAAG,IAJC;IAKZC,SAAS,GAAG,EALA;IAMZC;;MACGC;;EAEH,MAAMC,eAAe,GAAGC,UAAU,CAAC,iBAAD,EAAoB;IAAEL;GAAtB,EAAkCC,SAAlC,CAAlC;EACA,oBACIK,aAAA,SAAA;IACIL,SAAS,EAAEG,eADf;IAEIP,KAAK,EAAEA,KAFX;IAGIE,QAAQ,EAAGQ,KAAD,IAAYR,QAAQ,GAAGA,QAAQ,CAACQ,KAAK,CAACC,MAAN,CAAaX,KAAd,CAAX,GAAkCY,SAHpE;IAIIT,QAAQ,EAAEA,QAJd;IAKIE,YAAY,EAAEA;KACVC,UANR,GAQKL,OARL,oBAQKA,OAAO,CAAEY,GAAT,CAAcC,MAAD,iBACVL,aAAA,SAAA;IACIM,GAAG,EAAED,MAAM,CAACC,GAAP,IAAcD,MAAM,CAACd;IAC1BA,KAAK,EAAEc,MAAM,CAACd;IACdG,QAAQ,EAAEW,MAAM,CAACX;GAHrB,EAKKW,MAAM,CAACE,IALZ,CADH,CARL,CADJ;AAoBH;;AACDjB,MAAM,CAACkB,WAAP,GAAqB,QAArB;AACAlB,MAAM,CAACmB,YAAP,GAAsB;EAClBjB,OAAO,EAAE,EADS;EAElBE,QAAQ,EAAE;AAFQ,CAAtB;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement } from 'react';
|
|
2
2
|
|
|
3
|
-
const CloseIcon = () => /*#__PURE__*/
|
|
3
|
+
const CloseIcon = () => /*#__PURE__*/createElement("svg", {
|
|
4
4
|
width: "24",
|
|
5
5
|
height: "24",
|
|
6
6
|
viewBox: "0 0 24 24"
|
|
7
|
-
}, /*#__PURE__*/
|
|
7
|
+
}, /*#__PURE__*/createElement("path", {
|
|
8
8
|
fill: "gray",
|
|
9
9
|
fillRule: "evenodd",
|
|
10
10
|
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"
|
|
@@ -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":["CloseIcon","React","width","height","viewBox","fill","fillRule","d"],"mappings":";;AAEA,MAAMA,SAAS,GAAG,mBACdC,
|
|
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":["CloseIcon","React","width","height","viewBox","fill","fillRule","d"],"mappings":";;AAEA,MAAMA,SAAS,GAAG,mBACdC,aAAA,MAAA;EAAKC,KAAK,EAAC;EAAKC,MAAM,EAAC;EAAKC,OAAO,EAAC;CAApC,eACIH,aAAA,OAAA;EACII,IAAI,EAAC;EACLC,QAAQ,EAAC;EACTC,CAAC,EAAC;CAHN,CADJ,CADJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import { useRef, cloneElement } from 'react';
|
|
3
3
|
|
|
4
4
|
const SUPPORTED_KEYS = {
|
|
5
5
|
ARROW_UP: 'ArrowUp',
|
|
@@ -178,7 +178,7 @@ function KeyCapturer(props) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
return /*#__PURE__*/
|
|
181
|
+
return /*#__PURE__*/cloneElement(children, _objectSpread2({
|
|
182
182
|
[eventName]: handleKeyEvent
|
|
183
183
|
}, composingEventHandlers));
|
|
184
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-capturer.js","sources":["../../../src/components/key-capturer/key-capturer.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"key-capturer.js","sources":["../../../src/components/key-capturer/key-capturer.tsx"],"sourcesContent":["import * as React from 'react'\n\ntype Key = 'ArrowUp' | 'ArrowRight' | 'ArrowDown' | 'ArrowLeft' | 'Enter' | 'Backspace' | 'Escape'\n\nconst SUPPORTED_KEYS: Record<string, Key> = {\n ARROW_UP: 'ArrowUp',\n ARROW_RIGHT: 'ArrowRight',\n ARROW_DOWN: 'ArrowDown',\n ARROW_LEFT: 'ArrowLeft',\n ENTER: 'Enter',\n BACKSPACE: 'Backspace',\n ESCAPE: 'Escape',\n}\n\nconst KeyCapturerResolver = {\n resolveByKey(eventKey: string): Key | null {\n switch (eventKey) {\n case 'Left': // IE specific\n case 'ArrowLeft': {\n return 'ArrowLeft'\n }\n case 'Up': // IE specific\n case 'ArrowUp': {\n return 'ArrowUp'\n }\n case 'Right': // IE specific\n case 'ArrowRight': {\n return 'ArrowRight'\n }\n case 'Down': // IE specific\n case 'ArrowDown': {\n return 'ArrowDown'\n }\n case 'Enter': {\n return 'Enter'\n }\n case 'Backspace': {\n return 'Backspace'\n }\n case 'Esc': // IE specific\n case 'Escape': {\n return 'Escape'\n }\n default: {\n return null\n }\n }\n },\n\n resolveByKeyCode(keyCode: number): Key | null {\n switch (keyCode) {\n case 37: {\n return 'ArrowLeft'\n }\n case 38: {\n return 'ArrowUp'\n }\n case 39: {\n return 'ArrowRight'\n }\n case 40: {\n return 'ArrowDown'\n }\n case 13: {\n return 'Enter'\n }\n case 8: {\n return 'Backspace'\n }\n case 27: {\n return 'Escape'\n }\n default: {\n return null\n }\n }\n },\n}\n\ntype EventHandler = (event: React.SyntheticEvent) => void\n\ntype EventHandlerProps = {\n onArrowUp?: EventHandler\n onArrowDown?: EventHandler\n onArrowLeft?: EventHandler\n onArrowRight?: EventHandler\n onEnter?: EventHandler\n onBackspace?: EventHandler\n onEscape?: EventHandler\n}\n\ntype PropagateProps = {\n propagateArrowUp?: boolean\n propagateArrowDown?: boolean\n propagateArrowLeft?: boolean\n propagateArrowRight?: boolean\n propagateEnter?: boolean\n propagateBackspace?: boolean\n propagateEscape?: boolean\n}\n\nconst keyEventHandlerMapping: Record<Key, keyof EventHandlerProps> = {\n ArrowUp: 'onArrowUp',\n ArrowDown: 'onArrowDown',\n ArrowLeft: 'onArrowLeft',\n ArrowRight: 'onArrowRight',\n Enter: 'onEnter',\n Backspace: 'onBackspace',\n Escape: 'onEscape',\n}\n\nconst keyPropagatePropMapping: Record<Key, keyof PropagateProps> = {\n ArrowUp: 'propagateArrowUp',\n ArrowDown: 'propagateArrowDown',\n ArrowLeft: 'propagateArrowLeft',\n ArrowRight: 'propagateArrowRight',\n Enter: 'propagateEnter',\n Backspace: 'propagateBackspace',\n Escape: 'propagateEscape',\n}\n\ntype KeyCapturerProps = EventHandlerProps &\n PropagateProps & {\n eventName?: 'onKeyDown' | 'onKeyDownCapture' | 'onKeyUp' | 'onKeyUpCapture'\n children: React.ReactElement<unknown>\n }\n\n/**\n * Use this component to wrap anything you want to handle key events for (e.g. an input).\n * You can specify the `eventName` to capture (defaults to `onKeyDown`).\n * Check the SUPPORTED_KEYS map to see which keys are supported and supply the respective\n * `on${Key}` prop (i.e. `onEnter` or `onArrowDown`).\n * If you want the default behaviour to be preserved (i.e. only want to hook into the event\n * instead of replacing it) set the `propagate${Key}` prop (e.g. propagateBackspace).\n */\nfunction KeyCapturer(props: KeyCapturerProps) {\n const { children, eventName = 'onKeyDown' } = props\n const composingRef = React.useRef(false)\n const composingEventHandlers = props.onEnter\n ? {\n onCompositionStart: () => {\n composingRef.current = true\n },\n onCompositionEnd: () => {\n composingRef.current = false\n },\n }\n : undefined\n\n function handleKeyEvent(event: React.KeyboardEvent<HTMLInputElement>) {\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode\n const key =\n event.key !== undefined\n ? KeyCapturerResolver.resolveByKey(event.key)\n : KeyCapturerResolver.resolveByKeyCode(event.keyCode)\n\n if (!key) return\n const propagateEvent = props[keyPropagatePropMapping[key]] || false\n const eventHandler = props[keyEventHandlerMapping[key]]\n\n if (key === 'Enter' && eventHandler) {\n if (\n composingRef.current ||\n // Safari fires the onCompositionEnd event before the keydown event, so we\n // have to rely on the 229 keycode, which is Enter when fired from an IME\n // https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode\n (event.keyCode || event.which) === 229\n ) {\n return\n }\n }\n\n if (eventHandler) {\n eventHandler(event)\n if (!propagateEvent) {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n }\n\n return React.cloneElement(children, {\n [eventName]: handleKeyEvent,\n ...composingEventHandlers,\n })\n}\n\nexport { KeyCapturer, KeyCapturerResolver, SUPPORTED_KEYS }\n"],"names":["SUPPORTED_KEYS","ARROW_UP","ARROW_RIGHT","ARROW_DOWN","ARROW_LEFT","ENTER","BACKSPACE","ESCAPE","KeyCapturerResolver","resolveByKey","eventKey","resolveByKeyCode","keyCode","keyEventHandlerMapping","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","Backspace","Escape","keyPropagatePropMapping","KeyCapturer","props","children","eventName","composingRef","React","composingEventHandlers","onEnter","onCompositionStart","current","onCompositionEnd","undefined","handleKeyEvent","event","key","propagateEvent","eventHandler","which","preventDefault","stopPropagation"],"mappings":";;;MAIMA,cAAc,GAAwB;EACxCC,QAAQ,EAAE,SAD8B;EAExCC,WAAW,EAAE,YAF2B;EAGxCC,UAAU,EAAE,WAH4B;EAIxCC,UAAU,EAAE,WAJ4B;EAKxCC,KAAK,EAAE,OALiC;EAMxCC,SAAS,EAAE,WAN6B;EAOxCC,MAAM,EAAE;AAPgC;MAUtCC,mBAAmB,GAAG;EACxBC,YAAY,CAACC,QAAD;IACR,QAAQA,QAAR;MACI,KAAK,MAAL,CADJ;;MAEI,KAAK,WAAL;QAAkB;UACd,OAAO,WAAP;;;MAEJ,KAAK,IAAL,CALJ;;MAMI,KAAK,SAAL;QAAgB;UACZ,OAAO,SAAP;;;MAEJ,KAAK,OAAL,CATJ;;MAUI,KAAK,YAAL;QAAmB;UACf,OAAO,YAAP;;;MAEJ,KAAK,MAAL,CAbJ;;MAcI,KAAK,WAAL;QAAkB;UACd,OAAO,WAAP;;;MAEJ,KAAK,OAAL;QAAc;UACV,OAAO,OAAP;;;MAEJ,KAAK,WAAL;QAAkB;UACd,OAAO,WAAP;;;MAEJ,KAAK,KAAL,CAvBJ;;MAwBI,KAAK,QA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MACdN,YAAY,CAACK,OAAb,GAAuB,KAAvB;;GANiB,GASzBE,SATN;;EAWA,SAASC,cAAT,CAAwBC,KAAxB;;IAEI,MAAMC,GAAG,GACLD,KAAK,CAACC,GAAN,KAAcH,SAAd,GACMzB,mBAAmB,CAACC,YAApB,CAAiC0B,KAAK,CAACC,GAAvC,CADN,GAEM5B,mBAAmB,CAACG,gBAApB,CAAqCwB,KAAK,CAACvB,OAA3C,CAHV;IAKA,IAAI,CAACwB,GAAL,EAAU;IACV,MAAMC,cAAc,GAAGd,KAAK,CAACF,uBAAuB,CAACe,GAAD,CAAxB,CAAL,IAAuC,KAA9D;IACA,MAAME,YAAY,GAAGf,KAAK,CAACV,sBAAsB,CAACuB,GAAD,CAAvB,CAA1B;;IAEA,IAAIA,GAAG,KAAK,OAAR,IAAmBE,YAAvB,EAAqC;MACjC,IACIZ,YAAY,CAACK,OAAb;;;MAIA,CAACI,KAAK,CAACvB,OAAN,IAAiBuB,KAAK,CAACI,KAAxB,MAAmC,GALvC,EAME;QACE;;;;IAIR,IAAID,YAAJ,EAAkB;MACdA,YAAY,CAACH,KAAD,CAAZ;;MACA,IAAI,CAACE,cAAL,EAAqB;QACjBF,KAAK,CAACK,cAAN;QACAL,KAAK,CAACM,eAAN;;;;;EAKZ,oBAAOd,YAAA,CAAmBH,QAAnB;IACH,CAACC,SAAD,GAAaS;KACVN,sBAFA,EAAP;AAIH;;;;"}
|
|
@@ -2,8 +2,8 @@ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _
|
|
|
2
2
|
import { useCallback, useMemo, createElement, useContext, forwardRef, Children, cloneElement, createContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { polymorphicComponent } from '../../utils/polymorphism.js';
|
|
5
|
-
import FocusLock from 'react-focus-lock';
|
|
6
5
|
import { Portal } from 'ariakit/portal';
|
|
6
|
+
import FocusLock from 'react-focus-lock';
|
|
7
7
|
import { useMenuState, MenuButton as MenuButton$1, Menu as Menu$1, MenuItem as MenuItem$1, useMenuItem, MenuGroup as MenuGroup$1 } from 'ariakit/menu';
|
|
8
8
|
|
|
9
9
|
const _excluded = ["children", "onItemSelect"],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { HiddenVisually } from '../../new-components/hidden-visually/hidden-visually.js';
|
|
4
4
|
|
|
@@ -9,14 +9,14 @@ function ProgressBar({
|
|
|
9
9
|
}) {
|
|
10
10
|
const finalClassName = classNames('reactist_progress_bar', className);
|
|
11
11
|
const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage;
|
|
12
|
-
return /*#__PURE__*/
|
|
12
|
+
return /*#__PURE__*/createElement("div", {
|
|
13
13
|
className: finalClassName
|
|
14
|
-
}, /*#__PURE__*/
|
|
14
|
+
}, /*#__PURE__*/createElement("div", {
|
|
15
15
|
className: "inner",
|
|
16
16
|
style: {
|
|
17
17
|
width: width + "%"
|
|
18
18
|
}
|
|
19
|
-
}), /*#__PURE__*/
|
|
19
|
+
}), /*#__PURE__*/createElement(HiddenVisually, null, /*#__PURE__*/createElement("progress", {
|
|
20
20
|
value: width,
|
|
21
21
|
max: 100,
|
|
22
22
|
"aria-valuetext": ariaValuetext != null ? ariaValuetext : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import React from 'react'\nimport { HiddenVisually } from '../../new-components/hidden-visually'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n /** Defines the human readable text alternative for assitive technologies. */\n 'aria-valuetext'?: string\n}\nfunction ProgressBar({ fillPercentage = 0, className, 'aria-valuetext': ariaValuetext }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n <HiddenVisually>\n <progress value={width} max={100} aria-valuetext={ariaValuetext ?? undefined} />\n </HiddenVisually>\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","className","ariaValuetext","finalClassName","classNames","width","React","style","HiddenVisually","value","max","undefined","displayName"],"mappings":";;;;AAcA,SAASA,WAAT,CAAqB;EAAEC,cAAc,GAAG,CAAnB;EAAsBC,SAAtB;EAAiC,kBAAkBC;AAAnD,CAArB;EACI,MAAMC,cAAc,GAAGC,UAAU,CAAC,uBAAD,EAA0BH,SAA1B,CAAjC;EACA,MAAMI,KAAK,GAAGL,cAAc,GAAG,CAAjB,GAAqB,CAArB,GAAyBA,cAAc,GAAG,GAAjB,GAAuB,GAAvB,GAA6BA,cAApE;EACA,oBACIM,
|
|
1
|
+
{"version":3,"file":"progress-bar.js","sources":["../../../src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["import * as React from 'react'\nimport { HiddenVisually } from '../../new-components/hidden-visually'\nimport classNames from 'classnames'\n\nimport './progress-bar.less'\n\ntype Props = {\n /** Additional css class applied to the progress bar. */\n className?: string\n /** How much of the progress bar should be filled. Number between 0 and 100 inclusive. */\n fillPercentage?: number\n /** Defines the human readable text alternative for assitive technologies. */\n 'aria-valuetext'?: string\n}\nfunction ProgressBar({ fillPercentage = 0, className, 'aria-valuetext': ariaValuetext }: Props) {\n const finalClassName = classNames('reactist_progress_bar', className)\n const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage\n return (\n <div className={finalClassName}>\n <div className=\"inner\" style={{ width: `${width}%` }} />\n <HiddenVisually>\n <progress value={width} max={100} aria-valuetext={ariaValuetext ?? undefined} />\n </HiddenVisually>\n </div>\n )\n}\nProgressBar.displayName = 'ProgressBar'\n\nexport { ProgressBar }\n"],"names":["ProgressBar","fillPercentage","className","ariaValuetext","finalClassName","classNames","width","React","style","HiddenVisually","value","max","undefined","displayName"],"mappings":";;;;AAcA,SAASA,WAAT,CAAqB;EAAEC,cAAc,GAAG,CAAnB;EAAsBC,SAAtB;EAAiC,kBAAkBC;AAAnD,CAArB;EACI,MAAMC,cAAc,GAAGC,UAAU,CAAC,uBAAD,EAA0BH,SAA1B,CAAjC;EACA,MAAMI,KAAK,GAAGL,cAAc,GAAG,CAAjB,GAAqB,CAArB,GAAyBA,cAAc,GAAG,GAAjB,GAAuB,GAAvB,GAA6BA,cAApE;EACA,oBACIM,aAAA,MAAA;IAAKL,SAAS,EAAEE;GAAhB,eACIG,aAAA,MAAA;IAAKL,SAAS,EAAC;IAAQM,KAAK,EAAE;MAAEF,KAAK,EAAKA,KAAL;;GAArC,CADJ,eAEIC,aAAA,CAACE,cAAD,MAAA,eACIF,aAAA,WAAA;IAAUG,KAAK,EAAEJ;IAAOK,GAAG,EAAE;sBAAqBR,wBAAAA,gBAAiBS;GAAnE,CADJ,CAFJ,CADJ;AAQH;;AACDZ,WAAW,CAACa,WAAZ,GAA0B,aAA1B;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component, createElement } from 'react';
|
|
2
2
|
import { Tooltip } from '../tooltip/tooltip.js';
|
|
3
3
|
import { TimeUtils } from './time-utils.js';
|
|
4
4
|
|
|
5
5
|
const DELAY = 60000;
|
|
6
6
|
|
|
7
|
-
class Time extends
|
|
7
|
+
class Time extends Component {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
10
|
this.refreshInterval = void 0;
|
|
@@ -93,13 +93,13 @@ class Time extends React__default.Component {
|
|
|
93
93
|
|
|
94
94
|
const timeComponent = this._renderTime(this.props.config);
|
|
95
95
|
|
|
96
|
-
return /*#__PURE__*/
|
|
96
|
+
return /*#__PURE__*/createElement("time", {
|
|
97
97
|
className: className,
|
|
98
98
|
onMouseEnter: event => this._setHovered(true, event),
|
|
99
99
|
onMouseLeave: event => this._setHovered(false, event)
|
|
100
|
-
}, this.props.tooltipOnHover ? /*#__PURE__*/
|
|
100
|
+
}, this.props.tooltipOnHover ? /*#__PURE__*/createElement(Tooltip, {
|
|
101
101
|
content: this.props.tooltip || this.props.time && TimeUtils.formatTimeLong(this.props.time, this.props.config)
|
|
102
|
-
}, /*#__PURE__*/
|
|
102
|
+
}, /*#__PURE__*/createElement("span", null, timeComponent)) : timeComponent);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
}
|