@pingux/astro 2.70.0 → 2.71.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.
Files changed (41) hide show
  1. package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +3 -1
  2. package/lib/cjs/components/TimeField/TimeField.d.ts +7 -0
  3. package/lib/cjs/components/TimeField/TimeField.js +105 -0
  4. package/lib/cjs/components/TimeField/TimeField.mdx +35 -0
  5. package/lib/cjs/components/TimeField/TimeField.stories.d.ts +27 -0
  6. package/lib/cjs/components/TimeField/TimeField.stories.js +96 -0
  7. package/lib/cjs/components/TimeField/TimeField.styles.d.ts +865 -0
  8. package/lib/cjs/components/TimeField/TimeField.styles.js +47 -0
  9. package/lib/cjs/components/TimeField/TimeField.test.d.ts +1 -0
  10. package/lib/cjs/components/TimeField/TimeField.test.js +194 -0
  11. package/lib/cjs/components/TimeField/TimeSegment.d.ts +4 -0
  12. package/lib/cjs/components/TimeField/TimeSegment.js +64 -0
  13. package/lib/cjs/components/TimeField/index.d.ts +2 -0
  14. package/lib/cjs/components/TimeField/index.js +33 -0
  15. package/lib/cjs/index.d.ts +2 -0
  16. package/lib/cjs/index.js +23 -4
  17. package/lib/cjs/recipes/DateTimeRangePicker.stories.js +182 -0
  18. package/lib/cjs/styles/forms/index.js +2 -0
  19. package/lib/cjs/styles/variants/variants.js +2 -0
  20. package/lib/cjs/types/index.d.ts +1 -0
  21. package/lib/cjs/types/index.js +13 -2
  22. package/lib/cjs/types/timefield.d.ts +69 -0
  23. package/lib/cjs/types/timefield.js +6 -0
  24. package/lib/cjs/utils/designUtils/figmaLinks.d.ts +3 -0
  25. package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
  26. package/lib/components/SelectFieldBase/SelectFieldBase.js +3 -1
  27. package/lib/components/TimeField/TimeField.js +92 -0
  28. package/lib/components/TimeField/TimeField.mdx +35 -0
  29. package/lib/components/TimeField/TimeField.stories.js +75 -0
  30. package/lib/components/TimeField/TimeField.styles.js +39 -0
  31. package/lib/components/TimeField/TimeField.test.js +191 -0
  32. package/lib/components/TimeField/TimeSegment.js +50 -0
  33. package/lib/components/TimeField/index.js +2 -0
  34. package/lib/index.js +2 -0
  35. package/lib/recipes/DateTimeRangePicker.stories.js +167 -0
  36. package/lib/styles/forms/index.js +2 -0
  37. package/lib/styles/variants/variants.js +2 -0
  38. package/lib/types/index.js +1 -0
  39. package/lib/types/timefield.js +1 -0
  40. package/lib/utils/designUtils/figmaLinks.js +3 -0
  41. package/package.json +4 -4
