@katlux/toolkit 0.1.0-beta.54 → 0.1.0-beta.56

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 (24) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +9 -0
  3. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +2 -1
  4. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +9 -0
  5. package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +6 -0
  6. package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +7 -1
  7. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
  8. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
  9. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +1 -1
  10. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +1 -1
  11. package/dist/runtime/components/KDropdown/KDropdown.global.vue +2 -1
  12. package/dist/runtime/components/KModal/KModal.global.d.vue.ts +14 -2
  13. package/dist/runtime/components/KModal/KModal.global.vue +1 -0
  14. package/dist/runtime/components/KModal/KModal.global.vue.d.ts +14 -2
  15. package/dist/runtime/components/KModal/KModal.logic.d.ts +7 -1
  16. package/dist/runtime/components/KModal/KModal.logic.js +6 -1
  17. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +1 -0
  18. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +4 -1
  19. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +1 -0
  20. package/dist/runtime/presets/default/components/KModal/KModal.d.vue.ts +1 -0
  21. package/dist/runtime/presets/default/components/KModal/KModal.vue +31 -10
  22. package/dist/runtime/presets/default/components/KModal/KModal.vue.d.ts +1 -0
  23. package/dist/runtime/presets/default/components/KPanel/KPanel.vue +2 -0
  24. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
3
  "configKey": "katluxToolkit",
4
- "version": "0.1.0-beta.54",
4
+ "version": "0.1.0-beta.56",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -17,6 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
17
17
  type: StringConstructor;
18
18
  default: string;
19
19
  };
20
+ label: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
20
24
  modelValue: {
21
25
  type: import("vue").PropType<any>;
22
26
  };
@@ -40,12 +44,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
40
44
  type: StringConstructor;
41
45
  default: string;
42
46
  };
47
+ label: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
43
51
  modelValue: {
44
52
  type: import("vue").PropType<any>;
45
53
  };
46
54
  }>> & Readonly<{
47
55
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
48
56
  }>, {
57
+ label: string;
49
58
  value: any;
50
59
  disabled: boolean;
51
60
  validation: "error" | "success" | "warning" | null | undefined;
@@ -12,7 +12,8 @@ const templateProps = computed(() => ({
12
12
  checkboxValue: checkboxValue.value,
13
13
  isDisabled: isDisabled.value,
14
14
  validation: props.validation,
15
- validationText: props.validationText
15
+ validationText: props.validationText,
16
+ label: props.label
16
17
  }));
17
18
  </script>
18
19
 
@@ -17,6 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
17
17
  type: StringConstructor;
18
18
  default: string;
19
19
  };
20
+ label: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
20
24
  modelValue: {
21
25
  type: import("vue").PropType<any>;
22
26
  };
@@ -40,12 +44,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
40
44
  type: StringConstructor;
41
45
  default: string;
42
46
  };
47
+ label: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
43
51
  modelValue: {
44
52
  type: import("vue").PropType<any>;
45
53
  };
