@varlet/ui 3.18.2 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/es/action-sheet/ActionItem.mjs +28 -8
  2. package/es/action-sheet/actionSheet.css +1 -1
  3. package/es/action-sheet/index.mjs +4 -2
  4. package/es/action-sheet/style/index.mjs +1 -1
  5. package/es/alert/alert.css +1 -1
  6. package/es/badge/Badge.mjs +20 -10
  7. package/es/badge/badge.css +1 -1
  8. package/es/bottom-navigation-item/BottomNavigationItem.mjs +34 -20
  9. package/es/bottom-navigation-item/bottomNavigationItem.css +1 -1
  10. package/es/checkbox/Checkbox.mjs +45 -22
  11. package/es/checkbox/checkbox.css +1 -1
  12. package/es/chip/Chip.mjs +11 -4
  13. package/es/chip/chip.css +1 -1
  14. package/es/chip/props.mjs +4 -0
  15. package/es/date-input/DateInput.mjs +865 -0
  16. package/es/date-input/DateInputSfc.css +0 -0
  17. package/es/date-input/TimeSelect.mjs +201 -0
  18. package/es/date-input/date-input.css +1 -0
  19. package/es/date-input/index.mjs +12 -0
  20. package/es/date-input/props.mjs +77 -0
  21. package/es/date-input/style/index.mjs +14 -0
  22. package/es/date-picker/DatePicker.mjs +522 -451
  23. package/es/date-picker/DayPickerPanel.mjs +318 -0
  24. package/es/date-picker/MonthPickerPanel.mjs +187 -0
  25. package/es/date-picker/PanelHeader.mjs +332 -0
  26. package/es/date-picker/YearPickerPanel.mjs +199 -0
  27. package/es/date-picker/constants.mjs +31 -0
  28. package/es/date-picker/date-picker.css +1 -1
  29. package/es/date-picker/props.mjs +6 -9
  30. package/es/date-picker/style/index.mjs +0 -1
  31. package/es/date-picker/types.mjs +0 -0
  32. package/es/field-decorator/fieldDecorator.css +1 -1
  33. package/es/icon/icon.css +1 -1
  34. package/es/index.bundle.mjs +7 -1
  35. package/es/index.mjs +6 -1
  36. package/es/input/props.mjs +1 -1
  37. package/es/locale/en-US.mjs +2 -0
  38. package/es/locale/fa-IR.mjs +2 -0
  39. package/es/locale/ja-JP.mjs +2 -0
  40. package/es/locale/zh-CN.mjs +2 -0
  41. package/es/locale/zh-TW.mjs +2 -0
  42. package/es/menu-select/MenuSelect.mjs +11 -2
  43. package/es/menu-select/menuSelect.css +1 -1
  44. package/es/radio/Radio.mjs +30 -14
  45. package/es/radio/radio.css +1 -1
  46. package/es/rail-navigation-item/RailNavigationItem.mjs +33 -19
  47. package/es/rail-navigation-item/railNavigationItem.css +1 -1
  48. package/es/rate/Rate.mjs +23 -12
  49. package/es/rate/rate.css +1 -1
  50. package/es/select/Select.mjs +10 -1
  51. package/es/select/select.css +1 -1
  52. package/es/step/Step.mjs +50 -20
  53. package/es/step/step.css +1 -1
  54. package/es/style.mjs +1 -0
  55. package/es/themes/dark/alert.mjs +2 -2
  56. package/es/themes/dark/dateInput.mjs +9 -0
  57. package/es/themes/dark/datePicker.mjs +23 -19
  58. package/es/themes/dark/index.mjs +3 -2
  59. package/es/themes/md3-dark/alert.mjs +2 -2
  60. package/es/themes/md3-dark/dateInput.mjs +9 -0
  61. package/es/themes/md3-dark/datePicker.mjs +18 -13
  62. package/es/themes/md3-dark/index.mjs +3 -2
  63. package/es/themes/md3-light/alert.mjs +2 -2
  64. package/es/themes/md3-light/dateInput.mjs +9 -0
  65. package/es/themes/md3-light/datePicker.mjs +18 -13
  66. package/es/themes/md3-light/index.mjs +3 -2
  67. package/es/utils/elements.mjs +7 -0
  68. package/es/utils/shared.mjs +15 -0
  69. package/es/varlet.css +1 -1
  70. package/es/varlet.esm.js +11893 -10656
  71. package/highlight/web-types.en-US.json +599 -73
  72. package/highlight/web-types.zh-CN.json +572 -67
  73. package/lib/varlet.cjs.js +5592 -4211
  74. package/lib/varlet.css +1 -1
  75. package/package.json +7 -7
  76. package/types/actionSheet.d.ts +1 -1
  77. package/types/badge.d.ts +1 -0
  78. package/types/chip.d.ts +3 -0
  79. package/types/dateInput.d.ts +96 -0
  80. package/types/datePicker.d.ts +4 -2
  81. package/types/index.d.ts +2 -0
  82. package/types/locale.d.ts +2 -0
  83. package/types/rate.d.ts +7 -0
  84. package/types/step.d.ts +3 -0
  85. package/types/styleVars.d.ts +14 -4
  86. package/umd/varlet.js +7 -7
  87. package/es/date-picker/src/day-picker-panel.mjs +0 -385
  88. package/es/date-picker/src/month-picker-panel.mjs +0 -300
  89. package/es/date-picker/src/panel-header.mjs +0 -142
  90. package/es/date-picker/src/year-picker-panel.mjs +0 -311
