@cck-ui/core 0.20.2 → 0.20.3

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.
@@ -0,0 +1,116 @@
1
+ "use client";
2
+ const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
3
+ const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
4
+ let vue = require("vue");
5
+ //#region packages/@cck-ui/core/src/components/file-button/file-button.vue
6
+ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
7
+ name: "CFileButton",
8
+ __name: "file-button",
9
+ props: {
10
+ multiple: {
11
+ type: Boolean,
12
+ required: false
13
+ },
14
+ accept: {
15
+ type: String,
16
+ required: false
17
+ },
18
+ name: {
19
+ type: String,
20
+ required: false
21
+ },
22
+ form: {
23
+ type: String,
24
+ required: false
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ required: false
29
+ },
30
+ capture: {
31
+ type: [Boolean, String],
32
+ required: false
33
+ },
34
+ inputProps: {
35
+ type: Object,
36
+ required: false
37
+ }
38
+ },
39
+ emits: ["change"],
40
+ setup(__props, { expose: __expose, emit: __emit }) {
41
+ const inputRef = (0, vue.ref)(null);
42
+ const rawProps = __props;
43
+ const emit = __emit;
44
+ const defaultProps = {
45
+ multiple: false,
46
+ disabled: false
47
+ };
48
+ const props = require_use_component_props.useComponentProps({
49
+ component: "CFileButton",
50
+ defaultProps,
51
+ props: rawProps
52
+ });
53
+ const handleClick = () => {
54
+ if (!props.value.disabled) inputRef.value?.click();
55
+ };
56
+ const handleChange = (event) => {
57
+ const target = event.target;
58
+ if (target.files === null) {
59
+ emit("change", props.value.multiple ? [] : null);
60
+ return;
61
+ }
62
+ if (props.value.multiple !== false && props.value.multiple !== void 0) emit("change", Array.from(target.files));
63
+ else emit("change", target.files[0] || null);
64
+ };
65
+ const reset = () => {
66
+ if (inputRef.value) inputRef.value.value = "";
67
+ };
68
+ __expose({
69
+ input: inputRef,
70
+ reset
71
+ });
72
+ const __returned__ = {
73
+ inputRef,
74
+ rawProps,
75
+ emit,
76
+ defaultProps,
77
+ props,
78
+ handleClick,
79
+ handleChange,
80
+ reset
81
+ };
82
+ Object.defineProperty(__returned__, "__isScriptSetup", {
83
+ enumerable: false,
84
+ value: true
85
+ });
86
+ return __returned__;
87
+ }
88
+ });
89
+ const _hoisted_1 = [
90
+ "accept",
91
+ "capture",
92
+ "disabled",
93
+ "form",
94
+ "multiple",
95
+ "name"
96
+ ];
97
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
98
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [(0, vue.createElementVNode)("input", (0, vue.mergeProps)({
99
+ ref: "inputRef",
100
+ style: { "display": "none" },
101
+ type: "file"
102
+ }, $setup.props.inputProps, {
103
+ accept: $setup.props.accept,
104
+ capture: $setup.props.capture,
105
+ disabled: $setup.props.disabled,
106
+ form: $setup.props.form,
107
+ multiple: $setup.props.multiple,
108
+ name: $setup.props.name,
109
+ onChange: $setup.handleChange
110
+ }), null, 16, _hoisted_1), (0, vue.renderSlot)(_ctx.$slots, "default", { onClick: $setup.handleClick })], 64);
111
+ }
112
+ var file_button_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/file-button/file-button.vue"]]);
113
+ //#endregion
114
+ exports.default = file_button_default;
115
+
116
+ //# sourceMappingURL=file-button.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-button.cjs","names":[],"sources":["../../../src/components/file-button/file-button.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputRef\"\n style=\"display: none\"\n type=\"file\"\n v-bind=\"props.inputProps\"\n :accept=\"props.accept\"\n :capture=\"props.capture\"\n :disabled=\"props.disabled\"\n :form=\"props.form\"\n :multiple=\"props.multiple\"\n :name=\"props.name\"\n @change=\"handleChange\"\n />\n <slot :on-click=\"handleClick\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { useComponentProps } from '../../core'\nimport { FileButtonProps } from './file-button.types'\n\ndefineOptions({\n name: 'CFileButton',\n})\n\nconst inputRef = ref<HTMLInputElement | null>(null)\n\nconst rawProps = defineProps<FileButtonProps>()\n\nconst emit = defineEmits<{\n (e: 'change', payload: File | File[] | null): void\n}>()\n\nconst defaultProps = {\n multiple: false,\n disabled: false,\n} satisfies Partial<FileButtonProps>\n\nconst props = useComponentProps({\n component: 'CFileButton',\n defaultProps,\n props: rawProps,\n})\n\nconst handleClick = () => {\n if (!props.value.disabled) {\n inputRef.value?.click()\n }\n}\n\nconst handleChange = (event: Event) => {\n const target = event.target as HTMLInputElement\n if (target.files === null) {\n emit('change', props.value.multiple ? [] : null)\n return\n }\n\n if (props.value.multiple !== false && props.value.multiple !== undefined) {\n emit('change', Array.from(target.files))\n } else {\n emit('change', target.files[0] || null)\n }\n}\n\nconst reset = () => {\n if (inputRef.value) {\n inputRef.value.value = ''\n }\n}\n\ndefineExpose({\n input: inputRef,\n reset,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,YAAA,GAAA,IAAA,IAAA,CAAwC,IAAI;EAElD,MAAM,WAAW;EAEjB,MAAM,OAAO;EAIb,MAAM,eAAe;GACnB,UAAU;GACV,UAAU;EACZ;EAEA,MAAM,QAAQ,4BAAA,kBAAkB;GAC9B,WAAW;GACX;GACA,OAAO;EACT,CAAC;EAED,MAAM,oBAAoB;GACxB,IAAI,CAAC,MAAM,MAAM,UACf,SAAS,OAAO,MAAM;EAE1B;EAEA,MAAM,gBAAgB,UAAiB;GACrC,MAAM,SAAS,MAAM;GACrB,IAAI,OAAO,UAAU,MAAM;IACzB,KAAK,UAAU,MAAM,MAAM,WAAW,CAAC,IAAI,IAAI;IAC/C;GACF;GAEA,IAAI,MAAM,MAAM,aAAa,SAAS,MAAM,MAAM,aAAa,KAAA,GAC7D,KAAK,UAAU,MAAM,KAAK,OAAO,KAAK,CAAC;QAEvC,KAAK,UAAU,OAAO,MAAM,MAAM,IAAI;EAE1C;EAEA,MAAM,cAAc;GAClB,IAAI,SAAS,OACX,SAAS,MAAM,QAAQ;EAE3B;EAEA,SAAa;GACX,OAAO;GACP;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;2GA7DG,UAAA,GAAA,IAAA,WAAA,CAAA;EAXA,KAAI;EACJ,OAAA,EAAA,WAAA,OAAA;EACA,MAAK;IACG,OAAA,MAAM,YAAU;EACvB,QAAQ,OAAA,MAAM;EACd,SAAS,OAAA,MAAM;EACf,UAAU,OAAA,MAAM;EAChB,MAAM,OAAA,MAAM;EACZ,UAAU,OAAA,MAAM;EAChB,MAAM,OAAA,MAAM;EACZ,UAAQ,OAAA;gDAEqB,KAAA,QAAA,WAAA,EAAzB,SAAU,OAAA,YAAW,CAAA,CAAA,GAAA,EAAA"}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ const require_install = require("../../core/utils/vue/install.cjs");
3
+ const require_file_button = require("./file-button.cjs");
4
+ //#region packages/@cck-ui/core/src/components/file-button/index.ts
5
+ const CFileButton = require_install.withInstall(require_file_button.default);
6
+ //#endregion
7
+ exports.CFileButton = CFileButton;
8
+ exports.default = CFileButton;
9
+
10
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["withInstall","FileButton"],"sources":["../../../src/components/file-button/index.ts"],"sourcesContent":["import { withInstall } from '../../core'\nimport FileButton from './file-button.vue'\n\nexport const CFileButton = withInstall(FileButton)\n\nexport default CFileButton\n\nexport * from './file-button.types'\n"],"mappings":";;;;AAGA,MAAa,cAAcA,gBAAAA,YAAYC,oBAAAA,OAAU"}
package/cjs/index.cjs CHANGED
@@ -68,18 +68,19 @@ const require_index$11 = require("./components/center/index.cjs");
68
68
  const require_index$12 = require("./components/container/index.cjs");
