@pingux/astro 2.245.1-alpha.0 → 2.246.0-alpha.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.
Files changed (43) hide show
  1. package/lib/cjs/components/Calendar/CalendarCell.js +8 -2
  2. package/lib/cjs/components/DatePicker/DateField.js +24 -5
  3. package/lib/cjs/components/DatePicker/DatePicker.js +19 -9
  4. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +1 -0
  5. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +3 -2
  6. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +17 -0
  7. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +17 -0
  8. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/calendar.d.ts +113 -0
  9. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/calendar.js +128 -0
  10. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/forms.d.ts +1822 -0
  11. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/forms.js +42 -2
  12. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +112 -0
  13. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
  14. package/lib/cjs/styles/themeOverrides/onyxUiLibraryOverride.js +5 -1
  15. package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +1 -0
  16. package/lib/cjs/styles/themes/next-gen/colors/colors.js +1 -0
  17. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
  18. package/lib/cjs/styles/themes/next-gen/forms.d.ts +2044 -214
  19. package/lib/cjs/styles/themes/next-gen/forms.js +48 -2
  20. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +1185 -90
  21. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +22 -0
  22. package/lib/cjs/styles/themes/next-gen/variants/button.js +22 -0
  23. package/lib/cjs/styles/themes/next-gen/variants/calendar.d.ts +158 -0
  24. package/lib/cjs/styles/themes/next-gen/variants/calendar.js +172 -0
  25. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +157 -0
  26. package/lib/cjs/styles/themes/next-gen/variants/variants.js +2 -0
  27. package/lib/cjs/types/popoverContainer.d.ts +7 -2
  28. package/lib/components/Calendar/CalendarCell.js +9 -3
  29. package/lib/components/DatePicker/DateField.js +25 -6
  30. package/lib/components/DatePicker/DatePicker.js +20 -10
  31. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +3 -2
  32. package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +17 -0
  33. package/lib/styles/themeOverrides/nextGenDarkMode/variants/calendar.js +122 -0
  34. package/lib/styles/themeOverrides/nextGenDarkMode/variants/forms.js +41 -1
  35. package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +3 -1
  36. package/lib/styles/themeOverrides/onyxUiLibraryOverride.js +5 -1
  37. package/lib/styles/themes/next-gen/colors/colors.js +1 -0
  38. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
  39. package/lib/styles/themes/next-gen/forms.js +47 -1
  40. package/lib/styles/themes/next-gen/variants/button.js +22 -0
  41. package/lib/styles/themes/next-gen/variants/calendar.js +166 -0
  42. package/lib/styles/themes/next-gen/variants/variants.js +2 -0
  43. package/package.json +1 -1
@@ -29,6 +29,10 @@ const CalendarCell = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
29
29
  ...others
30
30
  } = props;
31
31
  const cellRef = (0, _hooks.useLocalOrForwardRef)(ref);
32
+ const {
33
+ themeState
34
+ } = (0, _hooks.useGetTheme)();
35
+ const isOnyxTheme = themeState.isOnyx;
32
36
  const {
33
37
  cellProps,
34
38
  buttonProps,
@@ -78,17 +82,19 @@ const CalendarCell = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
78
82
  within: true
79
83
  });
80
84
  const mergedProps = (0, _utils.mergeProps)(cellProps, hoverProps, pressProps, focusWithinProps);
85
+ const isOutsideMonth = date.compare(state.visibleRange.start) < 0 || date.compare(state.visibleRange.end) > 0;
81
86
  const {
82
87
  classNames
83
88
  } = (0, _hooks.useStatusClasses)(className, {
84
89
  isSelected,
85
90
  isExtreme: isDisabled,
86
- isUnavailable,
91
+ isUnavailable: isUnavailable || isOnyxTheme && Boolean(state.minValue || state.maxValue) && state.isInvalid(date),
87
92
  isPressed,
88
93
  isFocused: isFocusVisible,
89
94
  isHovered,
90
95
  isOutsideVisibleRange,
91
- isCompletelyDisabled: state.isDisabled
96
+ isCompletelyDisabled: state.isDisabled,
97
+ isOutsideMonth
92
98
  });
