orio-ui 1.23.3 → 1.27.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/README.md +5 -5
- package/dist/module.json +1 -1
- package/dist/runtime/components/Button.d.vue.ts +3 -2
- package/dist/runtime/components/Button.vue +19 -11
- package/dist/runtime/components/Button.vue.d.ts +3 -2
- package/dist/runtime/components/Calendar.USAGE.md +51 -0
- package/dist/runtime/components/Calendar.d.vue.ts +33 -0
- package/dist/runtime/components/Calendar.vue +418 -0
- package/dist/runtime/components/Calendar.vue.d.ts +33 -0
- package/dist/runtime/components/Canvas/USAGE.md +65 -0
- package/dist/runtime/components/CheckBox.vue +9 -3
- package/dist/runtime/components/CheckboxGroup.vue +7 -1
- package/dist/runtime/components/ControlElement.USAGE.md +69 -0
- package/dist/runtime/components/ControlElement.d.vue.ts +42 -27
- package/dist/runtime/components/ControlElement.vue +28 -9
- package/dist/runtime/components/ControlElement.vue.d.ts +42 -27
- package/dist/runtime/components/Form.d.vue.ts +1 -1
- package/dist/runtime/components/Form.vue.d.ts +1 -1
- package/dist/runtime/components/Input.USAGE.md +49 -0
- package/dist/runtime/components/Input.vue +13 -3
- package/dist/runtime/components/Modal.USAGE.md +64 -0
- package/dist/runtime/components/NavButton.d.vue.ts +0 -1
- package/dist/runtime/components/NavButton.vue +9 -5
- package/dist/runtime/components/NavButton.vue.d.ts +0 -1
- package/dist/runtime/components/NumberInput/Horizontal.vue +7 -2
- package/dist/runtime/components/NumberInput/Vertical.vue +7 -2
- package/dist/runtime/components/NumberInput/index.d.vue.ts +0 -2
- package/dist/runtime/components/NumberInput/index.vue +9 -7
- package/dist/runtime/components/NumberInput/index.vue.d.ts +0 -2
- package/dist/runtime/components/RadioButton.d.vue.ts +0 -2
- package/dist/runtime/components/RadioButton.vue +9 -4
- package/dist/runtime/components/RadioButton.vue.d.ts +0 -2
- package/dist/runtime/components/Selector.d.vue.ts +1 -0
- package/dist/runtime/components/Selector.vue +10 -4
- package/dist/runtime/components/Selector.vue.d.ts +1 -0
- package/dist/runtime/components/SwitchButton.d.vue.ts +1 -4
- package/dist/runtime/components/SwitchButton.vue +10 -7
- package/dist/runtime/components/SwitchButton.vue.d.ts +1 -4
- package/dist/runtime/components/TaggableSelector.vue +7 -1
- package/dist/runtime/components/Textarea.vue +13 -3
- package/dist/runtime/components/date/Picker.USAGE.md +44 -0
- package/dist/runtime/components/date/Picker.d.vue.ts +26 -0
- package/dist/runtime/components/date/Picker.vue +60 -0
- package/dist/runtime/components/date/Picker.vue.d.ts +26 -0
- package/dist/runtime/components/date/PickerTrigger.d.vue.ts +23 -0
- package/dist/runtime/components/date/PickerTrigger.vue +86 -0
- package/dist/runtime/components/date/PickerTrigger.vue.d.ts +23 -0
- package/dist/runtime/components/date/RangePicker.d.vue.ts +28 -0
- package/dist/runtime/components/date/RangePicker.vue +154 -0
- package/dist/runtime/components/date/RangePicker.vue.d.ts +28 -0
- package/dist/runtime/components/view/Dates.d.vue.ts +2 -5
- package/dist/runtime/components/view/Dates.vue +17 -23
- package/dist/runtime/components/view/Dates.vue.d.ts +2 -5
- package/dist/runtime/composables/useFilter.d.ts +91 -0
- package/dist/runtime/composables/useFilter.js +111 -0
- package/dist/runtime/composables/useRovingGrid.d.ts +35 -0
- package/dist/runtime/composables/useRovingGrid.js +115 -0
- package/dist/runtime/i18n/en.json +11 -5
- package/dist/runtime/i18n/uk.json +11 -5
- package/dist/runtime/index.d.ts +4 -2
- package/dist/runtime/index.js +6 -2
- package/dist/runtime/utils/date.d.ts +10 -0
- package/dist/runtime/utils/date.js +38 -0
- package/package.json +1 -1
- package/dist/runtime/components/DatePicker.d.vue.ts +0 -15
- package/dist/runtime/components/DatePicker.vue +0 -24
- package/dist/runtime/components/DatePicker.vue.d.ts +0 -15
- package/dist/runtime/components/DateRangePicker.d.vue.ts +0 -18
- package/dist/runtime/components/DateRangePicker.vue +0 -67
- package/dist/runtime/components/DateRangePicker.vue.d.ts +0 -18
|
@@ -6,14 +6,19 @@ defineProps({
|
|
|
6
6
|
max: { type: Number, required: false, default: void 0 },
|
|
7
7
|
step: { type: Number, required: false, default: 1 },
|
|
8
8
|
decimalPlaces: { type: Number, required: false, default: 0 },
|
|
9
|
-
disabled: { type: Boolean, required: false, default: false },
|
|
10
9
|
appearance: { type: String, required: false },
|
|
11
10
|
error: { type: [String, null], required: false },
|
|
12
11
|
group: { type: Boolean, required: false },
|
|
13
12
|
id: { type: String, required: false },
|
|
14
13
|
label: { type: String, required: false },
|
|
15
14
|
size: { type: String, required: false },
|
|
16
|
-
fill: { type: Boolean, required: false }
|
|
15
|
+
fill: { type: Boolean, required: false },
|
|
16
|
+
tabindex: { type: [Number, String], required: false },
|
|
17
|
+
focusKey: { type: String, required: false },
|
|
18
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
19
|
+
required: { type: Boolean, required: false },
|
|
20
|
+
name: { type: String, required: false },
|
|
21
|
+
ariaLabel: { type: String, required: false }
|
|
17
22
|
});
|
|
18
23
|
const modelValue = defineModel({ type: Number, ...{ default: 0 } });
|
|
19
24
|
const { pressAndHold, stop } = usePressAndHold();
|
|
@@ -6,7 +6,6 @@ export interface NumberInputProps extends Omit<ControlProps, "layout"> {
|
|
|
6
6
|
max?: number;
|
|
7
7
|
step?: number;
|
|
8
8
|
decimalPlaces?: number;
|
|
9
|
-
disabled?: boolean;
|
|
10
9
|
}
|
|
11
10
|
type __VLS_Props = NumberInputProps;
|
|
12
11
|
declare function increase(): void;
|
|
@@ -30,7 +29,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
30
29
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
31
30
|
}>, {
|
|
32
31
|
layout: InputLayout;
|
|
33
|
-
disabled: boolean;
|
|
34
32
|
step: number;
|
|
35
33
|
min: number;
|
|
36
34
|
max: number;
|
|
@@ -6,14 +6,19 @@ const props = defineProps({
|
|
|
6
6
|
max: { type: Number, required: false, default: void 0 },
|
|
7
7
|
step: { type: Number, required: false, default: 1 },
|
|
8
8
|
decimalPlaces: { type: Number, required: false, default: 0 },
|
|
9
|
-
disabled: { type: Boolean, required: false, default: false },
|
|
10
9
|
appearance: { type: String, required: false },
|
|
11
10
|
error: { type: [String, null], required: false },
|
|
12
11
|
group: { type: Boolean, required: false },
|
|
13
12
|
id: { type: String, required: false },
|
|
14
13
|
label: { type: String, required: false },
|
|
15
14
|
size: { type: String, required: false },
|
|
16
|
-
fill: { type: Boolean, required: false }
|
|
15
|
+
fill: { type: Boolean, required: false },
|
|
16
|
+
tabindex: { type: [Number, String], required: false },
|
|
17
|
+
focusKey: { type: String, required: false },
|
|
18
|
+
disabled: { type: Boolean, required: false },
|
|
19
|
+
required: { type: Boolean, required: false },
|
|
20
|
+
name: { type: String, required: false },
|
|
21
|
+
ariaLabel: { type: String, required: false }
|
|
17
22
|
});
|
|
18
23
|
const { min, max, step, decimalPlaces } = toRefs(props);
|
|
19
24
|
const modelValue = defineModel({ type: Number, ...{ default: 0 } });
|
|
@@ -49,7 +54,6 @@ const controlProps = computed(() => {
|
|
|
49
54
|
max: _max,
|
|
50
55
|
step: _step,
|
|
51
56
|
decimalPlaces: _decimalPlaces,
|
|
52
|
-
disabled: _disabled,
|
|
53
57
|
...rest
|
|
54
58
|
} = props;
|
|
55
59
|
return rest;
|
|
@@ -64,19 +68,17 @@ const slotExpose = computed(() => ({
|
|
|
64
68
|
|
|
65
69
|
<template>
|
|
66
70
|
<orio-control-element
|
|
67
|
-
v-slot="{
|
|
71
|
+
v-slot="{ control }"
|
|
68
72
|
v-bind="controlProps"
|
|
69
73
|
:layout="layout === 'inner' ? 'vertical' : layout"
|
|
70
74
|
:class="{ inner: layout === 'inner' }"
|
|
71
75
|
>
|
|
72
76
|
<div class="wrapper">
|
|
73
77
|
<input
|
|
74
|
-
v-bind="
|
|
75
|
-
:id
|
|
78
|
+
v-bind="{ ...$attrs, ...control }"
|
|
76
79
|
v-model="modelValue"
|
|
77
80
|
type="number"
|
|
78
81
|
class="number-input"
|
|
79
|
-
:disabled
|
|
80
82
|
:min
|
|
81
83
|
:max
|
|
82
84
|
:step
|
|
@@ -6,7 +6,6 @@ export interface NumberInputProps extends Omit<ControlProps, "layout"> {
|
|
|
6
6
|
max?: number;
|
|
7
7
|
step?: number;
|
|
8
8
|
decimalPlaces?: number;
|
|
9
|
-
disabled?: boolean;
|
|
10
9
|
}
|
|
11
10
|
type __VLS_Props = NumberInputProps;
|
|
12
11
|
declare function increase(): void;
|
|
@@ -30,7 +29,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
30
29
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
31
30
|
}>, {
|
|
32
31
|
layout: InputLayout;
|
|
33
|
-
disabled: boolean;
|
|
34
32
|
step: number;
|
|
35
33
|
min: number;
|
|
36
34
|
max: number;
|
|
@@ -2,8 +2,6 @@ import type { ControlProps } from "./ControlElement.vue.js";
|
|
|
2
2
|
export interface RadioButtonProps extends ControlProps {
|
|
3
3
|
/** The value this radio represents; compared to v-model to determine checked state */
|
|
4
4
|
value?: unknown;
|
|
5
|
-
/** HTML name attribute — groups radios together so only one is selected at a time */
|
|
6
|
-
name?: string;
|
|
7
5
|
/** Inline label text (alternative to default slot) */
|
|
8
6
|
text?: string;
|
|
9
7
|
/** Visually hides the label while keeping it accessible to SR (screen readers) */
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
const modelValue = defineModel({ type: null });
|
|
3
3
|
const props = defineProps({
|
|
4
4
|
value: { type: null, required: false },
|
|
5
|
-
name: { type: String, required: false },
|
|
6
5
|
text: { type: String, required: false },
|
|
7
6
|
hideLabel: { type: Boolean, required: false },
|
|
8
7
|
appearance: { type: String, required: false },
|
|
@@ -12,17 +11,23 @@ const props = defineProps({
|
|
|
12
11
|
label: { type: String, required: false },
|
|
13
12
|
layout: { type: String, required: false },
|
|
14
13
|
size: { type: String, required: false },
|
|
15
|
-
fill: { type: Boolean, required: false }
|
|
14
|
+
fill: { type: Boolean, required: false },
|
|
15
|
+
tabindex: { type: [Number, String], required: false },
|
|
16
|
+
focusKey: { type: String, required: false },
|
|
17
|
+
disabled: { type: Boolean, required: false },
|
|
18
|
+
required: { type: Boolean, required: false },
|
|
19
|
+
name: { type: String, required: false },
|
|
20
|
+
ariaLabel: { type: String, required: false }
|
|
16
21
|
});
|
|
17
22
|
</script>
|
|
18
23
|
|
|
19
24
|
<template>
|
|
20
|
-
<orio-control-element v-bind="props" class="radio">
|
|
25
|
+
<orio-control-element v-slot="{ control }" v-bind="props" class="radio">
|
|
21
26
|
<label class="radio-label">
|
|
22
27
|
<input
|
|
23
28
|
v-model="modelValue"
|
|
29
|
+
v-bind="control"
|
|
24
30
|
type="radio"
|
|
25
|
-
:name="name"
|
|
26
31
|
:value="value"
|
|
27
32
|
class="radio-input"
|
|
28
33
|
tabindex="-1"
|
|
@@ -2,8 +2,6 @@ import type { ControlProps } from "./ControlElement.vue.js";
|
|
|
2
2
|
export interface RadioButtonProps extends ControlProps {
|
|
3
3
|
/** The value this radio represents; compared to v-model to determine checked state */
|
|
4
4
|
value?: unknown;
|
|
5
|
-
/** HTML name attribute — groups radios together so only one is selected at a time */
|
|
6
|
-
name?: string;
|
|
7
5
|
/** Inline label text (alternative to default slot) */
|
|
8
6
|
text?: string;
|
|
9
7
|
/** Visually hides the label while keeping it accessible to SR (screen readers) */
|
|
@@ -17,7 +17,13 @@ const props = defineProps({
|
|
|
17
17
|
label: { type: String, required: false },
|
|
18
18
|
layout: { type: String, required: false },
|
|
19
19
|
size: { type: String, required: false },
|
|
20
|
-
fill: { type: Boolean, required: false }
|
|
20
|
+
fill: { type: Boolean, required: false },
|
|
21
|
+
tabindex: { type: [Number, String], required: false },
|
|
22
|
+
focusKey: { type: String, required: false },
|
|
23
|
+
disabled: { type: Boolean, required: false },
|
|
24
|
+
required: { type: Boolean, required: false },
|
|
25
|
+
name: { type: String, required: false },
|
|
26
|
+
ariaLabel: { type: String, required: false }
|
|
21
27
|
});
|
|
22
28
|
const { field, optionName } = toRefs(props);
|
|
23
29
|
const resolvedPlaceholder = computed(
|
|
@@ -107,12 +113,12 @@ const {
|
|
|
107
113
|
</script>
|
|
108
114
|
|
|
109
115
|
<template>
|
|
110
|
-
<orio-control-element v-bind="controlProps">
|
|
116
|
+
<orio-control-element v-slot="{ control }" v-bind="controlProps">
|
|
111
117
|
<orio-popover position="bottom-right" :offset="5">
|
|
112
118
|
<template #default="{ toggle, isOpen }">
|
|
113
|
-
<slot name="trigger" :toggle>
|
|
119
|
+
<slot name="trigger" :toggle :control>
|
|
114
120
|
<button
|
|
115
|
-
|
|
121
|
+
v-bind="control"
|
|
116
122
|
type="button"
|
|
117
123
|
class="selector-trigger"
|
|
118
124
|
aria-haspopup="listbox"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
const props = defineProps({
|
|
3
|
-
disabled: { type: Boolean, required: false, default: false },
|
|
4
3
|
appearance: { type: String, required: false },
|
|
5
4
|
error: { type: [String, null], required: false },
|
|
6
5
|
group: { type: Boolean, required: false },
|
|
@@ -8,7 +7,13 @@ const props = defineProps({
|
|
|
8
7
|
label: { type: String, required: false },
|
|
9
8
|
layout: { type: String, required: false },
|
|
10
9
|
size: { type: String, required: false },
|
|
11
|
-
fill: { type: Boolean, required: false }
|
|
10
|
+
fill: { type: Boolean, required: false },
|
|
11
|
+
tabindex: { type: [Number, String], required: false },
|
|
12
|
+
focusKey: { type: String, required: false },
|
|
13
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
14
|
+
required: { type: Boolean, required: false },
|
|
15
|
+
name: { type: String, required: false },
|
|
16
|
+
ariaLabel: { type: String, required: false }
|
|
12
17
|
});
|
|
13
18
|
const modelValue = defineModel({ type: Boolean, ...{ required: false } });
|
|
14
19
|
function toggle() {
|
|
@@ -18,13 +23,11 @@ function toggle() {
|
|
|
18
23
|
</script>
|
|
19
24
|
|
|
20
25
|
<template>
|
|
21
|
-
<orio-control-element v-slot="{
|
|
26
|
+
<orio-control-element v-slot="{ control }" v-bind="props">
|
|
22
27
|
<button
|
|
23
|
-
|
|
24
|
-
v-bind="$attrs"
|
|
28
|
+
v-bind="{ ...$attrs, ...control }"
|
|
25
29
|
class="switch-button"
|
|
26
|
-
:class="{ active: modelValue, disabled }"
|
|
27
|
-
:disabled="disabled"
|
|
30
|
+
:class="{ active: modelValue, disabled: props.disabled }"
|
|
28
31
|
@click="toggle"
|
|
29
32
|
@keydown.enter.prevent="toggle"
|
|
30
33
|
@keydown.space.prevent="toggle"
|
|
@@ -12,7 +12,13 @@ const props = defineProps({
|
|
|
12
12
|
label: { type: String, required: false },
|
|
13
13
|
layout: { type: String, required: false },
|
|
14
14
|
size: { type: String, required: false },
|
|
15
|
-
fill: { type: Boolean, required: false }
|
|
15
|
+
fill: { type: Boolean, required: false },
|
|
16
|
+
tabindex: { type: [Number, String], required: false },
|
|
17
|
+
focusKey: { type: String, required: false },
|
|
18
|
+
disabled: { type: Boolean, required: false },
|
|
19
|
+
required: { type: Boolean, required: false },
|
|
20
|
+
name: { type: String, required: false },
|
|
21
|
+
ariaLabel: { type: String, required: false }
|
|
16
22
|
});
|
|
17
23
|
const modelValue = defineModel({ type: Array });
|
|
18
24
|
</script>
|
|
@@ -8,18 +8,28 @@ const props = defineProps({
|
|
|
8
8
|
id: { type: String, required: false },
|
|
9
9
|
label: { type: String, required: false },
|
|
10
10
|
size: { type: String, required: false },
|
|
11
|
-
fill: { type: Boolean, required: false }
|
|
11
|
+
fill: { type: Boolean, required: false },
|
|
12
|
+
tabindex: { type: [Number, String], required: false },
|
|
13
|
+
focusKey: { type: String, required: false },
|
|
14
|
+
disabled: { type: Boolean, required: false },
|
|
15
|
+
required: { type: Boolean, required: false },
|
|
16
|
+
name: { type: String, required: false },
|
|
17
|
+
ariaLabel: { type: String, required: false }
|
|
12
18
|
});
|
|
13
19
|
</script>
|
|
14
20
|
|
|
15
21
|
<template>
|
|
16
22
|
<orio-control-element
|
|
17
|
-
v-slot="{
|
|
23
|
+
v-slot="{ control }"
|
|
18
24
|
v-bind="props"
|
|
19
25
|
:layout="layout === 'inner' ? 'vertical' : layout"
|
|
20
26
|
:class="{ inner: layout === 'inner' }"
|
|
21
27
|
>
|
|
22
|
-
<textarea
|
|
28
|
+
<textarea
|
|
29
|
+
v-model="modelValue"
|
|
30
|
+
rows="4"
|
|
31
|
+
v-bind="{ ...$attrs, ...control }"
|
|
32
|
+
/>
|
|
23
33
|
</orio-control-element>
|
|
24
34
|
</template>
|
|
25
35
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# date/Picker — agent-only invariants
|
|
2
|
+
|
|
3
|
+
`<orio-date-picker>` is the single-date picker: a `<orio-date-picker-trigger>`
|
|
4
|
+
button that opens a popover containing `<orio-calendar>`. For ranges use
|
|
5
|
+
`<orio-date-range-picker>`.
|
|
6
|
+
|
|
7
|
+
## Invariants
|
|
8
|
+
|
|
9
|
+
- **Extends `ControlProps`.** Pass `label`, `error`, `size`, `disabled`,
|
|
10
|
+
`required` straight through — they reach the trigger via ControlElement.
|
|
11
|
+
See `ControlElement.USAGE.md`.
|
|
12
|
+
- **v-model is `string | null`** in ISO `YYYY-MM-DD` form. `null` means
|
|
13
|
+
unpicked.
|
|
14
|
+
- **`min` / `max`** are ISO strings. They merge with the consumer's
|
|
15
|
+
`isDisabled(iso)` callback — Picker's `calendarIsDisabled` returns true
|
|
16
|
+
when either the min/max bound is violated OR the consumer says so.
|
|
17
|
+
- **Selecting a day closes the popover** automatically (`toggle(false)` is
|
|
18
|
+
called inside the `@select` handler). Do not wire your own close.
|
|
19
|
+
- **Markers + getMarker** are forwarded to the inner Calendar unchanged.
|
|
20
|
+
See `Calendar.USAGE.md` for the matching rules.
|
|
21
|
+
- **Placeholder text** falls back to the i18n key `datePicker.placeholder`
|
|
22
|
+
if no `placeholder` prop is given.
|
|
23
|
+
|
|
24
|
+
## Gotchas
|
|
25
|
+
|
|
26
|
+
- The trigger displays the date via `formatDate(value, locale)` from
|
|
27
|
+
`../../utils/date`. If you need a custom display format, wrap the
|
|
28
|
+
picker — the prop is not exposed.
|
|
29
|
+
- `<orio-date-picker-trigger>` is the popover host. Wiring up your own
|
|
30
|
+
trigger means re-creating popover focus management — prefer composing
|
|
31
|
+
with the existing trigger via its `#default` scoped slot if you need
|
|
32
|
+
custom calendar content (this is exactly how Picker itself works).
|
|
33
|
+
|
|
34
|
+
## Quick reference
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
<orio-date-picker
|
|
38
|
+
v-model="checkInDate"
|
|
39
|
+
label="Check-in"
|
|
40
|
+
:min="todayIso"
|
|
41
|
+
:max="maxBookingIso"
|
|
42
|
+
:is-disabled="(iso) => blockedDates.has(iso)"
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ControlProps } from "../ControlElement.vue.js";
|
|
2
|
+
import type { CalendarMarker } from "../Calendar.vue.js";
|
|
3
|
+
interface Props extends ControlProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
min?: string | null;
|
|
6
|
+
max?: string | null;
|
|
7
|
+
markers?: CalendarMarker[];
|
|
8
|
+
getMarker?: (iso: string) => CalendarMarker | null;
|
|
9
|
+
isDisabled?: (iso: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
type __VLS_Props = Props;
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
modelValue?: string | null;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
"update:modelValue": (value: string | null) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
markers: CalendarMarker[];
|
|
22
|
+
min: string | null;
|
|
23
|
+
max: string | null;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { formatDate } from "../../utils/date";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
placeholder: { type: String, required: false },
|
|
7
|
+
min: { type: [String, null], required: false, default: null },
|
|
8
|
+
max: { type: [String, null], required: false, default: null },
|
|
9
|
+
markers: { type: Array, required: false, default: () => [] },
|
|
10
|
+
getMarker: { type: Function, required: false },
|
|
11
|
+
isDisabled: { type: Function, required: false },
|
|
12
|
+
appearance: { type: String, required: false },
|
|
13
|
+
error: { type: [String, null], required: false },
|
|
14
|
+
group: { type: Boolean, required: false },
|
|
15
|
+
id: { type: String, required: false },
|
|
16
|
+
label: { type: String, required: false },
|
|
17
|
+
layout: { type: String, required: false },
|
|
18
|
+
size: { type: String, required: false },
|
|
19
|
+
fill: { type: Boolean, required: false },
|
|
20
|
+
tabindex: { type: [Number, String], required: false },
|
|
21
|
+
focusKey: { type: String, required: false },
|
|
22
|
+
disabled: { type: Boolean, required: false },
|
|
23
|
+
required: { type: Boolean, required: false },
|
|
24
|
+
name: { type: String, required: false },
|
|
25
|
+
ariaLabel: { type: String, required: false }
|
|
26
|
+
});
|
|
27
|
+
const value = defineModel({ type: [String, null], ...{ default: null } });
|
|
28
|
+
const { locale, t } = useI18n();
|
|
29
|
+
const display = computed(() => formatDate(value.value, locale.value));
|
|
30
|
+
const placeholderText = computed(
|
|
31
|
+
() => props.placeholder ?? t("datePicker.placeholder")
|
|
32
|
+
);
|
|
33
|
+
const calendarIsDisabled = computed(() => (iso) => {
|
|
34
|
+
if (props.min && iso < props.min) return true;
|
|
35
|
+
if (props.max && iso > props.max) return true;
|
|
36
|
+
return props.isDisabled?.(iso) ?? false;
|
|
37
|
+
});
|
|
38
|
+
function pick(iso, toggle) {
|
|
39
|
+
value.value = iso;
|
|
40
|
+
toggle(false);
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<orio-date-picker-trigger
|
|
46
|
+
v-bind="props"
|
|
47
|
+
:text="display"
|
|
48
|
+
:placeholder="placeholderText"
|
|
49
|
+
>
|
|
50
|
+
<template #default="{ toggle }">
|
|
51
|
+
<orio-calendar
|
|
52
|
+
:selected="value"
|
|
53
|
+
:markers
|
|
54
|
+
:get-marker="getMarker"
|
|
55
|
+
:is-disabled="calendarIsDisabled"
|
|
56
|
+
@select="pick($event, toggle)"
|
|
57
|
+
/>
|
|
58
|
+
</template>
|
|
59
|
+
</orio-date-picker-trigger>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ControlProps } from "../ControlElement.vue.js";
|
|
2
|
+
import type { CalendarMarker } from "../Calendar.vue.js";
|
|
3
|
+
interface Props extends ControlProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
min?: string | null;
|
|
6
|
+
max?: string | null;
|
|
7
|
+
markers?: CalendarMarker[];
|
|
8
|
+
getMarker?: (iso: string) => CalendarMarker | null;
|
|
9
|
+
isDisabled?: (iso: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
type __VLS_Props = Props;
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
modelValue?: string | null;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
"update:modelValue": (value: string | null) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
markers: CalendarMarker[];
|
|
22
|
+
min: string | null;
|
|
23
|
+
max: string | null;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ControlProps } from "../ControlElement.vue.js";
|
|
2
|
+
interface Props extends ControlProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_21: {
|
|
7
|
+
toggle: any;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_21) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
13
|
+
text: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
text: { type: String, required: false, default: "" },
|
|
5
|
+
placeholder: { type: String, required: false, default: "" },
|
|
6
|
+
appearance: { type: String, required: false },
|
|
7
|
+
error: { type: [String, null], required: false },
|
|
8
|
+
group: { type: Boolean, required: false },
|
|
9
|
+
id: { type: String, required: false },
|
|
10
|
+
label: { type: String, required: false },
|
|
11
|
+
layout: { type: String, required: false },
|
|
12
|
+
size: { type: String, required: false },
|
|
13
|
+
fill: { type: Boolean, required: false },
|
|
14
|
+
tabindex: { type: [Number, String], required: false },
|
|
15
|
+
focusKey: { type: String, required: false },
|
|
16
|
+
disabled: { type: Boolean, required: false },
|
|
17
|
+
required: { type: Boolean, required: false },
|
|
18
|
+
name: { type: String, required: false },
|
|
19
|
+
ariaLabel: { type: String, required: false }
|
|
20
|
+
});
|
|
21
|
+
const controlProps = computed(() => {
|
|
22
|
+
const { text, placeholder, ...rest } = props;
|
|
23
|
+
return rest;
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<orio-control-element v-slot="{ control }" v-bind="controlProps">
|
|
29
|
+
<orio-popover position="bottom-right" :offset="5">
|
|
30
|
+
<template #default="{ toggle, isOpen }">
|
|
31
|
+
<button
|
|
32
|
+
v-bind="control"
|
|
33
|
+
type="button"
|
|
34
|
+
class="date-trigger"
|
|
35
|
+
:aria-expanded="isOpen"
|
|
36
|
+
@click="toggle()"
|
|
37
|
+
>
|
|
38
|
+
<span :class="{ placeholder: !text }">
|
|
39
|
+
{{ text || placeholder }}
|
|
40
|
+
</span>
|
|
41
|
+
<orio-icon name="calendar" />
|
|
42
|
+
</button>
|
|
43
|
+
</template>
|
|
44
|
+
<template #content="{ toggle }">
|
|
45
|
+
<slot :toggle />
|
|
46
|
+
</template>
|
|
47
|
+
</orio-popover>
|
|
48
|
+
</orio-control-element>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<style scoped>
|
|
52
|
+
.date-trigger {
|
|
53
|
+
width: 100%;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: space-between;
|
|
57
|
+
gap: var(--control-gap);
|
|
58
|
+
background: var(--color-bg);
|
|
59
|
+
border: 1px solid var(--color-border);
|
|
60
|
+
border-radius: var(--control-radius);
|
|
61
|
+
padding: var(--control-py) var(--control-px);
|
|
62
|
+
color: var(--color-text);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
user-select: none;
|
|
65
|
+
transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
|
|
66
|
+
}
|
|
67
|
+
.date-trigger:hover {
|
|
68
|
+
border-color: var(--color-accent);
|
|
69
|
+
background-color: var(--color-surface);
|
|
70
|
+
}
|
|
71
|
+
.date-trigger[aria-expanded=true], .date-trigger:focus-visible {
|
|
72
|
+
border-color: var(--color-accent);
|
|
73
|
+
box-shadow: 0 0 0 2px var(--color-surface);
|
|
74
|
+
outline: none;
|
|
75
|
+
}
|
|
76
|
+
.date-trigger .placeholder {
|
|
77
|
+
color: var(--color-muted);
|
|
78
|
+
}
|
|
79
|
+
.date-trigger .icon {
|
|
80
|
+
color: var(--color-muted);
|
|
81
|
+
transition: color 0.2s ease;
|
|
82
|
+
}
|
|
83
|
+
.date-trigger:hover .icon {
|
|
84
|
+
color: var(--color-accent);
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ControlProps } from "../ControlElement.vue.js";
|
|
2
|
+
interface Props extends ControlProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_21: {
|
|
7
|
+
toggle: any;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_21) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
13
|
+
text: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ControlProps } from "../ControlElement.vue.js";
|
|
2
|
+
import type { CalendarMarker } from "../Calendar.vue.js";
|
|
3
|
+
import { type DateRange } from "../../utils/date.js";
|
|
4
|
+
export type { DateRange };
|
|
5
|
+
interface Props extends ControlProps {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
min?: string | null;
|
|
8
|
+
max?: string | null;
|
|
9
|
+
markers?: CalendarMarker[];
|
|
10
|
+
getMarker?: (iso: string) => CalendarMarker | null;
|
|
11
|
+
isDisabled?: (iso: string) => boolean;
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = Props;
|
|
14
|
+
type __VLS_ModelProps = {
|
|
15
|
+
modelValue?: DateRange;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
18
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: DateRange) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: DateRange) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
markers: CalendarMarker[];
|
|
24
|
+
min: string | null;
|
|
25
|
+
max: string | null;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|