@pingux/astro 2.2.0 → 2.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Calendar/Calendar.js +202 -0
- package/lib/cjs/components/Calendar/Calendar.stories.js +192 -0
- package/lib/cjs/components/Calendar/Calendar.styles.js +74 -0
- package/lib/cjs/components/Calendar/Calendar.test.js +324 -0
- package/lib/cjs/components/Calendar/CalendarCell.js +125 -0
- package/lib/cjs/components/Calendar/CalendarGrid.js +77 -0
- package/lib/cjs/components/Calendar/index.js +14 -0
- package/lib/cjs/components/DatePicker/DateField.js +316 -0
- package/lib/cjs/components/DatePicker/DatePicker.js +195 -0
- package/lib/cjs/components/DatePicker/DatePicker.stories.js +205 -0
- package/lib/cjs/components/DatePicker/DatePicker.styles.js +60 -0
- package/lib/cjs/components/DatePicker/DatePicker.test.js +570 -0
- package/lib/cjs/components/DatePicker/DateSegment.js +71 -0
- package/lib/cjs/components/DatePicker/index.js +14 -0
- package/lib/cjs/components/IconButton/IconButton.styles.js +4 -0
- package/lib/cjs/components/TextField/TextField.js +6 -2
- package/lib/cjs/components/TextField/TextField.stories.js +13 -1
- package/lib/cjs/components/TooltipTrigger/Tooltip.js +4 -6
- package/lib/cjs/components/TooltipTrigger/Tooltip.styles.js +14 -18
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +2 -2
- package/lib/cjs/index.js +132 -59
- package/lib/cjs/styles/forms/index.js +2 -0
- package/lib/cjs/styles/variants/variants.js +4 -2
- package/lib/components/Calendar/Calendar.js +190 -0
- package/lib/components/Calendar/Calendar.stories.js +171 -0
- package/lib/components/Calendar/Calendar.styles.js +66 -0
- package/lib/components/Calendar/Calendar.test.js +321 -0
- package/lib/components/Calendar/CalendarCell.js +111 -0
- package/lib/components/Calendar/CalendarGrid.js +68 -0
- package/lib/components/Calendar/index.js +1 -0
- package/lib/components/DatePicker/DateField.js +303 -0
- package/lib/components/DatePicker/DatePicker.js +183 -0
- package/lib/components/DatePicker/DatePicker.stories.js +180 -0
- package/lib/components/DatePicker/DatePicker.styles.js +51 -0
- package/lib/components/DatePicker/DatePicker.test.js +563 -0
- package/lib/components/DatePicker/DateSegment.js +58 -0
- package/lib/components/DatePicker/index.js +1 -0
- package/lib/components/IconButton/IconButton.styles.js +4 -0
- package/lib/components/TextField/TextField.js +6 -2
- package/lib/components/TextField/TextField.stories.js +11 -0
- package/lib/components/TooltipTrigger/Tooltip.js +4 -6
- package/lib/components/TooltipTrigger/Tooltip.styles.js +14 -18
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +2 -2
- package/lib/index.js +8 -0
- package/lib/styles/forms/index.js +2 -0
- package/lib/styles/variants/variants.js +3 -1
- package/package.json +7 -1
- package/NOTICE.html +0 -12399
- /package/lib/cjs/{styles/variants/callout.js → components/Callout/Callout.styles.js} +0 -0
- /package/lib/{styles/variants/callout.js → components/Callout/Callout.styles.js} +0 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
3
|
+
import { useFocusManager } from 'react-aria';
|
4
|
+
import { useDateSegment } from '@react-aria/datepicker';
|
5
|
+
import PropTypes from 'prop-types';
|
6
|
+
import { Box } from '../../index';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Each editable segment of date.
|
10
|
+
*/
|
11
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
|
+
var DateSegment = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
|
+
var segment = props.segment,
|
14
|
+
state = props.state,
|
15
|
+
handlePaste = props.handlePaste;
|
16
|
+
var segmentRef = useRef();
|
17
|
+
// istanbul ignore next
|
18
|
+
useImperativeHandle(ref, function () {
|
19
|
+
return segmentRef.current;
|
20
|
+
});
|
21
|
+
var text = segment.text,
|
22
|
+
isPlaceholder = segment.isPlaceholder;
|
23
|
+
var _useDateSegment = useDateSegment(segment, state, segmentRef),
|
24
|
+
segmentProps = _useDateSegment.segmentProps;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Handler to autofocus segments when using deleting them
|
28
|
+
*/
|
29
|
+
var focusManager = useFocusManager();
|
30
|
+
var handleKeyEvents = useCallback(function (e) {
|
31
|
+
if (e.key === 'Backspace' && isPlaceholder && (text === 'mm' || text === 'dd')) {
|
32
|
+
focusManager.focusPrevious();
|
33
|
+
}
|
34
|
+
}, [focusManager, segment, text, isPlaceholder]);
|
35
|
+
return ___EmotionJSX(Box, _extends({}, segmentProps, {
|
36
|
+
ref: segmentRef,
|
37
|
+
variant: "forms.datePicker.segment",
|
38
|
+
onKeyUp: handleKeyEvents,
|
39
|
+
onPaste: handlePaste
|
40
|
+
}), text === '/' ? '-' : text);
|
41
|
+
});
|
42
|
+
DateSegment.propTypes = {
|
43
|
+
/** slot for input that indicates each date segment */
|
44
|
+
segment: PropTypes.shape({
|
45
|
+
isPlaceholder: PropTypes.bool,
|
46
|
+
text: PropTypes.string,
|
47
|
+
placeholder: PropTypes.string,
|
48
|
+
value: PropTypes.number
|
49
|
+
}),
|
50
|
+
/** state returned by useDateField */
|
51
|
+
state: PropTypes.shape({}),
|
52
|
+
/**
|
53
|
+
* Handler that is called when a paste event is called.
|
54
|
+
* (e: PasteEvent) => void
|
55
|
+
*/
|
56
|
+
handlePaste: PropTypes.func
|
57
|
+
};
|
58
|
+
export default DateSegment;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './DatePicker';
|
@@ -13,6 +13,7 @@ import { badgeDeleteButton, deleteButton } from '../Badge/Badge.styles';
|
|
13
13
|
import { defaultFocus } from '../Button/Buttons.styles';
|
14
14
|
import { toggle } from '../CollapsiblePanel/CollapsiblePanel.styles';
|
15
15
|
import { copyButton } from '../CopyText/CopyText.styles';
|
16
|
+
import { containedIcon } from '../DatePicker/DatePicker.styles';
|
16
17
|
import { hintButton } from '../HelpHint/HelpHint.styles';
|
17
18
|
import { messageCloseButton } from '../Messages/Message.styles';
|
18
19
|
import { modalCloseButton } from '../Modal/Modal.styles';
|
@@ -138,6 +139,9 @@ export default {
|
|
138
139
|
},
|
139
140
|
badgeDeleteButton: badgeDeleteButton,
|
140
141
|
copyButton: copyButton,
|
142
|
+
datePicker: {
|
143
|
+
containedIcon: _objectSpread(_objectSpread({}, base), containedIcon)
|
144
|
+
},
|
141
145
|
hintButton: _objectSpread(_objectSpread({}, base), hintButton),
|
142
146
|
inverted: inverted,
|
143
147
|
messageCloseButton: _objectSpread(_objectSpread({}, base), messageCloseButton),
|
@@ -26,6 +26,7 @@ import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusP
|
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
27
|
var TextField = /*#__PURE__*/forwardRef(function (props, ref) {
|
28
28
|
var helperText = props.helperText,
|
29
|
+
helpHintProps = props.helpHintProps,
|
29
30
|
slots = props.slots,
|
30
31
|
status = props.status;
|
31
32
|
var _useField = useField(props),
|
@@ -57,7 +58,8 @@ var TextField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
57
58
|
ref: labelRef,
|
58
59
|
sx: isLabelHigher && {
|
59
60
|
gridRow: '1/5'
|
60
|
-
}
|
61
|
+
},
|
62
|
+
helpHintProps: helpHintProps
|
61
63
|
})), ___EmotionJSX(Box, _extends({
|
62
64
|
variant: "forms.input.fieldControlWrapper"
|
63
65
|
}, fieldControlWrapperProps), slots === null || slots === void 0 ? void 0 : slots.beforeInput, ___EmotionJSX(Input, _extends({
|
@@ -89,7 +91,7 @@ TextField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
89
91
|
*/
|
90
92
|
onChange: PropTypes.func,
|
91
93
|
/** The value for the input element (controlled). */
|
92
|
-
value: PropTypes.string,
|
94
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
93
95
|
/** How the input should handle autocompletion according to the browser. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). The `autocomplete` prop is an alias for this. */
|
94
96
|
autoComplete: PropTypes.string,
|
95
97
|
/** @ignore Alias for `autoComplete` prop. Exists for backwards-compatibility. */
|
@@ -104,6 +106,8 @@ TextField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
104
106
|
hintText: PropTypes.string,
|
105
107
|
/** Whether the field has a status indicator. */
|
106
108
|
hasNoStatusIndicator: PropTypes.bool,
|
109
|
+
/** Props object that is spread directly into the helphint element. */
|
110
|
+
helpHintProps: PropTypes.shape({}),
|
107
111
|
/** Whether the field is disabled. */
|
108
112
|
isDisabled: PropTypes.bool,
|
109
113
|
/** Whether the input can be selected, but not changed by the user. */
|
@@ -187,6 +187,17 @@ export var WithHelpHint = function WithHelpHint() {
|
|
187
187
|
label: "Example Label"
|
188
188
|
});
|
189
189
|
};
|
190
|
+
export var WithHelpHintCustomWidth = function WithHelpHintCustomWidth() {
|
191
|
+
return ___EmotionJSX(TextField, {
|
192
|
+
id: "with-help-hint-id",
|
193
|
+
name: "custom-name",
|
194
|
+
hintText: "Example Hint",
|
195
|
+
label: "Example Label",
|
196
|
+
helpHintProps: {
|
197
|
+
width: '300px'
|
198
|
+
}
|
199
|
+
});
|
200
|
+
};
|
190
201
|
export var WithoutStatusIndicator = function WithoutStatusIndicator() {
|
191
202
|
return ___EmotionJSX(TextField, {
|
192
203
|
label: "Example Label",
|
@@ -4,7 +4,6 @@ var _excluded = ["children"];
|
|
4
4
|
import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react';
|
5
5
|
import { useTooltip } from 'react-aria';
|
6
6
|
import { TooltipContext } from '../../context/TooltipContext/index';
|
7
|
-
import Box from '../Box';
|
8
7
|
import Text from '../Text';
|
9
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
9
|
var Tooltip = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -20,11 +19,10 @@ var Tooltip = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
20
19
|
useImperativeHandle(ref, function () {
|
21
20
|
return tooltipRef.current;
|
22
21
|
});
|
23
|
-
return ___EmotionJSX(
|
22
|
+
return ___EmotionJSX(Text, _extends({
|
24
23
|
ref: tooltipRef,
|
25
|
-
variant: "tooltip.container"
|
26
|
-
|
27
|
-
|
28
|
-
}, children));
|
24
|
+
variant: "variants.tooltip.container",
|
25
|
+
p: "sm"
|
26
|
+
}, tooltipProps, others), children);
|
29
27
|
});
|
30
28
|
export default Tooltip;
|
@@ -12,7 +12,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
12
12
|
import { baseBadge } from '../Badge/Badge.styles';
|
13
13
|
import { text } from '../Button/Buttons.styles';
|
14
14
|
var container = {
|
15
|
-
|
15
|
+
maxWidth: '11.3em',
|
16
|
+
maxHeight: '15em',
|
17
|
+
overflow: 'hidden',
|
18
|
+
textOverflow: 'ellipsis',
|
19
|
+
WebkitLineClamp: '10',
|
20
|
+
WebkitBoxOrient: 'vertical',
|
21
|
+
display: '-webkit-box !important',
|
22
|
+
wordBreak: 'break-word',
|
23
|
+
'.is-right > * > &, .is-left > * > &': {
|
24
|
+
maxWidth: '24em',
|
25
|
+
maxHeight: '6.5em',
|
26
|
+
WebkitLineClamp: '4'
|
27
|
+
}
|
16
28
|
};
|
17
29
|
var badge = _objectSpread(_objectSpread({}, baseBadge), {}, {
|
18
30
|
cursor: 'default',
|
@@ -40,25 +52,9 @@ var inline = _objectSpread(_objectSpread({}, text), {}, {
|
|
40
52
|
textDecoration: 'inherit'
|
41
53
|
}
|
42
54
|
});
|
43
|
-
var content = {
|
44
|
-
maxWidth: '10em',
|
45
|
-
maxHeight: '15em',
|
46
|
-
overflow: 'hidden',
|
47
|
-
textOverflow: 'ellipsis',
|
48
|
-
WebkitLineClamp: '10',
|
49
|
-
WebkitBoxOrient: 'vertical',
|
50
|
-
display: '-webkit-box !important',
|
51
|
-
wordBreak: 'break-word',
|
52
|
-
'.is-right > * > &, .is-left > * > &': {
|
53
|
-
maxWidth: '24em',
|
54
|
-
maxHeight: '6.5em',
|
55
|
-
WebkitLineClamp: '4'
|
56
|
-
}
|
57
|
-
};
|
58
55
|
export default {
|
59
56
|
container: container,
|
60
57
|
badge: badge,
|
61
58
|
button: button,
|
62
|
-
inline: inline
|
63
|
-
content: content
|
59
|
+
inline: inline
|
64
60
|
};
|
@@ -10,9 +10,9 @@ test('default useOverlayPanelState', function () {
|
|
10
10
|
open: expect.any(Function),
|
11
11
|
close: expect.any(Function),
|
12
12
|
toggle: expect.any(Function),
|
13
|
-
isOpen: expect.any(Boolean),
|
14
13
|
isTransitioning: expect.any(Boolean),
|
15
|
-
setOpen: expect.any(Function)
|
14
|
+
setOpen: expect.any(Function),
|
15
|
+
isOpen: expect.any(Boolean)
|
16
16
|
},
|
17
17
|
onClose: expect.any(Function),
|
18
18
|
isTransitioning: expect.any(Boolean)
|
package/lib/index.js
CHANGED
@@ -26,6 +26,12 @@ export { default as Breadcrumbs } from './components/Breadcrumbs';
|
|
26
26
|
export * from './components/Breadcrumbs';
|
27
27
|
export { default as Button } from './components/Button';
|
28
28
|
export * from './components/Button';
|
29
|
+
export { default as Calendar } from './components/Calendar';
|
30
|
+
export * from './components/Calendar';
|
31
|
+
export { default as CalendarCell } from './components/Calendar/CalendarCell';
|
32
|
+
export * from './components/Calendar/CalendarCell';
|
33
|
+
export { default as CalendarGrid } from './components/Calendar/CalendarGrid';
|
34
|
+
export * from './components/Calendar/CalendarGrid';
|
29
35
|
export { default as Bulletin } from './components/Callout';
|
30
36
|
export { default as Callout } from './components/Callout';
|
31
37
|
export * from './components/Callout';
|
@@ -45,6 +51,8 @@ export * from './components/CollapsiblePanelItem';
|
|
45
51
|
export { default as ColorField } from './components/ColorField';
|
46
52
|
export { default as ComboBoxField } from './components/ComboBoxField';
|
47
53
|
export { default as CopyText } from './components/CopyText';
|
54
|
+
export { default as DatePicker } from './components/DatePicker';
|
55
|
+
export { default as DateField } from './components/DatePicker/DateField';
|
48
56
|
export { default as EnvironmentBreadcrumb } from './components/EnvironmentBreadcrumb';
|
49
57
|
export { default as FieldHelperText } from './components/FieldHelperText';
|
50
58
|
export * from './components/FieldHelperText';
|
@@ -12,6 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
12
12
|
import * as checkbox from '../../components/Checkbox/Checkbox.styles';
|
13
13
|
import colorField from '../../components/ColorField/ColorField.styles';
|
14
14
|
import comboBox from '../../components/ComboBox/ComboBox.styles';
|
15
|
+
import datePicker from '../../components/DatePicker/DatePicker.styles';
|
15
16
|
import fileInputField from '../../components/FileInputField/FileInputField.styles';
|
16
17
|
import * as input from '../../components/Input/Input.styles';
|
17
18
|
import * as label from '../../components/Label/Label.styles';
|
@@ -27,6 +28,7 @@ import textarea from '../../components/TextArea/TextArea.styles';
|
|
27
28
|
export default _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, checkbox), {}, {
|
28
29
|
colorField: colorField,
|
29
30
|
comboBox: comboBox,
|
31
|
+
datePicker: datePicker,
|
30
32
|
fileInputField: fileInputField
|
31
33
|
}, input), label), {}, {
|
32
34
|
numberField: numberField,
|
@@ -14,6 +14,8 @@ import accordion from '../../components/AccordionGroup/Accordion.styles';
|
|
14
14
|
import box from '../../components/Box/Box.styles';
|
15
15
|
import bracket from '../../components/Bracket/Bracket.styles';
|
16
16
|
import breadcrumb from '../../components/Breadcrumbs/Breadcrumb.styles';
|
17
|
+
import calendar from '../../components/Calendar/Calendar.styles';
|
18
|
+
import callout from '../../components/Callout/Callout.styles';
|
17
19
|
import codeView from '../../components/CodeView/CodeView.styles';
|
18
20
|
import collapsiblePanel from '../../components/CollapsiblePanel/CollapsiblePanel.styles';
|
19
21
|
import copyText from '../../components/CopyText/CopyText.styles';
|
@@ -41,13 +43,13 @@ import table from '../../components/Table/Table.styles';
|
|
41
43
|
import * as tab from '../../components/Tabs/Tabs.style';
|
42
44
|
import timeZone from '../../components/TimeZonePicker/TimeZone.styles';
|
43
45
|
import tooltip from '../../components/TooltipTrigger/Tooltip.styles';
|
44
|
-
import callout from './callout';
|
45
46
|
export default _objectSpread({
|
46
47
|
accordion: accordion,
|
47
48
|
accordionGrid: accordionGrid,
|
48
49
|
box: box,
|
49
50
|
bracket: bracket,
|
50
51
|
breadcrumb: breadcrumb,
|
52
|
+
calendar: calendar,
|
51
53
|
callout: callout,
|
52
54
|
codeView: codeView,
|
53
55
|
collapsiblePanel: collapsiblePanel,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.3.0-alpha.1",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -39,14 +39,17 @@
|
|
39
39
|
"@emotion/react": "^11.1.1",
|
40
40
|
"@emotion/styled": "^11.1.1",
|
41
41
|
"@faker-js/faker": "~7.5.0",
|
42
|
+
"@internationalized/date": "3.0.1",
|
42
43
|
"@mdx-js/react": "^1.6.22",
|
43
44
|
"@pingux/mdi-react": "^1.0.0",
|
44
45
|
"@react-aria/accordion": "~3.0.0-alpha.11",
|
45
46
|
"@react-aria/breadcrumbs": "^3.1.4",
|
46
47
|
"@react-aria/button": "^3.2.1",
|
48
|
+
"@react-aria/calendar": "^3.0.0",
|
47
49
|
"@react-aria/checkbox": "^3.2.0",
|
48
50
|
"@react-aria/color": "~3.0.0-beta.15",
|
49
51
|
"@react-aria/combobox": "^3.0.0",
|
52
|
+
"@react-aria/datepicker": "^3.1.0",
|
50
53
|
"@react-aria/dialog": "^3.1.2",
|
51
54
|
"@react-aria/focus": "~3.8.0",
|
52
55
|
"@react-aria/grid": "~3.4.1",
|
@@ -57,12 +60,15 @@
|
|
57
60
|
"@react-aria/list": "3.0.0-nightly.3248",
|
58
61
|
"@react-aria/listbox": "~3.3.1",
|
59
62
|
"@react-aria/live-announcer": "~3.1.1",
|
63
|
+
"@react-aria/overlays": "^3.7.0",
|
60
64
|
"@react-aria/selection": "~3.10.1",
|
61
65
|
"@react-aria/utils": "~3.13.3",
|
62
66
|
"@react-aria/virtualizer": "~3.5.0",
|
63
67
|
"@react-aria/visually-hidden": "~3.6.0",
|
64
68
|
"@react-spectrum/utils": "~3.6.1",
|
69
|
+
"@react-stately/calendar": "3.0.1",
|
65
70
|
"@react-stately/color": "~3.1.1",
|
71
|
+
"@react-stately/datepicker": "^3.0.1",
|
66
72
|
"@react-stately/grid": "~3.3.1",
|
67
73
|
"@react-stately/layout": "~3.7.1",
|
68
74
|
"@react-stately/list": "~3.4.1",
|