69
69
  const require_index$13 = require("./components/copy-button/index.cjs");
70
70
  const require_index$14 = require("./components/empty-state/index.cjs");
71
- const require_index$15 = require("./components/flex/index.cjs");
72
- const require_index$16 = require("./components/grid/index.cjs");
73
- const require_index$17 = require("./components/group/index.cjs");
74
- const require_index$18 = require("./components/image/index.cjs");
75
- const require_index$19 = require("./components/paper/index.cjs");
76
- const require_index$20 = require("./components/semi-circle-progress/index.cjs");
77
- const require_index$21 = require("./components/simple-grid/index.cjs");
78
- const require_index$22 = require("./components/skeleton/index.cjs");
79
- const require_index$23 = require("./components/space/index.cjs");
80
- const require_index$24 = require("./components/splitter/index.cjs");
81
- const require_index$25 = require("./components/stack/index.cjs");
82
- const require_index$26 = require("./components/text/index.cjs");
71
+ const require_index$15 = require("./components/file-button/index.cjs");
72
+ const require_index$16 = require("./components/flex/index.cjs");
73
+ const require_index$17 = require("./components/grid/index.cjs");
74
+ const require_index$18 = require("./components/group/index.cjs");
75
+ const require_index$19 = require("./components/image/index.cjs");
76
+ const require_index$20 = require("./components/paper/index.cjs");
77
+ const require_index$21 = require("./components/semi-circle-progress/index.cjs");
78
+ const require_index$22 = require("./components/simple-grid/index.cjs");
79
+ const require_index$23 = require("./components/skeleton/index.cjs");
80
+ const require_index$24 = require("./components/space/index.cjs");
81
+ const require_index$25 = require("./components/splitter/index.cjs");
82
+ const require_index$26 = require("./components/stack/index.cjs");
83
+ const require_index$27 = require("./components/text/index.cjs");
83
84
  let _vue_shared = require("@vue/shared");