@@ -0,0 +1,167 @@
1
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
+ import _padStartInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/pad-start";
3
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
+ import React, { useState } from 'react';
5
+ import { Time } from '@internationalized/date';
6
+ import CalendarIcon from '@pingux/mdi-react/CalendarIcon';
7
+ import { withDesign } from 'storybook-addon-designs';
8
+ import { useModalState } from '../hooks';
9
+ import { Box, Button, ButtonBar, Icon, Item, Modal, OverlayProvider, RangeCalendar, SelectField, Separator, Text, TimeField } from '../index';
10
+ import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks';
11
+ import { jsx as ___EmotionJSX } from "@emotion/react";
12
+ export default {
13
+ title: 'Recipes/DateTimeRangePicker',
14
+ decorators: [withDesign]
15
+ };
16
+ var dropdownItems = [{
17
+ key: 'Today',
18
+ name: 'Today'
19
+ }, {
20
+ key: 'From Yesterday',
21
+ name: 'From Yesterday'
22
+ }, {
23
+ key: 'Last 7 Days',
24
+ name: 'Last 7 Days'
25
+ }, {
26
+ key: 'Last 30 Days',
27
+ name: 'Last 30 Days'
28
+ }, {
29
+ key: 'This Month',
30
+ name: 'This Month'
31
+ }, {
32
+ key: 'Last Month',
33
+ name: 'Last Month'
34
+ }, {
35
+ key: 'Custom Range',
36
+ name: 'Custom Range'
37
+ }];
38
+ function convertDateTimeValueToString(timeValue, DateValue) {
39
+ var _context, _context2, _context3, _context4;
40
+ // eslint-disable-next-line prefer-const
41
+ var hour = timeValue.hour,
42
+ minute = timeValue.minute;
43
+ var ampm = hour >= 12 ? 'PM' : 'AM';
44
+ hour %= 12;
45
+ hour = hour || 12;
46
+ var hourString = String(hour);
47
+ var minuteString = _padStartInstanceProperty(_context = String(minute)).call(_context, 2, '0');
48
+ return _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "".concat(DateValue.toString(), " ")).call(_context4, hourString, ":")).call(_context3, minuteString, " ")).call(_context2, ampm);
49
+ }
50
+ export var Default = function Default() {
51
+ var modalState = useModalState();
52
+ var _useState = useState({
53
+ start: '2030-01-12',
54
+ end: '2030-01-15'
55
+ }),
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ range = _useState2[0],
58
+ setRange = _useState2[1];
59
+ var _useState3 = useState(new Time(1)),
60
+ _useState4 = _slicedToArray(_useState3, 2),
61
+ startTime = _useState4[0],
62
+ setStartTime = _useState4[1];
63
+ var _useState5 = useState(new Time(12, 59)),
64
+ _useState6 = _slicedToArray(_useState5, 2),
65
+ endTime = _useState6[0],
66
+ setEndTime = _useState6[1];
67
+ var _useState7 = useState('Today'),
68
+ _useState8 = _slicedToArray(_useState7, 2),
69
+ selectedKey = _useState8[0],
70
+ setSelectedKey = _useState8[1];
71
+ var handleSelectionChange = function handleSelectionChange(key) {
72
+ if (key === 'Custom Range') {
73
+ modalState.open();
74
+ }
75
+ setSelectedKey(key);
76
+ };
77
+ return ___EmotionJSX(Box, {
78
+ gap: "lg"
79
+ }, ___EmotionJSX(Text, null, "Click on the \u2018Custom Range\u2019 option to view the modal"), ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(SelectField, {
80
+ width: "200px",
81
+ items: dropdownItems,
82
+ selectedKey: selectedKey,
83
+ onSelectionChange: handleSelectionChange,
84
+ label: "Date Range",
85
+ slots: {
86
+ leftOfData: ___EmotionJSX(Icon, {
87
+ icon: CalendarIcon,
88
+ color: "accent.40",
89
+ mr: "xs",
90
+ title: {
91
+ name: 'Calendar Icon'
92
+ }
93
+ })
94
+ }
95
+ }, function (item) {
96
+ return ___EmotionJSX(Item, {
97
+ key: item.key
98
+ }, item.name);
99
+ }), modalState.isOpen && ___EmotionJSX(Modal, {
100
+ isOpen: modalState.isOpen,
101
+ onClose: modalState.close,
102
+ hasCloseButton: true,
103
+ title: "Custom Date and Time Range",
104
+ contentProps: {
105
+ maxWidth: '636px',
106
+ width: '100%'
107
+ }
108
+ }, ___EmotionJSX(Box, {
109
+ gap: "lg",
110
+ mt: "lg"
111
+ }, ___EmotionJSX(Box, {
112
+ minHeight: "358px"
113
+ }, ___EmotionJSX(Text, {
114
+ as: "h2",
115
+ variant: "H2",
116
+ mb: "xs"
117
+ }, "Date Range"), ___EmotionJSX(RangeCalendar, {
118
+ value: range,
119
+ onChange: setRange
120
+ })), ___EmotionJSX(Separator, {
121
+ margin: 0
122
+ }), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
123
+ as: "h2",
124
+ variant: "H2"
125
+ }, "Time Range"), ___EmotionJSX(Box, {
126
+ isRow: true,
127
+ gap: "lg",
128
+ alignItems: "center",
129
+ mt: "xs"
130
+ }, ___EmotionJSX(TimeField, {
131
+ label: "Start Time",
132
+ value: startTime,
133
+ onChange: setStartTime
134
+ }), ___EmotionJSX(Box, {
135
+ height: "59.95px"
136
+ }, ___EmotionJSX(Box, {
137
+ height: "19.95px"
138
+ }), ___EmotionJSX(Box, {
139
+ height: "40px",
140
+ justifyContent: "center"
141
+ }, ___EmotionJSX(Text, {
142
+ as: "h2",
143
+ variant: "H2"
144
+ }, "-"))), ___EmotionJSX(TimeField, {
145
+ label: "End Time",
146
+ value: endTime,
147
+ onChange: setEndTime
148
+ }))), ___EmotionJSX(Separator, {
149
+ margin: 0
150
+ }), ___EmotionJSX(Text, null, convertDateTimeValueToString(startTime, range.start), ' ', "-", ' ', convertDateTimeValueToString(endTime, range.end)), ___EmotionJSX(ButtonBar, {
151
+ sx: {
152
+ padding: 0
153
+ }
154
+ }, ___EmotionJSX(Button, {
155
+ variant: "primary",
156
+ "data-id": "apply-button"
157
+ }, "Apply"), ___EmotionJSX(Button, {
158
+ variant: "link",
159
+ "data-id": "cancel-button"
160
+ }, "Cancel"))))));
161
+ };
162
+ Default.parameters = {
163
+ design: {
164
+ type: 'figma',
165
+ url: FIGMA_LINKS.dateTimeRangePicker["default"]
166
+ }
167
+ };
@@ -22,6 +22,7 @@ import search from '../../components/SearchField/Search.styles';
22
22
  import * as select from '../../components/SelectField/Select.styles';
