@naptics/vue-collection 0.3.1 → 1.0.0-beta.1

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 (129) hide show
  1. package/eslint.config.cjs +0 -2
  2. package/package.json +32 -31
  3. package/postcss.config.js +1 -4
  4. package/src/demo/App.css +47 -3
  5. package/src/demo/components/ComponentSection.tsx +1 -1
  6. package/src/demo/views/NavigationView.tsx +1 -1
  7. package/src/demo/views/presentation/TooltipView.tsx +8 -2
  8. package/src/lib/components/NAlert.tsx +3 -3
  9. package/src/lib/components/NBadge.tsx +1 -1
  10. package/src/lib/components/NButton.tsx +6 -4
  11. package/src/lib/components/NCheckbox.tsx +2 -2
  12. package/src/lib/components/NDialog.tsx +2 -2
  13. package/src/lib/components/NDropdown.tsx +11 -9
  14. package/src/lib/components/NDropzone.tsx +4 -4
  15. package/src/lib/components/NIconButton.tsx +2 -2
  16. package/src/lib/components/NInput.tsx +1 -1
  17. package/src/lib/components/NLink.tsx +1 -1
  18. package/src/lib/components/NModal.tsx +4 -4
  19. package/src/lib/components/NPagination.css +4 -2
  20. package/src/lib/components/NPagination.tsx +1 -1
  21. package/src/lib/components/NSearchbar.tsx +1 -1
  22. package/src/lib/components/NSelect.tsx +1 -1
  23. package/src/lib/components/NSuggestionList.tsx +1 -1
  24. package/src/lib/components/NTable.css +2 -0
  25. package/src/lib/components/NTableAction.tsx +1 -1
  26. package/src/lib/components/NTextArea.tsx +1 -1
  27. package/src/lib/components/NTooltip.css +2 -0
  28. package/src/lib/components/NTooltip.tsx +42 -3
  29. package/src/lib/utils/component.tsx +1 -1
  30. package/tsconfig.lib.json +1 -0
  31. package/vite.config.ts +2 -0
  32. package/components/NAlert.d.ts +0 -29
  33. package/components/NAlert.js +0 -84
  34. package/components/NBadge.d.ts +0 -69
  35. package/components/NBadge.js +0 -64
  36. package/components/NBreadcrub.d.ts +0 -69
  37. package/components/NBreadcrub.js +0 -71
  38. package/components/NButton.d.ts +0 -60
  39. package/components/NButton.js +0 -72
  40. package/components/NCheckbox.d.ts +0 -20
  41. package/components/NCheckbox.js +0 -43
  42. package/components/NCheckboxLabel.d.ts +0 -26
  43. package/components/NCheckboxLabel.js +0 -42
  44. package/components/NCrudModal.d.ts +0 -118
  45. package/components/NCrudModal.js +0 -120
  46. package/components/NDialog.d.ts +0 -81
  47. package/components/NDialog.js +0 -161
  48. package/components/NDropdown.d.ts +0 -67
  49. package/components/NDropdown.js +0 -115
  50. package/components/NDropzone.d.ts +0 -61
  51. package/components/NDropzone.js +0 -218
  52. package/components/NForm.d.ts +0 -21
  53. package/components/NForm.js +0 -29
  54. package/components/NFormModal.d.ts +0 -75
  55. package/components/NFormModal.js +0 -59
  56. package/components/NIconButton.d.ts +0 -79
  57. package/components/NIconButton.js +0 -88
  58. package/components/NIconCircle.d.ts +0 -49
  59. package/components/NIconCircle.js +0 -67
  60. package/components/NInput.css +0 -11
  61. package/components/NInput.d.ts +0 -90
  62. package/components/NInput.js +0 -110
  63. package/components/NInputPhone.d.ts +0 -54
  64. package/components/NInputPhone.js +0 -47
  65. package/components/NInputSelect.d.ts +0 -99
  66. package/components/NInputSelect.js +0 -115
  67. package/components/NInputSuggestion.d.ts +0 -75
  68. package/components/NInputSuggestion.js +0 -64
  69. package/components/NLink.d.ts +0 -47
  70. package/components/NLink.js +0 -67
  71. package/components/NList.d.ts +0 -37
  72. package/components/NList.js +0 -40
  73. package/components/NLoadingIndicator.css +0 -46
  74. package/components/NLoadingIndicator.d.ts +0 -29
  75. package/components/NLoadingIndicator.js +0 -54
  76. package/components/NModal.d.ts +0 -133
  77. package/components/NModal.js +0 -232
  78. package/components/NPagination.css +0 -15
  79. package/components/NPagination.d.ts +0 -37
  80. package/components/NPagination.js +0 -105
  81. package/components/NSearchbar.d.ts +0 -39
  82. package/components/NSearchbar.js +0 -64
  83. package/components/NSearchbarList.d.ts +0 -33
  84. package/components/NSearchbarList.js +0 -41
  85. package/components/NSelect.d.ts +0 -78
  86. package/components/NSelect.js +0 -101
  87. package/components/NSuggestionList.d.ts +0 -153
  88. package/components/NSuggestionList.js +0 -160
  89. package/components/NTable.css +0 -3
  90. package/components/NTable.d.ts +0 -97
  91. package/components/NTable.js +0 -128
  92. package/components/NTableAction.d.ts +0 -30
  93. package/components/NTableAction.js +0 -50
  94. package/components/NTextArea.d.ts +0 -92
  95. package/components/NTextArea.js +0 -133
  96. package/components/NTooltip.css +0 -37
  97. package/components/NTooltip.d.ts +0 -136
  98. package/components/NTooltip.js +0 -207
  99. package/components/NValInput.d.ts +0 -155
  100. package/components/NValInput.js +0 -113
  101. package/components/ValidatedForm.d.ts +0 -39
  102. package/components/ValidatedForm.js +0 -35
  103. package/i18n/de/vue-collection.json +0 -58
  104. package/i18n/en/vue-collection.json +0 -58
  105. package/i18n/index.d.ts +0 -40
  106. package/i18n/index.js +0 -31
  107. package/index.d.ts +0 -2
  108. package/index.js +0 -2
  109. package/tailwind.config.js +0 -38
  110. package/utils/breakpoints.d.ts +0 -18
  111. package/utils/breakpoints.js +0 -40
  112. package/utils/component.d.ts +0 -57
  113. package/utils/component.js +0 -79
  114. package/utils/deferred.d.ts +0 -13
  115. package/utils/deferred.js +0 -17
  116. package/utils/identifiable.d.ts +0 -56
  117. package/utils/identifiable.js +0 -81
  118. package/utils/stringMaxLength.d.ts +0 -14
  119. package/utils/stringMaxLength.js +0 -23
  120. package/utils/tailwind.d.ts +0 -4
  121. package/utils/tailwind.js +0 -1
  122. package/utils/utils.d.ts +0 -47
  123. package/utils/utils.js +0 -56
  124. package/utils/vModel.d.ts +0 -182
  125. package/utils/vModel.js +0 -224
  126. package/utils/validation.d.ts +0 -90
  127. package/utils/validation.js +0 -147
  128. package/utils/vue.d.ts +0 -13
  129. package/utils/vue.js +0 -21
