orio-ui 1.23.2 → 1.24.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 (40) hide show
  1. package/README.md +3 -3
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/canvas.d.ts +1 -1
  4. package/dist/runtime/canvas.js +4 -1
  5. package/dist/runtime/components/Calendar.d.vue.ts +33 -0
  6. package/dist/runtime/components/Calendar.vue +251 -0
  7. package/dist/runtime/components/Calendar.vue.d.ts +33 -0
  8. package/dist/runtime/components/Canvas/context.d.ts +9 -0
  9. package/dist/runtime/components/Canvas/index.d.vue.ts +3 -0
  10. package/dist/runtime/components/Canvas/index.vue +19 -2
  11. package/dist/runtime/components/Canvas/index.vue.d.ts +3 -0
  12. package/dist/runtime/components/Canvas/tools/exportTool.d.ts +53 -6
  13. package/dist/runtime/components/Canvas/tools/exportTool.js +79 -32
  14. package/dist/runtime/components/Form.d.vue.ts +1 -1
  15. package/dist/runtime/components/Form.vue.d.ts +1 -1
  16. package/dist/runtime/components/date/Picker.d.vue.ts +26 -0
  17. package/dist/runtime/components/date/Picker.vue +54 -0
  18. package/dist/runtime/components/date/Picker.vue.d.ts +26 -0
  19. package/dist/runtime/components/date/PickerTrigger.d.vue.ts +23 -0
  20. package/dist/runtime/components/date/PickerTrigger.vue +80 -0
  21. package/dist/runtime/components/date/PickerTrigger.vue.d.ts +23 -0
  22. package/dist/runtime/components/date/RangePicker.d.vue.ts +28 -0
  23. package/dist/runtime/components/date/RangePicker.vue +148 -0
  24. package/dist/runtime/components/date/RangePicker.vue.d.ts +28 -0
  25. package/dist/runtime/components/view/Dates.d.vue.ts +2 -5
  26. package/dist/runtime/components/view/Dates.vue +17 -23
  27. package/dist/runtime/components/view/Dates.vue.d.ts +2 -5
  28. package/dist/runtime/i18n/en.json +8 -5
  29. package/dist/runtime/i18n/uk.json +8 -5
  30. package/dist/runtime/index.d.ts +4 -2
  31. package/dist/runtime/index.js +6 -2
  32. package/dist/runtime/utils/date.d.ts +10 -0
  33. package/dist/runtime/utils/date.js +38 -0
  34. package/package.json +1 -1
  35. package/dist/runtime/components/DatePicker.d.vue.ts +0 -15
  36. package/dist/runtime/components/DatePicker.vue +0 -24
  37. package/dist/runtime/components/DatePicker.vue.d.ts +0 -15
  38. package/dist/runtime/components/DateRangePicker.d.vue.ts +0 -18
  39. package/dist/runtime/components/DateRangePicker.vue +0 -67
  40. package/dist/runtime/components/DateRangePicker.vue.d.ts +0 -18
@@ -1,9 +1,6 @@
1
- export interface ResumeDate {
2
- startDate: string;
3
- endDate?: string | null;
4
- }
1
+ import { type DateRange } from "../../utils/date.js";
5
2
  interface Props {
6
- dates: ResumeDate;
3
+ dates: DateRange;
7
4
  month?: boolean;
8
5
  size?: "small" | "medium" | "large";
9
6
  type?: "text" | "title" | "subtitle" | "italics";
@@ -4,12 +4,15 @@
4
4
  "selected": "{count} selected",
5
5
  "noOptions": "No options found"
6
6
  },