84
85
  //#region packages/@cck-ui/core/src/index.ts
85
86
  const INSTALLED_KEY = Symbol("INSTALLED_KEY");
@@ -96,7 +97,7 @@ const components = [
96
97
  require_index$10.CButtonGroupSection,
97
98
  require_index$11.CCenter,
98
99
  require_index$7.CCloseButton,
99
- require_index$16.CCol,
100
+ require_index$17.CCol,
100
101
  require_index$12.CContainer,
101
102
  require_index$13.CCopyButton,
102
103
  require_index$14.CEmptyState,
@@ -104,20 +105,21 @@ const components = [
104
105
  require_index$14.CEmptyStateDescription,
105
106
  require_index$14.CEmptyStateIndicator,
106
107
  require_index$14.CEmptyStateTitle,
107
- require_index$15.CFlex,
108
- require_index$16.CGrid,
109
- require_index$17.CGroup,
110
- require_index$18.CImage,
108
+ require_index$15.CFileButton,
109
+ require_index$16.CFlex,
110
+ require_index$17.CGrid,
111
+ require_index$18.CGroup,
112
+ require_index$19.CImage,
111
113
  require_index$4.CLoader,
112
- require_index$19.CPaper,
113
- require_index$20.CSemiCircleProgress,
114
- require_index$21.CSimpleGrid,
115
- require_index$22.CSkeleton,
116
- require_index$23.CSpace,
117
- require_index$24.CSplitter,
118
- require_index$24.CSplitterPane,
119
- require_index$25.CStack,
120
- require_index$26.CText,
114
+ require_index$20.CPaper,
115
+ require_index$21.CSemiCircleProgress,
116
+ require_index$22.CSimpleGrid,
117
+ require_index$23.CSkeleton,
118
+ require_index$24.CSpace,
119
+ require_index$25.CSplitter,
120
+ require_index$25.CSplitterPane,
121
+ require_index$26.CStack,
122
+ require_index$27.CText,
121
123
  require_index$5.CTransition,
122
124
  require_index$3.UnstyledButton
123
125
  ];
@@ -141,7 +143,7 @@ exports.CButtonGroupSection = require_index$10.CButtonGroupSection;
141
143
  exports.CCK_TRANSITIONS = require_transitions.transitions;
142
144
  exports.CCenter = require_index$11.CCenter;
143
145
  exports.CCloseButton = require_index$7.CCloseButton;
144
- exports.CCol = require_index$16.CCol;
146
+ exports.CCol = require_index$17.CCol;
145
147
  exports.CContainer = require_index$12.CContainer;
146
148
  exports.CCopyButton = require_index$13.CCopyButton;
147
149
  exports.CDefaultLoaders = require_index$4.CDefaultLoaders;
@@ -150,21 +152,22 @@ exports.CEmptyStateActions = require_index$14.CEmptyStateActions;
150
152
  exports.CEmptyStateDescription = require_index$14.CEmptyStateDescription;
151
153
  exports.CEmptyStateIndicator = require_index$14.CEmptyStateIndicator;
152
154
  exports.CEmptyStateTitle = require_index$14.CEmptyStateTitle;
153
- exports.CFlex = require_index$15.CFlex;
154
- exports.CGrid = require_index$16.CGrid;
155
- exports.CGroup = require_index$17.CGroup;
156
- exports.CImage = require_index$18.CImage;
155
+ exports.CFileButton = require_index$15.CFileButton;
156
+ exports.CFlex = require_index$16.CFlex;
157
+ exports.CGrid = require_index$17.CGrid;
158
+ exports.CGroup = require_index$18.CGroup;
159
+ exports.CImage = require_index$19.CImage;
157
160
  exports.CLoader = require_index$4.CLoader;
158
161
  exports.CONFIG_KEY = require_config_provider_types.CONFIG_KEY;
159
- exports.CPaper = require_index$19.CPaper;
160
- exports.CSemiCircleProgress = require_index$20.CSemiCircleProgress;
161
- exports.CSimpleGrid = require_index$21.CSimpleGrid;
162
- exports.CSkeleton = require_index$22.CSkeleton;
163
- exports.CSpace = require_index$23.CSpace;
164
- exports.CSplitter = require_index$24.CSplitter;
165
- exports.CSplitterPane = require_index$24.CSplitterPane;
166
- exports.CStack = require_index$25.CStack;
167
- exports.CText = require_index$26.CText;
162
+ exports.CPaper = require_index$20.CPaper;
163
+ exports.CSemiCircleProgress = require_index$21.CSemiCircleProgress;
164
+ exports.CSimpleGrid = require_index$22.CSimpleGrid;
165
+ exports.CSkeleton = require_index$23.CSkeleton;
166
+ exports.CSpace = require_index$24.CSpace;
167
+ exports.CSplitter = require_index$25.CSplitter;
168
+ exports.CSplitterPane = require_index$25.CSplitterPane;
169
+ exports.CStack = require_index$26.CStack;
170
+ exports.CText = require_index$27.CText;
168
171
  exports.CTransition = require_index$5.CTransition;
169
172
  exports.CckConfigProvider = require_index$1.CckConfigProvider;
170
173
  exports.CckUI = CckUI;
package/cjs/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CckConfigProvider","CBox","CActionIcon","CActionIconGroup","CActionIconGroupSection","CAlert","CAspectRatio","CButton","CButtonGroup","CButtonGroupSection","CCenter","CCloseButton","CCol","CContainer","CCopyButton","CEmptyState","CEmptyStateActions","CEmptyStateDescription","CEmptyStateIndicator","CEmptyStateTitle","CFlex","CGrid","CGroup","CImage","CLoader","CPaper","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","UnstyledButton"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjBA,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
1
+ {"version":3,"file":"index.cjs","names":["CckConfigProvider","CBox","CActionIcon","CActionIconGroup","CActionIconGroupSection","CAlert","CAspectRatio","CButton","CButtonGroup","CButtonGroupSection","CCenter","CCloseButton","CCol","CContainer","CCopyButton","CEmptyState","CEmptyStateActions","CEmptyStateDescription","CEmptyStateIndicator","CEmptyStateTitle","CFileButton","CFlex","CGrid","CGroup","CImage","CLoader","CPaper","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","UnstyledButton"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjBA,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,iBAAAA;CACAC,gBAAAA;CACAC,gBAAAA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
@@ -0,0 +1,116 @@
1
+ "use client";
2
+ import export_helper_default from "../../_virtual/_/plugin-vue/export-helper.mjs";
3
+ import { useComponentProps } from "../../core/config-provider/use-component-props/use-component-props.mjs";
4
+ import { Fragment, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, ref, renderSlot } from "vue";
5
+ //#region packages/@cck-ui/core/src/components/file-button/file-button.vue
6
+ const _sfc_main = /*@__PURE__*/ defineComponent({
7
+ name: "CFileButton",
8
+ __name: "file-button",
9
+ props: {
10
+ multiple: {
11
+ type: Boolean,
12
+ required: false
13
+ },
14
+ accept: {
15
+ type: String,
16
+ required: false
17
+ },
18
+ name: {
19
+ type: String,
20
+ required: false
21
+ },
22
+ form: {
23
+ type: String,
24
+ required: false
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ required: false
29
+ },
30
+ capture: {
31
+ type: [Boolean, String],
32
+ required: false
33
+ },
34
+ inputProps: {
35
+ type: Object,
36
+ required: false
37
+ }
38
+ },
39
+ emits: ["change"],
40
+ setup(__props, { expose: __expose, emit: __emit }) {
41
+ const inputRef = ref(null);
42
+ const rawProps = __props;
43
+ const emit = __emit;
44
+ const defaultProps = {
45
+ multiple: false,
46
+ disabled: false
47
+ };
48
+ const props = useComponentProps({
49
+ component: "CFileButton",
50
+ defaultProps,
51
+ props: rawProps
52
+ });
53
+ const handleClick = () => {
54
+ if (!props.value.disabled) inputRef.value?.click();
55
+ };
56
+ const handleChange = (event) => {
57
+ const target = event.target;
58
+ if (target.files === null) {
59
+ emit("change", props.value.multiple ? [] : null);
60
+ return;
61
+ }
62
+ if (props.value.multiple !== false && props.value.multiple !== void 0) emit("change", Array.from(target.files));
63
+ else emit("change", target.files[0] || null);
64
+ };
65
+ const reset = () => {
66
+ if (inputRef.value) inputRef.value.value = "";
67
+ };
68
+ __expose({
69
+ input: inputRef,
70
+ reset
71
+ });
72
+ const __returned__ = {
73
+ inputRef,
74
+ rawProps,
75
+ emit,
76
+ defaultProps,
77
+ props,
78
+ handleClick,
79
+ handleChange,
80
+ reset
81
+ };
82
+ Object.defineProperty(__returned__, "__isScriptSetup", {
83
+ enumerable: false,
84
+ value: true
85
+ });
86
+ return __returned__;
87
+ }
88
+ });
89
+ const _hoisted_1 = [
90
+ "accept",
91
+ "capture",
92
+ "disabled",
93
+ "form",
94
+ "multiple",
95
+ "name"
96
+ ];
97
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
98
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("input", mergeProps({
99
+ ref: "inputRef",
100
+ style: { "display": "none" },
101
+ type: "file"
102
+ }, $setup.props.inputProps, {
103
+ accept: $setup.props.accept,
104
+ capture: $setup.props.capture,
105
+ disabled: $setup.props.disabled,
106
+ form: $setup.props.form,
107
+ multiple: $setup.props.multiple,
108
+ name: $setup.props.name,
109
+ onChange: $setup.handleChange
110
+ }), null, 16, _hoisted_1), renderSlot(_ctx.$slots, "default", { onClick: $setup.handleClick })], 64);
111
+ }
112
+ var file_button_default = /*#__PURE__*/ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/file-button/file-button.vue"]]);
113
+ //#endregion
114
+ export { file_button_default as default };
115
+
116
+ //# sourceMappingURL=file-button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-button.mjs","names":[],"sources":["../../../src/components/file-button/file-button.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputRef\"\n style=\"display: none\"\n type=\"file\"\n v-bind=\"props.inputProps\"\n :accept=\"props.accept\"\n :capture=\"props.capture\"\n :disabled=\"props.disabled\"\n :form=\"props.form\"\n :multiple=\"props.multiple\"\n :name=\"props.name\"\n @change=\"handleChange\"\n />\n <slot :on-click=\"handleClick\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { useComponentProps } from '../../core'\nimport { FileButtonProps } from './file-button.types'\n\ndefineOptions({\n name: 'CFileButton',\n})\n\nconst inputRef = ref<HTMLInputElement | null>(null)\n\nconst rawProps = defineProps<FileButtonProps>()\n\nconst emit = defineEmits<{\n (e: 'change', payload: File | File[] | null): void\n}>()\n\nconst defaultProps = {\n multiple: false,\n disabled: false,\n} satisfies Partial<FileButtonProps>\n\nconst props = useComponentProps({\n component: 'CFileButton',\n defaultProps,\n props: rawProps,\n})\n\nconst handleClick = () => {\n if (!props.value.disabled) {\n inputRef.value?.click()\n }\n}\n\nconst handleChange = (event: Event) => {\n const target = event.target as HTMLInputElement\n if (target.files === null) {\n emit('change', props.value.multiple ? [] : null)\n return\n }\n\n if (props.value.multiple !== false && props.value.multiple !== undefined) {\n emit('change', Array.from(target.files))\n } else {\n emit('change', target.files[0] || null)\n }\n}\n\nconst reset = () => {\n if (inputRef.value) {\n inputRef.value.value = ''\n }\n}\n\ndefineExpose({\n input: inputRef,\n reset,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,WAAW,IAA6B,IAAI;EAElD,MAAM,WAAW;EAEjB,MAAM,OAAO;EAIb,MAAM,eAAe;GACnB,UAAU;GACV,UAAU;EACZ;EAEA,MAAM,QAAQ,kBAAkB;GAC9B,WAAW;GACX;GACA,OAAO;EACT,CAAC;EAED,MAAM,oBAAoB;GACxB,IAAI,CAAC,MAAM,MAAM,UACf,SAAS,OAAO,MAAM;EAE1B;EAEA,MAAM,gBAAgB,UAAiB;GACrC,MAAM,SAAS,MAAM;GACrB,IAAI,OAAO,UAAU,MAAM;IACzB,KAAK,UAAU,MAAM,MAAM,WAAW,CAAC,IAAI,IAAI;IAC/C;GACF;GAEA,IAAI,MAAM,MAAM,aAAa,SAAS,MAAM,MAAM,aAAa,KAAA,GAC7D,KAAK,UAAU,MAAM,KAAK,OAAO,KAAK,CAAC;QAEvC,KAAK,UAAU,OAAO,MAAM,MAAM,IAAI;EAE1C;EAEA,MAAM,cAAc;GAClB,IAAI,SAAS,OACX,SAAS,MAAM,QAAQ;EAE3B;EAEA,SAAa;GACX,OAAO;GACP;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAzEC,mBAYE,SAZF,WAYE;EAXA,KAAI;EACJ,OAAA,EAAA,WAAA,OAAA;EACA,MAAK;IACG,OAAA,MAAM,YAAU;EACvB,QAAQ,OAAA,MAAM;EACd,SAAS,OAAA,MAAM;EACf,UAAU,OAAA,MAAM;EAChB,MAAM,OAAA,MAAM;EACZ,UAAU,OAAA,MAAM;EAChB,MAAM,OAAA,MAAM;EACZ,UAAQ,OAAA;4BAEX,WAAgC,KAAA,QAAA,WAAA,EAAzB,SAAU,OAAA,YAAW,CAAA,CAAA,GAAA,EAAA"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { withInstall } from "../../core/utils/vue/install.mjs";
3
+ import file_button_default from "./file-button.mjs";
4
+ //#region packages/@cck-ui/core/src/components/file-button/index.ts
5
+ const CFileButton = withInstall(file_button_default);
6
+ //#endregion
7
+ export { CFileButton, CFileButton as default };
8
+
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["FileButton"],"sources":["../../../src/components/file-button/index.ts"],"sourcesContent":["import { withInstall } from '../../core'\nimport FileButton from './file-button.vue'\n\nexport const CFileButton = withInstall(FileButton)\n\nexport default CFileButton\n\nexport * from './file-button.types'\n"],"mappings":";;;;AAGA,MAAa,cAAc,YAAYA,mBAAU"}
package/esm/index.mjs CHANGED
@@ -64,6 +64,7 @@ import { CCenter } from "./components/center/index.mjs";
64
64
  import { CContainer } from "./components/container/index.mjs";
