@elliemae/ds-time-picker 2.3.0-alpha.8 → 2.3.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSTimePicker.js +121 -0
- package/cjs/DSTimePickerMenu.js +35 -0
- package/cjs/PickerPanel.js +402 -0
- package/cjs/TimePickerDropdown.js +53 -0
- package/cjs/TimePickerImpl.js +175 -0
- package/cjs/TimePickerMenu.js +312 -0
- package/cjs/index.js +17 -0
- package/cjs/moveElementOnScroll.js +75 -0
- package/cjs/utils.js +38 -0
- package/esm/DSTimePicker.js +111 -0
- package/esm/DSTimePickerMenu.js +24 -0
- package/esm/PickerPanel.js +392 -0
- package/esm/TimePickerDropdown.js +45 -0
- package/esm/TimePickerImpl.js +165 -0
- package/esm/TimePickerMenu.js +301 -0
- package/esm/index.js +4 -0
- package/esm/moveElementOnScroll.js +70 -0
- package/esm/utils.js +31 -0
- package/package.json +38 -40
- package/types/DSTimePicker.d.ts +162 -0
- package/types/DSTimePickerMenu.d.ts +4 -0
- package/types/PickerPanel.d.ts +24 -0
- package/types/TimePickerDropdown.d.ts +25 -0
- package/types/TimePickerImpl.d.ts +35 -0
- package/types/TimePickerMenu.d.ts +19 -0
- package/types/index.d.ts +5 -0
- package/types/moveElementOnScroll.d.ts +13 -0
- package/types/utils.d.ts +8 -0
- package/dist/cjs/DSTimePicker.js +0 -106
- package/dist/cjs/DSTimePicker.js.map +0 -7
- package/dist/cjs/DSTimePickerMenu.js +0 -48
- package/dist/cjs/DSTimePickerMenu.js.map +0 -7
- package/dist/cjs/PickerPanel.js +0 -299
- package/dist/cjs/PickerPanel.js.map +0 -7
- package/dist/cjs/TimePickerDropdown.js +0 -74
- package/dist/cjs/TimePickerDropdown.js.map +0 -7
- package/dist/cjs/TimePickerImpl.js +0 -183
- package/dist/cjs/TimePickerImpl.js.map +0 -7
- package/dist/cjs/TimePickerMenu.js +0 -241
- package/dist/cjs/TimePickerMenu.js.map +0 -7
- package/dist/cjs/index.js +0 -40
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/moveElementOnScroll.js +0 -93
- package/dist/cjs/moveElementOnScroll.js.map +0 -7
- package/dist/cjs/utils.js +0 -71
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/DSTimePicker.js +0 -77
- package/dist/esm/DSTimePicker.js.map +0 -7
- package/dist/esm/DSTimePickerMenu.js +0 -19
- package/dist/esm/DSTimePickerMenu.js.map +0 -7
- package/dist/esm/PickerPanel.js +0 -270
- package/dist/esm/PickerPanel.js.map +0 -7
- package/dist/esm/TimePickerDropdown.js +0 -45
- package/dist/esm/TimePickerDropdown.js.map +0 -7
- package/dist/esm/TimePickerImpl.js +0 -154
- package/dist/esm/TimePickerImpl.js.map +0 -7
- package/dist/esm/TimePickerMenu.js +0 -212
- package/dist/esm/TimePickerMenu.js.map +0 -7
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/moveElementOnScroll.js +0 -64
- package/dist/esm/moveElementOnScroll.js.map +0 -7
- package/dist/esm/utils.js +0 -42
- package/dist/esm/utils.js.map +0 -7
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var TimePickerMenu_exports = {};
|
|
29
|
-
__export(TimePickerMenu_exports, {
|
|
30
|
-
TimePickerMenu: () => TimePickerMenu,
|
|
31
|
-
default: () => TimePickerMenu_default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_prop_types = __toESM(require("prop-types"));
|
|
36
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
37
|
-
var import_moment = __toESM(require("moment"));
|
|
38
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
39
|
-
var import_utils = require("./utils");
|
|
40
|
-
var import_PickerPanel = require("./PickerPanel");
|
|
41
|
-
const blockName = "time-picker-menu";
|
|
42
|
-
const TimePickerContainer = (0, import_ds_classnames.aggregatedClasses)("div")(blockName);
|
|
43
|
-
const TimePickerHeader = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "header");
|
|
44
|
-
const TimePickerPanelContainer = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "panel-container");
|
|
45
|
-
const generateOption = (format) => (option) => ({
|
|
46
|
-
value: option,
|
|
47
|
-
label: typeof format === "function" ? format(option) : option
|
|
48
|
-
});
|
|
49
|
-
class TimePickerMenu extends import_react.Component {
|
|
50
|
-
constructor(props) {
|
|
51
|
-
super(props);
|
|
52
|
-
this.renderHeader = () => {
|
|
53
|
-
const { time } = this.state;
|
|
54
|
-
return /* @__PURE__ */ import_react.default.createElement(TimePickerHeader, null, time.format("hh:mma"));
|
|
55
|
-
};
|
|
56
|
-
this.state = {
|
|
57
|
-
time: (0, import_moment.default)(props.time || "", props.format) || (0, import_moment.default)()
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
static getDerivedStateFromProps(props, state) {
|
|
61
|
-
if (props.time) {
|
|
62
|
-
return { ...state, time: (0, import_moment.default)(props.time) };
|
|
63
|
-
}
|
|
64
|
-
return { ...state, time: void 0 };
|
|
65
|
-
}
|
|
66
|
-
componentDidMount() {
|
|
67
|
-
const { time } = this.state;
|
|
68
|
-
this.setState({ time });
|
|
69
|
-
}
|
|
70
|
-
handleMinuteChange(value) {
|
|
71
|
-
const { time } = this.state;
|
|
72
|
-
this.updateTime(time.minute(value));
|
|
73
|
-
}
|
|
74
|
-
handleHoursChange(value) {
|
|
75
|
-
const { time } = this.state;
|
|
76
|
-
const { use12Hours } = this.props;
|
|
77
|
-
let nextHour = value;
|
|
78
|
-
if (use12Hours) {
|
|
79
|
-
if (!(0, import_utils.isAM)(time)) {
|
|
80
|
-
nextHour = value % 12 + 12;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
this.updateTime(time.hour(nextHour));
|
|
84
|
-
}
|
|
85
|
-
handleSecondsChange(value) {
|
|
86
|
-
const { time } = this.state;
|
|
87
|
-
this.updateTime(time.second(value));
|
|
88
|
-
}
|
|
89
|
-
handleAMPMChange(value) {
|
|
90
|
-
const { time } = this.state;
|
|
91
|
-
const hour = time.hour();
|
|
92
|
-
const nextHour = value.toLowerCase() === "am" ? hour % 12 : hour % 12 + 12;
|
|
93
|
-
this.updateTime(time.hour(nextHour));
|
|
94
|
-
}
|
|
95
|
-
updateTime(time) {
|
|
96
|
-
const { onTimeChange } = this.props;
|
|
97
|
-
onTimeChange(time);
|
|
98
|
-
this.setState({ time });
|
|
99
|
-
}
|
|
100
|
-
renderHoursPanel() {
|
|
101
|
-
const { time } = this.state;
|
|
102
|
-
const { showHours, use12Hours, format, hasHeader, disabledTimes } = this.props;
|
|
103
|
-
if (!showHours)
|
|
104
|
-
return null;
|
|
105
|
-
const hour = time.hour();
|
|
106
|
-
let selectedHour = use12Hours ? hour % 12 || 12 : hour;
|
|
107
|
-
if (disabledTimes) {
|
|
108
|
-
const { from, to } = disabledTimes;
|
|
109
|
-
if (hour > from.hour && hour < to.hour) {
|
|
110
|
-
if (to.hour < 24) {
|
|
111
|
-
const toFormatted = to.hour % 12 || 12;
|
|
112
|
-
if (selectedHour !== toFormatted)
|
|
113
|
-
this.handleHoursChange(toFormatted);
|
|
114
|
-
selectedHour = toFormatted;
|
|
115
|
-
} else if (from) {
|
|
116
|
-
selectedHour = (from.hour - 1) % 12 || 12;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const meridiem = hour >= 12 ? "PM" : "AM";
|
|
121
|
-
const withLeadingZeros = format.indexOf("hh") > -1;
|
|
122
|
-
const rangeHours = use12Hours ? (0, import_ds_utilities.range)(1, 13) : (0, import_ds_utilities.range)(24);
|
|
123
|
-
const hoursOptions = rangeHours.map(generateOption(withLeadingZeros && (0, import_ds_utilities.addLeadingZeros)(2)));
|
|
124
|
-
return /* @__PURE__ */ import_react.default.createElement(import_PickerPanel.PickerPanel, {
|
|
125
|
-
type: "hour",
|
|
126
|
-
time,
|
|
127
|
-
meridiem,
|
|
128
|
-
hasHeader,
|
|
129
|
-
header: "H",
|
|
130
|
-
onChange: this.handleHoursChange,
|
|
131
|
-
options: hoursOptions,
|
|
132
|
-
selected: selectedHour,
|
|
133
|
-
disabledTimes
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
renderMinutesPanel() {
|
|
137
|
-
const { time } = this.state;
|
|
138
|
-
const { showMinutes, format, hasHeader, disabledTimes, minutesInterval } = this.props;
|
|
139
|
-
if (!showMinutes)
|
|
140
|
-
return null;
|
|
141
|
-
const withLeadingZeros = format.indexOf("mm") > -1;
|
|
142
|
-
const rangeMinutes = (0, import_ds_utilities.range)(0, 60, minutesInterval).map(generateOption(withLeadingZeros && (0, import_ds_utilities.addLeadingZeros)(2)));
|
|
143
|
-
let selectedMinute = time.minute();
|
|
144
|
-
const selectedHour = time.hour();
|
|
145
|
-
if (disabledTimes) {
|
|
146
|
-
const { from, to } = disabledTimes;
|
|
147
|
-
if (selectedHour <= to.hour && selectedHour > from.hour) {
|
|
148
|
-
if (to) {
|
|
149
|
-
if (selectedMinute < to.min)
|
|
150
|
-
this.handleMinuteChange(to.min);
|
|
151
|
-
} else if (from) {
|
|
152
|
-
if (selectedMinute > from.min)
|
|
153
|
-
this.handleMinuteChange(from.min - 1);
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
selectedMinute = time.minute();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return /* @__PURE__ */ import_react.default.createElement(import_PickerPanel.PickerPanel, {
|
|
160
|
-
type: "minutes",
|
|
161
|
-
time,
|
|
162
|
-
hasHeader,
|
|
163
|
-
header: "M",
|
|
164
|
-
onChange: this.handleMinuteChange,
|
|
165
|
-
options: rangeMinutes,
|
|
166
|
-
selected: selectedMinute,
|
|
167
|
-
disabledTimes
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
renderSecondsPanel() {
|
|
171
|
-
const { time } = this.state;
|
|
172
|
-
const { showSeconds, format, hasHeader } = this.props;
|
|
173
|
-
if (!showSeconds)
|
|
174
|
-
return null;
|
|
175
|
-
const withLeadingZeros = format.indexOf("ss") > -1;
|
|
176
|
-
const rangeSeconds = (0, import_ds_utilities.range)(60).map(generateOption(withLeadingZeros && (0, import_ds_utilities.addLeadingZeros)(2)));
|
|
177
|
-
return /* @__PURE__ */ import_react.default.createElement(import_PickerPanel.PickerPanel, {
|
|
178
|
-
type: "seconds",
|
|
179
|
-
hasHeader,
|
|
180
|
-
header: "S",
|
|
181
|
-
onChange: this.handleSecondsChange,
|
|
182
|
-
options: rangeSeconds,
|
|
183
|
-
selected: time.second()
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
renderAMPMPanel() {
|
|
187
|
-
const { time } = this.state;
|
|
188
|
-
const { use12Hours, hasHeader, disabledTimes } = this.props;
|
|
189
|
-
if (!use12Hours)
|
|
190
|
-
return null;
|
|
191
|
-
let meridiemSelected = !(0, import_utils.isAM)(time) ? "pm" : "am";
|
|
192
|
-
if (disabledTimes && disabledTimes.to && meridiemSelected === "am") {
|
|
193
|
-
meridiemSelected = disabledTimes.to.hour >= 12 ? "pm" : "am";
|
|
194
|
-
if (meridiemSelected === "am" && time.hour() > 12) {
|
|
195
|
-
this.handleAMPMChange("am");
|
|
196
|
-
}
|
|
197
|
-
if (meridiemSelected === "pm" && time.hour() <= 12) {
|
|
198
|
-
this.handleAMPMChange("pm");
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return /* @__PURE__ */ import_react.default.createElement(import_PickerPanel.PickerPanel, {
|
|
202
|
-
type: "meridiem",
|
|
203
|
-
hasHeader,
|
|
204
|
-
header: "",
|
|
205
|
-
onChange: this.handleAMPMChange,
|
|
206
|
-
options: [
|
|
207
|
-
{ value: "am", label: "am" },
|
|
208
|
-
{ value: "pm", label: "pm" }
|
|
209
|
-
],
|
|
210
|
-
selected: meridiemSelected,
|
|
211
|
-
disabledTimes
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
render() {
|
|
215
|
-
const { hasHeaderDisplay } = this.props;
|
|
216
|
-
return /* @__PURE__ */ import_react.default.createElement(TimePickerContainer, null, hasHeaderDisplay && this.renderHeader(), /* @__PURE__ */ import_react.default.createElement(TimePickerPanelContainer, null, this.renderHoursPanel(), this.renderMinutesPanel(), this.renderSecondsPanel(), this.renderAMPMPanel()));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
TimePickerMenu.defaultProps = {
|
|
220
|
-
time: (0, import_moment.default)(),
|
|
221
|
-
hasHeader: false,
|
|
222
|
-
use12Hours: true,
|
|
223
|
-
showSeconds: true,
|
|
224
|
-
showMinutes: true,
|
|
225
|
-
showHours: true,
|
|
226
|
-
disabledTimes: void 0,
|
|
227
|
-
onTimeChange: () => null
|
|
228
|
-
};
|
|
229
|
-
TimePickerMenu.propTypes = {
|
|
230
|
-
time: import_prop_types.default.instanceOf(import_moment.default),
|
|
231
|
-
hasHeader: import_prop_types.default.bool,
|
|
232
|
-
use12Hours: import_prop_types.default.bool,
|
|
233
|
-
showSeconds: import_prop_types.default.bool,
|
|
234
|
-
showMinutes: import_prop_types.default.bool,
|
|
235
|
-
showHours: import_prop_types.default.bool,
|
|
236
|
-
onTimeChange: import_prop_types.default.func,
|
|
237
|
-
disabledTimes: import_prop_types.default.object
|
|
238
|
-
};
|
|
239
|
-
var TimePickerMenu_default = TimePickerMenu;
|
|
240
|
-
module.exports = __toCommonJS(TimePickerMenu_exports);
|
|
241
|
-
//# sourceMappingURL=TimePickerMenu.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/TimePickerMenu.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable react/prop-types */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport moment from 'moment';\nimport { range, addLeadingZeros } from '@elliemae/ds-utilities';\nimport { isAM } from './utils';\nimport { PickerPanel } from './PickerPanel';\n\nconst blockName = 'time-picker-menu';\n\nconst TimePickerContainer = aggregatedClasses('div')(blockName);\nconst TimePickerHeader = aggregatedClasses('div')(blockName, 'header');\nconst TimePickerPanelContainer = aggregatedClasses('div')(blockName, 'panel-container');\n\nconst generateOption = (format) => (option) => ({\n value: option,\n label: typeof format === 'function' ? format(option) : option,\n});\n\nclass TimePickerMenu extends Component {\n constructor(props) {\n super(props);\n this.state = {\n time: moment(props.time || '', props.format) || moment(),\n };\n }\n\n static getDerivedStateFromProps(props, state) {\n if (props.time) {\n return { ...state, time: moment(props.time) };\n }\n return { ...state, time: undefined };\n }\n\n componentDidMount() {\n const { time } = this.state;\n this.setState({ time });\n }\n\n handleMinuteChange(value) {\n const { time } = this.state;\n this.updateTime(time.minute(value));\n }\n\n handleHoursChange(value) {\n const { time } = this.state;\n const { use12Hours } = this.props;\n let nextHour = value;\n if (use12Hours) {\n if (!isAM(time)) {\n nextHour = (value % 12) + 12;\n }\n }\n this.updateTime(time.hour(nextHour));\n }\n\n handleSecondsChange(value) {\n const { time } = this.state;\n this.updateTime(time.second(value));\n }\n\n handleAMPMChange(value) {\n const { time } = this.state;\n const hour = time.hour();\n const nextHour = value.toLowerCase() === 'am' ? hour % 12 : (hour % 12) + 12;\n this.updateTime(time.hour(nextHour));\n }\n\n updateTime(time) {\n const { onTimeChange } = this.props;\n onTimeChange(time);\n this.setState({ time });\n }\n\n renderHoursPanel() {\n const { time } = this.state;\n const { showHours, use12Hours, format, hasHeader, disabledTimes } = this.props;\n if (!showHours) return null;\n\n const hour = time.hour(); // in 24 format\n let selectedHour = use12Hours ? hour % 12 || 12 : hour;\n if (disabledTimes) {\n const { from, to } = disabledTimes;\n if (hour > from.hour && hour < to.hour) {\n if (to.hour < 24) {\n const toFormatted = to.hour % 12 || 12;\n if (selectedHour !== toFormatted) this.handleHoursChange(toFormatted);\n selectedHour = toFormatted;\n } else if (from) {\n selectedHour = (from.hour - 1) % 12 || 12;\n }\n }\n }\n\n const meridiem = hour >= 12 ? 'PM' : 'AM';\n const withLeadingZeros = format.indexOf('hh') > -1;\n const rangeHours = use12Hours ? range(1, 13) : range(24);\n const hoursOptions = rangeHours.map(generateOption(withLeadingZeros && addLeadingZeros(2)));\n return (\n <PickerPanel\n type=\"hour\"\n time={time}\n meridiem={meridiem}\n hasHeader={hasHeader}\n header=\"H\"\n onChange={this.handleHoursChange}\n options={hoursOptions}\n selected={selectedHour}\n disabledTimes={disabledTimes}\n />\n );\n }\n\n renderMinutesPanel() {\n const { time } = this.state;\n const { showMinutes, format, hasHeader, disabledTimes, minutesInterval } = this.props;\n if (!showMinutes) return null;\n const withLeadingZeros = format.indexOf('mm') > -1;\n const rangeMinutes = range(0, 60, minutesInterval).map(generateOption(withLeadingZeros && addLeadingZeros(2)));\n\n let selectedMinute = time.minute();\n const selectedHour = time.hour();\n\n if (disabledTimes) {\n const { from, to } = disabledTimes;\n if (selectedHour <= to.hour && selectedHour > from.hour) {\n if (to) {\n if (selectedMinute < to.min) this.handleMinuteChange(to.min);\n } else if (from) {\n if (selectedMinute > from.min) this.handleMinuteChange(from.min - 1);\n }\n } else {\n selectedMinute = time.minute();\n }\n }\n\n return (\n <PickerPanel\n type=\"minutes\"\n time={time}\n hasHeader={hasHeader}\n header=\"M\"\n onChange={this.handleMinuteChange}\n options={rangeMinutes}\n selected={selectedMinute}\n disabledTimes={disabledTimes}\n />\n );\n }\n\n renderSecondsPanel() {\n const { time } = this.state;\n const { showSeconds, format, hasHeader } = this.props;\n if (!showSeconds) return null;\n const withLeadingZeros = format.indexOf('ss') > -1;\n const rangeSeconds = range(60).map(generateOption(withLeadingZeros && addLeadingZeros(2)));\n return (\n <PickerPanel\n type=\"seconds\"\n hasHeader={hasHeader}\n header=\"S\"\n onChange={this.handleSecondsChange}\n options={rangeSeconds}\n selected={time.second()}\n />\n );\n }\n\n renderAMPMPanel() {\n const { time } = this.state;\n const { use12Hours, hasHeader, disabledTimes } = this.props;\n if (!use12Hours) return null;\n\n let meridiemSelected = !isAM(time) ? 'pm' : 'am';\n if (disabledTimes && disabledTimes.to && meridiemSelected === 'am') {\n meridiemSelected = disabledTimes.to.hour >= 12 ? 'pm' : 'am';\n if (meridiemSelected === 'am' && time.hour() > 12) {\n this.handleAMPMChange('am');\n }\n\n if (meridiemSelected === 'pm' && time.hour() <= 12) {\n this.handleAMPMChange('pm');\n }\n }\n\n return (\n <PickerPanel\n type=\"meridiem\"\n hasHeader={hasHeader}\n header=\"\"\n onChange={this.handleAMPMChange}\n options={[\n { value: 'am', label: 'am' },\n { value: 'pm', label: 'pm' },\n ]}\n selected={meridiemSelected}\n disabledTimes={disabledTimes}\n />\n );\n }\n\n renderHeader = () => {\n const { time } = this.state;\n return <TimePickerHeader>{time.format('hh:mma')}</TimePickerHeader>;\n };\n\n render() {\n const { hasHeaderDisplay } = this.props;\n\n return (\n <TimePickerContainer>\n {hasHeaderDisplay && this.renderHeader()}\n <TimePickerPanelContainer>\n {this.renderHoursPanel()}\n {this.renderMinutesPanel()}\n {this.renderSecondsPanel()}\n {this.renderAMPMPanel()}\n </TimePickerPanelContainer>\n </TimePickerContainer>\n );\n }\n}\n\nTimePickerMenu.defaultProps = {\n time: moment(),\n hasHeader: false,\n use12Hours: true,\n showSeconds: true,\n showMinutes: true,\n showHours: true,\n disabledTimes: undefined,\n onTimeChange: () => null,\n};\n\nTimePickerMenu.propTypes = {\n /** Time value */\n time: PropTypes.instanceOf(moment),\n /** If the menu has header or not */\n hasHeader: PropTypes.bool,\n /** Whether to use the 12 hours format */\n use12Hours: PropTypes.bool,\n /** Whether show 'seconds' or not */\n showSeconds: PropTypes.bool,\n /** Whether show 'minutes' or not */\n showMinutes: PropTypes.bool,\n /** Whether show 'hours' or not */\n showHours: PropTypes.bool,\n /** Handler when time changes */\n onTimeChange: PropTypes.func,\n disabledTimes: PropTypes.object,\n};\n\nexport { TimePickerMenu };\nexport default TimePickerMenu;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,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|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
convertTimeString: () => import_utils.convertTimeString,
|
|
31
|
-
default: () => import_DSTimePicker.default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
__reExport(src_exports, require("./DSTimePicker"));
|
|
35
|
-
__reExport(src_exports, require("./TimePickerMenu"));
|
|
36
|
-
__reExport(src_exports, require("./DSTimePickerMenu"));
|
|
37
|
-
var import_utils = require("./utils");
|
|
38
|
-
var import_DSTimePicker = __toESM(require("./DSTimePicker"));
|
|
39
|
-
module.exports = __toCommonJS(src_exports);
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './DSTimePicker';\nexport * from './TimePickerMenu';\nexport * from './DSTimePickerMenu';\n\nexport { convertTimeString } from './utils'; // this is an exception, we should move utils to shared tho?\n\nexport { default } from './DSTimePicker';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AACd,wBAAc;AAEd,mBAAkC;AAElC,0BAAwB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var moveElementOnScroll_exports = {};
|
|
29
|
-
__export(moveElementOnScroll_exports, {
|
|
30
|
-
MoveElementOnScroll: () => MoveElementOnScroll,
|
|
31
|
-
default: () => moveElementOnScroll_default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
function MoveElementOnScroll(element, {
|
|
35
|
-
container,
|
|
36
|
-
min = 0,
|
|
37
|
-
max = element.offsetHeight,
|
|
38
|
-
speed = 1,
|
|
39
|
-
smooth = 2,
|
|
40
|
-
onUpdate = () => null,
|
|
41
|
-
onEndScroll = () => null
|
|
42
|
-
}) {
|
|
43
|
-
let moving = false;
|
|
44
|
-
let pos = min;
|
|
45
|
-
let lastPos = pos;
|
|
46
|
-
const requestFrame = function() {
|
|
47
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(func) {
|
|
48
|
-
window.setTimeout(func, 1e3 / 50);
|
|
49
|
-
};
|
|
50
|
-
}();
|
|
51
|
-
function update() {
|
|
52
|
-
moving = true;
|
|
53
|
-
const delta = (pos - lastPos) / smooth;
|
|
54
|
-
lastPos += delta;
|
|
55
|
-
if (Math.abs(delta) > 0.7) {
|
|
56
|
-
requestFrame(() => {
|
|
57
|
-
onUpdate(lastPos, delta);
|
|
58
|
-
update();
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
onEndScroll(pos);
|
|
62
|
-
moving = false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function scrolling(e) {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
let delta = e.delta || e.wheelDelta;
|
|
68
|
-
if (delta === void 0) {
|
|
69
|
-
delta = -e.detail;
|
|
70
|
-
delta *= 10 * speed;
|
|
71
|
-
}
|
|
72
|
-
pos += -delta * speed;
|
|
73
|
-
pos = Math.max(min, Math.min(pos, max));
|
|
74
|
-
if (!moving) {
|
|
75
|
-
update();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
container.addEventListener("mousewheel", scrolling, false);
|
|
79
|
-
container.addEventListener("DOMMouseScroll", scrolling, false);
|
|
80
|
-
return {
|
|
81
|
-
unsubscribe: () => {
|
|
82
|
-
container.removeEventListener("mousewheel", scrolling);
|
|
83
|
-
container.removeEventListener("DOMMouseScroll", scrolling);
|
|
84
|
-
},
|
|
85
|
-
updatePosition: (newPos) => {
|
|
86
|
-
pos = -newPos;
|
|
87
|
-
lastPos = -pos;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
var moveElementOnScroll_default = MoveElementOnScroll;
|
|
92
|
-
module.exports = __toCommonJS(moveElementOnScroll_exports);
|
|
93
|
-
//# sourceMappingURL=moveElementOnScroll.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/moveElementOnScroll.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export function MoveElementOnScroll(\n element,\n {\n container,\n min = 0,\n max = element.offsetHeight,\n speed = 1,\n smooth = 2,\n onUpdate = () => null,\n onEndScroll = () => null,\n },\n) {\n let moving = false;\n let pos = min;\n let lastPos = pos;\n\n // todo: move this to utils if we finally need it\n const requestFrame = (function() {\n return (\n window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function(func) {\n window.setTimeout(func, 1000 / 50);\n }\n );\n })();\n\n function update() {\n moving = true;\n const delta = (pos - lastPos) / smooth;\n lastPos += delta;\n\n if (Math.abs(delta) > 0.7) {\n requestFrame(() => {\n onUpdate(lastPos, delta);\n update();\n });\n } else {\n onEndScroll(pos);\n moving = false;\n }\n }\n\n function scrolling(e) {\n e.preventDefault(); // disable default scrolling\n let delta = e.delta || e.wheelDelta;\n if (delta === undefined) {\n // for firefox\n delta = -e.detail;\n delta *= 10 * speed;\n }\n\n pos += -delta * speed;\n pos = Math.max(min, Math.min(pos, max)); // limit scrolling\n if (!moving) {\n update();\n }\n }\n\n container.addEventListener('mousewheel', scrolling, false);\n container.addEventListener('DOMMouseScroll', scrolling, false);\n\n return {\n unsubscribe: () => {\n container.removeEventListener('mousewheel', scrolling);\n container.removeEventListener('DOMMouseScroll', scrolling);\n },\n updatePosition: newPos => {\n pos = -newPos;\n lastPos = -pos;\n },\n };\n}\n\nexport default MoveElementOnScroll;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,6BACL,SACA;AAAA,EACE;AAAA,EACA,MAAM;AAAA,EACN,MAAM,QAAQ;AAAA,EACd,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW,MAAM;AAAA,EACjB,cAAc,MAAM;AAAA,GAEtB;AACA,MAAI,SAAS;AACb,MAAI,MAAM;AACV,MAAI,UAAU;AAGd,QAAM,eAAgB,WAAW;AAC/B,WACE,OAAO,yBACP,OAAO,+BACP,OAAO,4BACP,OAAO,0BACP,OAAO,2BACP,SAAS,MAAM;AACb,aAAO,WAAW,MAAM,MAAO;AAAA;AAAA;AAKrC,oBAAkB;AAChB,aAAS;AACT,UAAM,QAAS,OAAM,WAAW;AAChC,eAAW;AAEX,QAAI,KAAK,IAAI,SAAS,KAAK;AACzB,mBAAa,MAAM;AACjB,iBAAS,SAAS;AAClB;AAAA;AAAA,WAEG;AACL,kBAAY;AACZ,eAAS;AAAA;AAAA;AAIb,qBAAmB,GAAG;AACpB,MAAE;AACF,QAAI,QAAQ,EAAE,SAAS,EAAE;AACzB,QAAI,UAAU,QAAW;AAEvB,cAAQ,CAAC,EAAE;AACX,eAAS,KAAK;AAAA;AAGhB,WAAO,CAAC,QAAQ;AAChB,UAAM,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK;AAClC,QAAI,CAAC,QAAQ;AACX;AAAA;AAAA;AAIJ,YAAU,iBAAiB,cAAc,WAAW;AACpD,YAAU,iBAAiB,kBAAkB,WAAW;AAExD,SAAO;AAAA,IACL,aAAa,MAAM;AACjB,gBAAU,oBAAoB,cAAc;AAC5C,gBAAU,oBAAoB,kBAAkB;AAAA;AAAA,IAElD,gBAAgB,YAAU;AACxB,YAAM,CAAC;AACP,gBAAU,CAAC;AAAA;AAAA;AAAA;AAKjB,IAAO,8BAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/utils.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
convertTimeString: () => convertTimeString,
|
|
31
|
-
getOptionIndex: () => getOptionIndex,
|
|
32
|
-
isAM: () => isAM,
|
|
33
|
-
validateIndex: () => validateIndex
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
const validateIndex = (index, options) => {
|
|
37
|
-
if (index < 0)
|
|
38
|
-
return 0;
|
|
39
|
-
if (index >= options.length)
|
|
40
|
-
return options.length - 1;
|
|
41
|
-
return index;
|
|
42
|
-
};
|
|
43
|
-
const getOptionIndex = (options, selectedOption, valueProperty = "value") => {
|
|
44
|
-
const index = options.findIndex((option) => option[valueProperty] === selectedOption);
|
|
45
|
-
return validateIndex(index, options);
|
|
46
|
-
};
|
|
47
|
-
const isAM = (time) => time && time.hour() < 12;
|
|
48
|
-
const convertTimeString = (string) => {
|
|
49
|
-
if (!string)
|
|
50
|
-
return null;
|
|
51
|
-
let meridiem = "AM";
|
|
52
|
-
if (string.toUpperCase().includes("PM"))
|
|
53
|
-
meridiem = "PM";
|
|
54
|
-
const arr = string.split(":");
|
|
55
|
-
let hour = parseInt(arr[0], 10);
|
|
56
|
-
if (meridiem === "PM" && hour !== 12)
|
|
57
|
-
hour += 12;
|
|
58
|
-
if (meridiem === "AM" && hour === 12)
|
|
59
|
-
hour = 0;
|
|
60
|
-
if (meridiem === "PM" && hour === 12)
|
|
61
|
-
hour = 12;
|
|
62
|
-
const min = parseInt(arr[1], 10);
|
|
63
|
-
const sec = parseInt(arr[2], 10);
|
|
64
|
-
return {
|
|
65
|
-
hour,
|
|
66
|
-
min,
|
|
67
|
-
sec
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
module.exports = __toCommonJS(utils_exports);
|
|
71
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/cjs/utils.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const validateIndex = (index, options) => {\n if (index < 0) return 0;\n if (index >= options.length) return options.length - 1;\n return index;\n};\n\nexport const getOptionIndex = (\n options,\n selectedOption,\n valueProperty = 'value',\n) => {\n const index = options.findIndex(\n (option) => option[valueProperty] === selectedOption,\n );\n return validateIndex(index, options);\n};\n\nexport const isAM = (time) => time && time.hour() < 12;\n\nexport const convertTimeString = (string) => {\n if (!string) return null;\n let meridiem = 'AM';\n if (string.toUpperCase().includes('PM')) meridiem = 'PM';\n\n const arr = string.split(':');\n let hour = parseInt(arr[0], 10);\n if (meridiem === 'PM' && hour !== 12) hour += 12; // formats to 24\n if (meridiem === 'AM' && hour === 12) hour = 0;\n if (meridiem === 'PM' && hour === 12) hour = 12;\n\n const min = parseInt(arr[1], 10);\n const sec = parseInt(arr[2], 10);\n\n return {\n hour,\n min,\n sec,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,gBAAgB,CAAC,OAAO,YAAY;AAC/C,MAAI,QAAQ;AAAG,WAAO;AACtB,MAAI,SAAS,QAAQ;AAAQ,WAAO,QAAQ,SAAS;AACrD,SAAO;AAAA;AAGF,MAAM,iBAAiB,CAC5B,SACA,gBACA,gBAAgB,YACb;AACH,QAAM,QAAQ,QAAQ,UACpB,CAAC,WAAW,OAAO,mBAAmB;AAExC,SAAO,cAAc,OAAO;AAAA;AAGvB,MAAM,OAAO,CAAC,SAAS,QAAQ,KAAK,SAAS;AAE7C,MAAM,oBAAoB,CAAC,WAAW;AAC3C,MAAI,CAAC;AAAQ,WAAO;AACpB,MAAI,WAAW;AACf,MAAI,OAAO,cAAc,SAAS;AAAO,eAAW;AAEpD,QAAM,MAAM,OAAO,MAAM;AACzB,MAAI,OAAO,SAAS,IAAI,IAAI;AAC5B,MAAI,aAAa,QAAQ,SAAS;AAAI,YAAQ;AAC9C,MAAI,aAAa,QAAQ,SAAS;AAAI,WAAO;AAC7C,MAAI,aAAa,QAAQ,SAAS;AAAI,WAAO;AAE7C,QAAM,MAAM,SAAS,IAAI,IAAI;AAC7B,QAAM,MAAM,SAAS,IAAI,IAAI;AAE7B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/DSTimePicker.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import { PropTypes, describe } from "react-desc";
|
|
4
|
-
import Moment from "moment";
|
|
5
|
-
import { TimePickerImpl } from "./TimePickerImpl";
|
|
6
|
-
const DSTimePicker = ({
|
|
7
|
-
containerProps = {},
|
|
8
|
-
innerRef,
|
|
9
|
-
className = "",
|
|
10
|
-
disabled = false,
|
|
11
|
-
value = "",
|
|
12
|
-
format,
|
|
13
|
-
style = {},
|
|
14
|
-
onChange = () => null,
|
|
15
|
-
onOpen = () => null,
|
|
16
|
-
isOpen = void 0,
|
|
17
|
-
clearable = false,
|
|
18
|
-
hasHeader = true,
|
|
19
|
-
hasHeaderDisplay = false,
|
|
20
|
-
"aria-label": ariaLabel,
|
|
21
|
-
zIndex = "auto",
|
|
22
|
-
placement = "bottom",
|
|
23
|
-
disabledTimes,
|
|
24
|
-
minutesInterval = 1
|
|
25
|
-
}) => /* @__PURE__ */ React2.createElement(TimePickerImpl, {
|
|
26
|
-
ref: innerRef,
|
|
27
|
-
"aria-label": ariaLabel,
|
|
28
|
-
className,
|
|
29
|
-
clearable,
|
|
30
|
-
containerProps,
|
|
31
|
-
disabled,
|
|
32
|
-
format,
|
|
33
|
-
hasHeader,
|
|
34
|
-
hasHeaderDisplay,
|
|
35
|
-
isOpen,
|
|
36
|
-
onChange,
|
|
37
|
-
onOpen,
|
|
38
|
-
placement,
|
|
39
|
-
style,
|
|
40
|
-
value,
|
|
41
|
-
zIndex,
|
|
42
|
-
minutesInterval,
|
|
43
|
-
disabledTimes
|
|
44
|
-
});
|
|
45
|
-
DSTimePicker.defaultProps = {
|
|
46
|
-
format: "hh:mm:ss A"
|
|
47
|
-
};
|
|
48
|
-
const props = {
|
|
49
|
-
"aria-label": PropTypes.string.description("a11y label"),
|
|
50
|
-
containerProps: PropTypes.object.description("inject props to time picker wrapper"),
|
|
51
|
-
disabled: PropTypes.bool.description("Whether the time picker is disabled or not"),
|
|
52
|
-
value: PropTypes.instanceOf(Moment).description("Time picker value"),
|
|
53
|
-
format: PropTypes.string.description("Time format (hh:mm:ss, H:m:s)"),
|
|
54
|
-
hasHeader: PropTypes.bool.description("toggle header style"),
|
|
55
|
-
hasHeaderDisplay: PropTypes.bool.description("toggle header display"),
|
|
56
|
-
onChange: PropTypes.func.description("Handler when time picker value changes"),
|
|
57
|
-
onOpen: PropTypes.func.description("Handler when the time picker menu opens"),
|
|
58
|
-
isOpen: PropTypes.bool.description("Whether the time picker menu is opened or not"),
|
|
59
|
-
innerRef: PropTypes.func.description("ref for time picker input"),
|
|
60
|
-
clearable: PropTypes.bool.description("Enable to clear the time picker value"),
|
|
61
|
-
className: PropTypes.string.description("class for time picker"),
|
|
62
|
-
style: PropTypes.object.description("style object"),
|
|
63
|
-
zIndex: PropTypes.number.description("z index for menu"),
|
|
64
|
-
placement: PropTypes.string.description("DSPopper placement"),
|
|
65
|
-
disabledTimes: PropTypes.object.description("disabled time"),
|
|
66
|
-
minutesInterval: PropTypes.number.description("steps for the picker")
|
|
67
|
-
};
|
|
68
|
-
DSTimePicker.propTypes = props;
|
|
69
|
-
const DSTimePickerWithSchema = describe(DSTimePicker);
|
|
70
|
-
DSTimePickerWithSchema.propTypes = props;
|
|
71
|
-
var DSTimePicker_default = DSTimePicker;
|
|
72
|
-
export {
|
|
73
|
-
DSTimePicker,
|
|
74
|
-
DSTimePickerWithSchema,
|
|
75
|
-
DSTimePicker_default as default
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=DSTimePicker.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTimePicker.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport Moment from 'moment';\nimport { TimePickerImpl } from './TimePickerImpl';\n\nconst DSTimePicker = ({\n containerProps = {},\n innerRef,\n className = '',\n disabled = false,\n value = '',\n format,\n style = {},\n onChange = () => null,\n onOpen = () => null,\n isOpen = undefined,\n clearable = false,\n hasHeader = true,\n hasHeaderDisplay = false,\n 'aria-label': ariaLabel,\n zIndex = 'auto',\n placement = 'bottom',\n disabledTimes,\n minutesInterval = 1,\n}) => (\n <TimePickerImpl\n ref={innerRef}\n aria-label={ariaLabel}\n className={className}\n clearable={clearable}\n containerProps={containerProps}\n disabled={disabled}\n format={format}\n hasHeader={hasHeader}\n hasHeaderDisplay={hasHeaderDisplay}\n isOpen={isOpen}\n onChange={onChange}\n onOpen={onOpen}\n placement={placement}\n style={style}\n value={value}\n zIndex={zIndex}\n minutesInterval={minutesInterval}\n disabledTimes={disabledTimes}\n />\n);\n\nDSTimePicker.defaultProps = {\n format: 'hh:mm:ss A',\n};\n\nconst props = {\n /** a11y label */\n 'aria-label': PropTypes.string.description('a11y label'),\n /** inject props to time picker wrapper */\n containerProps: PropTypes.object.description(\n 'inject props to time picker wrapper',\n ),\n /** Whether the time picker is disabled or not */\n disabled: PropTypes.bool.description(\n 'Whether the time picker is disabled or not',\n ),\n /** Time picker value */\n value: PropTypes.instanceOf(Moment).description('Time picker value'),\n /** Time format (hh:mm:ss, H:m:s) */\n format: PropTypes.string.description('Time format (hh:mm:ss, H:m:s)'),\n /** toggle header style */\n hasHeader: PropTypes.bool.description('toggle header style'),\n /** toggle header display */\n hasHeaderDisplay: PropTypes.bool.description('toggle header display'),\n /** Handler when time picker value changes */\n onChange: PropTypes.func.description(\n 'Handler when time picker value changes',\n ),\n /** Handler when the time picker menu opens */\n onOpen: PropTypes.func.description('Handler when the time picker menu opens'),\n /** Whether the time picker menu is opened or not */\n isOpen: PropTypes.bool.description(\n 'Whether the time picker menu is opened or not',\n ),\n /** ref for time picker input */\n innerRef: PropTypes.func.description('ref for time picker input'),\n /** Enable to clear the time picker value */\n clearable: PropTypes.bool.description(\n 'Enable to clear the time picker value',\n ),\n /** class for time picker */\n className: PropTypes.string.description('class for time picker'),\n /** style object */\n style: PropTypes.object.description('style object'),\n /** z index for menu */\n zIndex: PropTypes.number.description('z index for menu'),\n /** DSPopper placement */\n placement: PropTypes.string.description('DSPopper placement'),\n /** disabled time */\n disabledTimes: PropTypes.object.description('disabled time'),\n /** steps for the picker */\n minutesInterval: PropTypes.number.description('steps for the picker'),\n};\n\nDSTimePicker.propTypes = props;\nconst DSTimePickerWithSchema = describe(DSTimePicker);\nDSTimePickerWithSchema.propTypes = props;\n\nexport { DSTimePicker, DSTimePickerWithSchema };\nexport default DSTimePicker;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB;AAAA,EACjB;AAAA,EACA,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,EACR,WAAW,MAAM;AAAA,EACjB,SAAS,MAAM;AAAA,EACf,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA,kBAAkB;AAAA,MAElB,qCAAC,gBAAD;AAAA,EACE,KAAK;AAAA,EACL,cAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAIJ,aAAa,eAAe;AAAA,EAC1B,QAAQ;AAAA;AAGV,MAAM,QAAQ;AAAA,EAEZ,cAAc,UAAU,OAAO,YAAY;AAAA,EAE3C,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAGF,UAAU,UAAU,KAAK,YACvB;AAAA,EAGF,OAAO,UAAU,WAAW,QAAQ,YAAY;AAAA,EAEhD,QAAQ,UAAU,OAAO,YAAY;AAAA,EAErC,WAAW,UAAU,KAAK,YAAY;AAAA,EAEtC,kBAAkB,UAAU,KAAK,YAAY;AAAA,EAE7C,UAAU,UAAU,KAAK,YACvB;AAAA,EAGF,QAAQ,UAAU,KAAK,YAAY;AAAA,EAEnC,QAAQ,UAAU,KAAK,YACrB;AAAA,EAGF,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,WAAW,UAAU,KAAK,YACxB;AAAA,EAGF,WAAW,UAAU,OAAO,YAAY;AAAA,EAExC,OAAO,UAAU,OAAO,YAAY;AAAA,EAEpC,QAAQ,UAAU,OAAO,YAAY;AAAA,EAErC,WAAW,UAAU,OAAO,YAAY;AAAA,EAExC,eAAe,UAAU,OAAO,YAAY;AAAA,EAE5C,iBAAiB,UAAU,OAAO,YAAY;AAAA;AAGhD,aAAa,YAAY;AACzB,MAAM,yBAAyB,SAAS;AACxC,uBAAuB,YAAY;AAGnC,IAAO,uBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { TimePickerMenu } from "./TimePickerMenu";
|
|
5
|
-
const DSTimePickerMenuWrapper = styled.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
height: 18.6rem;
|
|
8
|
-
`;
|
|
9
|
-
function DSTimePickerMenu(props) {
|
|
10
|
-
return /* @__PURE__ */ React2.createElement(DSTimePickerMenuWrapper, null, /* @__PURE__ */ React2.createElement(TimePickerMenu, {
|
|
11
|
-
...props
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
var DSTimePickerMenu_default = DSTimePickerMenu;
|
|
15
|
-
export {
|
|
16
|
-
DSTimePickerMenu,
|
|
17
|
-
DSTimePickerMenu_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=DSTimePickerMenu.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTimePickerMenu.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport styled from 'styled-components';\nimport { TimePickerMenu } from './TimePickerMenu';\n\nconst DSTimePickerMenuWrapper = styled.div`\n display: flex;\n height: 18.6rem;\n`;\nfunction DSTimePickerMenu(props) {\n return (\n <DSTimePickerMenuWrapper>\n <TimePickerMenu {...props} />\n </DSTimePickerMenuWrapper>\n );\n}\nexport { DSTimePickerMenu };\nexport default DSTimePickerMenu;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,0BAA0B,OAAO;AAAA;AAAA;AAAA;AAIvC,0BAA0B,OAAO;AAC/B,SACE,qCAAC,yBAAD,MACE,qCAAC,gBAAD;AAAA,OAAoB;AAAA;AAAA;AAK1B,IAAO,2BAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|