7
- "dateRangePicker": {
8
- "startBeforeEnd": "Start date must be before end date.",
9
- "present": "Present"
7
+ "calendar": {
8
+ "previousMonth": "Previous month",
9
+ "nextMonth": "Next month"
10
+ },
11
+ "datePicker": {
12
+ "placeholder": "Select a date"
10
13
  },
11
- "dates": {
12
- "present": "Present"
14
+ "dateRangePicker": {
15
+ "placeholder": "Select a date range"
13
16
  },
14
17
  "validation": {
15
18
  "fieldError": "Error on this field"
@@ -4,12 +4,15 @@
4
4
  "selected": "{count} обрано",
5
5
  "noOptions": "Опцій не знайдено"
6
6
  },
7
- "dateRangePicker": {
8
- "startBeforeEnd": "Дата початку має бути раніше дати завершення.",
9
- "present": "Теперішній час"
7
+ "calendar": {
8
+ "previousMonth": "Попередній місяць",
9
+ "nextMonth": "Наступний місяць"
10
+ },
11
+ "datePicker": {
12
+ "placeholder": "Оберіть дату"
10
13
  },
11
- "dates": {
12
- "present": "Теперішній час"
14
+ "dateRangePicker": {
15
+ "placeholder": "Оберіть діапазон дат"
13
16
  },
14
17
  "validation": {
15
18
  "fieldError": "Помилка в цьому полі"
@@ -11,8 +11,10 @@ export { default as CheckBox } from "./components/CheckBox.vue.js";
11
11
  export { default as CheckboxGroup, type CheckboxOption, type CheckboxGroupProps, } from "./components/CheckboxGroup.vue.js";
12
12
  export { default as RadioButton, type RadioButtonProps, } from "./components/RadioButton.vue.js";
13
13
  export { default as SwitchButton } from "./components/SwitchButton.vue.js";
14
- export { default as DatePicker } from "./components/DatePicker.vue.js";
15
- export { default as DateRangePicker } from "./components/DateRangePicker.vue.js";
14
+ export { default as Calendar, type CalendarProps, } from "./components/Calendar.vue.js";
15
+ export { default as DatePicker } from "./components/date/Picker.vue.js";
16
+ export { default as DateRangePicker } from "./components/date/RangePicker.vue.js";
17
+ export { type DateRange, parseISO, formatISO, formatDate } from "./utils/date.js";
16
18
  export { default as Selector } from "./components/Selector.vue.js";
17
19
  export { default as TaggableSelector } from "./components/TaggableSelector.vue.js";
18
20
  export { default as Tag } from "./components/Tag.vue.js";
@@ -15,8 +15,12 @@ export {
15
15
  default as RadioButton
16
16
  } from "./components/RadioButton.vue";
17
17
  export { default as SwitchButton } from "./components/SwitchButton.vue";
18
- export { default as DatePicker } from "./components/DatePicker.vue";
19
- export { default as DateRangePicker } from "./components/DateRangePicker.vue";
18
+ export {
19
+ default as Calendar
20
+ } from "./components/Calendar.vue";
21
+ export { default as DatePicker } from "./components/date/Picker.vue";
22
+ export { default as DateRangePicker } from "./components/date/RangePicker.vue";
23
+ export { parseISO, formatISO, formatDate } from "./utils/date.js";
20
24
  export { default as Selector } from "./components/Selector.vue";
21
25
  export { default as TaggableSelector } from "./components/TaggableSelector.vue";
22
26
  export { default as Tag } from "./components/Tag.vue";
@@ -0,0 +1,10 @@
1
+ export interface DateRange {
2
+ start: string | null;
3
+ end: string | null;
4
+ }
5
+ export declare function parseISO(value: string | null | undefined): Date | null;
6
+ export declare function formatISO(date: Date): string;
7
+ export declare function isSameDay(a: Date, b: Date): boolean;
8
+ export declare function startOfMonth(date: Date): Date;
9
+ export declare function addMonths(date: Date, count: number): Date;
10
+ export declare function formatDate(value: string | null | undefined, locale: string, options?: Intl.DateTimeFormatOptions): string;
@@ -0,0 +1,38 @@
1
+ const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
2
+ export function parseISO(value) {
3
+ if (!value) return null;
4
+ const match = ISO_DATE.exec(value);
5
+ if (!match) return null;
6
+ const [, y, m, d] = match;
7
+ const date = new Date(Number(y), Number(m) - 1, Number(d));
8
+ if (Number.isNaN(date.getTime())) return null;
9
+ if (date.getFullYear() !== Number(y) || date.getMonth() !== Number(m) - 1 || date.getDate() !== Number(d)) {
10
+ return null;
11
+ }
12
+ return date;
13
+ }
14
+ export function formatISO(date) {
15
+ const y = date.getFullYear();
16
+ const m = String(date.getMonth() + 1).padStart(2, "0");
17
+ const d = String(date.getDate()).padStart(2, "0");
18
+ return `${y}-${m}-${d}`;
19
+ }
20
+ export function isSameDay(a, b) {
21
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
22
+ }
23
+ export function startOfMonth(date) {
24
+ return new Date(date.getFullYear(), date.getMonth(), 1);
25
+ }
26
+ export function addMonths(date, count) {
27
+ return new Date(date.getFullYear(), date.getMonth() + count, 1);
28
+ }
29
+ const DEFAULT_DATE_FORMAT = {
30
+ day: "numeric",
31
+ month: "short",
32
+ year: "numeric"
33
+ };
34
+ export function formatDate(value, locale, options = DEFAULT_DATE_FORMAT) {
35
+ const date = parseISO(value);
36
+ if (!date) return "";
37
+ return new Intl.DateTimeFormat(locale, options).format(date);
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orio-ui",
3
- "version": "1.23.2",
3
+ "version": "1.24.0",
4
4
  "description": "Modern Nuxt component library with theme support",
5
5
  "type": "module",
6
6
  "main": "./dist/module.mjs",
@@ -1,15 +0,0 @@
1
- interface Props {
2
- month?: boolean;
3
- }
4
- type __VLS_Props = Props;
5
- type __VLS_ModelProps = {
6
- "date": string | null | undefined;
7
- };
8
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
- "update:date": (value: string | null | undefined) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:date"?: ((value: string | null | undefined) => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
- declare const _default: typeof __VLS_export;
15
- export default _default;
@@ -1,24 +0,0 @@
1
- <script setup>
2
- defineProps({
3
- month: { type: Boolean, required: false }
4
- });
5
- const date = defineModel("date", { type: null, ...{
6
- required: true
7
- } });
8
- </script>
9
-
10
- <template>
11
- <orio-control-element v-slot="{ id }" class="date-picker" v-bind="$attrs">
12
- <input
13
- :id
14
- v-model="date"
15
- :type="month ? 'month' : 'date'"
16
- class="date-input"
17
- :name="id"
18
- />
19
- </orio-control-element>
20
- </template>
21
-
22
- <style scoped>
23
- .date-picker *{cursor:pointer;width:100%}.date-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--color-bg);border:1px solid var(--color-border);border-radius:var(--border-radius-md);box-sizing:border-box;color:var(--color-text);padding:.4rem .6rem;transition:border-color .2s ease}.date-input:focus,.date-input:hover{border-color:var(--color-accent)}.date-input:focus{outline:none}.date-input:disabled{background-color:var(--color-surface);color:var(--color-muted);cursor:not-allowed}.date-input::-webkit-calendar-picker-indicator{cursor:pointer;filter:invert(36%) sepia(65%) saturate(325%) hue-rotate(180deg);opacity:.7;-webkit-transition:opacity .2s ease;transition:opacity .2s ease}.date-input::-webkit-calendar-picker-indicator:hover{opacity:1}
24
- </style>
@@ -1,15 +0,0 @@
1
- interface Props {
2
- month?: boolean;
3
- }
4
- type __VLS_Props = Props;
5
- type __VLS_ModelProps = {
6
- "date": string | null | undefined;
7
- };
8
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
- "update:date": (value: string | null | undefined) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:date"?: ((value: string | null | undefined) => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
- declare const _default: typeof __VLS_export;
15
- export default _default;
@@ -1,18 +0,0 @@
1
- import type { ResumeDate } from "./view/Dates.vue.js";
2
- export interface DateRangePickerProps {
3
- month?: boolean;
4
- }
5
- type __VLS_Props = DateRangePickerProps;
6
- type __VLS_ModelProps = {
7
- "dates": ResumeDate;
8
- };
9
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
11
- dateIsCorrect: import("vue").ComputedRef<boolean>;
12
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:dates": (value: ResumeDate) => any;
14
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
- "onUpdate:dates"?: ((value: ResumeDate) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,67 +0,0 @@
1
- <script setup>
2
- import { ref, watch, computed } from "vue";
3
- import { useI18n } from "vue-i18n";
4
- defineProps({
5
- month: { type: Boolean, required: false }
6
- });
7
- const { t } = useI18n();
8
- const dates = defineModel("dates", { type: Object, ...{ required: true } });
9
- const present = ref(dates.value.endDate !== "" && !dates.value.endDate);
10
- watch(present, (value) => {
11
- if (value) {
12
- dates.value.endDate = null;
13
- } else {
14
- dates.value.endDate = "";
15
- }
16
- });
17
- const dateIsCorrect = computed(() => {
18
- if (dates.value.startDate && dates.value.endDate) {
19
- return new Date(dates.value.startDate) <= new Date(dates.value.endDate);
20
- }
21
- return true;
22
- });
23
- defineExpose({ dateIsCorrect });
24
- </script>
25
-
26
- <template>
27
- <orio-control-element
28
- v-bind="$attrs"
29
- :error="!dateIsCorrect ? t('dateRangePicker.startBeforeEnd') : null"
30
- >
31
- <div class="date-range-picker">
32
- <orio-date-picker
33
- v-model:date="dates.startDate"
34
- class="error-fields"
35
- :month
36
- />
37
- <orio-date-picker
38
- v-model:date="dates.endDate"
39
- class="error-fields"
40
- :month
41
- />
42
- <orio-check-box v-model="present">
43
- {{ t("dateRangePicker.present") }}
44
- </orio-check-box>
45
- </div>
46
- </orio-control-element>
47
- </template>
48
-
49
- <style scoped>
50
- .date-range-picker {
51
- display: flex;
52
- align-items: center;
53
- flex-wrap: wrap;
54
- }
55
- .date-range-picker > * {
56
- min-width: 0;
57
- }
58
- .date-range-picker .date-picker {
59
- margin-inline: 0;
60
- }
61
- .date-range-picker .date-picker:first-child {
62
- margin-inline-end: 0.5rem;
63
- }
64
- .date-range-picker .checkbox {
65
- margin-inline-start: 0.25rem;
66
- }
67
- </style>
@@ -1,18 +0,0 @@
1
- import type { ResumeDate } from "./view/Dates.vue.js";
2
- export interface DateRangePickerProps {
3
- month?: boolean;
4
- }
5
- type __VLS_Props = DateRangePickerProps;
6
- type __VLS_ModelProps = {
7
- "dates": ResumeDate;
8
- };
9
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
11
- dateIsCorrect: import("vue").ComputedRef<boolean>;
12
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:dates": (value: ResumeDate) => any;
14
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
- "onUpdate:dates"?: ((value: ResumeDate) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;