@@ -97,7 +97,7 @@ export function extractProps<T extends Record<string, unknown>>(
97
97
  ...keys: (keyof T)[]
98
98
  ): UnwrapNestedRefs<Partial<ToRefs<T>>> {
99
99
  const partial: Partial<ToRefs<T>> = {}
100
- for (const key of keys) partial[key] = toRef(props, key)
100
+ for (const key of keys) partial[key] = toRef(props, key) as never
101
101
  return reactive(partial)
102
102
  }
103
103
 
package/tsconfig.lib.json CHANGED
@@ -12,6 +12,7 @@
12
12
  "noImplicitAny": false,
13
13
  "downlevelIteration": true,
14
14
  "skipLibCheck": true,
15
+ "allowImportingTsExtensions": false,
15
16
  "noEmit": false,
16
17
  "declaration": true
17
18
  }
package/vite.config.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { fileURLToPath, URL } from 'url'
2
2
  import { defineConfig } from 'vite'
3
+ import tailwindcss from '@tailwindcss/vite'
3
4
  import vue from '@vitejs/plugin-vue'
4
5
  import vueJsx from '@vitejs/plugin-vue-jsx'
5
6
  import vueI18n from '@intlify/unplugin-vue-i18n/vite'
@@ -10,6 +11,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url))
10
11
  // https://vitejs.dev/config/