93
99
  return (0, _react2.jsx)(_index.TableCell, (0, _extends2.default)({}, mergedProps, {
94
100
  variant: "calendar.calendarCell"
@@ -18,6 +18,7 @@ var _datepicker2 = require("@react-stately/datepicker");
18
18
  var _hooks = require("../../hooks");
19
19
  var _index = require("../../index");
20
20
  var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
21
+ var _IconSymbol = _interopRequireDefault(require("../Icon/IconSymbol"));
21
22
  var _DateSegment = _interopRequireDefault(require("./DateSegment"));
22
23
  var _react2 = require("@emotion/react");
23
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -52,6 +53,10 @@ const DateField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
52
53
  ...other
53
54
  } = props;
54
55
  const [errorMessage, setErrorMessage] = (0, _react.useState)('');
56
+ const {
57
+ themeState
58
+ } = (0, _hooks.useGetTheme)();
59
+ const isOnyxTheme = themeState.isOnyx;
55
60
  const fieldRef = (0, _react.useRef)(null);
56
61
  const inputRef = (0, _react.useRef)(null);
57
62
  const labelRef = (0, _react.useRef)(null);
@@ -152,10 +157,11 @@ const DateField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
152
157
  */
153
158
 
154
159
  const formatHelpText = (0, _react.useMemo)(() => {
155
- return (isLocalEnUS ? enUSSegments : segments).map(s => {
160
+ const displaySegments = isLocalEnUS ? enUSSegments : segments;
161
+ return displaySegments.map(s => {
156
162
  return s.text;
157
163
  }).join(' ');
158
- }, [hasFormatHelpText]);
164
+ }, [hasFormatHelpText, isLocalEnUS]);
159
165
  const handlePaste = (0, _react.useCallback)(e => {
160
166
  const copiedValue = e.clipboardData.getData('text');
161
167
  let isNextAvailableDate;
@@ -203,7 +209,9 @@ const DateField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
203
209
  }, [minValue, maxValue, unavailableRanges]);
204
210
  return (0, _react2.jsx)(_index.Box, (0, _extends2.default)({
205
211
  variant: "forms.input.fieldContainer"
206
- }, fieldContainerProps), (0, _react2.jsx)(_index.Label, (0, _extends2.default)({}, fieldLabelProps, {
212
+ }, fieldContainerProps, {
213
+ className: classNames
214
+ }), (0, _react2.jsx)(_index.Label, (0, _extends2.default)({}, fieldLabelProps, {
207
215
  ref: labelRef
208
216
  })), (0, _react2.jsx)(_index.Box, (0, _extends2.default)({
209
217
  isRow: true,
@@ -240,13 +248,24 @@ const DateField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
240
248
  isDisabled: isDisabled || isReadOnly
241
249
  }, buttonProps, {
242
250
  "aria-label": toggleCalendarButtonAriaLabel
243
- }), (0, _react2.jsx)(_index.Icon, {
251
+ }), isOnyxTheme ? (0, _react2.jsx)(_IconSymbol.default, {
252
+ icon: "calendar_today",
253
+ size: 20,
254
+ sx: {
255
+ flexShrink: 0
256
+ },
257
+ title: {
258
+ name: 'Calendar Icon'
259
+ }
260
+ }) : (0, _react2.jsx)(_index.Icon, {
244
261
  icon: _CalendarIcon.default,
245
262
  title: {
246
263
  name: 'Calendar Icon'
247
264
  },
248
265
  size: 20
249
- })))), hasFormatHelpText && (0, _react2.jsx)(_index.FieldHelperText, null, formatHelpText), errorMessage && (0, _react2.jsx)(_index.Messages, {
266
+ })))), hasFormatHelpText && (0, _react2.jsx)(_index.FieldHelperText, null, formatHelpText), helperText && (0, _react2.jsx)(_index.FieldHelperText, {
267
+ status: status
268
+ }, helperText), errorMessage && (0, _react2.jsx)(_index.Messages, {
250
269
  onClose: () => setErrorMessage('')
251
270
  }, (0, _react2.jsx)(_reactStately.Item, {
252
271
  key: "message1",
@@ -8,11 +8,13 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _date = require("@internationalized/date");
11
+ var _onyxTokens = require("@pingux/onyx-tokens");
11
12
  var _datepicker = require("@react-aria/datepicker");
12
13
  var _focus = require("@react-aria/focus");
13
14
  var _utils = require("@react-aria/utils");
14
15
  var _datepicker2 = require("@react-stately/datepicker");
15
16
  var _object = require("lodash/object");
17
+ var _hooks = require("../../hooks");
16
18
  var _index = require("../../index");
17
19
  var _pendoID = require("../../utils/devUtils/constants/pendoID");
18
20
  var _isDateWithinRanges = require("../../utils/devUtils/props/isDateWithinRanges");
@@ -52,6 +54,10 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
52
54
  } = props;
53
55
  const groupRef = (0, _react.useRef)(null);
54
56
  const popoverRef = (0, _react.useRef)(null);
57
+ const {
58
+ themeState
59
+ } = (0, _hooks.useGetTheme)();
60
+ const isOnyxTheme = themeState.isOnyx;
55
61
 
56
62
  /**
57
63
  * This function is run against each date in the calendar
@@ -95,12 +101,18 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
95
101
  popoverRef: popoverRef,
96
102
  triggerRef: groupRef,
97
103
  state: state,
98
- offset: 15,
99
- crossOffset: 40,
100
- "data-testid": "popover-container"
101
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
- ,
103
- overflow: 'auto'
104
+ offset: isOnyxTheme ? 1 : 15,
105
+ crossOffset: isOnyxTheme ? -45 : 40,
106
+ "data-testid": "popover-container",
107
+ style: isOnyxTheme ? {
108
+ position: 'absolute',
109
+ overflow: 'auto',
110
+ borderRadius: _onyxTokens.astroTokens.radius.xl,
111
+ maxWidth: '312px'
112
+ } : {
113
+ position: 'absolute',
114
+ overflow: 'auto'
115
+ }
104
116
  }, (0, _react2.jsx)(_focus.FocusScope, {
105
117
  autoFocus: true,
106
118
  contain: true,
@@ -123,8 +135,6 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
123
135
  status: status,
124
136
  datePickerState: state,
125
137
  helpHintProps: helpHintProps
126
- })), calendar, helperText && (0, _react2.jsx)(_index.FieldHelperText, {
127
- status: status
128
- }, helperText));
138
+ })), calendar);
129
139
  });
130
140
  var _default = exports.default = DatePicker;
@@ -85,6 +85,7 @@ export declare const colors: {
85
85
  text: {
86
86
  primary: string;
87
87
  secondary: string;
88
+ reverse: string;
88
89
  error: string;
89
90
  message: string;
90
91
  fieldHelper: string;
@@ -167,6 +167,7 @@ const colors = exports.colors = {
167
167
  text: {
168
168
  primary: _onyxTokens.astroTokensDark.color.font.base,
169
169
  secondary: _onyxTokens.astroTokensDark.color.font.light,
170
+ reverse: _onyxTokens.astroTokensDark.color.font.reverse,
170
171
  error: _onyxTokens.astroTokensDark.color.font.error,
171
172
  message: 'white',
172
173
  fieldHelper: _onyxTokens.astroTokensDark.color.gray[400]
@@ -182,8 +183,8 @@ const colors = exports.colors = {
182
183
  badge,
183
184
  codeEditor,
184
185
  critical: {
185
- bright: _onyxTokens.astroTokensDark.color.red[300],
186
- dark: _onyxTokens.astroTokensDark.color.red[100]
186
+ bright: _onyxTokens.astroTokensDark.color.red[500],
187
+ dark: _onyxTokens.astroTokensDark.color.red[500]
187
188
  },
188
189
  common
189
190
  };
@@ -336,6 +336,23 @@ declare const buttons: {
336
336
  };
337
337
  };
338
338
  };
339
+ datePicker: {
340
+ containedIcon: {
341
+ width: number;
342
+ height: number;
343
+ minWidth: number;
344
+ right: number;
345
+ px: number;
346
+ py: number;
347
+ border: string;
348
+ '&.is-hovered': {
349
+ backgroundColor: string;
350
+ path: {
351
+ fill: string;
352
+ };
353
+ };
354
+ };
355
+ };
339
356
  messageCloseButton: {
340
357
  '&.is-hovered': {
341
358
  backgroundColor: string;
@@ -91,6 +91,23 @@ const iconButtons = {
91
91
  modalHeaderCloseButton: {
92
92
  ...baseIconButton
93
93
  },
94
+ datePicker: {
95
+ containedIcon: {
96
+ width: 28,
97
+ height: 28,
98
+ minWidth: 18,
99
+ right: 20,
100
+ px: 0,
101
+ py: 0,
102
+ border: 'none',
103
+ '&.is-hovered': {
104
+ backgroundColor: 'light',
105
+ path: {
106
+ fill: _onyxTokens.astroTokensDark.color.gray[400]
107
+ }
108
+ }
109
+ }
110
+ },
94
111
  messageCloseButton: {
95
112
  ...baseIconButton,
96
113
  '&.is-hovered': {
@@ -0,0 +1,113 @@
1
+ declare const _default: {
2
+ calendarBody: {
3
+ backgroundColor: string;
4
+ '& > tr:nth-of-type(odd) ': {
5
+ backgroundColor: string;
6
+ };
7
+ };
8
+ calendarButton: {
9
+ color: string;
10
+ '&.is-focused, &:focus-visible': {
11
+ outline: string;
12
+ outlineColor: string;
13
+ outlineOffset: string;
14
+ borderRadius: number;
15
+ };
16
+ '&.is-hovered': {
17
+ bg: string;
18
+ color: string;
19
+ cursor: string;
20
+ };
21
+ '&.is-selected': {
22
+ bg: string;
23
+ color: string;
24
+ '&.is-hovered': {
25
+ bg: string;
26
+ color: string;
27
+ };
28
+ };
29
+ '&.is-unavailable': {
30
+ color: string;
31
+ bg: string;
32
+ cursor: string;
33
+ };
34
+ '&:not(.is-outside-visible-range)&.is-extreme&:not(.is-completely-disabled)': {
35
+ color: string;
36
+ bg: string;
37
+ opacity: number;
38
+ '&.is-hovered': {
39
+ backgroundColor: string;
40
+ cursor: string;
41
+ };
42
+ };
43
+ '&.is-disabled': {
44
+ bg: string;
45
+ cursor: string;
46
+ '&.is-hovered': {
47
+ bg: string;
48
+ };
49
+ };
50
+ };
51
+ calendarCell: {
52
+ color: string;
53
+ '&.is-outside-month': {
54
+ opacity: number;
55
+ backgroundColor: string;
56
+ color: string;
57
+ '& > [hidden]': {
58
+ color: string;
59
+ };
60
+ '&.is-completely-disabled': {
61
+ backgroundColor: string;
62
+ '& > [hidden]': {
63
+ color: string;
64
+ };
65
+ };
66
+ '&.is-unavailable': {
67
+ backgroundColor: string;
68
+ color: string;
69
+ '& > [hidden]': {
70
+ color: string;
71
+ };
72
+ '&.is-hovered': {
73
+ backgroundColor: string;
74
+ color: string;
75
+ };
76
+ };
77
+ '&.is-extreme:not(.is-completely-disabled):not(.is-unavailable)': {
78
+ backgroundColor: string;
79
+ color: string;
80
+ '& > [hidden]': {
81
+ color: string;
82
+ };
83
+ '&.is-hovered': {
84
+ backgroundColor: string;
85
+ color: string;
86
+ };
87
+ };
88
+ };
89
+ };
90
+ calendarContainer: {
91
+ bg: string;
92
+ color: string;
93
+ border: string;
94
+ borderColor: string;
95
+ };
96
+ calendarHeader: {
97
+ color: string;
98
+ '& :is(div, span, h3)': {
99
+ color: string;
100
+ };
101
+ };
102
+ calendarRow: {
103
+ bg: string;
104
+ };
105
+ columnHeader: {
106
+ color: string;
107
+ borderBottom: string;
108
+ borderBottomColor: string;
109
+ pb: string;
110
+ mb: string;
111
+ };
112
+ };
113
+ export default _default;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _onyxTokens = require("@pingux/onyx-tokens");
8
+ const calendarBody = {
9
+ backgroundColor: 'backgroundBase',
10
+ '& > tr:nth-of-type(odd) ': {
11
+ backgroundColor: 'backgroundBase'
12
+ }
13
+ };
14
+ const calendarButton = {
15
+ color: 'text.primary',
16
+ '&.is-focused, &:focus-visible': {
17
+ outline: '2px solid',
18
+ outlineColor: 'focus',
19
+ outlineOffset: '2px',
20
+ borderRadius: _onyxTokens.astroTokensDark.radius.xl
21
+ },
22
+ '&.is-hovered': {
23
+ bg: _onyxTokens.astroTokensDark.color.gray[700],
24
+ color: 'text.primary',
25
+ cursor: 'pointer'
26
+ },
27
+ '&.is-selected': {
28
+ bg: 'active',
29
+ color: 'text.reverse',
30
+ '&.is-hovered': {
31
+ bg: 'active',
32
+ color: 'text.reverse'
33
+ }
34
+ },
35
+ '&.is-unavailable': {
36
+ color: 'text.primary',
37
+ bg: _onyxTokens.astroTokensDark.color.gray[750],
38
+ cursor: 'default'
39
+ },
40
+ '&:not(.is-outside-visible-range)&.is-extreme&:not(.is-completely-disabled)': {
41
+ color: 'text.primary',
42
+ bg: _onyxTokens.astroTokensDark.color.gray[750],
43
+ opacity: 1,
44
+ '&.is-hovered': {
45
+ backgroundColor: _onyxTokens.astroTokensDark.color.gray[750],
46
+ cursor: 'default'
47
+ }
48
+ },
49
+ '&.is-disabled': {
50
+ bg: _onyxTokens.astroTokensDark.color.gray[750],
51
+ cursor: 'default',
52
+ '&.is-hovered': {
53
+ bg: _onyxTokens.astroTokensDark.color.gray[750]
54
+ }
55
+ }
56
+ };
57
+ const calendarCell = {
58
+ color: 'text.primary',
59
+ '&.is-outside-month': {
60
+ opacity: 0.65,
61
+ backgroundColor: 'transparent',
62
+ color: 'text.secondary',
63
+ '& > [hidden]': {
64
+ color: 'text.secondary'
65
+ },
66
+ '&.is-completely-disabled': {
67
+ backgroundColor: 'transparent',
68
+ '& > [hidden]': {
69
+ color: 'text.secondary'
70
+ }
71
+ },
72
+ '&.is-unavailable': {
73
+ backgroundColor: _onyxTokens.astroTokensDark.color.gray[750],
74
+ color: 'text.primary',
75
+ '& > [hidden]': {
76
+ color: 'text.secondary'
77
+ },
78
+ '&.is-hovered': {
79
+ backgroundColor: _onyxTokens.astroTokensDark.color.gray[750],
80
+ color: 'text.primary'
81
+ }
82
+ },
83
+ '&.is-extreme:not(.is-completely-disabled):not(.is-unavailable)': {
84
+ backgroundColor: _onyxTokens.astroTokensDark.color.gray[750],
85
+ color: 'text.primary',
86
+ '& > [hidden]': {
87
+ color: 'text.secondary'
88
+ },
89
+ '&.is-hovered': {
90
+ backgroundColor: _onyxTokens.astroTokensDark.color.gray[750],
91
+ color: 'text.primary'
92
+ }
93
+ }
94
+ }
95
+ };
96
+ const calendarHeader = {
97
+ // Month/year title renders at #F6F8FA per the Figma spec; the shared itemTitle
98
+ // variant resolves to text.secondary (#C0C9D5) under the dark theme.
99
+ color: 'text.primary',
100
+ '& :is(div, span, h3)': {
101
+ color: 'inherit'
102
+ }
103
+ };
104
+ const columnHeader = {
105
+ color: 'text.primary',
106
+ borderBottom: '1px solid',
107
+ borderBottomColor: _onyxTokens.astroTokensDark.color.common.border,
108
+ pb: '32px',
109
+ mb: '0'
110
+ };
111
+ const calendarContainer = {
112
+ bg: 'backgroundBase',
113
+ color: 'text.primary',
114
+ border: '1px solid',
115
+ borderColor: _onyxTokens.astroTokensDark.color.common.border
116
+ };
117
+ const calendarRow = {
118
+ bg: 'backgroundBase'
119
+ };
120
+ var _default = exports.default = {
121
+ calendarBody,
122
+ calendarButton,
123
+ calendarCell,
124
+ calendarContainer,
125
+ calendarHeader,
126
+ calendarRow,
127
+ columnHeader
128
+ };