23
23
  import * as switchable from '../../components/Switch/Switch.styles'; // 'switch' is a reserved keyword
24
24
  import textarea from '../../components/TextArea/TextArea.styles';
25
+ import timeField from '../../components/TimeField/TimeField.styles';
25
26
 
26
27
  // See ThemeUI docs on variants and themes for intended structure
27
28
  // Variants should be defined in the approprate file.
@@ -35,6 +36,7 @@ export default _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSp
35
36
  radio: radio
36
37
  }, select), {}, {
37
38
  textarea: textarea,
39
+ timeField: timeField,
38
40
  "switch": _objectSpread({}, switchable),
39
41
  search: search
40
42
  });
@@ -46,6 +46,7 @@ import separator from '../../components/Separator/Separator.styles';
46
46
  import stepper from '../../components/Stepper/Stepper.styles';
47
47
  import table from '../../components/Table/Table.styles';
48
48
  import * as tab from '../../components/Tabs/Tabs.style';
49
+ import timefield from '../../components/TimeField/TimeField.styles';
49
50
  import timeZone from '../../components/TimeZonePicker/TimeZone.styles';
50
51
  import tooltip from '../../components/TooltipTrigger/Tooltip.styles';
51
52
  import treeView from '../../components/TreeView/TreeView.styles';
@@ -86,6 +87,7 @@ export default _objectSpread({
86
87
  separator: separator,
87
88
  stepper: stepper,
88
89
  table: table,
90
+ timefield: timefield,
89
91
  timeZone: timeZone,
90
92
  tooltip: tooltip,
91
93
  treeView: treeView
@@ -44,4 +44,5 @@ export * from './tab';
44
44
  export * from './table';
45
45
  export * from './tabs';
46
46
  export * from './text';
47
+ export * from './timefield';
47
48
  export * from './tooltipTrigger';
@@ -0,0 +1 @@
1
+ export {};
@@ -79,6 +79,9 @@ export var FIGMA_LINKS = {
79
79
  countryPicker: {
80
80
  "default": 'https://www.figma.com/file/Oa6VYtJcUJzEJuuRp0p4ls/Astro?type=design&node-id=4568-7532&mode=design&t=eSfQYHRFNPf37J4C-0'
81
81
  },
82
+ dateTimeRangePicker: {
83
+ "default": 'https://www.figma.com/design/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=49152-4497&t=n7OkhpTOBBWW4rme-0'
84
+ },
82
85
  helpHint: {
83
86
  "default": 'https://www.figma.com/file/Oa6VYtJcUJzEJuuRp0p4ls/Astro?type=design&node-id=0%3A4534&t=We3h7LaaFJQnxdSy-1',
84
87
  withLink: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=28958%3A40081&mode=design&t=WmSYPx1hR8kxFiXf-1'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.70.0",
3
+ "version": "2.71.0-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,7 +51,7 @@
51
51
  "@react-aria/checkbox": "^3.2.0",
52
52
  "@react-aria/color": "~3.0.0-beta.15",
53
53
  "@react-aria/combobox": "^3.0.0",
54
- "@react-aria/datepicker": "^3.10.0",
54
+ "@react-aria/datepicker": "^3.10.1",
55
55
  "@react-aria/dialog": "^3.1.2",
56
56
  "@react-aria/dnd": "^3.5.0",
57
57
  "@react-aria/focus": "~3.8.0",
@@ -76,7 +76,7 @@
76
76
  "@react-spectrum/utils": "~3.6.1",
77
77
  "@react-stately/calendar": "^3.5.0",
78
78
  "@react-stately/color": "~3.1.1",
79
- "@react-stately/datepicker": "^3.9.3",
79
+ "@react-stately/datepicker": "^3.9.4",
80
80
  "@react-stately/dnd": "^3.2.6",
81
81
  "@react-stately/grid": "~3.3.1",
82
82
  "@react-stately/layout": "^3.13.4",
@@ -93,7 +93,7 @@
93
93
  "@react-types/button": "^3.9.3",
94
94
  "@react-types/calendar": "^3.4.5",
95
95
  "@react-types/checkbox": "^3.8.0",
96
- "@react-types/datepicker": "^3.7.3",
96
+ "@react-types/datepicker": "^3.7.4",
97
97
  "@react-types/grid": "^3.2.4",
98
98
  "@react-types/select": "^3.9.1",
99
99
  "@react-types/shared": "^3.23.1",