@openedx/paragon 23.22.1 → 23.22.2
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/Alert/index.js +0 -1
- package/dist/Alert/index.js.map +1 -1
- package/dist/Card/BaseCard.d.ts +7 -0
- package/dist/Card/BaseCard.js +0 -21
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Chip/ChipIcon.d.ts +7 -18
- package/dist/Chip/ChipIcon.js +2 -17
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.js +6 -2
- package/dist/Chip/index.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.d.ts +3 -0
- package/dist/Modal/ModalDialogHeader.js +0 -13
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Overlay/index.d.ts +86 -123
- package/dist/Overlay/index.js +25 -123
- package/dist/Overlay/index.js.map +1 -1
- package/dist/Tooltip/index.d.ts +16 -0
- package/dist/Tooltip/index.js +4 -48
- package/dist/Tooltip/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Alert/index.tsx +0 -1
- package/src/Card/BaseCard.tsx +7 -21
- package/src/Chip/ChipIcon.tsx +16 -24
- package/src/Chip/index.tsx +8 -4
- package/src/Modal/ModalDialogHeader.tsx +5 -17
- package/src/Overlay/index.tsx +88 -120
- package/src/Tooltip/index.tsx +21 -69
package/dist/Overlay/index.js
CHANGED
|
@@ -2,141 +2,43 @@ import React from 'react';
|
|
|
2
2
|
import BaseOverlay from 'react-bootstrap/Overlay';
|
|
3
3
|
import BaseOverlayTrigger from 'react-bootstrap/OverlayTrigger';
|
|
4
4
|
import Fade from 'react-bootstrap/Fade';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
|
|
7
|
-
// Note: The only thing this file adds to the base
|
|
6
|
+
// Note: The only thing this file adds to the base components is default prop values.
|
|
8
7
|
// As more Paragon consumers adopt TypeScript, we could consider removing almost all of this code
|
|
9
8
|
// and just re-export the Overlay and OverlayTrigger components from react-bootstrap unmodified.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
function Overlay({
|
|
11
|
+
placement = 'top',
|
|
12
|
+
popperConfig = {},
|
|
13
|
+
rootClose = false,
|
|
14
|
+
show = false,
|
|
15
|
+
transition = Fade,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
14
18
|
return /*#__PURE__*/React.createElement(BaseOverlay, {
|
|
19
|
+
placement: placement,
|
|
20
|
+
popperConfig: popperConfig,
|
|
21
|
+
rootClose: rootClose,
|
|
22
|
+
show: show,
|
|
23
|
+
transition: transition
|
|
24
|
+
// `target` is currently optional for Paragon consumers, but react-bootstrap types it as required.
|
|
25
|
+
,
|
|
15
26
|
...props
|
|
16
27
|
});
|
|
17
28
|
}
|
|
18
|
-
function OverlayTrigger(
|
|
29
|
+
function OverlayTrigger({
|
|
30
|
+
defaultShow = false,
|
|
31
|
+
popperConfig = {},
|
|
32
|
+
trigger = ['hover', 'focus'],
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
19
35
|
return /*#__PURE__*/React.createElement(BaseOverlayTrigger, {
|
|
36
|
+
defaultShow: defaultShow,
|
|
37
|
+
popperConfig: popperConfig,
|
|
38
|
+
trigger: trigger,
|
|
20
39
|
...props
|
|
21
40
|
}, props.children);
|
|
22
41
|
}
|
|
23
|
-
const triggerType = PropTypes.oneOf(TRIGGER_VARIANTS);
|
|
24
|
-
Overlay.propTypes = {
|
|
25
|
-
/** Specifies the content of the `Overlay`. */
|
|
26
|
-
children: PropTypes.node.isRequired,
|
|
27
|
-
/**
|
|
28
|
-
* A component instance, DOM node, or function that returns either.
|
|
29
|
-
* The overlay will be positioned in relation to the target.
|
|
30
|
-
*/
|
|
31
|
-
container: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),
|
|
32
|
-
/** Callback fired before the `Overlay` transitions in. */
|
|
33
|
-
onEnter: PropTypes.func,
|
|
34
|
-
/** Callback fired after the `Overlay` finishes transitioning in. */
|
|
35
|
-
onEntered: PropTypes.func,
|
|
36
|
-
/** Callback fired as the `Overlay` begins to transition in. */
|
|
37
|
-
onEntering: PropTypes.func,
|
|
38
|
-
/** Callback fired right before the `Overlay` transitions out */
|
|
39
|
-
onExit: PropTypes.func,
|
|
40
|
-
/** Callback fired after the `Overlay` finishes transitioning out. */
|
|
41
|
-
onExited: PropTypes.func,
|
|
42
|
-
/** Callback fired as the Overlay begins to transition out. */
|
|
43
|
-
onExiting: PropTypes.func,
|
|
44
|
-
/**
|
|
45
|
-
* A callback invoked by the overlay when it wishes to be hidden.
|
|
46
|
-
* Required if `rootClose` is specified.
|
|
47
|
-
*/
|
|
48
|
-
onHide: PropTypes.func,
|
|
49
|
-
/** The placement of the `Overlay` in relation to it's target. */
|
|
50
|
-
placement: PropTypes.oneOf(PLACEMENT_VARIANTS),
|
|
51
|
-
/** A set of popper options and props passed directly to `Popper`. */
|
|
52
|
-
popperConfig: PropTypes.shape({}),
|
|
53
|
-
/** Specify whether the overlay should trigger `onHide` when the user clicks outside the overlay. */
|
|
54
|
-
rootClose: PropTypes.bool,
|
|
55
|
-
/** Specify event for triggering a “root close” toggle. */
|
|
56
|
-
rootCloseEvent: PropTypes.oneOf(['click', 'mousedown']),
|
|
57
|
-
/** Set the visibility of the `Overlay`. */
|
|
58
|
-
show: PropTypes.bool,
|
|
59
|
-
/**
|
|
60
|
-
* The visibility of the `Overlay`. `show` is a controlled prop so should
|
|
61
|
-
* be paired with `onToggle` to avoid breaking user interactions.
|
|
62
|
-
*
|
|
63
|
-
* Manually toggling show does not wait for delay to change the visibility.
|
|
64
|
-
*
|
|
65
|
-
* Controls `onToggle`.
|
|
66
|
-
*/
|
|
67
|
-
target: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),
|
|
68
|
-
/**
|
|
69
|
-
* Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,
|
|
70
|
-
* or a custom react-transition-group `<Transition>` component can be provided.
|
|
71
|
-
*/
|
|
72
|
-
transition: PropTypes.oneOfType([PropTypes.object, PropTypes.bool])
|
|
73
|
-
};
|
|
74
|
-
OverlayTrigger.propTypes = {
|
|
75
|
-
/** Specifies the content of the `OverlayTrigger`. */
|
|
76
|
-
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
|
|
77
|
-
/** An element or text to overlay next to the target. */
|
|
78
|
-
overlay: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
|
|
79
|
-
/** The initial visibility state of the `Overlay`. */
|
|
80
|
-
defaultShow: PropTypes.bool,
|
|
81
|
-
/** A millisecond delay amount to show and hide the `Overlay` once triggered. */
|
|
82
|
-
delay: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({})]),
|
|
83
|
-
/** The initial flip state of the `Overlay`. */
|
|
84
|
-
flip: PropTypes.bool,
|
|
85
|
-
onHide: PropTypes.func,
|
|
86
|
-
/**
|
|
87
|
-
* A callback that fires when the user triggers a change in tooltip visibility.
|
|
88
|
-
* `onToggle` is called with the desired next show, and generally should be
|
|
89
|
-
* passed back to the `show` prop. `onToggle` fires after the configured `delay`.
|
|
90
|
-
*
|
|
91
|
-
* Controls `show`.
|
|
92
|
-
*/
|
|
93
|
-
onToggle: PropTypes.func,
|
|
94
|
-
/** The placement of the `Overlay` in relation to it's target. */
|
|
95
|
-
placement: PropTypes.oneOf(PLACEMENT_VARIANTS),
|
|
96
|
-
/** A `Popper.js` config object passed to the the underlying popper instance. */
|
|
97
|
-
popperConfig: PropTypes.shape({}),
|
|
98
|
-
/**
|
|
99
|
-
* The visibility of the `Overlay`. `show` is a controlled prop so should
|
|
100
|
-
* be paired with `onToggle` to avoid breaking user interactions.
|
|
101
|
-
*
|
|
102
|
-
* Manually toggling show does not wait for delay to change the visibility.
|
|
103
|
-
*
|
|
104
|
-
* Controls `onToggle`.
|
|
105
|
-
*/
|
|
106
|
-
show: PropTypes.bool,
|
|
107
|
-
target: PropTypes.instanceOf(EventTarget),
|
|
108
|
-
/** Specify which action or actions trigger `Overlay` visibility. */
|
|
109
|
-
trigger: PropTypes.oneOfType([triggerType, PropTypes.arrayOf(triggerType)])
|
|
110
|
-
};
|
|
111
|
-
Overlay.defaultProps = {
|
|
112
|
-
container: undefined,
|
|
113
|
-
onEnter: undefined,
|
|
114
|
-
onEntered: undefined,
|
|
115
|
-
onEntering: undefined,
|
|
116
|
-
onExit: undefined,
|
|
117
|
-
onExited: undefined,
|
|
118
|
-
onExiting: undefined,
|
|
119
|
-
onHide: undefined,
|
|
120
|
-
placement: 'top',
|
|
121
|
-
popperConfig: {},
|
|
122
|
-
rootClose: false,
|
|
123
|
-
rootCloseEvent: undefined,
|
|
124
|
-
show: false,
|
|
125
|
-
target: undefined,
|
|
126
|
-
transition: Fade
|
|
127
|
-
};
|
|
128
|
-
OverlayTrigger.defaultProps = {
|
|
129
|
-
defaultShow: false,
|
|
130
|
-
delay: undefined,
|
|
131
|
-
flip: undefined,
|
|
132
|
-
onHide: undefined,
|
|
133
|
-
onToggle: undefined,
|
|
134
|
-
placement: undefined,
|
|
135
|
-
popperConfig: {},
|
|
136
|
-
show: undefined,
|
|
137
|
-
target: undefined,
|
|
138
|
-
trigger: ['hover', 'focus']
|
|
139
|
-
};
|
|
140
42
|
export { OverlayTrigger };
|
|
141
43
|
export default Overlay;
|
|
142
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","BaseOverlay","BaseOverlayTrigger","Fade","PropTypes","PLACEMENT_VARIANTS","TRIGGER_VARIANTS","Overlay","props","createElement","OverlayTrigger","children","triggerType","oneOf","propTypes","node","isRequired","container","oneOfType","elementType","func","onEnter","onEntered","onEntering","onExit","onExited","onExiting","onHide","placement","popperConfig","shape","rootClose","bool","rootCloseEvent","show","target","transition","object","element","overlay","defaultShow","delay","number","flip","onToggle","instanceOf","EventTarget","trigger","arrayOf","defaultProps","undefined"],"sources":["../../src/Overlay/index.tsx"],"sourcesContent":["import React from 'react';\nimport BaseOverlay, { type OverlayProps, type Placement } from 'react-bootstrap/Overlay';\nimport BaseOverlayTrigger, { type OverlayTriggerProps, type OverlayTriggerType } from 'react-bootstrap/OverlayTrigger';\nimport Fade from 'react-bootstrap/Fade';\nimport PropTypes from 'prop-types';\n\n// Note: The only thing this file adds to the base component is propTypes validation.\n// As more Paragon consumers adopt TypeScript, we could consider removing almost all of this code\n// and just re-export the Overlay and OverlayTrigger components from react-bootstrap unmodified.\n\nconst PLACEMENT_VARIANTS: Placement[] = [\n 'auto-start',\n 'auto',\n 'auto-end',\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n\nconst TRIGGER_VARIANTS: OverlayTriggerType[] = [\n 'hover',\n 'click',\n 'focus',\n];\n\nfunction Overlay(props: OverlayProps) {\n return <BaseOverlay {...props} />;\n}\nfunction OverlayTrigger(props: OverlayTriggerProps) {\n return (\n <BaseOverlayTrigger {...props}>\n {props.children}\n </BaseOverlayTrigger>\n );\n}\n\nconst triggerType = PropTypes.oneOf(TRIGGER_VARIANTS);\n\nOverlay.propTypes = {\n /** Specifies the content of the `Overlay`. */\n children: PropTypes.node.isRequired,\n /**\n * A component instance, DOM node, or function that returns either.\n * The overlay will be positioned in relation to the target.\n */\n container: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),\n /** Callback fired before the `Overlay` transitions in. */\n onEnter: PropTypes.func,\n /** Callback fired after the `Overlay` finishes transitioning in. */\n onEntered: PropTypes.func,\n /** Callback fired as the `Overlay` begins to transition in. */\n onEntering: PropTypes.func,\n /** Callback fired right before the `Overlay` transitions out */\n onExit: PropTypes.func,\n /** Callback fired after the `Overlay` finishes transitioning out. */\n onExited: PropTypes.func,\n /** Callback fired as the Overlay begins to transition out. */\n onExiting: PropTypes.func,\n /**\n * A callback invoked by the overlay when it wishes to be hidden.\n * Required if `rootClose` is specified.\n */\n onHide: PropTypes.func,\n /** The placement of the `Overlay` in relation to it's target. */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /** A set of popper options and props passed directly to `Popper`. */\n popperConfig: PropTypes.shape({}),\n /** Specify whether the overlay should trigger `onHide` when the user clicks outside the overlay. */\n rootClose: PropTypes.bool,\n /** Specify event for triggering a “root close” toggle. */\n rootCloseEvent: PropTypes.oneOf(['click', 'mousedown']),\n /** Set the visibility of the `Overlay`. */\n show: PropTypes.bool,\n /**\n * The visibility of the `Overlay`. `show` is a controlled prop so should\n * be paired with `onToggle` to avoid breaking user interactions.\n *\n * Manually toggling show does not wait for delay to change the visibility.\n *\n * Controls `onToggle`.\n */\n target: PropTypes.oneOfType([PropTypes.elementType, PropTypes.func]),\n /**\n * Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,\n * or a custom react-transition-group `<Transition>` component can be provided.\n */\n transition: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),\n};\n\nOverlayTrigger.propTypes = {\n /** Specifies the content of the `OverlayTrigger`. */\n children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,\n /** An element or text to overlay next to the target. */\n overlay: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,\n /** The initial visibility state of the `Overlay`. */\n defaultShow: PropTypes.bool,\n /** A millisecond delay amount to show and hide the `Overlay` once triggered. */\n delay: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({})]),\n /** The initial flip state of the `Overlay`. */\n flip: PropTypes.bool,\n onHide: PropTypes.func,\n /**\n * A callback that fires when the user triggers a change in tooltip visibility.\n * `onToggle` is called with the desired next show, and generally should be\n * passed back to the `show` prop. `onToggle` fires after the configured `delay`.\n *\n * Controls `show`.\n */\n onToggle: PropTypes.func,\n /** The placement of the `Overlay` in relation to it's target. */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popperConfig: PropTypes.shape({}),\n /**\n * The visibility of the `Overlay`. `show` is a controlled prop so should\n * be paired with `onToggle` to avoid breaking user interactions.\n *\n * Manually toggling show does not wait for delay to change the visibility.\n *\n * Controls `onToggle`.\n */\n show: PropTypes.bool,\n target: PropTypes.instanceOf(EventTarget),\n /** Specify which action or actions trigger `Overlay` visibility. */\n trigger: PropTypes.oneOfType([triggerType, PropTypes.arrayOf(triggerType)]),\n};\n\nOverlay.defaultProps = {\n container: undefined,\n onEnter: undefined,\n onEntered: undefined,\n onEntering: undefined,\n onExit: undefined,\n onExited: undefined,\n onExiting: undefined,\n onHide: undefined,\n placement: 'top',\n popperConfig: {},\n rootClose: false,\n rootCloseEvent: undefined,\n show: false,\n target: undefined,\n transition: Fade,\n};\n\nOverlayTrigger.defaultProps = {\n defaultShow: false,\n delay: undefined,\n flip: undefined,\n onHide: undefined,\n onToggle: undefined,\n placement: undefined,\n popperConfig: {},\n show: undefined,\n target: undefined,\n trigger: ['hover', 'focus'],\n};\n\nexport { OverlayTrigger };\nexport default Overlay;\n"],"mappings":"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","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","BaseOverlay","BaseOverlayTrigger","Fade","Overlay","placement","popperConfig","rootClose","show","transition","props","createElement","OverlayTrigger","defaultShow","trigger","children"],"sources":["../../src/Overlay/index.tsx"],"sourcesContent":["import React from 'react';\nimport BaseOverlay, { type OverlayProps, type OverlayChildren, type Placement } from 'react-bootstrap/Overlay';\nimport BaseOverlayTrigger, { type OverlayTriggerProps, type OverlayTriggerType } from 'react-bootstrap/OverlayTrigger';\nimport Fade from 'react-bootstrap/Fade';\n\n// Note: The only thing this file adds to the base components is default prop values.\n// As more Paragon consumers adopt TypeScript, we could consider removing almost all of this code\n// and just re-export the Overlay and OverlayTrigger components from react-bootstrap unmodified.\n\nexport interface ParagonOverlayProps extends Omit<OverlayProps, 'target'> {\n /** Specifies the content of the `Overlay`. */\n children: OverlayChildren;\n /**\n * A component instance, DOM node, or function that returns either.\n * The overlay will be positioned in relation to the target.\n */\n container?: OverlayProps['container'];\n /** Callback fired before the `Overlay` transitions in. */\n onEnter?: (node: HTMLElement, isAppearing: boolean) => any;\n /** Callback fired after the `Overlay` finishes transitioning in. */\n onEntered?: (node: HTMLElement, isAppearing: boolean) => any;\n /** Callback fired as the `Overlay` begins to transition in. */\n onEntering?: (node: HTMLElement, isAppearing: boolean) => any;\n /** Callback fired right before the `Overlay` transitions out. */\n onExit?: (node: HTMLElement) => any;\n /** Callback fired after the `Overlay` finishes transitioning out. */\n onExited?: (node: HTMLElement) => any;\n /** Callback fired as the Overlay begins to transition out. */\n onExiting?: (node: HTMLElement) => any;\n /**\n * A callback invoked by the overlay when it wishes to be hidden.\n * Required if `rootClose` is specified.\n */\n onHide?: (e: Event) => void;\n /**\n * The placement of the `Overlay` in relation to its target.\n *\n * Valid values are: `auto`, `auto-start`, `auto-end`, `top`, `bottom`, `right`, `left`,\n * `top-start`, `top-end`, `bottom-start`, `bottom-end`, `right-start`, `right-end`, `left-start`, `left-end`.\n */\n placement?: Placement;\n /** A set of popper options and props passed directly to `Popper`. */\n popperConfig?: OverlayProps['popperConfig'];\n /** Specify whether the overlay should trigger `onHide` when the user clicks outside the overlay. */\n rootClose?: boolean;\n /** Specify event for triggering a \"root close\" toggle. */\n rootCloseEvent?: OverlayProps['rootCloseEvent'];\n /** Set the visibility of the `Overlay`. */\n show?: boolean;\n /**\n * The target element the `Overlay` is positioned in relation to.\n * Note: this is marked optional for backwards compatibility, but it is required for the overlay to work,\n * and the upstream types mark it as required.\n */\n target?: OverlayProps['target'];\n /**\n * Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,\n * or a custom react-transition-group `<Transition>` component can be provided.\n */\n transition?: OverlayProps['transition'];\n}\n\nexport interface ParagonOverlayTriggerProps extends OverlayTriggerProps {\n /** Specifies the content of the `OverlayTrigger`. */\n children: OverlayTriggerProps['children'];\n /** An element or text to overlay next to the target. */\n overlay: OverlayTriggerProps['overlay'];\n /** The initial visibility state of the `Overlay`. */\n defaultShow?: boolean;\n /** A millisecond delay amount to show and hide the `Overlay` once triggered. */\n delay?: OverlayTriggerProps['delay'];\n /** The initial flip state of the `Overlay`. */\n flip?: boolean;\n /** Callback fired when the visibility of the overlay changes. */\n onHide?: OverlayTriggerProps['onHide'];\n /**\n * A callback that fires when the user triggers a change in tooltip visibility.\n * `onToggle` is called with the desired next show, and generally should be\n * passed back to the `show` prop. `onToggle` fires after the configured `delay`.\n */\n onToggle?: OverlayTriggerProps['onToggle'];\n /** The placement of the `Overlay` in relation to its target. */\n placement?: Placement;\n /** A `Popper.js` config object passed to the underlying popper instance. */\n popperConfig?: OverlayTriggerProps['popperConfig'];\n /**\n * The visibility of the `Overlay`. `show` is a controlled prop so should be\n * paired with `onToggle` to avoid breaking user interactions.\n */\n show?: boolean;\n /** The target element the `Overlay` is positioned in relation to. */\n target?: OverlayTriggerProps['target'];\n /** Specify which action or actions trigger `Overlay` visibility. */\n trigger?: OverlayTriggerType | OverlayTriggerType[];\n}\n\nfunction Overlay({\n placement = 'top',\n popperConfig = {},\n rootClose = false,\n show = false,\n transition = Fade,\n ...props\n}: ParagonOverlayProps) {\n return (\n <BaseOverlay\n placement={placement}\n popperConfig={popperConfig}\n rootClose={rootClose}\n show={show}\n transition={transition}\n // `target` is currently optional for Paragon consumers, but react-bootstrap types it as required.\n {...props as (typeof props & Pick<OverlayProps, 'target'>)}\n />\n );\n}\n\nfunction OverlayTrigger({\n defaultShow = false,\n popperConfig = {},\n trigger = ['hover', 'focus'],\n ...props\n}: ParagonOverlayTriggerProps) {\n return (\n <BaseOverlayTrigger\n defaultShow={defaultShow}\n popperConfig={popperConfig}\n trigger={trigger}\n {...props}\n >\n {props.children}\n </BaseOverlayTrigger>\n );\n}\n\nexport { OverlayTrigger };\nexport default Overlay;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAmE,yBAAyB;AAC9G,OAAOC,kBAAkB,MAA6D,gCAAgC;AACtH,OAAOC,IAAI,MAAM,sBAAsB;;AAEvC;AACA;AACA;;AAyFA,SAASC,OAAOA,CAAC;EACfC,SAAS,GAAG,KAAK;EACjBC,YAAY,GAAG,CAAC,CAAC;EACjBC,SAAS,GAAG,KAAK;EACjBC,IAAI,GAAG,KAAK;EACZC,UAAU,GAAGN,IAAI;EACjB,GAAGO;AACgB,CAAC,EAAE;EACtB,oBACEV,KAAA,CAAAW,aAAA,CAACV,WAAW;IACVI,SAAS,EAAEA,SAAU;IACrBC,YAAY,EAAEA,YAAa;IAC3BC,SAAS,EAAEA,SAAU;IACrBC,IAAI,EAAEA,IAAK;IACXC,UAAU,EAAEA;IACZ;IAAA;IAAA,GACIC;EAAK,CACV,CAAC;AAEN;AAEA,SAASE,cAAcA,CAAC;EACtBC,WAAW,GAAG,KAAK;EACnBP,YAAY,GAAG,CAAC,CAAC;EACjBQ,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;EAC5B,GAAGJ;AACuB,CAAC,EAAE;EAC7B,oBACEV,KAAA,CAAAW,aAAA,CAACT,kBAAkB;IACjBW,WAAW,EAAEA,WAAY;IACzBP,YAAY,EAAEA,YAAa;IAC3BQ,OAAO,EAAEA,OAAQ;IAAA,GACbJ;EAAK,GAERA,KAAK,CAACK,QACW,CAAC;AAEzB;AAEA,SAASH,cAAc;AACvB,eAAeR,OAAO","ignoreList":[]}
|
package/dist/Tooltip/index.d.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { type TooltipProps as BaseTooltipProps } from 'react-bootstrap/Tooltip';
|
|
2
|
+
import { type Placement } from 'react-bootstrap/Overlay';
|
|
2
3
|
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
3
4
|
interface TooltipProps extends BaseTooltipProps {
|
|
5
|
+
/** An html `id` attribute, necessary for accessibility. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The visual style variant of the `Tooltip`. Use `'light'` for a light-themed tooltip. */
|
|
4
8
|
variant?: 'light';
|
|
9
|
+
/** Whether the tooltip is currently visible. */
|
|
10
|
+
show?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the direction the Tooltip is positioned towards.
|
|
13
|
+
*
|
|
14
|
+
* This is generally provided by the Overlay component positioning the tooltip.
|
|
15
|
+
*/
|
|
16
|
+
placement?: Placement;
|
|
17
|
+
/** Additional CSS class(es) to put on the tooltip element. */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** A Popper.js config object passed to the the underlying popper instance. */
|
|
20
|
+
popper?: any;
|
|
5
21
|
}
|
|
6
22
|
declare const Tooltip: ComponentWithAsProp<'div', TooltipProps>;
|
|
7
23
|
export default Tooltip;
|
package/dist/Tooltip/index.js
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import BaseTooltip from 'react-bootstrap/Tooltip';
|
|
5
|
-
const PLACEMENT_VARIANTS = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
|
6
4
|
const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
7
5
|
children,
|
|
8
6
|
variant,
|
|
7
|
+
placement = 'right',
|
|
8
|
+
bsPrefix = 'tooltip',
|
|
9
9
|
...props
|
|
10
10
|
}, ref) => /*#__PURE__*/React.createElement(BaseTooltip, {
|
|
11
11
|
...props,
|
|
12
|
+
placement: placement,
|
|
13
|
+
bsPrefix: bsPrefix,
|
|
12
14
|
className: classNames({
|
|
13
15
|
'tooltip-light': variant === 'light'
|
|
14
16
|
}, props.className),
|
|
15
17
|
ref: ref
|
|
16
18
|
}, children));
|
|
17
|
-
Tooltip.propTypes = {
|
|
18
|
-
...BaseTooltip.propTypes,
|
|
19
|
-
/** An html id attribute, necessary for accessibility. */
|
|
20
|
-
id: PropTypes.string.isRequired,
|
|
21
|
-
/**
|
|
22
|
-
* Sets the direction the `Tooltip` is positioned towards.
|
|
23
|
-
*
|
|
24
|
-
* This is generally provided by the `Overlay` component positioning the tooltip.
|
|
25
|
-
*/
|
|
26
|
-
placement: PropTypes.oneOf(PLACEMENT_VARIANTS),
|
|
27
|
-
/**
|
|
28
|
-
* An `Overlay` injected set of props for positioning the `Tooltip` arrow.
|
|
29
|
-
*
|
|
30
|
-
* This is generally provided by the `Overlay` component positioning the tooltip.
|
|
31
|
-
*/
|
|
32
|
-
arrowProps: PropTypes.shape({
|
|
33
|
-
ref: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
34
|
-
current: PropTypes.element
|
|
35
|
-
})]),
|
|
36
|
-
style: PropTypes.shape({})
|
|
37
|
-
}),
|
|
38
|
-
/** Whether the `Overlay` is shown. */
|
|
39
|
-
show: PropTypes.bool,
|
|
40
|
-
/** A `Popper.js` config object passed to the the underlying popper instance. */
|
|
41
|
-
popper: PropTypes.shape({}),
|
|
42
|
-
/** Overrides underlying component base CSS class name */
|
|
43
|
-
bsPrefix: PropTypes.string,
|
|
44
|
-
/** Specifies the content of the `Tooltip` */
|
|
45
|
-
children: PropTypes.node,
|
|
46
|
-
/** Specifies class name to append to the base element */
|
|
47
|
-
className: PropTypes.string,
|
|
48
|
-
/** The visual style of the `Tooltip` */
|
|
49
|
-
variant: PropTypes.string
|
|
50
|
-
};
|
|
51
|
-
Tooltip.defaultProps = {
|
|
52
|
-
...Tooltip.defaultProps,
|
|
53
|
-
id: undefined,
|
|
54
|
-
placement: 'right',
|
|
55
|
-
arrowProps: undefined,
|
|
56
|
-
show: undefined,
|
|
57
|
-
popper: undefined,
|
|
58
|
-
children: undefined,
|
|
59
|
-
className: undefined,
|
|
60
|
-
variant: undefined,
|
|
61
|
-
bsPrefix: 'tooltip'
|
|
62
|
-
};
|
|
63
19
|
export default Tooltip;
|
|
64
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","BaseTooltip","Tooltip","forwardRef","children","variant","placement","bsPrefix","props","ref","createElement","className"],"sources":["../../src/Tooltip/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport BaseTooltip, { type TooltipProps as BaseTooltipProps } from 'react-bootstrap/Tooltip';\nimport { type Placement } from 'react-bootstrap/Overlay';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\ninterface TooltipProps extends BaseTooltipProps {\n // NOTE: we have to re-declare many inherited props so that they show up in the auto-generated docs.\n /** An html `id` attribute, necessary for accessibility. */\n id: string;\n /** The visual style variant of the `Tooltip`. Use `'light'` for a light-themed tooltip. */\n variant?: 'light';\n /** Whether the tooltip is currently visible. */\n show?: boolean;\n /**\n * Sets the direction the Tooltip is positioned towards.\n *\n * This is generally provided by the Overlay component positioning the tooltip.\n */\n placement?: Placement;\n /** Additional CSS class(es) to put on the tooltip element. */\n className?: string;\n /** A Popper.js config object passed to the the underlying popper instance. */\n popper?: any;\n}\n\nconst Tooltip: ComponentWithAsProp<'div', TooltipProps> = React.forwardRef(({\n children,\n variant,\n placement = 'right',\n bsPrefix = 'tooltip',\n ...props\n}: TooltipProps, ref: React.ForwardedRef<HTMLDivElement>) => (\n <BaseTooltip\n {...props}\n placement={placement}\n bsPrefix={bsPrefix}\n className={classNames({ 'tooltip-light': variant === 'light' }, props.className)}\n ref={ref}\n >\n {children}\n </BaseTooltip>\n));\n\nexport default Tooltip;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAiD,yBAAyB;AAwB5F,MAAMC,OAAiD,gBAAGH,KAAK,CAACI,UAAU,CAAC,CAAC;EAC1EC,QAAQ;EACRC,OAAO;EACPC,SAAS,GAAG,OAAO;EACnBC,QAAQ,GAAG,SAAS;EACpB,GAAGC;AACS,CAAC,EAAEC,GAAuC,kBACtDV,KAAA,CAAAW,aAAA,CAACT,WAAW;EAAA,GACNO,KAAK;EACTF,SAAS,EAAEA,SAAU;EACrBC,QAAQ,EAAEA,QAAS;EACnBI,SAAS,EAAEX,UAAU,CAAC;IAAE,eAAe,EAAEK,OAAO,KAAK;EAAQ,CAAC,EAAEG,KAAK,CAACG,SAAS,CAAE;EACjFF,GAAG,EAAEA;AAAI,GAERL,QACU,CACd,CAAC;AAEF,eAAeF,OAAO","ignoreList":[]}
|
package/package.json
CHANGED
package/src/Alert/index.tsx
CHANGED
package/src/Card/BaseCard.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
|
|
5
4
|
import type { ComponentWithAsProp, BsPropsWithAs } from '../utils/types/bootstrap';
|
|
@@ -28,12 +27,19 @@ const textVariants = [
|
|
|
28
27
|
type ColorVariant = typeof colorVariants[number];
|
|
29
28
|
type TextVariant = typeof textVariants[number];
|
|
30
29
|
interface Props extends BsPropsWithAs {
|
|
30
|
+
/** Prefix for component CSS classes. */
|
|
31
31
|
prefix?: string;
|
|
32
|
+
/** Background color of the card. */
|
|
32
33
|
bgColor?: ColorVariant;
|
|
34
|
+
/** Text color of the card. */
|
|
33
35
|
textColor?: ColorVariant | TextVariant;
|
|
36
|
+
/** Border color of the card. */
|
|
34
37
|
borderColor?: ColorVariant;
|
|
38
|
+
/** Determines whether the card should render its children inside a `CardBody` wrapper. */
|
|
35
39
|
hasBody?: boolean;
|
|
40
|
+
/** Additional CSS class names to apply to the card element. */
|
|
36
41
|
className?: string;
|
|
42
|
+
/** The content to render inside the card. */
|
|
37
43
|
children: React.ReactNode;
|
|
38
44
|
}
|
|
39
45
|
type BaseCardType = ComponentWithAsProp<'div', Props>;
|
|
@@ -69,24 +75,4 @@ const BaseCard : BaseCardType = React.forwardRef<HTMLDivElement, Props>(
|
|
|
69
75
|
},
|
|
70
76
|
);
|
|
71
77
|
|
|
72
|
-
/* eslint-disable react/require-default-props */
|
|
73
|
-
BaseCard.propTypes = {
|
|
74
|
-
/** Prefix for component CSS classes. */
|
|
75
|
-
prefix: PropTypes.string,
|
|
76
|
-
/** Background color of the card. */
|
|
77
|
-
bgColor: PropTypes.oneOf(colorVariants),
|
|
78
|
-
/** Text color of the card. */
|
|
79
|
-
textColor: PropTypes.oneOf([...colorVariants, ...textVariants]),
|
|
80
|
-
/** Border color of the card. */
|
|
81
|
-
borderColor: PropTypes.oneOf(colorVariants),
|
|
82
|
-
/** Determines whether the card should render its children inside a `CardBody` wrapper. */
|
|
83
|
-
hasBody: PropTypes.bool,
|
|
84
|
-
/** Set a custom element for this component. */
|
|
85
|
-
as: PropTypes.elementType,
|
|
86
|
-
/** Additional CSS class names to apply to the card element. */
|
|
87
|
-
className: PropTypes.string,
|
|
88
|
-
/** The content to render inside the card. */
|
|
89
|
-
children: PropTypes.node,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
78
|
export default BaseCard;
|
package/src/Chip/ChipIcon.tsx
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Icon from '../Icon';
|
|
4
3
|
import IconButton from '../IconButton';
|
|
5
4
|
import { STYLE_VARIANTS } from './constants';
|
|
6
5
|
|
|
7
6
|
export type ChipIconProps = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/** Additional CSS class name(s) to append to the base element. */
|
|
8
|
+
className: string;
|
|
9
|
+
/** The icon component to render. */
|
|
10
|
+
src: React.ComponentType;
|
|
11
|
+
/** The visual style variant of the chip icon. */
|
|
12
|
+
variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];
|
|
13
|
+
/** Whether the icon is in a disabled state. */
|
|
14
|
+
disabled?: boolean;
|
|
12
15
|
} & (
|
|
13
16
|
// Either _both_ onClick and alt are provided, or neither is:
|
|
14
|
-
| {
|
|
15
|
-
|
|
17
|
+
| {
|
|
18
|
+
/** Callback for click and keyboard events on the icon button. */
|
|
19
|
+
onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>;
|
|
20
|
+
/** Accessible label for the icon button. Required when `onClick` is provided. */
|
|
21
|
+
alt: string;
|
|
22
|
+
}
|
|
23
|
+
| { onClick?: undefined; alt?: undefined }
|
|
16
24
|
);
|
|
17
25
|
|
|
18
26
|
function ChipIcon({
|
|
19
|
-
className, src, onClick, alt, variant, disabled,
|
|
27
|
+
className, src, onClick, alt, variant = STYLE_VARIANTS.LIGHT, disabled = false,
|
|
20
28
|
}: ChipIconProps) {
|
|
21
29
|
if (onClick) {
|
|
22
30
|
return (
|
|
@@ -35,20 +43,4 @@ function ChipIcon({
|
|
|
35
43
|
return <Icon src={src} className={className} size="sm" />;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
ChipIcon.propTypes = {
|
|
39
|
-
className: PropTypes.string.isRequired,
|
|
40
|
-
src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
|
|
41
|
-
onClick: PropTypes.func,
|
|
42
|
-
alt: PropTypes.string,
|
|
43
|
-
variant: PropTypes.string,
|
|
44
|
-
disabled: PropTypes.bool,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
ChipIcon.defaultProps = {
|
|
48
|
-
onClick: undefined,
|
|
49
|
-
alt: undefined,
|
|
50
|
-
variant: STYLE_VARIANTS.LIGHT,
|
|
51
|
-
disabled: false,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
46
|
export default ChipIcon;
|
package/src/Chip/index.tsx
CHANGED
|
@@ -83,8 +83,10 @@ const Chip = React.forwardRef(({
|
|
|
83
83
|
<ChipIcon
|
|
84
84
|
className={`${CHIP_PGN_CLASS}__icon-before`}
|
|
85
85
|
src={iconBefore}
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
/* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor
|
|
87
|
+
enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */
|
|
88
|
+
onClick={onIconBeforeClick!}
|
|
89
|
+
alt={iconBeforeAlt!}
|
|
88
90
|
variant={variant}
|
|
89
91
|
disabled={disabled}
|
|
90
92
|
/>
|
|
@@ -101,8 +103,10 @@ const Chip = React.forwardRef(({
|
|
|
101
103
|
<ChipIcon
|
|
102
104
|
className={`${CHIP_PGN_CLASS}__icon-after`}
|
|
103
105
|
src={iconAfter}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
/* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor
|
|
107
|
+
enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */
|
|
108
|
+
onClick={onIconAfterClick!}
|
|
109
|
+
alt={iconAfterAlt!}
|
|
106
110
|
variant={variant}
|
|
107
111
|
disabled={disabled}
|
|
108
112
|
/>
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
5
4
|
|
|
6
5
|
export interface Props {
|
|
6
|
+
/** Specifies the base element. */
|
|
7
7
|
as?: string;
|
|
8
|
+
/** Specifies the contents of the header. */
|
|
8
9
|
children: React.ReactNode;
|
|
10
|
+
/** Specifies class name to append to the base element. */
|
|
9
11
|
className?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
type HeaderType = ComponentWithAsProp<'div', Props>;
|
|
13
15
|
|
|
14
|
-
const ModalDialogHeader: HeaderType = React.forwardRef
|
|
16
|
+
const ModalDialogHeader: HeaderType = React.forwardRef(({
|
|
15
17
|
as = 'div',
|
|
16
18
|
children,
|
|
17
19
|
...props
|
|
18
|
-
}, ref) => (
|
|
20
|
+
}: Props, ref: React.ForwardedRef<HTMLDivElement>) => (
|
|
19
21
|
React.createElement(
|
|
20
22
|
as,
|
|
21
23
|
{
|
|
@@ -27,18 +29,4 @@ const ModalDialogHeader: HeaderType = React.forwardRef<HTMLDivElement, Props>(({
|
|
|
27
29
|
)
|
|
28
30
|
));
|
|
29
31
|
|
|
30
|
-
ModalDialogHeader.propTypes = {
|
|
31
|
-
/** Specifies the base element */
|
|
32
|
-
as: PropTypes.elementType,
|
|
33
|
-
/** Specifies the contents of the header */
|
|
34
|
-
children: PropTypes.node.isRequired,
|
|
35
|
-
/** Specifies class name to append to the base element */
|
|
36
|
-
className: PropTypes.string,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
ModalDialogHeader.defaultProps = {
|
|
40
|
-
as: 'div',
|
|
41
|
-
className: '',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
32
|
export default ModalDialogHeader;
|