File without changes
@@ -0,0 +1,201 @@
1
+ import { times } from "@varlet/shared";
2
+ import { computed, defineComponent, onBeforeUnmount, onMounted, ref } from "vue";
3
+ import VarMenuSelect from "../menu-select/index.mjs";
4
+ import { createNamespace } from "../utils/components.mjs";
5
+ import { padStart } from "../utils/shared.mjs";
6
+ const { name, n, classes } = createNamespace("date-input-time-select");
7
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeClass as _normalizeClass, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, withModifiers as _withModifiers, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode } from "vue";
8
+ const _hoisted_1 = ["aria-disabled", "onClick"];
9
+ function __render__(_ctx, _cache) {
10
+ const _component_var_menu_select = _resolveComponent("var-menu-select");
11
+ return _openBlock(), _createElementBlock(
12
+ "div",
13
+ {
14
+ ref: "root",
15
+ class: _normalizeClass(_ctx.n())
16
+ },
17
+ [
18
+ (_openBlock(true), _createElementBlock(
19
+ _Fragment,
20
+ null,
21
+ _renderList(_ctx.segments, (segment, index) => {
22
+ return _openBlock(), _createElementBlock(
23
+ _Fragment,
24
+ {
25
+ key: segment.key
26
+ },
27
+ [
28
+ index > 0 ? (_openBlock(), _createElementBlock(
29
+ "span",
30
+ {
31
+ key: 0,
32
+ class: _normalizeClass(_ctx.n("separator"))
33
+ },
34
+ ":",
35
+ 2
36
+ /* CLASS */
37
+ )) : _createCommentVNode("v-if", true),
38
+ _createVNode(_component_var_menu_select, {
39
+ show: _ctx.openKey === segment.key,
40
+ "model-value": segment.value,
41
+ options: segment.options,
42
+ trigger: "manual",
43
+ placement: "bottom",
44
+ "offset-y": 4,
45
+ scrollable: "",
46
+ "close-on-select": false,
47
+ "popover-class": _ctx.n("popover"),
48
+ disabled: _ctx.disabled || _ctx.readonly,
49
+ "onUpdate:show": (value) => _ctx.handleUpdateShow(segment.key, value),
50
+ "onUpdate:modelValue": (value) => _ctx.selectOption(segment.key, value)
51
+ }, {
52
+ default: _withCtx(() => [
53
+ _createElementVNode("button", {
54
+ type: "button",
55
+ class: _normalizeClass(
56
+ _ctx.classes(_ctx.n("box"), [_ctx.openKey === segment.key, _ctx.n("box--active")], [_ctx.disabled || _ctx.readonly, _ctx.n("box--disabled")])
57
+ ),
58
+ "aria-disabled": _ctx.disabled || _ctx.readonly,
59
+ onMousedown: _cache[0] || (_cache[0] = _withModifiers(() => {
60
+ }, ["prevent"])),
61
+ onClick: ($event) => _ctx.toggle(segment.key)
62
+ }, _toDisplayString(segment.label), 43, _hoisted_1)
63
+ ]),
64
+ _: 2
65
+ /* DYNAMIC */
66
+ }, 1032, ["show", "model-value", "options", "popover-class", "disabled", "onUpdate:show", "onUpdate:modelValue"])
67
+ ],
68
+ 64
69
+ /* STABLE_FRAGMENT */
70
+ );
71
+ }),
72
+ 128
73
+ /* KEYED_FRAGMENT */
74
+ ))
75
+ ],
76
+ 2
77
+ /* CLASS */
78
+ );
79
+ }
80
+ const __sfc__ = defineComponent({
81
+ name,
82
+ components: {
83
+ VarMenuSelect
84
+ },
85
+ props: {
86
+ hour: {
87
+ type: Number,
88
+ default: 0
89
+ },
90
+ minute: {
91
+ type: Number,
92
+ default: 0
93
+ },
94
+ second: {
95
+ type: Number,
96
+ default: 0
97
+ },
98
+ useSeconds: {
99
+ type: Boolean,
100
+ default: true
101
+ },
102
+ readonly: Boolean,
103
+ disabled: Boolean,
104
+ isHourAllowed: Function,
105
+ isMinuteAllowed: Function,
106
+ isSecondAllowed: Function
107
+ },
108
+ emits: ["change"],
109
+ setup(props, { emit }) {
110
+ const root = ref(null);
111
+ const openKey = ref(null);
112
+ const segments = computed(() => {
113
+ const list = [
114
+ buildSegment("hour", props.hour, 24, props.isHourAllowed),
115
+ buildSegment("minute", props.minute, 60, props.isMinuteAllowed)
116
+ ];
117
+ if (props.useSeconds) {
118
+ list.push(buildSegment("second", props.second, 60, props.isSecondAllowed));
119
+ }
120
+ return list;
121
+ });
122
+ onMounted(() => {
123
+ document.addEventListener("mousedown", handlePopoverMousedown, true);
124
+ document.addEventListener("pointerdown", handleOutsidePointerdown, true);
125
+ });
126
+ onBeforeUnmount(() => {
127
+ document.removeEventListener("mousedown", handlePopoverMousedown, true);
128
+ document.removeEventListener("pointerdown", handleOutsidePointerdown, true);
129
+ });
130
+ function buildSegment(key, value, count, allowed) {
131
+ return {
132
+ key,
133
+ value,
134
+ label: padStart(`${value}`, 2, "0"),
135
+ options: times(count, (option) => ({
136
+ label: padStart(`${option}`, 2, "0"),
137
+ value: option,
138
+ disabled: allowed ? !allowed(option) : false
139
+ }))
140
+ };
141
+ }
142
+ function toggle(key) {
143
+ if (props.disabled || props.readonly) {
144
+ return;
145
+ }
146
+ openKey.value = openKey.value === key ? null : key;
147
+ }
148
+ function handleUpdateShow(key, value) {
149
+ if (!value && openKey.value === key) {
150
+ openKey.value = null;
151
+ }
152
+ }
153
+ function selectOption(key, value) {
154
+ const time = {
155
+ hour: props.hour,
156
+ minute: props.minute,
157
+ second: props.second
158
+ };
159
+ time[key] = value;
160
+ openKey.value = null;
161
+ emit("change", time, key);
162
+ }
163
+ function isInsidePopover(target) {
164
+ if (!target) {
165
+ return false;
166
+ }
167
+ return Array.from(document.querySelectorAll(`.${n("popover")}`)).some((popover) => popover.contains(target));
168
+ }
169
+ function handlePopoverMousedown(event) {
170
+ if (openKey.value != null && isInsidePopover(event.target)) {
171
+ event.preventDefault();
172
+ }
173
+ }
174
+ function handleOutsidePointerdown(event) {
175
+ var _a;
176
+ if (openKey.value == null) {
177
+ return;
178
+ }
179
+ const target = event.target;
180
+ if (target && ((_a = root.value) == null ? void 0 : _a.contains(target)) || isInsidePopover(target)) {
181
+ return;
182
+ }
183
+ openKey.value = null;
184
+ }
185
+ return {
186
+ n,
187
+ classes,
188
+ root,
189
+ openKey,
190
+ segments,
191
+ toggle,
192
+ handleUpdateShow,
193
+ selectOption
194
+ };
195
+ }
196
+ });
197
+ __sfc__.render = __render__;
198
+ var stdin_default = __sfc__;
199
+ export {
200
+ stdin_default as default
201
+ };
@@ -0,0 +1 @@
1
+ :root { --date-input-picker-width: 320px; --date-input-time-select-separator-color: var(--color-on-surface-variant); --date-input-time-select-border-color: var(--color-outline); --date-input-time-select-active-color: var(--color-primary);}.var-date-input { text-align: left;}.var-date-input .var-menu[var-date-input-cover] { width: 100%; background: transparent; display: block;}.var-date-input__picker { width: var(--date-input-picker-width); --date-picker-border-radius: 0; --date-picker-body-background-color: transparent; --date-picker-title-background: transparent;}.var-date-input__picker .var-date-picker-header { background-color: var(--menu-background-color);}.var-date-input__calendar-icon-container { display: inline-flex; align-items: center; margin-left: 6px;}.var-date-input__calendar-icon { font-size: var(--field-decorator-icon-size);}.var-date-input__clear-icon-container { display: inline-flex; align-items: center; margin-left: 6px; cursor: pointer;}.var-date-input__clear-icon { font-size: var(--field-decorator-icon-size);}.var-date-input--menu { overflow: hidden;}.var-date-input--standard-menu-margin { margin-top: var(--field-decorator-line-focus-size) !important;}.var-date-input--filled-menu-margin { margin-top: var(--field-decorator-line-focus-size) !important;}.var-date-input__datetime { width: 100%;}.var-date-input__datetime-row { display: flex; align-items: center; gap: 10px;}.var-date-input__datetime-row--range { justify-content: center;}.var-date-input__datetime-arrow { flex: none; font-size: 12px; color: var(--date-input-time-select-separator-color);}.var-date-input-time-select { display: inline-flex; align-items: center;}.var-date-input-time-select__separator { margin: 0 4px; color: var(--date-input-time-select-separator-color);}.var-date-input-time-select__box { min-width: 36px; height: 30px; padding: 0 8px; border: thin solid var(--date-input-time-select-border-color); border-radius: 4px; background: transparent; color: inherit; font-size: inherit; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color 0.2s var(--cubic-bezier);}.var-date-input-time-select__box:not(.var-date-input-time-select__box--disabled):hover { border-color: var(--date-input-time-select-active-color);}.var-date-input-time-select__box--active { border-color: var(--date-input-time-select-active-color); color: var(--date-input-time-select-active-color);}.var-date-input-time-select__box--disabled { cursor: not-allowed; opacity: var(--opacity-disabled);}.var-date-input-time-select__popover { min-width: 64px; --menu-select-menu-max-height: 200px;}.var-date-input-time-select__popover .var-menu-select__menu { scrollbar-width: none;}.var-date-input-time-select__popover .var-menu-select__menu::-webkit-scrollbar { display: none;}
@@ -0,0 +1,12 @@
1
+ import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
2
+ import DateInput from "./DateInput.mjs";
3
+ import { props as dateInputProps } from "./props.mjs";
4
+ withInstall(DateInput);
5
+ withPropsDefaultsSetter(DateInput, dateInputProps);
6
+ const _DateInputComponent = DateInput;
7
+ var stdin_default = DateInput;
8
+ export {
9
+ _DateInputComponent,
10
+ dateInputProps,
11
+ stdin_default as default
12
+ };
@@ -0,0 +1,77 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import { props as inputProps } from "../input/props.mjs";
18
+ import { defineListenerProp, pickProps } from "../utils/components.mjs";
19
+ const props = __spreadValues({
20
+ modelValue: [String, Number, Date, Array],
21
+ type: {
22
+ type: String,
23
+ default: "date"
24
+ },
25
+ format: String,
26
+ valueFormat: {
27
+ type: String
28
+ },
29
+ useSeconds: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ multiple: Boolean,
34
+ range: Boolean,
35
+ separator: {
36
+ type: String,
37
+ default: ", "
38
+ },
39
+ rangeSeparator: {
40
+ type: String,
41
+ default: " ~ "
42
+ },
43
+ allowedDates: Function,
44
+ allowedTimes: Function,
45
+ min: String,
46
+ max: String,
47
+ firstDayOfWeek: {
48
+ type: [String, Number],
49
+ default: 0
50
+ },
51
+ readonly: Boolean,
52
+ disabled: Boolean,
53
+ clearable: Boolean,
54
+ validateTrigger: {
55
+ type: Array,
56
+ default: () => ["onInput", "onClear", "onChange"]
57
+ },
58
+ onFocus: defineListenerProp(),
59
+ onBlur: defineListenerProp(),
60
+ onChange: defineListenerProp(),
61
+ onClear: defineListenerProp(),
62
+ "onUpdate:modelValue": defineListenerProp()
63
+ }, pickProps(inputProps, [
64
+ "size",
65
+ "variant",
66
+ "placeholder",
67
+ "line",
68
+ "hint",
69
+ "textColor",
70
+ "focusColor",
71
+ "blurColor",
72
+ "rules",
73
+ "tabindex"
74
+ ]));
75
+ export {
76
+ props
77
+ };
@@ -0,0 +1,14 @@
1
+ import '../../styles/common.css'
2
+ import '../../styles/elevation.css'
3
+ import '../../ripple/ripple.css'
4
+ import '../../button/button.css'
5
+ import '../../icon/icon.css'
6
+ import '../../menu/menu.css'
7
+ import '../../menu-option/menuOption.css'
8
+ import '../../menu-select/menuSelect.css'
9
+ import '../../field-decorator/fieldDecorator.css'
10
+ import '../../form-details/formDetails.css'
11
+ import '../../input/input.css'
12
+ import '../../date-picker/date-picker.css'
13
+ import '../date-input.css'
14
+ import '../DateInputSfc.css'