@cck-ui/core 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/focus-trap/focus-trap.cjs +41 -0
- package/cjs/components/focus-trap/focus-trap.cjs.map +1 -0
- package/cjs/components/focus-trap/index.cjs +12 -0
- package/cjs/components/focus-trap/index.cjs.map +1 -0
- package/cjs/index.cjs +46 -43
- package/cjs/index.cjs.map +1 -1
- package/esm/components/focus-trap/focus-trap.mjs +39 -0
- package/esm/components/focus-trap/focus-trap.mjs.map +1 -0
- package/esm/components/focus-trap/index.mjs +9 -0
- package/esm/components/focus-trap/index.mjs.map +1 -0
- package/esm/index.mjs +3 -1
- package/esm/index.mjs.map +1 -1
- package/lib/components/focus-trap/focus-trap.types.d.ts +6 -0
- package/lib/components/focus-trap/index.d.ts +5 -0
- package/lib/components/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
let _cck_ui_hooks = require("@cck-ui/hooks");
|
|
6
|
+
//#region packages/@cck-ui/core/src/components/focus-trap/focus-trap.vue
|
|
7
|
+
const _sfc_main = (0, vue.defineComponent)({
|
|
8
|
+
name: "CFocusTrap",
|
|
9
|
+
props: { active: { type: Boolean } },
|
|
10
|
+
setup(props, { slots }) {
|
|
11
|
+
const computedProps = require_use_component_props.useComponentProps({
|
|
12
|
+
component: "CFocusTrap",
|
|
13
|
+
defaultProps: { active: true },
|
|
14
|
+
props
|
|
15
|
+
});
|
|
16
|
+
const trapRef = (0, _cck_ui_hooks.useFocusTrap)(() => computedProps.value.active);
|
|
17
|
+
return () => {
|
|
18
|
+
const children = slots.default?.();
|
|
19
|
+
if (!children || children.length === 0) {
|
|
20
|
+
if (process.env.NODE_ENV === "development") console.warn("[@cck-ui/core/focus-trap] No children provided, nothing to trap.");
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (children.length === 1) {
|
|
24
|
+
const child = children[0];
|
|
25
|
+
if ((0, vue.isVNode)(child) && child.type === vue.Fragment) {
|
|
26
|
+
if (process.env.NODE_ENV === "development") console.warn("[@cck-ui/core/focus-trap] Fragment as single child is not supported; wrapping with div.");
|
|
27
|
+
const subChildren = Array.isArray(child.children) ? child.children : [];
|
|
28
|
+
return (0, vue.h)("div", { ref: trapRef }, subChildren);
|
|
29
|
+
}
|
|
30
|
+
return (0, vue.h)(child, { ref: trapRef });
|
|
31
|
+
}
|
|
32
|
+
if (process.env.NODE_ENV === "development") console.warn("[@cck-ui/core/focus-trap] Multiple root elements found; wrapping with div.");
|
|
33
|
+
return (0, vue.h)("div", { ref: trapRef }, children);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var focus_trap_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/focus-trap/focus-trap.vue"]]);
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.default = focus_trap_default;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=focus-trap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-trap.cjs","names":[],"sources":["../../../src/components/focus-trap/focus-trap.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { useFocusTrap } from '@cck-ui/hooks'\nimport { defineComponent, Fragment, h, isVNode } from 'vue'\nimport { FocusTrapPrpos } from './focus-trap.types'\nimport { useComponentProps } from '../../core'\nexport default defineComponent({\n name: 'CFocusTrap',\n props: {\n active: {\n type: Boolean,\n },\n },\n setup(props, { slots }) {\n const defaultProps = { active: true } satisfies Partial<FocusTrapPrpos>\n const computedProps = useComponentProps({\n component: 'CFocusTrap',\n defaultProps,\n props,\n })\n\n const trapRef = useFocusTrap(() => computedProps.value.active)\n\n return () => {\n const children = slots.default?.()\n if (!children || children.length === 0) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('[@cck-ui/core/focus-trap] No children provided, nothing to trap.')\n }\n return null\n }\n\n if (children.length === 1) {\n const child = children[0]\n if (isVNode(child) && child.type === Fragment) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n '[@cck-ui/core/focus-trap] Fragment as single child is not supported; wrapping with div.'\n )\n }\n const subChildren = Array.isArray(child.children) ? child.children : []\n return h('div', { ref: trapRef }, subChildren)\n }\n return h(child, { ref: trapRef })\n }\n\n if (process.env.NODE_ENV === 'development') {\n console.warn('[@cck-ui/core/focus-trap] Multiple root elements found; wrapping with div.')\n }\n return h('div', { ref: trapRef }, children)\n }\n },\n})\n</script>\n"],"mappings":";;;;;;AAKA,MAAK,aAAA,GAAA,IAAA,gBAAA,CAA0B;CAC7B,MAAM;CACN,OAAO,EACL,QAAQ,EACN,MAAM,QACR,EACF;CACA,MAAM,OAAO,EAAE,SAAS;EAEtB,MAAM,gBAAgB,4BAAA,kBAAkB;GACtC,WAAW;GACX,cAAA,EAHqB,QAAQ,KAG7B;GACA;EACF,CAAC;EAED,MAAM,WAAA,GAAA,cAAA,aAAA,OAA6B,cAAc,MAAM,MAAM;EAE7D,aAAa;GACX,MAAM,WAAW,MAAM,UAAU;GACjC,IAAI,CAAC,YAAY,SAAS,WAAW,GAAG;IACtC,IAAI,QAAQ,IAAI,aAAa,eAC3B,QAAQ,KAAK,kEAAkE;IAEjF,OAAO;GACT;GAEA,IAAI,SAAS,WAAW,GAAG;IACzB,MAAM,QAAQ,SAAS;IACvB,KAAA,GAAA,IAAA,QAAA,CAAY,KAAK,KAAK,MAAM,SAAS,IAAA,UAAU;KAC7C,IAAI,QAAQ,IAAI,aAAa,eAC3B,QAAQ,KACN,yFACF;KAEF,MAAM,cAAc,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM,WAAW,CAAC;KACtE,QAAA,GAAA,IAAA,EAAA,CAAS,OAAO,EAAE,KAAK,QAAQ,GAAG,WAAW;IAC/C;IACA,QAAA,GAAA,IAAA,EAAA,CAAS,OAAO,EAAE,KAAK,QAAQ,CAAC;GAClC;GAEA,IAAI,QAAQ,IAAI,aAAa,eAC3B,QAAQ,KAAK,4EAA4E;GAE3F,QAAA,GAAA,IAAA,EAAA,CAAS,OAAO,EAAE,KAAK,QAAQ,GAAG,QAAQ;EAC5C;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_install = require("../../core/utils/vue/install.cjs");
|
|
3
|
+
const require_statics = require("../../core/utils/vue/statics.cjs");
|
|
4
|
+
const require_focus_trap = require("./focus-trap.cjs");
|
|
5
|
+
//#region packages/@cck-ui/core/src/components/focus-trap/index.ts
|
|
6
|
+
const FocusTrapWithStatic = require_statics.withPropsFactory(require_statics.withExtend(require_focus_trap.default));
|
|
7
|
+
const CFocusTrap = require_install.withInstall(FocusTrapWithStatic);
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.CFocusTrap = CFocusTrap;
|
|
10
|
+
exports.default = CFocusTrap;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["withPropsFactory","withExtend","FocusTrap","withInstall"],"sources":["../../../src/components/focus-trap/index.ts"],"sourcesContent":["import { SFCWithInstall, withExtend, withInstall, withPropsFactory } from '../../core'\nimport FocusTrap from './focus-trap.vue'\n\nconst FocusTrapWithStatic = withPropsFactory(withExtend(FocusTrap))\n\nexport const CFocusTrap: SFCWithInstall<typeof FocusTrap> = withInstall(FocusTrapWithStatic)\n\nexport default CFocusTrap\n\nexport * from './focus-trap.types'\n"],"mappings":";;;;;AAGA,MAAM,sBAAsBA,gBAAAA,iBAAiBC,gBAAAA,WAAWC,mBAAAA,OAAS,CAAC;AAElE,MAAa,aAA+CC,gBAAAA,YAAY,mBAAmB"}
|
package/cjs/index.cjs
CHANGED
|
@@ -70,19 +70,20 @@ const require_index$13 = require("./components/copy-button/index.cjs");
|
|
|
70
70
|
const require_index$14 = require("./components/empty-state/index.cjs");
|
|
71
71
|
const require_index$15 = require("./components/file-button/index.cjs");
|
|
72
72
|
const require_index$16 = require("./components/flex/index.cjs");
|
|
73
|
-
const require_index$17 = require("./components/
|
|
74
|
-
const require_index$18 = require("./components/
|
|
75
|
-
const require_index$19 = require("./components/
|
|
76
|
-
const require_index$20 = require("./components/
|
|
77
|
-
const require_index$21 = require("./components/
|
|
78
|
-
const require_index$22 = require("./components/
|
|
79
|
-
const require_index$23 = require("./components/
|
|
80
|
-
const require_index$24 = require("./components/
|
|
81
|
-
const require_index$25 = require("./components/
|
|
82
|
-
const require_index$26 = require("./components/
|
|
83
|
-
const require_index$27 = require("./components/
|
|
84
|
-
const require_index$28 = require("./components/
|
|
85
|
-
const require_index$29 = require("./components/
|
|
73
|
+
const require_index$17 = require("./components/focus-trap/index.cjs");
|
|
74
|
+
const require_index$18 = require("./components/grid/index.cjs");
|
|
75
|
+
const require_index$19 = require("./components/group/index.cjs");
|
|
76
|
+
const require_index$20 = require("./components/image/index.cjs");
|
|
77
|
+
const require_index$21 = require("./components/paper/index.cjs");
|
|
78
|
+
const require_index$22 = require("./components/semi-circle-progress/index.cjs");
|
|
79
|
+
const require_index$23 = require("./components/simple-grid/index.cjs");
|
|
80
|
+
const require_index$24 = require("./components/skeleton/index.cjs");
|
|
81
|
+
const require_index$25 = require("./components/space/index.cjs");
|
|
82
|
+
const require_index$26 = require("./components/splitter/index.cjs");
|
|
83
|
+
const require_index$27 = require("./components/stack/index.cjs");
|
|
84
|
+
const require_index$28 = require("./components/text/index.cjs");
|
|
85
|
+
const require_index$29 = require("./components/typography/index.cjs");
|
|
86
|
+
const require_index$30 = require("./components/visually-hidden/index.cjs");
|
|
86
87
|
let _vue_shared = require("@vue/shared");
|
|
87
88
|
//#region packages/@cck-ui/core/src/index.ts
|
|
88
89
|
const INSTALLED_KEY = Symbol("INSTALLED_KEY");
|
|
@@ -99,7 +100,7 @@ const components = [
|
|
|
99
100
|
require_index$10.CButtonGroupSection,
|
|
100
101
|
require_index$11.CCenter,
|
|
101
102
|
require_index$7.CCloseButton,
|
|
102
|
-
require_index$
|
|
103
|
+
require_index$18.CCol,
|
|
103
104
|
require_index$12.CContainer,
|
|
104
105
|
require_index$13.CCopyButton,
|
|
105
106
|
require_index$14.CEmptyState,
|
|
@@ -109,22 +110,23 @@ const components = [
|
|
|
109
110
|
require_index$14.CEmptyStateTitle,
|
|
110
111
|
require_index$15.CFileButton,
|
|
111
112
|
require_index$16.CFlex,
|
|
112
|
-
require_index$17.
|
|
113
|
-
require_index$18.
|
|
114
|
-
require_index$19.
|
|
113
|
+
require_index$17.CFocusTrap,
|
|
114
|
+
require_index$18.CGrid,
|
|
115
|
+
require_index$19.CGroup,
|
|
116
|
+
require_index$20.CImage,
|
|
115
117
|
require_index$4.CLoader,
|
|
116
|
-
require_index$
|
|
117
|
-
require_index$
|
|
118
|
-
require_index$
|
|
119
|
-
require_index$
|
|
120
|
-
require_index$
|
|
121
|
-
require_index$
|
|
122
|
-
require_index$
|
|
123
|
-
require_index$
|
|
124
|
-
require_index$
|
|
118
|
+
require_index$21.CPaper,
|
|
119
|
+
require_index$22.CSemiCircleProgress,
|
|
120
|
+
require_index$23.CSimpleGrid,
|
|
121
|
+
require_index$24.CSkeleton,
|
|
122
|
+
require_index$25.CSpace,
|
|
123
|
+
require_index$26.CSplitter,
|
|
124
|
+
require_index$26.CSplitterPane,
|
|
125
|
+
require_index$27.CStack,
|
|
126
|
+
require_index$28.CText,
|
|
125
127
|
require_index$5.CTransition,
|
|
126
|
-
require_index$
|
|
127
|
-
require_index$
|
|
128
|
+
require_index$29.CTypography,
|
|
129
|
+
require_index$30.CVisuallyHidden,
|
|
128
130
|
require_index$3.UnstyledButton
|
|
129
131
|
];
|
|
130
132
|
const CckUI = { install(app) {
|
|
@@ -147,7 +149,7 @@ exports.CButtonGroupSection = require_index$10.CButtonGroupSection;
|
|
|
147
149
|
exports.CCK_TRANSITIONS = require_transitions.transitions;
|
|
148
150
|
exports.CCenter = require_index$11.CCenter;
|
|
149
151
|
exports.CCloseButton = require_index$7.CCloseButton;
|
|
150
|
-
exports.CCol = require_index$
|
|
152
|
+
exports.CCol = require_index$18.CCol;
|
|
151
153
|
exports.CContainer = require_index$12.CContainer;
|
|
152
154
|
exports.CCopyButton = require_index$13.CCopyButton;
|
|
153
155
|
exports.CDefaultLoaders = require_index$4.CDefaultLoaders;
|
|
@@ -158,23 +160,24 @@ exports.CEmptyStateIndicator = require_index$14.CEmptyStateIndicator;
|
|
|
158
160
|
exports.CEmptyStateTitle = require_index$14.CEmptyStateTitle;
|
|
159
161
|
exports.CFileButton = require_index$15.CFileButton;
|
|
160
162
|
exports.CFlex = require_index$16.CFlex;
|
|
161
|
-
exports.
|
|
162
|
-
exports.
|
|
163
|
-
exports.
|
|
163
|
+
exports.CFocusTrap = require_index$17.CFocusTrap;
|
|
164
|
+
exports.CGrid = require_index$18.CGrid;
|
|
165
|
+
exports.CGroup = require_index$19.CGroup;
|
|
166
|
+
exports.CImage = require_index$20.CImage;
|
|
164
167
|
exports.CLoader = require_index$4.CLoader;
|
|
165
168
|
exports.CONFIG_KEY = require_config_provider_types.CONFIG_KEY;
|
|
166
|
-
exports.CPaper = require_index$
|
|
167
|
-
exports.CSemiCircleProgress = require_index$
|
|
168
|
-
exports.CSimpleGrid = require_index$
|
|
169
|
-
exports.CSkeleton = require_index$
|
|
170
|
-
exports.CSpace = require_index$
|
|
171
|
-
exports.CSplitter = require_index$
|
|
172
|
-
exports.CSplitterPane = require_index$
|
|
173
|
-
exports.CStack = require_index$
|
|
174
|
-
exports.CText = require_index$
|
|
169
|
+
exports.CPaper = require_index$21.CPaper;
|
|
170
|
+
exports.CSemiCircleProgress = require_index$22.CSemiCircleProgress;
|
|
171
|
+
exports.CSimpleGrid = require_index$23.CSimpleGrid;
|
|
172
|
+
exports.CSkeleton = require_index$24.CSkeleton;
|
|
173
|
+
exports.CSpace = require_index$25.CSpace;
|
|
174
|
+
exports.CSplitter = require_index$26.CSplitter;
|
|
175
|
+
exports.CSplitterPane = require_index$26.CSplitterPane;
|
|
176
|
+
exports.CStack = require_index$27.CStack;
|
|
177
|
+
exports.CText = require_index$28.CText;
|
|
175
178
|
exports.CTransition = require_index$5.CTransition;
|
|
176
|
-
exports.CTypography = require_index$
|
|
177
|
-
exports.CVisuallyHidden = require_index$
|
|
179
|
+
exports.CTypography = require_index$29.CTypography;
|
|
180
|
+
exports.CVisuallyHidden = require_index$30.CVisuallyHidden;
|
|
178
181
|
exports.CckConfigProvider = require_index$1.CckConfigProvider;
|
|
179
182
|
exports.CckUI = CckUI;
|
|
180
183
|
exports.default = 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","CFileButton","CFlex","CGrid","CGroup","CImage","CLoader","CPaper","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","CTypography","CVisuallyHidden","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 CTypography,\n CVisuallyHidden,\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 CTypography,\n CVisuallyHidden,\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":"
|
|
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","CFocusTrap","CGrid","CGroup","CImage","CLoader","CPaper","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","CTypography","CVisuallyHidden","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 CFocusTrap,\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 CTypography,\n CVisuallyHidden,\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 CFocusTrap,\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 CTypography,\n CVisuallyHidden,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,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,iBAAAA;CACAC,gBAAAA;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,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,39 @@
|
|
|
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, defineComponent, h, isVNode } from "vue";
|
|
5
|
+
import { useFocusTrap } from "@cck-ui/hooks";
|
|
6
|
+
var focus_trap_default = /*#__PURE__*/ export_helper_default(defineComponent({
|
|
7
|
+
name: "CFocusTrap",
|
|
8
|
+
props: { active: { type: Boolean } },
|
|
9
|
+
setup(props, { slots }) {
|
|
10
|
+
const computedProps = useComponentProps({
|
|
11
|
+
component: "CFocusTrap",
|
|
12
|
+
defaultProps: { active: true },
|
|
13
|
+
props
|
|
14
|
+
});
|
|
15
|
+
const trapRef = useFocusTrap(() => computedProps.value.active);
|
|
16
|
+
return () => {
|
|
17
|
+
const children = slots.default?.();
|
|
18
|
+
if (!children || children.length === 0) {
|
|
19
|
+
console.warn("[@cck-ui/core/focus-trap] No children provided, nothing to trap.");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (children.length === 1) {
|
|
23
|
+
const child = children[0];
|
|
24
|
+
if (isVNode(child) && child.type === Fragment) {
|
|
25
|
+
console.warn("[@cck-ui/core/focus-trap] Fragment as single child is not supported; wrapping with div.");
|
|
26
|
+
const subChildren = Array.isArray(child.children) ? child.children : [];
|
|
27
|
+
return h("div", { ref: trapRef }, subChildren);
|
|
28
|
+
}
|
|
29
|
+
return h(child, { ref: trapRef });
|
|
30
|
+
}
|
|
31
|
+
console.warn("[@cck-ui/core/focus-trap] Multiple root elements found; wrapping with div.");
|
|
32
|
+
return h("div", { ref: trapRef }, children);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}), [["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/focus-trap/focus-trap.vue"]]);
|
|
36
|
+
//#endregion
|
|
37
|
+
export { focus_trap_default as default };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=focus-trap.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-trap.mjs","names":[],"sources":["../../../src/components/focus-trap/focus-trap.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { useFocusTrap } from '@cck-ui/hooks'\nimport { defineComponent, Fragment, h, isVNode } from 'vue'\nimport { FocusTrapPrpos } from './focus-trap.types'\nimport { useComponentProps } from '../../core'\nexport default defineComponent({\n name: 'CFocusTrap',\n props: {\n active: {\n type: Boolean,\n },\n },\n setup(props, { slots }) {\n const defaultProps = { active: true } satisfies Partial<FocusTrapPrpos>\n const computedProps = useComponentProps({\n component: 'CFocusTrap',\n defaultProps,\n props,\n })\n\n const trapRef = useFocusTrap(() => computedProps.value.active)\n\n return () => {\n const children = slots.default?.()\n if (!children || children.length === 0) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('[@cck-ui/core/focus-trap] No children provided, nothing to trap.')\n }\n return null\n }\n\n if (children.length === 1) {\n const child = children[0]\n if (isVNode(child) && child.type === Fragment) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n '[@cck-ui/core/focus-trap] Fragment as single child is not supported; wrapping with div.'\n )\n }\n const subChildren = Array.isArray(child.children) ? child.children : []\n return h('div', { ref: trapRef }, subChildren)\n }\n return h(child, { ref: trapRef })\n }\n\n if (process.env.NODE_ENV === 'development') {\n console.warn('[@cck-ui/core/focus-trap] Multiple root elements found; wrapping with div.')\n }\n return h('div', { ref: trapRef }, children)\n }\n },\n})\n</script>\n"],"mappings":";;;;;6DAKkB,gBAAa;CAC7B,MAAM;CACN,OAAO,EACL,QAAQ,EACN,MAAM,QACR,EACF;CACA,MAAM,OAAO,EAAE,SAAS;EAEtB,MAAM,gBAAgB,kBAAkB;GACtC,WAAW;GACX,cAAA,EAHqB,QAAQ,KAG7B;GACA;EACF,CAAC;EAED,MAAM,UAAU,mBAAmB,cAAc,MAAM,MAAM;EAE7D,aAAa;GACX,MAAM,WAAW,MAAM,UAAU;GACjC,IAAI,CAAC,YAAY,SAAS,WAAW,GAAG;IAEpC,QAAQ,KAAK,kEAAkE;IAEjF,OAAO;GACT;GAEA,IAAI,SAAS,WAAW,GAAG;IACzB,MAAM,QAAQ,SAAS;IACvB,IAAI,QAAQ,KAAK,KAAK,MAAM,SAAS,UAAU;KAE3C,QAAQ,KACN,yFACF;KAEF,MAAM,cAAc,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM,WAAW,CAAC;KACtE,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,GAAG,WAAW;IAC/C;IACA,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,CAAC;GAClC;GAGE,QAAQ,KAAK,4EAA4E;GAE3F,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,GAAG,QAAQ;EAC5C;CACF;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { withInstall } from "../../core/utils/vue/install.mjs";
|
|
3
|
+
import { withExtend, withPropsFactory } from "../../core/utils/vue/statics.mjs";
|
|
4
|
+
import focus_trap_default from "./focus-trap.mjs";
|
|
5
|
+
const CFocusTrap = withInstall(withPropsFactory(withExtend(focus_trap_default)));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CFocusTrap, CFocusTrap as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["FocusTrap"],"sources":["../../../src/components/focus-trap/index.ts"],"sourcesContent":["import { SFCWithInstall, withExtend, withInstall, withPropsFactory } from '../../core'\nimport FocusTrap from './focus-trap.vue'\n\nconst FocusTrapWithStatic = withPropsFactory(withExtend(FocusTrap))\n\nexport const CFocusTrap: SFCWithInstall<typeof FocusTrap> = withInstall(FocusTrapWithStatic)\n\nexport default CFocusTrap\n\nexport * from './focus-trap.types'\n"],"mappings":";;;;AAKA,MAAa,aAA+C,YAFhC,iBAAiB,WAAWA,kBAAS,CAEO,CAAmB"}
|
package/esm/index.mjs
CHANGED
|
@@ -66,6 +66,7 @@ import { CCopyButton } from "./components/copy-button/index.mjs";
|
|
|
66
66
|
import { CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle } from "./components/empty-state/index.mjs";
|
|
67
67
|
import { CFileButton } from "./components/file-button/index.mjs";
|
|
68
68
|
import { CFlex } from "./components/flex/index.mjs";
|
|
69
|
+
import { CFocusTrap } from "./components/focus-trap/index.mjs";
|
|
69
70
|
import { CCol, CGrid } from "./components/grid/index.mjs";
|
|
70
71
|
import { CGroup } from "./components/group/index.mjs";
|
|
71
72
|
import { CImage } from "./components/image/index.mjs";
|
|
@@ -104,6 +105,7 @@ const components = [
|
|
|
104
105
|
CEmptyStateTitle,
|
|
105
106
|
CFileButton,
|
|
106
107
|
CFlex,
|
|
108
|
+
CFocusTrap,
|
|
107
109
|
CGrid,
|
|
108
110
|
CGroup,
|
|
109
111
|
CImage,
|
|
@@ -130,6 +132,6 @@ const CckUI = { install(app) {
|
|
|
130
132
|
});
|
|
131
133
|
} };
|
|
132
134
|
//#endregion
|
|
133
|
-
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, CTypography, CVisuallyHidden, 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 };
|
|
135
|
+
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, CFocusTrap, CGrid, CGroup, CImage, CLoader, CONFIG_KEY, CPaper, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CTypography, CVisuallyHidden, 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 };
|
|
134
136
|
|
|
135
137
|
//# 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 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 CTypography,\n CVisuallyHidden,\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 CTypography,\n CVisuallyHidden,\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":"
|
|
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 CFocusTrap,\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 CTypography,\n CVisuallyHidden,\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 CFocusTrap,\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 CTypography,\n CVisuallyHidden,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,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;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"}
|
package/package.json
CHANGED