46
54
  }>> & Readonly<{
47
55
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
48
56
  }>, {
57
+ label: string;
49
58
  value: any;
50
59
  disabled: boolean;
51
60
  validation: "error" | "success" | "warning" | null | undefined;
@@ -4,6 +4,7 @@ export interface KCheckboxProps {
4
4
  value?: any;
5
5
  validation?: 'success' | 'warning' | 'error' | null;
6
6
  validationText?: string;
7
+ label?: string;
7
8
  }
8
9
  /**
9
10
  * KCheckbox Logic Composable
@@ -14,6 +15,7 @@ export declare function useKCheckboxLogic(props: KCheckboxProps, model: any): {
14
15
  isDisabled: import("vue").ComputedRef<boolean | undefined>;
15
16
  checkboxValue: import("vue").ComputedRef<any>;
16
17
  model: any;
18
+ label: import("vue").ComputedRef<string | undefined>;
17
19
  };
18
20
  /**
19
21
  * Default props for KCheckbox
@@ -36,4 +38,8 @@ export declare const KCheckboxDefaultProps: {
36
38
  type: StringConstructor;
37
39
  default: string;
38
40
  };
41
+ label: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
39
45
  };
@@ -2,10 +2,12 @@ import { computed } from "vue";
2
2
  export function useKCheckboxLogic(props, model) {
3
3
  const isDisabled = computed(() => props.disabled);
4
4
  const checkboxValue = computed(() => props.value);
5
+ const label = computed(() => props.label);
5
6
  return {
6
7
  isDisabled,
7
8
  checkboxValue,
8
- model
9
+ model,
10
+ label
9
11
  };
10
12
  }
11
13
  export const KCheckboxDefaultProps = {
@@ -25,5 +27,9 @@ export const KCheckboxDefaultProps = {
25
27
  validationText: {
26
28
  type: String,
27
29
  default: ""
30
+ },
31
+ label: {
32
+ type: String,
33
+ default: ""
28
34
  }
29
35
  };
@@ -105,10 +105,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
105
105
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
106
106
  }>, {
107
107
  isOpen: boolean;
108
- day: string | Date;
109
108
  validation: "error" | "success" | "warning" | null | undefined;
110
109
  validationText: string;
111
110
  modelValue: string | Date;
111
+ day: string | Date;
112
112
  teleportTo: string;
113
113
  showClear: boolean;
114
114
  align: "left" | "right" | undefined;
@@ -105,10 +105,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
105
105
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
106
106
  }>, {
107
107
  isOpen: boolean;
108
- day: string | Date;
109
108
  validation: "error" | "success" | "warning" | null | undefined;
110
109
  validationText: string;
111
110
  modelValue: string | Date;
111
+ day: string | Date;
112
112
  teleportTo: string;
113
113
  showClear: boolean;
114
114
  align: "left" | "right" | undefined;
@@ -111,10 +111,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
111
111
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
112
112
  }>, {
113
113
  isOpen: boolean;
114
- day: string | Date;
115
114
  validation: "error" | "success" | "warning" | null | undefined;
116
115
  validationText: string;
117
116
  modelValue: string | Date;
117
+ day: string | Date;
118
118
  teleportTo: string;
119
119
  showClear: boolean;
120
120
  format: string;
@@ -111,10 +111,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
111
111
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
112
112
  }>, {
113
113
  isOpen: boolean;
114
- day: string | Date;
115
114
  validation: "error" | "success" | "warning" | null | undefined;
116
115
  validationText: string;
117
116
  modelValue: string | Date;
117
+ day: string | Date;
118
118
  teleportTo: string;
119
119
  showClear: boolean;
120
120
  format: string;
@@ -19,7 +19,8 @@ const templateProps = computed(() => ({
19
19
  dropdownRect: dropdownRect.value,
20
20
  clickoutside,
21
21
  teleportTarget: teleportTarget.value,
22
- isInModal: isInModal.value
22
+ isInModal: isInModal.value,
23
+ align: props.align
23
24
  }));
24
25
  </script>
25
26
 
@@ -1,6 +1,18 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ closeOnOutsideClick: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }>, {
2
7
  openModal: () => void;
3
8
  closeModal: () => void;
4
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
10
+ closeOnOutsideClick: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ closeOnOutsideClick: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
17
  declare const _default: typeof __VLS_export;
6
18
  export default _default;
@@ -15,6 +15,7 @@ const presetComponent = usePresetComponent("KModal", KModalDefault);
15
15
  const templateProps = computed(() => ({
16
16
  modalId: modalId.value,
17
17
  opened: opened.value,
18
+ closeOnOutsideClick: props.closeOnOutsideClick,
18
19
  closeModal
19
20
  }));
20
21
  </script>
@@ -1,6 +1,18 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ closeOnOutsideClick: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }>, {
2
7
  openModal: () => void;
3
8
  closeModal: () => void;
4
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
10
+ closeOnOutsideClick: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ closeOnOutsideClick: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
17
  declare const _default: typeof __VLS_export;
6
18
  export default _default;
@@ -1,7 +1,13 @@
1
1
  export declare const KMODAL_PORTAL_ID_KEY = "KMODAL_PORTAL_ID";
2
2
  export interface KModalProps {
3
+ closeOnOutsideClick?: boolean;
3
4
  }
4
- export declare const KModalDefaultProps: {};
5
+ export declare const KModalDefaultProps: {
6
+ closeOnOutsideClick: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
10
+ };
5
11
  export declare function useKModalLogic(props: KModalProps, stableId: string): {
6
12
  modalId: import("vue").ComputedRef<string>;
7
13
  opened: import("vue").Ref<boolean, boolean>;
@@ -1,6 +1,11 @@
1
1
  import { ref, provide, computed } from "vue";
2
2
  export const KMODAL_PORTAL_ID_KEY = "KMODAL_PORTAL_ID";
3
- export const KModalDefaultProps = {};
3
+ export const KModalDefaultProps = {
4
+ closeOnOutsideClick: {
5
+ type: Boolean,
6
+ default: true
7
+ }
8
+ };
4
9
  export function useKModalLogic(props, stableId) {
5
10
  const modalId = computed(() => stableId);
6
11
  provide(KMODAL_PORTAL_ID_KEY, modalId);
@@ -2,6 +2,7 @@ type __VLS_Props = {
2
2
  model: any;
3
3
  checkboxValue: any;
4
4
  isDisabled: boolean;
5
+ label?: string;
5
6
  validation?: 'success' | 'warning' | 'error' | null;
6
7
  validationText?: string;
7
8
  };
@@ -5,7 +5,9 @@
5
5
  .icon-container(:class="validation ? `is-${validation}` : ''")
6
6
  KIcon.icon(iconname="check")
7
7
  span
8
- slot
8
+ slot(name="label")
9
+ slot
10
+ | {{ label }}
9
11
  span.validation-text(v-if="validation && ['success', 'warning', 'error'].includes(validation) && validationText" :class="`is-${validation}`") {{ validationText }}
10
12
  </template>
11
13
 
@@ -17,6 +19,7 @@ const props = defineProps<{
17
19
  model: any
18
20
  checkboxValue: any
19
21
  isDisabled: boolean
22
+ label?: string
20
23
  validation?: 'success' | 'warning' | 'error' | null
21
24
  validationText?: string
22
25
  }>()
@@ -2,6 +2,7 @@ type __VLS_Props = {
2
2
  model: any;
3
3
  checkboxValue: any;
4
4
  isDisabled: boolean;
5
+ label?: string;
5
6
  validation?: 'success' | 'warning' | 'error' | null;
6
7
  validationText?: string;
7
8
  };
@@ -1,6 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  modalId: string;
3
3
  opened: boolean;
4
+ closeOnOutsideClick: boolean;
4
5
  closeModal: () => void;
5
6
  };
6
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,5 +1,5 @@
1
1
  <template lang="pug">
2
- dialog.k-dialog(ref="dialogRef" @close="closeModal" @click="handleBackdropClick")
2
+ dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick" @mousedown="handleMouseDown")
3
3
  .modal-portal(:id="modalId" style="position: absolute; top: 0; left: 0; z-index: 2000;")
4
4
  KPanel(no-gap flex-content scrollable).modal-container
5
5
  template(#header)
@@ -15,10 +15,12 @@ import { ref, watch, onMounted } from 'vue'
15
15
  const props = defineProps<{
16
16
  modalId: string
17
17
  opened: boolean
18
+ closeOnOutsideClick: boolean
18
19
  closeModal: () => void
19
20
  }>()
20
21
 
21
22
  const dialogRef = ref<HTMLDialogElement | null>(null)
23
+ let isMouseDownOnBackdrop = false
22
24
 
23
25
  // When your prop changes, trigger the native browser methods to enter/exit the Top Layer
24
26
  watch(() => props.opened, (isOpen) => {
@@ -37,23 +39,39 @@ onMounted(() => {
37
39
  }
38
40
  })
39
41
 
42
+ const handleMouseDown = (event: MouseEvent) => {
43
+ isMouseDownOnBackdrop = event.target === dialogRef.value
44
+ }
45
+
40
46
  // Native dialogs require a script trick to close when clicking the ::backdrop pseudo-element
41
47
  const handleBackdropClick = (event: MouseEvent) => {
42
- if (event.target === dialogRef.value) {
48
+ if (props.closeOnOutsideClick && isMouseDownOnBackdrop && event.target === dialogRef.value) {
43
49
  props.closeModal()
44
50
  }
51
+ isMouseDownOnBackdrop = false
45
52
  }
46
53
  </script>
47
54
 
48
55
  <style lang="scss" scoped>
49
- .k-dialog {
56
+ .k-modal {
50
57
  border: none;
51
58
  background: transparent;
52
59
  padding: 0;
53
60
  /* margin: auto applied natively by browsers for showModal */
54
- overflow: visible;
55
- max-width: 100vw;
56
- max-height: 100vh;
61
+ overflow: hidden;
62
+ max-width: 95vw;
63
+ max-height: 95vh;
64
+ width: fit-content;
65
+ height: fit-content;
66
+
67
+ &:not([open]) {
68
+ display: none;
69
+ }
70
+
71
+ &[open] {
72
+ display: flex;
73
+ flex-direction: column;
74
+ }
57
75
 
58
76
  &::backdrop {
59
77
  background-color: var(--modal-overlay-bg);
@@ -61,10 +79,13 @@ const handleBackdropClick = (event: MouseEvent) => {
61
79
  }
62
80
 
63
81
  .modal-container {
64
- max-height: 600px;
65
- height: 80vh;
66
- max-width: 700px;
67
- min-width: 500px;
82
+ flex: 1;
83
+ display: flex;
84
+ flex-direction: column;
85
+ min-height: 0;
86
+ max-height: 100%;
87
+ width: 100%;
88
+ min-width: 400px;
68
89
  }
69
90
  }
70
91
  </style>
@@ -1,6 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  modalId: string;
3
3
  opened: boolean;
4
+ closeOnOutsideClick: boolean;
4
5
  closeModal: () => void;
5
6
  };
6
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -74,6 +74,7 @@ const props = withDefaults(defineProps<{
74
74
 
75
75
  .full-height {
76
76
  height: 100%;
77
+ min-height: 0;
77
78
  }
78
79
 
79
80
  &--header {
@@ -88,6 +89,7 @@ const props = withDefaults(defineProps<{
88
89
  &--content {
89
90
  padding: var(--gap-md);
90
91
  flex: 1;
92
+ min-height: 0;
91
93
 
92
94
  &.scrollable {
93
95
  overflow-y: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.0-beta.54",
3
+ "version": "0.1.0-beta.56",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "MIT",