@kong/kongponents 9.44.1-pr.2962.c6edd95.0 → 9.45.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.
@@ -0,0 +1,69 @@
1
+ import { defineNuxtModule, createResolver, addComponent, useLogger, addImportsDir } from '@nuxt/kit';
2
+ import { components } from '@kong/kongponents';
3
+ // Components that should always be excluded from auto-registration
4
+ const ALWAYS_EXCLUDE_COMPONENTS = ['ToastManager', 'KTable', 'KModalFullscreen', 'KDropdownMenu'];
5
+ export default defineNuxtModule({
6
+ meta: {
7
+ name: '@kong/kongponents',
8
+ configKey: 'kongponents',
9
+ },
10
+ defaults: {
11
+ components: {
12
+ include: [],
13
+ exclude: [],
14
+ },
15
+ composables: true,
16
+ },
17
+ setup(options, nuxt) {
18
+ const { resolve } = createResolver(import.meta.url);
19
+ const logger = useLogger('kongponents');
20
+ // Register the styles
21
+ nuxt.options.css.push('@kong/kongponents/dist/style.css');
22
+ if (options.composables) {
23
+ // Register composables
24
+ addImportsDir(resolve('./runtime/composables'));
25
+ }
26
+ // Define a list of components that should be auto-registered.
27
+ const includeList = options.components?.include || [];
28
+ // Define a list of components that should never be auto-registered.
29
+ const excludeList = [...ALWAYS_EXCLUDE_COMPONENTS, ...(options.components?.exclude || [])];
30
+ const filteredComponents = Object.keys(components).filter((name) =>
31
+ // Only include components that start with 'K' (e.g., KButton)
32
+ name.startsWith('K')
33
+ // If an include list is provided, only keep those in the list
34
+ && (includeList.length === 0 || includeList.includes(name))
35
+ // Exclude any components explicitly listed in the exclude list
36
+ && !excludeList.includes(name));
37
+ if (filteredComponents.length === 0) {
38
+ logger.warn('⚠️ No Kongponents components were registered. Check your include/exclude config.');
39
+ }
40
+ filteredComponents.forEach((name) => {
41
+ addComponent({
42
+ name,
43
+ export: name,
44
+ filePath: '@kong/kongponents',
45
+ // we don't need global registration here
46
+ global: false,
47
+ // 'all' means both client and server
48
+ mode: 'all',
49
+ });
50
+ });
51
+ /**
52
+ * Integrate with Nuxt DevTools by adding a "Kongponents" tab.
53
+ * This gives quick access to documentation within the DevTools UI.
54
+ */
55
+ // @ts-ignore - nuxt types are missing devtools hook
56
+ nuxt.hook('devtools:customTabs', (tabs) => {
57
+ tabs.push({
58
+ name: 'kongponents',
59
+ title: 'Kongponents',
60
+ icon: 'https://kongponents.konghq.com/img/kong-logomark.png',
61
+ view: {
62
+ type: 'iframe',
63
+ src: 'https://kongponents.konghq.com',
64
+ },
65
+ });
66
+ });
67
+ logger.success('🚀 Kongponents module has been registered.');
68
+ },
69
+ });
@@ -0,0 +1,27 @@
1
+ import { onBeforeUnmount } from 'vue';
2
+ import { ToastManager } from '@kong/kongponents';
3
+ /** The default toaster configuration */
4
+ const defaultToastConfig = {
5
+ key: 'kongponents-toast',
6
+ appearance: 'success',
7
+ message: 'Success',
8
+ timeoutMilliseconds: 3000,
9
+ };
10
+ export function useToast() {
11
+ // Initialize the toast manager; stub out the `open` and `destroy` methods on the server
12
+ const toast = import.meta.client ? new ToastManager() : { open: () => { }, destroy: () => { } };
13
+ const showToast = async (notification) => {
14
+ if (import.meta.client) {
15
+ toast.open({
16
+ ...defaultToastConfig,
17
+ ...notification,
18
+ });
19
+ }
20
+ };
21
+ onBeforeUnmount(() => {
22
+ toast.destroy();
23
+ });
24
+ return {
25
+ showToast,
26
+ };
27
+ }
@@ -0,0 +1,25 @@
1
+ import { components } from '@kong/kongponents';
2
+ type ComponentKeys = keyof typeof components;
3
+ type ExcludedComponentKeys = Exclude<ComponentKeys, 'ToastManager' | 'KTable' | 'KModalFullscreen' | 'KDropdownMenu'>;
4
+ export interface ModuleOptions {
5
+ components?: {
6
+ /**
7
+ * List of component names to include in auto-registration. If unset or empty, all components will be included.
8
+ * @default []
9
+ */
10
+ include?: ComponentKeys[];
11
+ /**
12
+ * List of component names to exclude from automatic registration
13
+ * @default []
14
+ */
15
+ exclude?: ExcludedComponentKeys[];
16
+ };
17
+ /**
18
+ * Whether to register provided composables.
19
+ * For example, you can access the included `useToast` composable.
20
+ * @default true
21
+ */
22
+ composables?: boolean;
23
+ }
24
+ declare const _default: import("nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
25
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { Toast } from '@kong/kongponents';
2
+ export declare function useToast(): {
3
+ showToast: (notification: Partial<Toast>) => Promise<void>;
4
+ };
@@ -93,7 +93,7 @@ export type TableState = 'loading' | 'error' | 'success' | 'empty';
93
93
  export interface TableSortPayload<Key extends string = string> {
94
94
  prevKey: Key | '';
95
95
  sortColumnKey: Key | '';
96
- sortColumnOrder: SortColumnOrder | '';
96
+ sortColumnOrder: SortColumnOrder;
97
97
  }
98
98
  export interface TableStatePayload {
99
99
  state: TableState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong/kongponents",
3
- "version": "9.44.1-pr.2962.c6edd95.0",
3
+ "version": "9.45.1",
4
4
  "description": "Kong Component library",
5
5
  "type": "module",
6
6
  "repository": {
@@ -22,10 +22,42 @@
22
22
  "import": "./dist/kongponents.es.js",
23
23
  "require": "./dist/kongponents.umd.js"
24
24
  },
25
+ "./nuxt": {
26
+ "import": "./dist/nuxt/index.js",
27
+ "types": "./dist/types/nuxt/index.d.ts"
28
+ },
25
29
  "./dist/style.css": "./dist/kongponents.css",
26
30
  "./package.json": "./package.json",
27
31
  "./dist/*": "./dist/*"
28
32
  },
33
+ "scripts": {
34
+ "build:cli": "rimraf ./bin && tsc --project ./cli/tsconfig.json && chmod u+x ./bin/index.js",
35
+ "build:docs": "vitepress build docs",
36
+ "build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json' && pnpm build:nuxt",
37
+ "build:nuxt": "tsc -p ./tsconfig.build.nuxt.json --outDir dist/nuxt",
38
+ "build:visualize": "cross-env-shell BUILD_VISUALIZER=true vite build -m production",
39
+ "build": "pnpm build:cli && pnpm stylelint && pnpm lint && pnpm build:kongponents && pnpm build:docs",
40
+ "build:ci": "pnpm build:kongponents && pnpm build:docs",
41
+ "commit": "cz",
42
+ "create-kongponent": "node ./bin/index.js",
43
+ "sandbox:dev": "cross-env USE_SANDBOX=true vite",
44
+ "sandbox:build": "cross-env USE_SANDBOX=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
45
+ "sandbox:build:netlify": "cross-env USE_SANDBOX=true USE_NETLIFY=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
46
+ "sandbox:preview": "cross-env USE_SANDBOX=true vite preview",
47
+ "docs:build": "vitepress build docs",
48
+ "docs:dev": "vitepress dev docs",
49
+ "docs:serve": "vitepress serve docs",
50
+ "docs:preview": "vitepress preview docs --port 8080",
51
+ "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit",
52
+ "lint": "eslint",
53
+ "lint:fix": "eslint --fix",
54
+ "stylelint": "stylelint './src/**/*.{css,scss,sass,vue}'",
55
+ "stylelint:fix": "stylelint './src/**/*.{css,scss,sass,vue}' --fix",
56
+ "test": "cypress run --component -b chrome",
57
+ "test:open": "cypress open --component -b chrome",
58
+ "test:spec": "cypress run --component -b chrome --spec",
59
+ "semantic-release": "semantic-release"
60
+ },
29
61
  "dependencies": {
30
62
  "@floating-ui/vue": "^1.1.9",
31
63
  "@kong/icons": "^1.39.0",
@@ -44,7 +76,7 @@
44
76
  },
45
77
  "peerDependencies": {
46
78
  "vue": ">= 3.5.0 < 4",
47
- "vue-router": "^4.6.0"
79
+ "vue-router": "^4.6.3"
48
80
  },
49
81
  "devDependencies": {
50
82
  "@babel/types": "^7.28.4",
@@ -53,15 +85,16 @@
53
85
  "@cypress/vite-dev-server": "^6.0.3",
54
86
  "@digitalroute/cz-conventional-changelog-for-jira": "^8.0.1",
55
87
  "@evilmartians/lefthook": "^1.13.6",
56
- "@kong-ui-public/sandbox-layout": "^2.3.4",
88
+ "@kong-ui-public/sandbox-layout": "^2.3.6",
57
89
  "@kong/design-tokens": "^1.18.1",
58
90
  "@kong/eslint-config-kong-ui": "1.5.1",
91
+ "@nuxt/kit": "^4.1.3",
59
92
  "@semantic-release/changelog": "^6.0.3",
60
93
  "@semantic-release/git": "^10.0.1",
61
94
  "@stylistic/stylelint-plugin": "^4.0.0",
62
95
  "@types/inquirer": "^9.0.7",
63
96
  "@types/lodash-es": "^4.17.12",
64
- "@types/node": "^22.18.10",
97
+ "@types/node": "^22.18.11",
65
98
  "@types/sortablejs": "^1.15.8",
66
99
  "@vitejs/plugin-vue": "^5.2.4",
67
100
  "@vue/compiler-core": "^3.5.22",
@@ -79,12 +112,13 @@
79
112
  "inquirer": "^9.3.6",
80
113
  "nanospinner": "^1.2.2",
81
114
  "node-emoji": "^2.2.0",
115
+ "nuxt": "^4.1.3",
82
116
  "picocolors": "^1.1.1",
83
117
  "postcss-cli": "^11.0.1",
84
118
  "postcss-custom-properties": "^14.0.6",
85
119
  "postcss-html": "^1.8.0",
86
120
  "rimraf": "^6.0.1",
87
- "rollup-plugin-visualizer": "^6.0.4",
121
+ "rollup-plugin-visualizer": "^6.0.5",
88
122
  "sass": "^1.93.2",
89
123
  "semantic-release": "^24.2.9",
90
124
  "shiki": "^3.13.0",
@@ -96,11 +130,11 @@
96
130
  "stylelint-order": "^7.0.0",
97
131
  "tsc-alias": "^1.8.16",
98
132
  "typescript": "^5.9.3",
99
- "vite": "^6.3.6",
133
+ "vite": "^6.3.7",
100
134
  "vite-plugin-vue-devtools": "^7.7.7",
101
135
  "vitepress": "^1.6.4",
102
136
  "vue": "^3.5.22",
103
- "vue-router": "^4.6.0",
137
+ "vue-router": "^4.6.3",
104
138
  "vue-tsc": "^2.2.12"
105
139
  },
106
140
  "resolutions": {
@@ -160,9 +194,10 @@
160
194
  "node": ">=v16.20.2 || >=18.12.1 || >=20.14.0 || >=22.14.0",
161
195
  "pnpm": ">=9.11.0 || >=10.10.0"
162
196
  },
197
+ "packageManager": "pnpm@10.18.3",
163
198
  "volta": {
164
199
  "node": "24.10.0",
165
- "pnpm": "10.18.2"
200
+ "pnpm": "10.18.3"
166
201
  },
167
202
  "config": {
168
203
  "commitizen": {
@@ -173,32 +208,5 @@
173
208
  "jiraPrepend": "[",
174
209
  "jiraAppend": "]"
175
210
  }
176
- },
177
- "scripts": {
178
- "build:cli": "rimraf ./bin && tsc --project ./cli/tsconfig.json && chmod u+x ./bin/index.js",
179
- "build:docs": "vitepress build docs",
180
- "build:kongponents": "pnpm typecheck && vite build && vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly && tsc-alias -p './tsconfig.build.json'",
181
- "build:visualize": "cross-env-shell BUILD_VISUALIZER=true vite build -m production",
182
- "build": "pnpm build:cli && pnpm stylelint && pnpm lint && pnpm build:kongponents && pnpm build:docs",
183
- "build:ci": "pnpm build:kongponents && pnpm build:docs",
184
- "commit": "cz",
185
- "create-kongponent": "node ./bin/index.js",
186
- "sandbox:dev": "cross-env USE_SANDBOX=true vite",
187
- "sandbox:build": "cross-env USE_SANDBOX=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
188
- "sandbox:build:netlify": "cross-env USE_SANDBOX=true USE_NETLIFY=true vite build && shx cp sandbox/dist/index.html sandbox/dist/404.html",
189
- "sandbox:preview": "cross-env USE_SANDBOX=true vite preview",
190
- "docs:build": "vitepress build docs",
191
- "docs:dev": "vitepress dev docs",
192
- "docs:serve": "vitepress serve docs",
193
- "docs:preview": "vitepress preview docs --port 8080",
194
- "typecheck": "vue-tsc -p './tsconfig.build.json' --noEmit",
195
- "lint": "eslint",
196
- "lint:fix": "eslint --fix",
197
- "stylelint": "stylelint './src/**/*.{css,scss,sass,vue}'",
198
- "stylelint:fix": "stylelint './src/**/*.{css,scss,sass,vue}' --fix",
199
- "test": "cypress run --component -b chrome",
200
- "test:open": "cypress open --component -b chrome",
201
- "test:spec": "cypress run --component -b chrome --spec",
202
- "semantic-release": "semantic-release"
203
211
  }
204
- }
212
+ }