@razorpay/blade 12.53.1 → 12.54.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/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/TimePicker/TimePicker.native.js +7 -0
- package/build/lib/native/components/TimePicker/TimePicker.native.js.map +1 -0
- package/build/lib/native/components/index.js +1 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +14 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +4 -2
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +41 -2
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/TimePicker/BaseTimePicker.web.js +262 -0
- package/build/lib/web/development/components/TimePicker/BaseTimePicker.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/SpinWheel.web.js +188 -0
- package/build/lib/web/development/components/TimePicker/SpinWheel.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/TimeInput.web.js +256 -0
- package/build/lib/web/development/components/TimePicker/TimeInput.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/TimePicker.web.js +13 -0
- package/build/lib/web/development/components/TimePicker/TimePicker.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/TimePickerContent.web.js +200 -0
- package/build/lib/web/development/components/TimePicker/TimePickerContent.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/TimePickerFooter.web.js +49 -0
- package/build/lib/web/development/components/TimePicker/TimePickerFooter.web.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/index.js +2 -0
- package/build/lib/web/development/components/TimePicker/index.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/useTimePickerState.js +146 -0
- package/build/lib/web/development/components/TimePicker/useTimePickerState.js.map +1 -0
- package/build/lib/web/development/components/TimePicker/utils.js +252 -0
- package/build/lib/web/development/components/TimePicker/utils.js.map +1 -0
- package/build/lib/web/development/components/index.js +2 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +16 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +2 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +14 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +4 -2
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +41 -2
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/TimePicker/BaseTimePicker.web.js +262 -0
- package/build/lib/web/production/components/TimePicker/BaseTimePicker.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/SpinWheel.web.js +188 -0
- package/build/lib/web/production/components/TimePicker/SpinWheel.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/TimeInput.web.js +256 -0
- package/build/lib/web/production/components/TimePicker/TimeInput.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/TimePicker.web.js +13 -0
- package/build/lib/web/production/components/TimePicker/TimePicker.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/TimePickerContent.web.js +200 -0
- package/build/lib/web/production/components/TimePicker/TimePickerContent.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/TimePickerFooter.web.js +49 -0
- package/build/lib/web/production/components/TimePicker/TimePickerFooter.web.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/index.js +2 -0
- package/build/lib/web/production/components/TimePicker/index.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/useTimePickerState.js +146 -0
- package/build/lib/web/production/components/TimePicker/useTimePickerState.js.map +1 -0
- package/build/lib/web/production/components/TimePicker/utils.js +252 -0
- package/build/lib/web/production/components/TimePicker/utils.js.map +1 -0
- package/build/lib/web/production/components/index.js +2 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +16 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +2 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +426 -242
- package/build/types/components/index.native.d.ts +148 -144
- package/build/types/tokens/index.d.ts +16 -0
- package/build/types/tokens/index.native.d.ts +16 -0
- package/package.json +5 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import React__default, { useRef, useState } from 'react';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { useLocale } from '@react-aria/i18n';
|
|
7
|
+
import { useDateSegment, useTimeField } from '@react-aria/datepicker';
|
|
8
|
+
import { useTimeFieldState } from '@react-stately/datepicker';
|
|
9
|
+
import '../Box/BaseBox/index.js';
|
|
10
|
+
import { BaseInput } from '../Input/BaseInput/BaseInput.js';
|
|
11
|
+
import '../BladeProvider/index.js';
|
|
12
|
+
import '../Icons/index.js';
|
|
13
|
+
import '../../utils/assignWithoutSideEffects/index.js';
|
|
14
|
+
import { mergeRefs } from '../../utils/useMergeRefs.js';
|
|
15
|
+
import '../../tokens/global/index.js';
|
|
16
|
+
import '../../utils/makeSpace/index.js';
|
|
17
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
18
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
19
|
+
import { spacing } from '../../tokens/global/spacing.js';
|
|
20
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
21
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
22
|
+
import ClockIcon from '../Icons/ClockIcon/ClockIcon.js';
|
|
23
|
+
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
24
|
+
|
|
25
|
+
var _excluded = ["timeValue", "internalTimeValue", "onChange", "onTimeValueChange", "label", "helpText", "errorText", "successText", "validationState", "isDisabled", "isRequired", "necessityIndicator", "autoFocus", "name", "placeholder", "size", "labelPosition", "labelSuffix", "labelTrailing", "timeFormat", "testID", "accessibilityLabel", "inputRef", "referenceProps", "createCompleteTime", "setIsDropdownOpen"],
|
|
26
|
+
_excluded2 = ["onKeyDown"];
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
+
var StyledTimeSegment = /*#__PURE__*/styled.div.withConfig({
|
|
30
|
+
displayName: "TimeInputweb__StyledTimeSegment",
|
|
31
|
+
componentId: "kpey4b-0"
|
|
32
|
+
})(["padding-left:", ";padding-right:", ";box-sizing:content-box;font-variant-numeric:tabular-nums;text-align:right;outline:none;border-radius:", ";&:focus{background-color:", " !important;color:#ffffff !important;span{color:#000000 !important;}}"], makeSpace(spacing[1]), makeSpace(spacing[1]), makeSpace(spacing[1]), function (_ref) {
|
|
33
|
+
var theme = _ref.theme;
|
|
34
|
+
return theme.colors.interactive.background.primary.faded;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* TimeSegment Component
|
|
39
|
+
*
|
|
40
|
+
* Renders individual time segments (hour, minute, AM/PM) or literal text (separators like ":", " ").
|
|
41
|
+
*
|
|
42
|
+
* For EDITABLE segments (hour, minute, dayPeriod):
|
|
43
|
+
* - Uses React Aria's useDateSegment for full keyboard/accessibility support
|
|
44
|
+
* - Renders as contentEditable div that users can click and type in
|
|
45
|
+
* - Handles arrow keys, number input, focus management automatically
|
|
46
|
+
*
|
|
47
|
+
* For LITERAL segments (separators):
|
|
48
|
+
* - Just renders static text in a span
|
|
49
|
+
* - No interaction or focus behavior
|
|
50
|
+
*/
|
|
51
|
+
var TimeSegment = function TimeSegment(_ref2) {
|
|
52
|
+
var segment = _ref2.segment,
|
|
53
|
+
state = _ref2.state,
|
|
54
|
+
isDisabled = _ref2.isDisabled;
|
|
55
|
+
var ref = useRef(null);
|
|
56
|
+
var _useState = useState(false),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
isFocused = _useState2[0],
|
|
59
|
+
setIsFocused = _useState2[1];
|
|
60
|
+
var _useTheme = useTheme(),
|
|
61
|
+
theme = _useTheme.theme;
|
|
62
|
+
var _useDateSegment = useDateSegment(segment, state, ref),
|
|
63
|
+
segmentProps = _useDateSegment.segmentProps;
|
|
64
|
+
|
|
65
|
+
// Filter out bi-directional text control characters () that React Aria adds for RTL support but aren't needed for our UI - they appear as extra literal segments in some environments
|
|
66
|
+
|
|
67
|
+
if (segment.type === 'literal' && segment.text === '' || segment.text === '') {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
// Calculate minWidth based on segment maxValue to prevent layout shifts
|
|
71
|
+
var minWidth = segment.maxValue != null ? "".concat(String(segment.maxValue).length, "ch") : 'auto';
|
|
72
|
+
return /*#__PURE__*/jsxs(StyledTimeSegment, _objectSpread(_objectSpread({
|
|
73
|
+
ref: ref,
|
|
74
|
+
theme: theme,
|
|
75
|
+
style: _objectSpread(_objectSpread({}, segmentProps.style), {}, {
|
|
76
|
+
minWidth: minWidth
|
|
77
|
+
}),
|
|
78
|
+
onFocus: function onFocus(e) {
|
|
79
|
+
var _segmentProps$onFocus;
|
|
80
|
+
setIsFocused(true);
|
|
81
|
+
(_segmentProps$onFocus = segmentProps.onFocus) === null || _segmentProps$onFocus === void 0 || _segmentProps$onFocus.call(segmentProps, e);
|
|
82
|
+
},
|
|
83
|
+
onBlur: function onBlur(e) {
|
|
84
|
+
var _segmentProps$onBlur;
|
|
85
|
+
setIsFocused(false);
|
|
86
|
+
(_segmentProps$onBlur = segmentProps.onBlur) === null || _segmentProps$onBlur === void 0 || _segmentProps$onBlur.call(segmentProps, e);
|
|
87
|
+
}
|
|
88
|
+
}, segmentProps), {}, {
|
|
89
|
+
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
90
|
+
as: "span",
|
|
91
|
+
display: "block",
|
|
92
|
+
width: "100%",
|
|
93
|
+
textAlign: "center",
|
|
94
|
+
visibility: segment.isPlaceholder ? undefined : 'hidden',
|
|
95
|
+
height: segment.isPlaceholder ? 'auto' : 'spacing.0',
|
|
96
|
+
pointerEvents: "none",
|
|
97
|
+
style: {
|
|
98
|
+
color: isFocused ? theme.colors.surface.text.gray.normal : theme.colors.surface.text.gray.disabled
|
|
99
|
+
},
|
|
100
|
+
children: [segment.placeholder, " "]
|
|
101
|
+
}), /*#__PURE__*/jsx(BaseBox, {
|
|
102
|
+
as: "span",
|
|
103
|
+
style: {
|
|
104
|
+
color: isDisabled ? theme.colors.surface.text.gray.disabled : theme.colors.surface.text.gray.normal
|
|
105
|
+
},
|
|
106
|
+
children: segment.isPlaceholder ? '' : segment.type === 'dayPeriod' ? segment.text.toUpperCase() : segment.text
|
|
107
|
+
})]
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* TimeInput Component
|
|
113
|
+
*
|
|
114
|
+
* A complete time input field built with React Aria for accessibility and keyboard interaction.
|
|
115
|
+
*
|
|
116
|
+
* ARCHITECTURE:
|
|
117
|
+
* - Uses React Aria's useTimeFieldState for time value management & field-level behavior
|
|
118
|
+
* - Uses Blade's BaseInput (as="div") for styling and form integration
|
|
119
|
+
* - Renders multiple TimeSegment components for individual time parts
|
|
120
|
+
*
|
|
121
|
+
* USER INTERACTION:
|
|
122
|
+
* - Click on any segment (hour, minute, AM/PM) to focus and edit
|
|
123
|
+
* - Type numbers directly to change values
|
|
124
|
+
* - Use arrow keys to increment/decrement values
|
|
125
|
+
* - Tab between segments for navigation
|
|
126
|
+
* - Full keyboard accessibility support
|
|
127
|
+
*/
|
|
128
|
+
var _TimeInput = function _TimeInput(_ref3, ref) {
|
|
129
|
+
var timeValue = _ref3.timeValue,
|
|
130
|
+
internalTimeValue = _ref3.internalTimeValue,
|
|
131
|
+
onChange = _ref3.onChange,
|
|
132
|
+
onTimeValueChange = _ref3.onTimeValueChange,
|
|
133
|
+
label = _ref3.label,
|
|
134
|
+
helpText = _ref3.helpText,
|
|
135
|
+
errorText = _ref3.errorText,
|
|
136
|
+
successText = _ref3.successText,
|
|
137
|
+
validationState = _ref3.validationState,
|
|
138
|
+
isDisabled = _ref3.isDisabled,
|
|
139
|
+
isRequired = _ref3.isRequired,
|
|
140
|
+
necessityIndicator = _ref3.necessityIndicator,
|
|
141
|
+
autoFocus = _ref3.autoFocus,
|
|
142
|
+
name = _ref3.name,
|
|
143
|
+
placeholder = _ref3.placeholder,
|
|
144
|
+
_ref3$size = _ref3.size,
|
|
145
|
+
size = _ref3$size === void 0 ? 'medium' : _ref3$size,
|
|
146
|
+
labelPosition = _ref3.labelPosition,
|
|
147
|
+
labelSuffix = _ref3.labelSuffix,
|
|
148
|
+
labelTrailing = _ref3.labelTrailing,
|
|
149
|
+
timeFormat = _ref3.timeFormat,
|
|
150
|
+
testID = _ref3.testID,
|
|
151
|
+
accessibilityLabel = _ref3.accessibilityLabel,
|
|
152
|
+
inputRef = _ref3.inputRef,
|
|
153
|
+
referenceProps = _ref3.referenceProps,
|
|
154
|
+
createCompleteTime = _ref3.createCompleteTime,
|
|
155
|
+
setIsDropdownOpen = _ref3.setIsDropdownOpen,
|
|
156
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
157
|
+
var currentTimeFormat = timeFormat !== null && timeFormat !== void 0 ? timeFormat : '12h';
|
|
158
|
+
var _useLocale = useLocale(),
|
|
159
|
+
locale = _useLocale.locale;
|
|
160
|
+
var state = useTimeFieldState({
|
|
161
|
+
label: label,
|
|
162
|
+
locale: locale,
|
|
163
|
+
hourCycle: currentTimeFormat === '12h' ? 12 : 24,
|
|
164
|
+
value: internalTimeValue,
|
|
165
|
+
// Use TimeValue directly from hook
|
|
166
|
+
onChange: onTimeValueChange,
|
|
167
|
+
// Use TimeValue onChange directly
|
|
168
|
+
isDisabled: isDisabled,
|
|
169
|
+
shouldForceLeadingZeros: true // Force leading zeros (01, 02, 03...)
|
|
170
|
+
});
|
|
171
|
+
var timeFieldRef = useRef(null);
|
|
172
|
+
var _useTimeField = useTimeField({
|
|
173
|
+
label: label
|
|
174
|
+
}, state, timeFieldRef),
|
|
175
|
+
fieldProps = _useTimeField.fieldProps;
|
|
176
|
+
|
|
177
|
+
// Extract onKeyDown from referenceProps to handle Enter key for dropdown opening
|
|
178
|
+
var _ref4 = referenceProps || {},
|
|
179
|
+
referenceOnKeyDown = _ref4.onKeyDown,
|
|
180
|
+
otherReferenceProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
181
|
+
|
|
182
|
+
// Handle Enter key to open dropdown while preserving React Aria's keyboard navigation
|
|
183
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
184
|
+
var _fieldProps$onKeyDown;
|
|
185
|
+
if (event.key === 'Enter' && !isDisabled) {
|
|
186
|
+
// Trigger dropdown opening (same as clicking the input)
|
|
187
|
+
referenceOnKeyDown === null || referenceOnKeyDown === void 0 || referenceOnKeyDown(event);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Let React Aria handle all other keys for segment navigation
|
|
192
|
+
(_fieldProps$onKeyDown = fieldProps.onKeyDown) === null || _fieldProps$onKeyDown === void 0 || _fieldProps$onKeyDown.call(fieldProps, event);
|
|
193
|
+
};
|
|
194
|
+
var handleInputClick = React__default.useCallback(function (_e) {
|
|
195
|
+
if (isDisabled) return;
|
|
196
|
+
setIsDropdownOpen === null || setIsDropdownOpen === void 0 || setIsDropdownOpen(true);
|
|
197
|
+
}, [isDisabled, setIsDropdownOpen]);
|
|
198
|
+
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, fieldProps), {}, {
|
|
199
|
+
className: "timepicker-input",
|
|
200
|
+
onClick: handleInputClick,
|
|
201
|
+
onKeyDown: handleKeyDown,
|
|
202
|
+
ref: mergeRefs(timeFieldRef, ref),
|
|
203
|
+
children: /*#__PURE__*/jsx(BaseInput, _objectSpread(_objectSpread(_objectSpread({
|
|
204
|
+
ref: inputRef,
|
|
205
|
+
as: "div",
|
|
206
|
+
id: "timepicker",
|
|
207
|
+
label: label,
|
|
208
|
+
helpText: helpText,
|
|
209
|
+
errorText: errorText,
|
|
210
|
+
successText: successText,
|
|
211
|
+
validationState: validationState,
|
|
212
|
+
isDisabled: isDisabled,
|
|
213
|
+
isRequired: isRequired,
|
|
214
|
+
necessityIndicator: necessityIndicator,
|
|
215
|
+
autoFocus: autoFocus // eslint-disable-line jsx-a11y/no-autofocus
|
|
216
|
+
,
|
|
217
|
+
name: name,
|
|
218
|
+
size: size,
|
|
219
|
+
labelPosition: labelPosition,
|
|
220
|
+
labelSuffix: labelSuffix,
|
|
221
|
+
labelTrailing: labelTrailing,
|
|
222
|
+
leadingIcon: ClockIcon,
|
|
223
|
+
popupId: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps['aria-controls'],
|
|
224
|
+
isPopupExpanded: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps['aria-expanded'],
|
|
225
|
+
hasPopup: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps['aria-haspopup'],
|
|
226
|
+
testID: testID,
|
|
227
|
+
accessibilityLabel: accessibilityLabel || label || 'Time picker'
|
|
228
|
+
}, props), otherReferenceProps), {}, {
|
|
229
|
+
children: /*#__PURE__*/jsx(BaseBox, {
|
|
230
|
+
display: "flex",
|
|
231
|
+
children: state.segments.map(function (segment, i) {
|
|
232
|
+
return (
|
|
233
|
+
/*#__PURE__*/
|
|
234
|
+
// Fix for React Aria contentEditable focus issue
|
|
235
|
+
// Wrapping each segment in a div prevents unwanted focus when clicking outside
|
|
236
|
+
// See: https://github.com/adobe/react-spectrum/issues/3164
|
|
237
|
+
jsx(BaseBox, {
|
|
238
|
+
children: /*#__PURE__*/jsx(TimeSegment, {
|
|
239
|
+
segment: segment,
|
|
240
|
+
state: state,
|
|
241
|
+
isDisabled: isDisabled
|
|
242
|
+
})
|
|
243
|
+
}, i)
|
|
244
|
+
);
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
}))
|
|
248
|
+
}));
|
|
249
|
+
};
|
|
250
|
+
var TimeInput = /*#__PURE__*/assignWithoutSideEffects(/*#__PURE__*/React__default.forwardRef(_TimeInput), {
|
|
251
|
+
displayName: 'TimeInput',
|
|
252
|
+
componentId: 'TimeInput'
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
export { TimeInput };
|
|
256
|
+
//# sourceMappingURL=TimeInput.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeInput.web.js","sources":["../../../../../../src/components/TimePicker/TimeInput.web.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { useLocale } from '@react-aria/i18n';\nimport { useTimeField, useDateSegment } from '@react-aria/datepicker';\nimport { useTimeFieldState } from '@react-stately/datepicker';\nimport type { TimePickerInputProps, TimeSegmentProps } from './types';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseBox } from '~components/Box/BaseBox';\nimport { BaseInput } from '~components/Input/BaseInput/BaseInput';\nimport { useTheme } from '~components/BladeProvider';\nimport { ClockIcon } from '~components/Icons';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { mergeRefs } from '~utils/useMergeRefs';\nimport { spacing } from '~tokens/global';\nimport { makeSpace } from '~utils/makeSpace';\n\nconst StyledTimeSegment = styled.div`\n padding-left: ${makeSpace(spacing[1])};\n padding-right: ${makeSpace(spacing[1])};\n box-sizing: content-box;\n font-variant-numeric: tabular-nums;\n text-align: right;\n outline: none;\n border-radius: ${makeSpace(spacing[1])};\n\n &:focus {\n background-color: ${({ theme }) =>\n theme.colors.interactive.background.primary.faded} !important;\n color: #ffffff !important;\n\n span {\n color: #000000 !important;\n }\n }\n`;\n\n/**\n * TimeSegment Component\n *\n * Renders individual time segments (hour, minute, AM/PM) or literal text (separators like \":\", \" \").\n *\n * For EDITABLE segments (hour, minute, dayPeriod):\n * - Uses React Aria's useDateSegment for full keyboard/accessibility support\n * - Renders as contentEditable div that users can click and type in\n * - Handles arrow keys, number input, focus management automatically\n *\n * For LITERAL segments (separators):\n * - Just renders static text in a span\n * - No interaction or focus behavior\n */\nconst TimeSegment: React.ForwardRefRenderFunction<BladeElementRef, TimeSegmentProps> = ({\n segment,\n state,\n isDisabled,\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n const [isFocused, setIsFocused] = useState(false);\n const { theme } = useTheme();\n const { segmentProps } = useDateSegment(segment, state, ref);\n\n // Filter out bi-directional text control characters () that React Aria adds for RTL support but aren't needed for our UI - they appear as extra literal segments in some environments\n\n if ((segment.type === 'literal' && segment.text === '') || segment.text === '') {\n return null;\n }\n // Calculate minWidth based on segment maxValue to prevent layout shifts\n const minWidth = segment.maxValue != null ? `${String(segment.maxValue).length}ch` : 'auto';\n\n return (\n <StyledTimeSegment\n ref={ref}\n theme={theme}\n style={{ ...segmentProps.style, minWidth }}\n onFocus={(e: React.FocusEvent<HTMLDivElement>) => {\n setIsFocused(true);\n segmentProps.onFocus?.(e);\n }}\n onBlur={(e: React.FocusEvent<HTMLDivElement>) => {\n setIsFocused(false);\n segmentProps.onBlur?.(e);\n }}\n {...segmentProps}\n >\n {/* Always reserve space for the placeholder, to prevent layout shift when editing. */}\n <BaseBox\n as=\"span\"\n display=\"block\"\n width=\"100%\"\n textAlign=\"center\"\n visibility={segment.isPlaceholder ? undefined : 'hidden'}\n height={segment.isPlaceholder ? 'auto' : 'spacing.0'}\n pointerEvents=\"none\"\n style={{\n color: isFocused\n ? theme.colors.surface.text.gray.normal\n : theme.colors.surface.text.gray.disabled,\n }}\n >\n {segment.placeholder} {/* Placeholder text like \"––\" or \":\" */}\n </BaseBox>\n {/* Show actual value when not placeholder, empty string when placeholder */}\n <BaseBox\n as=\"span\"\n style={{\n color: isDisabled\n ? theme.colors.surface.text.gray.disabled\n : theme.colors.surface.text.gray.normal,\n }}\n >\n {segment.isPlaceholder\n ? ''\n : segment.type === 'dayPeriod'\n ? segment.text.toUpperCase()\n : segment.text}\n </BaseBox>\n </StyledTimeSegment>\n );\n};\n\n/**\n * TimeInput Component\n *\n * A complete time input field built with React Aria for accessibility and keyboard interaction.\n *\n * ARCHITECTURE:\n * - Uses React Aria's useTimeFieldState for time value management & field-level behavior\n * - Uses Blade's BaseInput (as=\"div\") for styling and form integration\n * - Renders multiple TimeSegment components for individual time parts\n *\n * USER INTERACTION:\n * - Click on any segment (hour, minute, AM/PM) to focus and edit\n * - Type numbers directly to change values\n * - Use arrow keys to increment/decrement values\n * - Tab between segments for navigation\n * - Full keyboard accessibility support\n */\nconst _TimeInput: React.ForwardRefRenderFunction<BladeElementRef, TimePickerInputProps> = (\n {\n timeValue,\n internalTimeValue,\n onChange,\n onTimeValueChange,\n label,\n helpText,\n errorText,\n successText,\n validationState,\n isDisabled,\n isRequired,\n necessityIndicator,\n autoFocus,\n name,\n placeholder,\n size = 'medium',\n labelPosition,\n labelSuffix,\n labelTrailing,\n timeFormat,\n testID,\n accessibilityLabel,\n inputRef,\n referenceProps,\n createCompleteTime,\n setIsDropdownOpen,\n ...props\n },\n ref: React.ForwardedRef<BladeElementRef>,\n) => {\n const currentTimeFormat = timeFormat ?? '12h';\n const { locale } = useLocale();\n\n const state = useTimeFieldState({\n label,\n locale,\n hourCycle: currentTimeFormat === '12h' ? 12 : 24,\n value: internalTimeValue, // Use TimeValue directly from hook\n onChange: onTimeValueChange, // Use TimeValue onChange directly\n isDisabled,\n shouldForceLeadingZeros: true, // Force leading zeros (01, 02, 03...)\n });\n\n const timeFieldRef = useRef<HTMLDivElement>(null);\n const { fieldProps } = useTimeField(\n {\n label,\n },\n state,\n timeFieldRef,\n );\n\n // Extract onKeyDown from referenceProps to handle Enter key for dropdown opening\n const { onKeyDown: referenceOnKeyDown, ...otherReferenceProps } = referenceProps || {};\n\n // Handle Enter key to open dropdown while preserving React Aria's keyboard navigation\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === 'Enter' && !isDisabled) {\n // Trigger dropdown opening (same as clicking the input)\n referenceOnKeyDown?.(event);\n return;\n }\n\n // Let React Aria handle all other keys for segment navigation\n fieldProps.onKeyDown?.(event);\n };\n\n const handleInputClick = React.useCallback(\n (_e: React.MouseEvent): void => {\n if (isDisabled) return;\n\n setIsDropdownOpen?.(true);\n },\n [isDisabled, setIsDropdownOpen],\n );\n\n return (\n <BaseBox\n {...fieldProps}\n className=\"timepicker-input\"\n onClick={handleInputClick}\n onKeyDown={handleKeyDown}\n ref={mergeRefs(timeFieldRef, ref as React.Ref<HTMLDivElement>)}\n >\n <BaseInput\n ref={inputRef}\n as=\"div\"\n id=\"timepicker\"\n label={label}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n autoFocus={autoFocus} // eslint-disable-line jsx-a11y/no-autofocus\n name={name}\n size={size}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n leadingIcon={ClockIcon}\n popupId={referenceProps?.['aria-controls']}\n isPopupExpanded={referenceProps?.['aria-expanded']}\n hasPopup={referenceProps?.['aria-haspopup']}\n testID={testID}\n accessibilityLabel={accessibilityLabel || label || 'Time picker'}\n {...props}\n {...otherReferenceProps}\n >\n <BaseBox display=\"flex\">\n {state.segments.map((segment, i) => {\n return (\n // Fix for React Aria contentEditable focus issue\n // Wrapping each segment in a div prevents unwanted focus when clicking outside\n // See: https://github.com/adobe/react-spectrum/issues/3164\n <BaseBox key={i}>\n <TimeSegment segment={segment} state={state} isDisabled={isDisabled} />\n </BaseBox>\n );\n })}\n </BaseBox>\n </BaseInput>\n </BaseBox>\n );\n};\n\nconst TimeInput = assignWithoutSideEffects(React.forwardRef(_TimeInput), {\n displayName: 'TimeInput',\n componentId: 'TimeInput',\n});\nexport { TimeInput };\n"],"names":["StyledTimeSegment","styled","div","withConfig","displayName","componentId","makeSpace","spacing","_ref","theme","colors","interactive","background","primary","faded","TimeSegment","_ref2","segment","state","isDisabled","ref","useRef","_useState","useState","_useState2","_slicedToArray","isFocused","setIsFocused","_useTheme","useTheme","_useDateSegment","useDateSegment","segmentProps","type","text","minWidth","maxValue","concat","String","length","_jsxs","_objectSpread","style","onFocus","e","_segmentProps$onFocus","call","onBlur","_segmentProps$onBlur","children","BaseBox","as","display","width","textAlign","visibility","isPlaceholder","undefined","height","pointerEvents","color","surface","gray","normal","disabled","placeholder","_jsx","toUpperCase","_TimeInput","_ref3","timeValue","internalTimeValue","onChange","onTimeValueChange","label","helpText","errorText","successText","validationState","isRequired","necessityIndicator","autoFocus","name","_ref3$size","size","labelPosition","labelSuffix","labelTrailing","timeFormat","testID","accessibilityLabel","inputRef","referenceProps","createCompleteTime","setIsDropdownOpen","props","_objectWithoutProperties","_excluded","currentTimeFormat","_useLocale","useLocale","locale","useTimeFieldState","hourCycle","value","shouldForceLeadingZeros","timeFieldRef","_useTimeField","useTimeField","fieldProps","_ref4","referenceOnKeyDown","onKeyDown","otherReferenceProps","_excluded2","handleKeyDown","event","_fieldProps$onKeyDown","key","handleInputClick","React","useCallback","_e","className","onClick","mergeRefs","BaseInput","id","leadingIcon","ClockIcon","popupId","isPopupExpanded","hasPopup","segments","map","i","TimeInput","assignWithoutSideEffects","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,iBAAiB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAClBC,CAAAA,CAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,EAAAA,wGAAAA,EAAAA,4BAAAA,EAAAA,uEAAAA,CAAAA,EAAAA,SAAS,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,EACpBD,SAAS,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,EAKrBD,SAAS,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,EAGhB,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;EAAA,OAC1BA,KAAK,CAACC,MAAM,CAACC,WAAW,CAACC,UAAU,CAACC,OAAO,CAACC,KAAK,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 +1,13 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { BaseTimePicker } from './BaseTimePicker.web.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
var TimePicker = function TimePicker(props) {
|
|
9
|
+
return /*#__PURE__*/jsx(BaseTimePicker, _objectSpread({}, props));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { TimePicker };
|
|
13
|
+
//# sourceMappingURL=TimePicker.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePicker.web.js","sources":["../../../../../../src/components/TimePicker/TimePicker.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { TimePickerProps } from './types';\nimport { BaseTimePicker } from './BaseTimePicker.web';\n\nconst TimePicker = (props: TimePickerProps): React.ReactElement => {\n return <BaseTimePicker {...props} />;\n};\n\nexport { TimePicker };\n"],"names":["TimePicker","props","_jsx","BaseTimePicker","_objectSpread"],"mappings":";;;;;;;AAIA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAsB,EAAyB;EACjE,oBAAOC,GAAA,CAACC,cAAc,EAAAC,aAAA,CAAKH,EAAAA,EAAAA,KAAK,CAAG,CAAC,CAAA;AACtC;;;;"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { SpinWheel } from './SpinWheel.web.js';
|
|
5
|
+
import { TimePickerFooter } from './TimePickerFooter.web.js';
|
|
6
|
+
import { getNearestStepValue, createDateFromSelection } from './utils.js';
|
|
7
|
+
import '../Divider/index.js';
|
|
8
|
+
import '../BladeProvider/index.js';
|
|
9
|
+
import '../Box/BaseBox/index.js';
|
|
10
|
+
import { useIsMobile } from '../../utils/useIsMobile.js';
|
|
11
|
+
import '../../tokens/global/index.js';
|
|
12
|
+
import '../../utils/makeSize/index.js';
|
|
13
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
14
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
15
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
16
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
17
|
+
import { size } from '../../tokens/global/size.js';
|
|
18
|
+
import { Divider } from '../Divider/Divider.js';
|
|
19
|
+
|
|
20
|
+
var StyledFadeContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
21
|
+
displayName: "TimePickerContentweb__StyledFadeContainer",
|
|
22
|
+
componentId: "sc-1c0gid8-0"
|
|
23
|
+
})(["position:relative;&::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient( to bottom,", " 0px,transparent 48px,transparent calc(100% - 48px),", " 100% );pointer-events:none;z-index:10;}"], function (_ref) {
|
|
24
|
+
var theme = _ref.theme;
|
|
25
|
+
return theme.colors.surface.background.gray.intense;
|
|
26
|
+
}, function (_ref2) {
|
|
27
|
+
var theme = _ref2.theme;
|
|
28
|
+
return theme.colors.surface.background.gray.intense;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Content component for TimePicker dropdown
|
|
33
|
+
* Contains the time selection wheels and footer
|
|
34
|
+
*/
|
|
35
|
+
var TimePickerContent = function TimePickerContent(_ref3) {
|
|
36
|
+
var setSelectedTime = _ref3.setSelectedTime,
|
|
37
|
+
selectedHour = _ref3.selectedHour,
|
|
38
|
+
selectedMinute = _ref3.selectedMinute,
|
|
39
|
+
selectedPeriod = _ref3.selectedPeriod,
|
|
40
|
+
timeFormat = _ref3.timeFormat,
|
|
41
|
+
minuteStep = _ref3.minuteStep,
|
|
42
|
+
showFooterActions = _ref3.showFooterActions,
|
|
43
|
+
onApply = _ref3.onApply,
|
|
44
|
+
onCancel = _ref3.onCancel;
|
|
45
|
+
var isMobile = useIsMobile();
|
|
46
|
+
var _useTheme = useTheme(),
|
|
47
|
+
theme = _useTheme.theme;
|
|
48
|
+
var currentHour = selectedHour;
|
|
49
|
+
var currentMinute = selectedMinute;
|
|
50
|
+
var currentPeriod = selectedPeriod;
|
|
51
|
+
var is12HourFormat = timeFormat === '12h';
|
|
52
|
+
|
|
53
|
+
// Roving tabindex + focus management across wheels
|
|
54
|
+
var _React$useState = React__default.useState(0),
|
|
55
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
56
|
+
activeWheelIndex = _React$useState2[0],
|
|
57
|
+
setActiveWheelIndex = _React$useState2[1];
|
|
58
|
+
var hourRef = React__default.useRef(null);
|
|
59
|
+
var minuteRef = React__default.useRef(null);
|
|
60
|
+
var periodRef = React__default.useRef(null);
|
|
61
|
+
var wheelRefs = is12HourFormat ? [hourRef, minuteRef, periodRef] : [hourRef, minuteRef];
|
|
62
|
+
var focusWheel = function focusWheel(index) {
|
|
63
|
+
setActiveWheelIndex(index);
|
|
64
|
+
// ensure tabindex update applies before focusing
|
|
65
|
+
requestAnimationFrame(function () {
|
|
66
|
+
var _wheelRefs$index;
|
|
67
|
+
(_wheelRefs$index = wheelRefs[index]) === null || _wheelRefs$index === void 0 || (_wheelRefs$index = _wheelRefs$index.current) === null || _wheelRefs$index === void 0 || _wheelRefs$index.focus();
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
var handleContainerKeyDown = function handleContainerKeyDown(e) {
|
|
71
|
+
// Up/Down should be handled by individual wheels; Left/Right move to next wheel
|
|
72
|
+
if (e.key === 'ArrowRight') {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
var next = Math.min(activeWheelIndex + 1, wheelRefs.length - 1);
|
|
75
|
+
if (next !== activeWheelIndex) focusWheel(next);
|
|
76
|
+
} else if (e.key === 'ArrowLeft') {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
var prev = Math.max(activeWheelIndex - 1, 0);
|
|
79
|
+
if (prev !== activeWheelIndex) focusWheel(prev);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var handleContainerFocus = function handleContainerFocus(e) {
|
|
83
|
+
var target = e.target;
|
|
84
|
+
var idx = wheelRefs.findIndex(function (ref) {
|
|
85
|
+
return ref.current === target;
|
|
86
|
+
});
|
|
87
|
+
if (idx !== -1 && idx !== activeWheelIndex) {
|
|
88
|
+
setActiveWheelIndex(idx);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Generate values for each wheel with leading zeros
|
|
93
|
+
var hourValues = is12HourFormat ? Array.from({
|
|
94
|
+
length: 12
|
|
95
|
+
}, function (_, i) {
|
|
96
|
+
return String(i + 1).padStart(2, '0');
|
|
97
|
+
}) : Array.from({
|
|
98
|
+
length: 24
|
|
99
|
+
}, function (_, i) {
|
|
100
|
+
return String(i).padStart(2, '0');
|
|
101
|
+
});
|
|
102
|
+
var minuteValues = Array.from({
|
|
103
|
+
length: 60 / minuteStep
|
|
104
|
+
}, function (_, i) {
|
|
105
|
+
return String(i * minuteStep).padStart(2, '0');
|
|
106
|
+
});
|
|
107
|
+
var periodValues = ['AM', 'PM'];
|
|
108
|
+
|
|
109
|
+
// Calculate display value for minute wheel positioning when minuteStep > 1
|
|
110
|
+
// This allows typed values like "03" to position at nearest step "00" while preserving actual value
|
|
111
|
+
var displayMinute = minuteStep > 1 ? getNearestStepValue(currentMinute, minuteStep) : undefined;
|
|
112
|
+
|
|
113
|
+
// Handle value changes - directly update selectedTime
|
|
114
|
+
var handleHourChange = function handleHourChange(value) {
|
|
115
|
+
var hour = Number(value);
|
|
116
|
+
var newDate = createDateFromSelection(currentHour, currentMinute, currentPeriod, timeFormat, hour);
|
|
117
|
+
setSelectedTime(newDate);
|
|
118
|
+
};
|
|
119
|
+
var handleMinuteChange = function handleMinuteChange(value) {
|
|
120
|
+
var minute = Number(value);
|
|
121
|
+
var newDate = createDateFromSelection(currentHour, currentMinute, currentPeriod, timeFormat, undefined, minute);
|
|
122
|
+
setSelectedTime(newDate);
|
|
123
|
+
};
|
|
124
|
+
var handlePeriodChange = function handlePeriodChange(value) {
|
|
125
|
+
var period = value;
|
|
126
|
+
var newDate = createDateFromSelection(currentHour, currentMinute, currentPeriod, timeFormat, undefined, undefined, period);
|
|
127
|
+
setSelectedTime(newDate);
|
|
128
|
+
};
|
|
129
|
+
var handleApply = function handleApply() {
|
|
130
|
+
var newDate = createDateFromSelection(currentHour, currentMinute, currentPeriod, timeFormat);
|
|
131
|
+
setSelectedTime(newDate);
|
|
132
|
+
onApply();
|
|
133
|
+
};
|
|
134
|
+
return /*#__PURE__*/jsxs(BaseBox, {
|
|
135
|
+
display: "flex",
|
|
136
|
+
className: "timepicker-content",
|
|
137
|
+
flexDirection: "column",
|
|
138
|
+
height: showFooterActions ? makeSize(size[250]) : makeSize(size[196]),
|
|
139
|
+
width: isMobile ? '100%' : makeSize(size[198]),
|
|
140
|
+
"data-allow-scroll": "true",
|
|
141
|
+
children: [/*#__PURE__*/jsxs(StyledFadeContainer, {
|
|
142
|
+
theme: theme,
|
|
143
|
+
display: "flex",
|
|
144
|
+
flexDirection: "row",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
alignItems: "flex-start",
|
|
147
|
+
margin: ['spacing.4', 'spacing.0'],
|
|
148
|
+
onKeyDown: handleContainerKeyDown,
|
|
149
|
+
onFocus: handleContainerFocus,
|
|
150
|
+
children: [/*#__PURE__*/jsx(BaseBox, {
|
|
151
|
+
position: "absolute",
|
|
152
|
+
top: "50%",
|
|
153
|
+
left: "spacing.0",
|
|
154
|
+
right: "spacing.0",
|
|
155
|
+
height: "36px",
|
|
156
|
+
transform: "translateY(-50%)",
|
|
157
|
+
backgroundColor: "interactive.background.gray.faded",
|
|
158
|
+
pointerEvents: "none",
|
|
159
|
+
zIndex: 1
|
|
160
|
+
}), /*#__PURE__*/jsx(SpinWheel, {
|
|
161
|
+
className: "timepicker-hour-wheel",
|
|
162
|
+
label: "Hour",
|
|
163
|
+
values: hourValues,
|
|
164
|
+
selectedValue: String(currentHour).padStart(2, '0'),
|
|
165
|
+
onChange: handleHourChange,
|
|
166
|
+
scrollContainerRef: hourRef,
|
|
167
|
+
tabIndex: activeWheelIndex === 0 ? 0 : -1
|
|
168
|
+
}), /*#__PURE__*/jsx(Divider, {
|
|
169
|
+
orientation: "vertical"
|
|
170
|
+
}), /*#__PURE__*/jsx(SpinWheel, {
|
|
171
|
+
className: "timepicker-minute-wheel",
|
|
172
|
+
label: "Min",
|
|
173
|
+
values: minuteValues,
|
|
174
|
+
selectedValue: String(currentMinute).padStart(2, '0'),
|
|
175
|
+
displayValue: displayMinute ? String(displayMinute).padStart(2, '0') : undefined,
|
|
176
|
+
onChange: handleMinuteChange,
|
|
177
|
+
scrollContainerRef: minuteRef,
|
|
178
|
+
tabIndex: activeWheelIndex === 1 ? 0 : -1
|
|
179
|
+
}), is12HourFormat && /*#__PURE__*/jsxs(Fragment, {
|
|
180
|
+
children: [/*#__PURE__*/jsx(Divider, {
|
|
181
|
+
orientation: "vertical"
|
|
182
|
+
}), /*#__PURE__*/jsx(SpinWheel, {
|
|
183
|
+
className: "timepicker-period-wheel",
|
|
184
|
+
label: "Period",
|
|
185
|
+
values: periodValues,
|
|
186
|
+
selectedValue: currentPeriod,
|
|
187
|
+
onChange: handlePeriodChange,
|
|
188
|
+
scrollContainerRef: periodRef,
|
|
189
|
+
tabIndex: activeWheelIndex === 2 ? 0 : -1
|
|
190
|
+
})]
|
|
191
|
+
})]
|
|
192
|
+
}), showFooterActions && /*#__PURE__*/jsx(TimePickerFooter, {
|
|
193
|
+
onApply: handleApply,
|
|
194
|
+
onCancel: onCancel
|
|
195
|
+
})]
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { TimePickerContent };
|
|
200
|
+
//# sourceMappingURL=TimePickerContent.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePickerContent.web.js","sources":["../../../../../../src/components/TimePicker/TimePickerContent.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { SpinWheel } from './SpinWheel';\nimport { TimePickerFooter } from './TimePickerFooter';\nimport type { TimePickerContentProps } from './types';\nimport { getNearestStepValue, createDateFromSelection } from './utils';\nimport { Divider } from '~components/Divider';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils/makeSize';\n\n// Styled container with fade overlay\nconst StyledFadeContainer = styled(BaseBox)`\n position: relative;\n\n /* Fade overlay that sits above content */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(\n to bottom,\n ${({ theme }) => theme.colors.surface.background.gray.intense} 0px,\n transparent 48px,\n transparent calc(100% - 48px),\n ${({ theme }) => theme.colors.surface.background.gray.intense} 100%\n );\n pointer-events: none;\n z-index: 10;\n }\n`;\n\n/**\n * Content component for TimePicker dropdown\n * Contains the time selection wheels and footer\n */\nconst TimePickerContent = ({\n setSelectedTime,\n selectedHour,\n selectedMinute,\n selectedPeriod,\n timeFormat,\n minuteStep,\n showFooterActions,\n onApply,\n onCancel,\n}: TimePickerContentProps): React.ReactElement => {\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n\n const currentHour = selectedHour;\n const currentMinute = selectedMinute;\n const currentPeriod = selectedPeriod;\n const is12HourFormat = timeFormat === '12h';\n\n // Roving tabindex + focus management across wheels\n const [activeWheelIndex, setActiveWheelIndex] = React.useState(0);\n const hourRef = React.useRef<HTMLDivElement>(null);\n const minuteRef = React.useRef<HTMLDivElement>(null);\n const periodRef = React.useRef<HTMLDivElement>(null);\n\n const wheelRefs = is12HourFormat ? [hourRef, minuteRef, periodRef] : [hourRef, minuteRef];\n\n const focusWheel = (index: number): void => {\n setActiveWheelIndex(index);\n // ensure tabindex update applies before focusing\n requestAnimationFrame(() => {\n wheelRefs[index]?.current?.focus();\n });\n };\n\n const handleContainerKeyDown = (e: React.KeyboardEvent<HTMLDivElement>): void => {\n // Up/Down should be handled by individual wheels; Left/Right move to next wheel\n if (e.key === 'ArrowRight') {\n e.preventDefault();\n const next = Math.min(activeWheelIndex + 1, wheelRefs.length - 1);\n if (next !== activeWheelIndex) focusWheel(next);\n } else if (e.key === 'ArrowLeft') {\n e.preventDefault();\n const prev = Math.max(activeWheelIndex - 1, 0);\n if (prev !== activeWheelIndex) focusWheel(prev);\n }\n };\n\n const handleContainerFocus = (e: React.FocusEvent<HTMLDivElement>): void => {\n const target = e.target as HTMLElement;\n const idx = wheelRefs.findIndex((ref) => ref.current === target);\n if (idx !== -1 && idx !== activeWheelIndex) {\n setActiveWheelIndex(idx);\n }\n };\n\n // Generate values for each wheel with leading zeros\n const hourValues = is12HourFormat\n ? Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, '0'))\n : Array.from({ length: 24 }, (_, i) => String(i).padStart(2, '0'));\n\n const minuteValues = Array.from({ length: 60 / minuteStep }, (_, i) =>\n String(i * minuteStep).padStart(2, '0'),\n );\n const periodValues: ('AM' | 'PM')[] = ['AM', 'PM'];\n\n // Calculate display value for minute wheel positioning when minuteStep > 1\n // This allows typed values like \"03\" to position at nearest step \"00\" while preserving actual value\n const displayMinute = minuteStep > 1 ? getNearestStepValue(currentMinute, minuteStep) : undefined;\n\n // Handle value changes - directly update selectedTime\n const handleHourChange = (value: string | number): void => {\n const hour = Number(value);\n const newDate = createDateFromSelection(\n currentHour,\n currentMinute,\n currentPeriod,\n timeFormat,\n hour,\n );\n setSelectedTime(newDate);\n };\n\n const handleMinuteChange = (value: string | number): void => {\n const minute = Number(value);\n const newDate = createDateFromSelection(\n currentHour,\n currentMinute,\n currentPeriod,\n timeFormat,\n undefined,\n minute,\n );\n setSelectedTime(newDate);\n };\n\n const handlePeriodChange = (value: string | number): void => {\n const period = value as 'AM' | 'PM';\n const newDate = createDateFromSelection(\n currentHour,\n currentMinute,\n currentPeriod,\n timeFormat,\n undefined,\n undefined,\n period,\n );\n setSelectedTime(newDate);\n };\n\n const handleApply = (): void => {\n const newDate = createDateFromSelection(currentHour, currentMinute, currentPeriod, timeFormat);\n setSelectedTime(newDate);\n onApply();\n };\n\n return (\n <BaseBox\n display=\"flex\"\n className=\"timepicker-content\"\n flexDirection=\"column\"\n height={showFooterActions ? makeSize(size[250]) : makeSize(size[196])}\n width={isMobile ? '100%' : makeSize(size[198])}\n data-allow-scroll=\"true\"\n >\n {/* Time Selection Wheels */}\n <StyledFadeContainer\n theme={theme}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"center\"\n alignItems=\"flex-start\"\n margin={['spacing.4', 'spacing.0']}\n onKeyDown={handleContainerKeyDown}\n onFocus={handleContainerFocus}\n >\n {/* Center highlight area */}\n <BaseBox\n position=\"absolute\"\n top=\"50%\"\n left=\"spacing.0\"\n right=\"spacing.0\"\n height=\"36px\"\n transform=\"translateY(-50%)\"\n backgroundColor=\"interactive.background.gray.faded\"\n pointerEvents=\"none\"\n zIndex={1}\n />\n\n {/* Hour Wheel */}\n <SpinWheel\n className=\"timepicker-hour-wheel\"\n label=\"Hour\"\n values={hourValues}\n selectedValue={String(currentHour).padStart(2, '0')}\n onChange={handleHourChange}\n scrollContainerRef={hourRef}\n tabIndex={activeWheelIndex === 0 ? 0 : -1}\n />\n <Divider orientation=\"vertical\" />\n {/* Minute Wheel */}\n <SpinWheel\n className=\"timepicker-minute-wheel\"\n label=\"Min\"\n values={minuteValues}\n selectedValue={String(currentMinute).padStart(2, '0')}\n displayValue={displayMinute ? String(displayMinute).padStart(2, '0') : undefined}\n onChange={handleMinuteChange}\n scrollContainerRef={minuteRef}\n tabIndex={activeWheelIndex === 1 ? 0 : -1}\n />\n {/* Period Wheel (only for 12-hour format) */}\n\n {is12HourFormat && (\n <>\n <Divider orientation=\"vertical\" />\n <SpinWheel\n className=\"timepicker-period-wheel\"\n label=\"Period\"\n values={periodValues}\n selectedValue={currentPeriod}\n onChange={handlePeriodChange}\n scrollContainerRef={periodRef}\n tabIndex={activeWheelIndex === 2 ? 0 : -1}\n />\n </>\n )}\n </StyledFadeContainer>\n\n {/* Footer with Apply/Cancel buttons */}\n {showFooterActions && <TimePickerFooter onApply={handleApply} onCancel={onCancel} />}\n </BaseBox>\n );\n};\n\nexport { TimePickerContent };\n"],"names":["StyledFadeContainer","styled","BaseBox","withConfig","displayName","componentId","_ref","theme","colors","surface","background","gray","intense","_ref2","TimePickerContent","_ref3","setSelectedTime","selectedHour","selectedMinute","selectedPeriod","timeFormat","minuteStep","showFooterActions","onApply","onCancel","isMobile","useIsMobile","_useTheme","useTheme","currentHour","currentMinute","currentPeriod","is12HourFormat","_React$useState","React","useState","_React$useState2","_slicedToArray","activeWheelIndex","setActiveWheelIndex","hourRef","useRef","minuteRef","periodRef","wheelRefs","focusWheel","index","requestAnimationFrame","_wheelRefs$index","current","focus","handleContainerKeyDown","e","key","preventDefault","next","Math","min","length","prev","max","handleContainerFocus","target","idx","findIndex","ref","hourValues","Array","from","_","i","String","padStart","minuteValues","periodValues","displayMinute","getNearestStepValue","undefined","handleHourChange","value","hour","Number","newDate","createDateFromSelection","handleMinuteChange","minute","handlePeriodChange","period","handleApply","_jsxs","display","className","flexDirection","height","makeSize","size","width","children","justifyContent","alignItems","margin","onKeyDown","onFocus","_jsx","position","top","left","right","transform","backgroundColor","pointerEvents","zIndex","SpinWheel","label","values","selectedValue","onChange","scrollContainerRef","tabIndex","Divider","orientation","displayValue","_Fragment","TimePickerFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,IAAMA,mBAAmB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,2CAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAAA,CAAA,+HAAA,EAAA,sDAAA,EAAA,0CAAA,CAAA,EAanC,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;EAAA,OAAOA,KAAK,CAACC,MAAM,CAACC,OAAO,CAACC,UAAU,CAACC,IAAI,CAACC,OAAO,CAAA;AAAA,CAAA,EAG3D,UAAAC,KAAA,EAAA;AAAA,EAAA,IAAGN,KAAK,GAAAM,KAAA,CAALN,KAAK,CAAA;EAAA,OAAOA,KAAK,CAACC,MAAM,CAACC,OAAO,CAACC,UAAU,CAACC,IAAI,CAACC,OAAO,CAAA;AAAA,CAKlE,CAAA,CAAA;;AAED;AACA;AACA;AACA;AACA,IAAME,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,KAAA,EAU2B;AAAA,EAAA,IAThDC,eAAe,GAAAD,KAAA,CAAfC,eAAe;IACfC,YAAY,GAAAF,KAAA,CAAZE,YAAY;IACZC,cAAc,GAAAH,KAAA,CAAdG,cAAc;IACdC,cAAc,GAAAJ,KAAA,CAAdI,cAAc;IACdC,UAAU,GAAAL,KAAA,CAAVK,UAAU;IACVC,UAAU,GAAAN,KAAA,CAAVM,UAAU;IACVC,iBAAiB,GAAAP,KAAA,CAAjBO,iBAAiB;IACjBC,OAAO,GAAAR,KAAA,CAAPQ,OAAO;IACPC,QAAQ,GAAAT,KAAA,CAARS,QAAQ,CAAA;AAER,EAAA,IAAMC,QAAQ,GAAGC,WAAW,EAAE,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,EAAEA,QAAAA;AAAS,KAAE,CAAC,CAAA;AAAA,GAC7E,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../Box/index.js';
|
|
3
|
+
import '../Button/index.js';
|
|
4
|
+
import '../Divider/index.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { Box } from '../Box/Box.js';
|
|
7
|
+
import { Divider } from '../Divider/Divider.js';
|
|
8
|
+
import Button from '../Button/Button/Button.js';
|
|
9
|
+
|
|
10
|
+
var TimePickerFooter = function TimePickerFooter(_ref) {
|
|
11
|
+
var onApply = _ref.onApply,
|
|
12
|
+
onCancel = _ref.onCancel,
|
|
13
|
+
_ref$isApplyDisabled = _ref.isApplyDisabled,
|
|
14
|
+
isApplyDisabled = _ref$isApplyDisabled === void 0 ? false : _ref$isApplyDisabled;
|
|
15
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
children: [/*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsxs(Box, {
|
|
19
|
+
width: "100%",
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "row",
|
|
22
|
+
gap: {
|
|
23
|
+
base: 'spacing.5',
|
|
24
|
+
m: 'spacing.3'
|
|
25
|
+
},
|
|
26
|
+
padding: {
|
|
27
|
+
base: 'spacing.5',
|
|
28
|
+
m: 'spacing.4'
|
|
29
|
+
},
|
|
30
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
31
|
+
isFullWidth: true,
|
|
32
|
+
variant: "tertiary",
|
|
33
|
+
size: "xsmall",
|
|
34
|
+
onClick: onCancel,
|
|
35
|
+
children: "Cancel"
|
|
36
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
37
|
+
isDisabled: isApplyDisabled,
|
|
38
|
+
isFullWidth: true,
|
|
39
|
+
variant: "primary",
|
|
40
|
+
size: "xsmall",
|
|
41
|
+
onClick: onApply,
|
|
42
|
+
children: "Apply"
|
|
43
|
+
})]
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { TimePickerFooter };
|
|
49
|
+
//# sourceMappingURL=TimePickerFooter.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePickerFooter.web.js","sources":["../../../../../../src/components/TimePicker/TimePickerFooter.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { TimePickerFooterProps } from './types';\nimport { Box } from '~components/Box';\nimport { Button } from '~components/Button';\nimport { Divider } from '~components/Divider';\n\n/**\n * Footer component for TimePicker with Apply/Cancel buttons\n */\nconst TimePickerFooter = ({\n onApply,\n onCancel,\n isApplyDisabled = false,\n}: TimePickerFooterProps): React.ReactElement => {\n return (\n <Box display=\"flex\" flexDirection=\"column\">\n <Divider />\n <Box\n width=\"100%\"\n display=\"flex\"\n flexDirection=\"row\"\n gap={{ base: 'spacing.5', m: 'spacing.3' }}\n padding={{ base: 'spacing.5', m: 'spacing.4' }}\n >\n <Button isFullWidth={true} variant=\"tertiary\" size=\"xsmall\" onClick={onCancel}>\n Cancel\n </Button>\n <Button\n isDisabled={isApplyDisabled}\n isFullWidth={true}\n variant=\"primary\"\n size=\"xsmall\"\n onClick={onApply}\n >\n Apply\n </Button>\n </Box>\n </Box>\n );\n};\n\nexport { TimePickerFooter };\n"],"names":["TimePickerFooter","_ref","onApply","onCancel","_ref$isApplyDisabled","isApplyDisabled","_jsxs","Box","display","flexDirection","children","_jsx","Divider","width","gap","base","m","padding","Button","isFullWidth","variant","size","onClick","isDisabled"],"mappings":";;;;;;;;;AASA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAI2B;AAAA,EAAA,IAH/CC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oBAAA,GAAAH,I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