65
65
  import { CCopyButton } from "./components/copy-button/index.mjs";
66
66
  import { CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle } from "./components/empty-state/index.mjs";
67
+ import { CFileButton } from "./components/file-button/index.mjs";
67
68
  import { CFlex } from "./components/flex/index.mjs";
68
69
  import { CCol, CGrid } from "./components/grid/index.mjs";
69
70
  import { CGroup } from "./components/group/index.mjs";
@@ -99,6 +100,7 @@ const components = [
99
100
  CEmptyStateDescription,
100
101
  CEmptyStateIndicator,
101
102
  CEmptyStateTitle,
103
+ CFileButton,
102
104
  CFlex,
103
105
  CGrid,
104
106
  CGroup,
@@ -124,6 +126,6 @@ const CckUI = { install(app) {
124
126
  });
125
127
  } };
126
128
  //#endregion
127
- export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAlert, CAspectRatio, CBox, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCenter, CCloseButton, CCol, CContainer, CCopyButton, CDefaultLoaders, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFlex, CGrid, CGroup, CImage, CLoader, CONFIG_KEY, CPaper, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
129
+ export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAlert, CAspectRatio, CBox, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCenter, CCloseButton, CCol, CContainer, CCopyButton, CDefaultLoaders, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFileButton, CFlex, CGrid, CGroup, CImage, CLoader, CONFIG_KEY, CPaper, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
128
130
 