11
12
  export default defineConfig({
12
13
  plugins: [
14
+ tailwindcss(),
13
15
  vue(),
14
16
  vueJsx(),
15
17
  vueI18n({
@@ -1,29 +0,0 @@
1
- import { type PropType } from 'vue';
2
- export type AlertVariant = 'success' | 'info' | 'warning' | 'error' | 'loading';
3
- export declare const nAlertProps: {
4
- /**
5
- * The variant of the alert. This defines its color and icon.
6
- */
7
- readonly variant: {
8
- readonly type: PropType<AlertVariant>;
9
- readonly default: "success";
10
- };
11
- /**
12
- * The text of the alert.
13
- */
14
- readonly text: StringConstructor;
15
- /**
16
- * If set to `true` the X-button of the alert is hidden.
17
- */
18
- readonly hideX: BooleanConstructor;
19
- /**
20
- * This is called, when the X-button is clicked.
21
- */
22
- readonly onDismiss: PropType<() => void>;
23
- };
24
- /**
25
- * The `NAlert` is a fully styled alert with multiple variants.
26
- * It can be used as a normal blocking element or as part of an alert queue.
27
- */
28
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
29
- export { Component as NAlert, Component as default };
@@ -1,84 +0,0 @@
1
- import { createVNode as _createVNode } from "vue";
2
- import { createComponent } from '../utils/component';
3
- import { CheckCircleIcon, ExclamationCircleIcon, InformationCircleIcon, XMarkIcon } from '@heroicons/vue/24/solid';
4
- import { computed } from 'vue';
5
- import NIconButton from './NIconButton';
6
- import NLoadingIndicator from './NLoadingIndicator';
7
- export const nAlertProps = {
8
- /**
9
- * The variant of the alert. This defines its color and icon.
10
- */
11
- variant: {
12
- type: String,
13
- default: 'success'
14
- },
15
- /**
16
- * The text of the alert.
17
- */
18
- text: String,
19
- /**
20
- * If set to `true` the X-button of the alert is hidden.
21
- */
22
- hideX: Boolean,
23
- /**
24
- * This is called, when the X-button is clicked.
25
- */
26
- onDismiss: Function
27
- };
28
- /**
29
- * The `NAlert` is a fully styled alert with multiple variants.
30
- * It can be used as a normal blocking element or as part of an alert queue.
31
- */
32
- const Component = createComponent('NAlert', nAlertProps, (props, {
33
- slots
34
- }) => {
35
- const variant = computed(() => VARIANTS[props.variant]);
36
- return () => _createVNode("div", {
37
- "class": `rounded-md p-3 shadow-lg bg-${variant.value.color}-50`
38
- }, [_createVNode("div", {
39
- "class": "flex items-center"
40
- }, [_createVNode("div", {
41
- "class": "flex flex-shrink-0 items-center"
42
- }, [variant.value.icon()]), _createVNode("div", {
43
- "class": "ml-3 flex-grow"
44
- }, [_createVNode("p", {
45
- "class": `text-sm font-medium text-${variant.value.color}-900`
46
- }, [slots.default?.() ?? props.text])]), !props.hideX && _createVNode("div", {
47
- "class": "flex items-center flex-shrink-0 ml-3"
48
- }, [_createVNode(NIconButton, {
49
- "color": variant.value.color,
50
- "size": 5,
51
- "icon": XMarkIcon,
52
- "onClick": props.onDismiss
53
- }, null)])])]);
54
- });
55
- const icon = (icon, color) => () => _createVNode(icon, {
56
- "class": `h-5 w-5 text-${color}-500`
57
- }, null);
58
- const VARIANTS = {
59
- success: {
60
- icon: icon(CheckCircleIcon, 'green'),
61
- color: 'green'
62
- },
63
- info: {
64
- icon: icon(InformationCircleIcon, 'blue'),
65
- color: 'blue'
66
- },
67
- warning: {
68
- icon: icon(ExclamationCircleIcon, 'yellow'),
69
- color: 'yellow'
70
- },
71
- error: {
72
- icon: icon(ExclamationCircleIcon, 'red'),
73
- color: 'red'
74
- },
75
- loading: {
76
- icon: () => _createVNode(NLoadingIndicator, {
77
- "color": "blue",
78
- "size": 7,
79
- "shade": 500
80
- }, null),
81
- color: 'blue'
82
- }
83
- };
84
- export { Component as NAlert, Component as default };
@@ -1,69 +0,0 @@
1
- import type { TWTextSize } from '../utils/tailwind';
2
- import type { PropType } from 'vue';
3
- export declare const nBadgeProps: {
4
- readonly tooltipText: StringConstructor;
5
- readonly tooltipContent: PropType<() => JSX.Element>;
6
- readonly tooltipHide: BooleanConstructor;
7
- readonly tooltipShow: BooleanConstructor;
8
- readonly tooltipPlacement: {
9
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
10
- readonly default: "auto";
11
- };
12
- readonly tooltipMaxWidth: {
13
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
14
- readonly default: "max-w-xs";
15
- };
16
- readonly tooltipWrapperClass: StringConstructor;
17
- readonly tooltipContentClass: StringConstructor;
18
- readonly tooltipArrowClass: StringConstructor;
19
- /**
20
- * The text of the badge. Can alternatively be passed in the default slot.
21
- */
22
- readonly text: StringConstructor;
23
- /**
24
- * The text size, a standard tailwind text-size class.
25
- */
26
- readonly textSize: {
27
- readonly type: PropType<TWTextSize>;
28
- readonly default: "text-sm";
29
- };
30
- /**
31
- * The color of the badge.
32
- */
33
- readonly color: {
34
- readonly type: StringConstructor;
35
- readonly default: "primary";
36
- };
37
- /**
38
- * The background shade of the badge.
39
- */
40
- readonly shade: {
41
- readonly type: NumberConstructor;
42
- readonly default: 200;
43
- };
44
- /**
45
- * The text shade of the badge.
46
- */
47
- readonly textShade: {
48
- readonly type: NumberConstructor;
49
- readonly default: 900;
50
- };
51
- /**
52
- * If set to `true` the badges text is all-caps. Default is `true`.
53
- */
54
- readonly allCaps: {
55
- readonly type: BooleanConstructor;
56
- readonly default: true;
57
- };
58
- /**
59
- * Adds the classes to the badge.
60
- * Use this instead of `class` to style the button, because the button is wrapped inside
61
- * a div for the tooltip and `class` would be applied to the wrapping div.
62
- */
63
- readonly badgeClass: StringConstructor;
64
- };
65
- /**
66
- * The `NBadge` is a styled element to wrap a text.
67
- */
68
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
69
- export { Component as NBadge, Component as default };
@@ -1,64 +0,0 @@
1
- import { createVNode as _createVNode } from "vue";
2
- import { createComponent } from '../utils/component';
3
- import NTooltip, { mapTooltipProps, nToolTipPropsForImplementor } from './NTooltip';
4
- export const nBadgeProps = {
5
- /**
6
- * The text of the badge. Can alternatively be passed in the default slot.
7
- */
8
- text: String,
9
- /**
10
- * The text size, a standard tailwind text-size class.
11
- */
12
- textSize: {
13
- type: String,
14
- default: 'text-sm'
15
- },
16
- /**
17
- * The color of the badge.
18
- */
19
- color: {
20
- type: String,
21
- default: 'primary'
22
- },
23
- /**
24
- * The background shade of the badge.
25
- */
26
- shade: {
27
- type: Number,
28
- default: 200
29
- },
30
- /**
31
- * The text shade of the badge.
32
- */
33
- textShade: {
34
- type: Number,
35
- default: 900
36
- },
37
- /**
38
- * If set to `true` the badges text is all-caps. Default is `true`.
39
- */
40
- allCaps: {
41
- type: Boolean,
42
- default: true
43
- },
44
- /**
45
- * Adds the classes to the badge.
46
- * Use this instead of `class` to style the button, because the button is wrapped inside
47
- * a div for the tooltip and `class` would be applied to the wrapping div.
48
- */
49
- badgeClass: String,
50
- ...nToolTipPropsForImplementor
51
- };
52
- /**
53
- * The `NBadge` is a styled element to wrap a text.
54
- */
55
- const Component = createComponent('NBadge', nBadgeProps, (props, {
56
- slots
57
- }) => {
58
- return () => _createVNode(NTooltip, mapTooltipProps(props), {
59
- default: () => [_createVNode("div", {
60
- "class": ['px-2 py-1 rounded-md font-semibold shadow', `${props.textSize} bg-${props.color}-${props.shade} text-${props.color}-${props.textShade}`, props.allCaps ? 'uppercase' : '', props.badgeClass]
61
- }, [slots.default?.() || props.text])]
62
- });
63
- });
64
- export { Component as NBadge, Component as default };
@@ -1,69 +0,0 @@
1
- import type { HeroIcon } from '../utils/tailwind';
2
- import type { TWTextSize } from '../utils/tailwind';
3
- import type { RouteLocationRaw } from 'vue-router';
4
- import type { PropType } from 'vue';
5
- export declare const nBreadcrumbProps: {
6
- /**
7
- * The items of the breadcrumb.
8
- */
9
- readonly items: {
10
- readonly type: PropType<BreadcrumbItem[]>;
11
- readonly default: () => never[];
12
- };
13
- /**
14
- * The color of the breadcrumbs text and icons.
15
- */
16
- readonly color: {
17
- readonly type: StringConstructor;
18
- readonly default: "primary";
19
- };
20
- /**
21
- * The text-size of the breadcrumb labels.
22
- */
23
- readonly textSize: {
24
- readonly type: PropType<TWTextSize>;
25
- readonly default: "text-base";
26
- };
27
- /**
28
- * The icon which is used as a seperator between two breadcrumb items.
29
- */
30
- readonly icon: {
31
- readonly type: PropType<HeroIcon>;
32
- readonly default: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
33
- };
34
- /**
35
- * The size of the icon in tailwind units.
36
- */
37
- readonly iconSize: {
38
- readonly type: NumberConstructor;
39
- readonly default: 5;
40
- };
41
- /**
42
- * Adds the classes to the separator icons.
43
- */
44
- readonly iconClass: StringConstructor;
45
- /**
46
- * A slot the replace the breadcrumb labels.
47
- */
48
- readonly item: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
49
- /**
50
- * A slot to replace the separators between the breadcrumb labels.
51
- * The passsed item is the item before the seperator.
52
- */
53
- readonly seperator: PropType<(item: BreadcrumbItem, index: number) => JSX.Element>;
54
- };
55
- export type BreadcrumbItem = {
56
- /**
57
- * The visible label of the breadcrumb item.
58
- */
59
- label: string;
60
- /**
61
- * The route the breadcrumb item points to.
62
- */
63
- route: RouteLocationRaw;
64
- };
65
- /**
66
- * The `NBreadcrumb` is a styled breadcrumb which can be used as a navigation in hierarchical views.
67
- */
68
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
69
- export { Component as NBreadcrumb, Component as default };
@@ -1,71 +0,0 @@
1
- import { Fragment as _Fragment, createVNode as _createVNode } from "vue";
2
- import { createComponentWithSlots } from '../utils/component';
3
- import { ChevronRightIcon } from '@heroicons/vue/24/solid';
4
- import NLink from './NLink';
5
- export const nBreadcrumbProps = {
6
- /**
7
- * The items of the breadcrumb.
8
- */
9
- items: {
10
- type: Array,
11
- default: () => []
12
- },
13
- /**
14
- * The color of the breadcrumbs text and icons.
15
- */
16
- color: {
17
- type: String,
18
- default: 'primary'
19
- },
20
- /**
21
- * The text-size of the breadcrumb labels.
22
- */
23
- textSize: {
24
- type: String,
25
- default: 'text-base'
26
- },
27
- /**
28
- * The icon which is used as a seperator between two breadcrumb items.
29
- */
30
- icon: {
31
- type: Function,
32
- default: ChevronRightIcon
33
- },
34
- /**
35
- * The size of the icon in tailwind units.
36
- */
37
- iconSize: {
38
- type: Number,
39
- default: 5
40
- },
41
- /**
42
- * Adds the classes to the separator icons.
43
- */
44
- iconClass: String,
45
- /**
46
- * A slot the replace the breadcrumb labels.
47
- */
48
- item: Function,
49
- /**
50
- * A slot to replace the separators between the breadcrumb labels.
51
- * The passsed item is the item before the seperator.
52
- */
53
- seperator: Function
54
- };
55
- /**
56
- * The `NBreadcrumb` is a styled breadcrumb which can be used as a navigation in hierarchical views.
57
- */
58
- const Component = createComponentWithSlots('NBreadcrumb', nBreadcrumbProps, ['seperator', 'item'], props => {
59
- return () => _createVNode("div", {
60
- "class": `flex flex-wrap items-center`
61
- }, [props.items.map((item, index) => _createVNode(_Fragment, null, [props.item?.(item, index) || _createVNode(NLink, {
62
- "textSize": props.textSize,
63
- "route": item.route,
64
- "color": props.color
65
- }, {
66
- default: () => [item.label]
67
- }), index < props.items.length - 1 && (props.seperator?.(item, index) || _createVNode(props.icon, {
68
- "class": `mx-2 w-${props.iconSize} h-${props.iconSize} text-${props.color}-500 ${props.iconClass}`
69
- }, null))]))]);
70
- });
71
- export { Component as NBreadcrumb, Component as default };
@@ -1,60 +0,0 @@
1
- import { type PropType } from 'vue';
2
- export declare const nButtonProps: {
3
- readonly tooltipText: StringConstructor;
4
- readonly tooltipContent: PropType<() => JSX.Element>;
5
- readonly tooltipHide: BooleanConstructor;
6
- readonly tooltipShow: BooleanConstructor;
7
- readonly tooltipPlacement: {
8
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
9
- readonly default: "auto";
10
- };
11
- readonly tooltipMaxWidth: {
12
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
13
- readonly default: "max-w-xs";
14
- };
15
- readonly tooltipWrapperClass: StringConstructor;
16
- readonly tooltipContentClass: StringConstructor;
17
- readonly tooltipArrowClass: StringConstructor;
18
- /**
19
- * The color of the button.
20
- */
21
- readonly color: {
22
- readonly type: StringConstructor;
23
- readonly default: "primary";
24
- };
25
- /**
26
- * The html attribute, which indicates the type of the button.
27
- */
28
- readonly type: {
29
- readonly type: PropType<"submit" | "button" | "reset">;
30
- readonly default: "button";
31
- };
32
- /**
33
- * If set to `true` the button is disabled and no interaction is possible.
34
- */
35
- readonly disabled: BooleanConstructor;
36
- /**
37
- * If set to `true` the button will show a loading animation.
38
- * Setting `loading` to `true` will also disable the button.
39
- */
40
- readonly loading: BooleanConstructor;
41
- /**
42
- * If set to `true` the button will appear smaller.
43
- */
44
- readonly small: BooleanConstructor;
45
- /**
46
- * Adds the classes to the button.
47
- * Use this instead of `class` to style the button, because the button is wrapped inside
48
- * a div for the tooltip and `class` would be applied to the wrapping div.
49
- */
50
- readonly buttonClass: StringConstructor;
51
- /**
52
- * This is called, when the button is clicked.
53
- */
54
- readonly onClick: PropType<() => void>;
55
- };
56
- /**
57
- * The `NButton` is a styled button.
58
- */
59
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
60
- export { Component as NButton, Component as default };
@@ -1,72 +0,0 @@
1
- import { createVNode as _createVNode } from "vue";
2
- import { createComponent } from '../utils/component';
3
- import { computed } from 'vue';
4
- import NLoadingIndicator from './NLoadingIndicator';
5
- import NTooltip, { mapTooltipProps, nToolTipPropsForImplementor } from './NTooltip';
6
- export const nButtonProps = {
7
- /**
8
- * The color of the button.
9
- */
10
- color: {
11
- type: String,
12
- default: 'primary'
13
- },
14
- /**
15
- * The html attribute, which indicates the type of the button.
16
- */
17
- type: {
18
- type: String,
19
- default: 'button'
20
- },
21
- /**
22
- * If set to `true` the button is disabled and no interaction is possible.
23
- */
24
- disabled: Boolean,
25
- /**
26
- * If set to `true` the button will show a loading animation.
27
- * Setting `loading` to `true` will also disable the button.
28
- */
29
- loading: Boolean,
30
- /**
31
- * If set to `true` the button will appear smaller.
32
- */
33
- small: Boolean,
34
- /**
35
- * Adds the classes to the button.
36
- * Use this instead of `class` to style the button, because the button is wrapped inside
37
- * a div for the tooltip and `class` would be applied to the wrapping div.
38
- */
39
- buttonClass: String,
40
- /**
41
- * This is called, when the button is clicked.
42
- */
43
- onClick: Function,
44
- ...nToolTipPropsForImplementor
45
- };
46
- /**
47
- * The `NButton` is a styled button.
48
- */
49
- const Component = createComponent('NButton', nButtonProps, (props, {
50
- slots
51
- }) => {
52
- const isDisabled = computed(() => props.loading || props.disabled);
53
- return () => _createVNode(NTooltip, mapTooltipProps(props), {
54
- default: () => [_createVNode("button", {
55
- "disabled": isDisabled.value,
56
- "type": props.type,
57
- "class": [`block w-full font-medium rounded-md focus:outline-none focus-visible:ring-2 shadow text-${props.color}-900 relative`, isDisabled.value ? `bg-${props.color}-100 text-opacity-20 cursor-default` : `bg-${props.color}-200 hover:bg-${props.color}-300 focus-visible:ring-${props.color}-500`, props.small ? 'py-1 px-2 text-xs' : 'py-2 px-4 text-sm', props.buttonClass],
58
- "onClick": props.onClick
59
- }, [_createVNode("span", {
60
- "class": {
61
- 'opacity-10': props.loading
62
- }
63
- }, [slots.default?.()]), props.loading && _createVNode("div", {
64
- "class": "absolute inset-0 flex items-center justify-center opacity-50"
65
- }, [_createVNode(NLoadingIndicator, {
66
- "color": props.color,
67
- "size": props.small ? 4 : 6,
68
- "shade": 600
69
- }, null)])])]
70
- });
71
- });
72
- export { Component as NButton, Component as default };
@@ -1,20 +0,0 @@
1
- export declare const nCheckboxProps: {
2
- /**
3
- * The color of the checkbox.
4
- */
5
- readonly color: {
6
- readonly type: StringConstructor;
7
- readonly default: "primary";
8
- };
9
- /**
10
- * If set to `true` the checkbox is disabled and no interaction is possible.
11
- */
12
- readonly disabled: BooleanConstructor;
13
- readonly value: import("vue").PropType<boolean>;
14
- readonly onUpdateValue: import("vue").PropType<(newValue: boolean) => void>;
15
- };
16
- /**
17
- * The `NCheckbox` is a styled checkbox.
18
- */
19
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
20
- export { Component as NCheckbox, Component as default };
@@ -1,43 +0,0 @@
1
- import { createVNode as _createVNode } from "vue";
2
- import { createComponent } from '../utils/component';
3
- import { vModelProps } from '../utils/vModel';
4
- import { nextTick, ref } from 'vue';
5
- export const nCheckboxProps = {
6
- ...vModelProps(Boolean),
7
- /**
8
- * The color of the checkbox.
9
- */
10
- color: {
11
- type: String,
12
- default: 'primary'
13
- },
14
- /**
15
- * If set to `true` the checkbox is disabled and no interaction is possible.
16
- */
17
- disabled: Boolean
18
- };
19
- /**
20
- * The `NCheckbox` is a styled checkbox.
21
- */
22
- const Component = createComponent('NCheckbox', nCheckboxProps, props => {
23
- const toggle = () => {
24
- props.onUpdateValue?.(!props.value);
25
- forceUpdate();
26
- };
27
- const checkBoxRef = ref();
28
- const updateKey = ref(0);
29
- const forceUpdate = () => {
30
- updateKey.value += 1;
31
- nextTick(() => checkBoxRef.value?.focus());
32
- };
33
- return () => _createVNode("input", {
34
- "type": "checkbox",
35
- "ref": checkBoxRef,
36
- "checked": props.value,
37
- "disabled": props.disabled,
38
- "onClick": toggle,
39
- "key": updateKey.value,
40
- "class": [`h-5 w-5 border-default-300 rounded focus:outline-none focus:ring-0 focus-visible:ring-2 focus-visible:ring-${props.color}-500`, props.disabled ? `cursor-default bg-default-100 text-${props.color}-200` : `cursor-pointer text-${props.color}-400`]
41
- }, null);
42
- });
43
- export { Component as NCheckbox, Component as default };
@@ -1,26 +0,0 @@
1
- export declare const nCheckboxLabelProps: {
2
- /**
3
- * The title of the checkbox.
4
- */
5
- readonly title: StringConstructor;
6
- /**
7
- * The description of the checkbox.
8
- */
9
- readonly description: StringConstructor;
10
- /**
11
- * If set to `true`, a smaller margin is applied between the label and the checkbox.
12
- */
13
- readonly compact: BooleanConstructor;
14
- readonly color: {
15
- readonly type: StringConstructor;
16
- readonly default: "primary";
17
- };
18
- readonly disabled: BooleanConstructor;
19
- readonly value: import("vue").PropType<boolean>;
20
- readonly onUpdateValue: import("vue").PropType<(newValue: boolean) => void>;
21
- };
22
- /**
23
- * The `NCheckboxLabel` is a checkbox with a title and a description.
24
- */
25
- declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
26
- export { Component as NCheckboxLabel, Component as default };