129
131
  //# sourceMappingURL=index.mjs.map
package/esm/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAlert,\n CAspectRatio,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCenter,\n CCloseButton,\n CCol,\n CContainer,\n CCopyButton,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
@@ -0,0 +1,31 @@
1
+ import { ElementProps } from '../../core';
2
+ export interface FileButtonProps {
3
+ /**
4
+ * @description If set, user can pick more than one file
5
+ */
6
+ multiple?: boolean;
7
+ /**
8
+ * @description File input accept attribute, for example, `"image/png,image/jpeg"`
9
+ */
10
+ accept?: string;
11
+ /**
12
+ * @description Input name attribute
13
+ */
14
+ name?: string;
15
+ /**
16
+ * @description Input form attribute
17
+ */
18
+ form?: string;
19
+ /**
20
+ * @description Disables file picker
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * @description Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute.
25
+ */
26
+ capture?: boolean | 'user' | 'environment';
27
+ /**
28
+ * @description Passes down props to the input element used to capture files
29
+ */
30
+ inputProps?: ElementProps<'input'>;
31
+ }
@@ -0,0 +1,3 @@
1
+ export declare const CFileButton: any;
2
+ export default CFileButton;
3
+ export * from './file-button.types';
@@ -7,6 +7,7 @@ export * from './close-button';
7
7
  export * from './container';
8
8
  export * from './copy-button';
9
9
  export * from './empty-state';
10
+ export * from './file-button';
10
11
  export * from './flex';
11
12
  export * from './grid';
12
13
  export * from './group';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cck-ui/core",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "description": "Vue component library focused on usability, accessibility and developer experience",
5
5
  "homepage": "https://cck-ui.jackatlas.xyz",
6
6
  "license": "ISC",