diff --git a/build/package.json b/build/package.json index de93ee44..ac0f6d52 100644 --- a/build/package.json +++ b/build/package.json @@ -36,6 +36,7 @@ "devDependencies": { "@esbuild-kit/cjs-loader": "^2.4.2", "@pnpm/types": "^9.0.0", + "@rollup/plugin-json": "^6.1.0", "@types/rollup-plugin-css-only": "^3.1.0", "unbuild": "^1.2.0", "vue": "^3.2.47" diff --git a/build/src/tasks/full-bundle.ts b/build/src/tasks/full-bundle.ts index 5585316f..a4e62147 100644 --- a/build/src/tasks/full-bundle.ts +++ b/build/src/tasks/full-bundle.ts @@ -8,6 +8,7 @@ import esbuild from 'rollup-plugin-esbuild' import { parallel } from 'gulp' import glob from 'fast-glob' import { camelCase, upperFirst } from 'lodash-unified' +import json from '@rollup/plugin-json' import { version } from '../../../packages/puik/version' import { PuikAlias } from '../plugins/puik-alias' import { @@ -48,6 +49,7 @@ async function buildFullEntry(minify: boolean) { 'process.env.NODE_ENV': JSON.stringify('production'), }, }), + json(), ], external: await generateExternal({ full: true }), }) @@ -97,6 +99,7 @@ async function buildFullLocale(minify: boolean) { sourceMap: minify, target, }), + json(), ], }) await writeBundles(bundle, [ diff --git a/build/src/tasks/modules.ts b/build/src/tasks/modules.ts index 04eec298..b4dfcdac 100644 --- a/build/src/tasks/modules.ts +++ b/build/src/tasks/modules.ts @@ -5,6 +5,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' import esbuild from 'rollup-plugin-esbuild' import glob from 'fast-glob' +import json from '@rollup/plugin-json' import { puikRoot, pkgRoot, @@ -44,6 +45,7 @@ export const buildModules = async () => { '.vue': 'ts', }, }), + json(), ], external: await generateExternal({ full: false }), treeshake: false, diff --git a/packages/components/icon/src/icon.ts b/packages/components/icon/src/icon.ts index 008b7611..171fc2c8 100644 --- a/packages/components/icon/src/icon.ts +++ b/packages/components/icon/src/icon.ts @@ -26,6 +26,11 @@ export const iconProps = buildProps({ default: '#00000', required: false, }, + isDisabled: { + type: Boolean, + default: false, + required: false, + }, } as const) export type IconProps = ExtractPropTypes diff --git a/packages/components/icon/src/icon.vue b/packages/components/icon/src/icon.vue index b758ed5d..58c7407c 100644 --- a/packages/components/icon/src/icon.vue +++ b/packages/components/icon/src/icon.vue @@ -11,11 +11,15 @@ diff --git a/packages/components/icon/stories/icon.stories.ts b/packages/components/icon/stories/icon.stories.ts index 4aaffbb6..211b0c85 100644 --- a/packages/components/icon/stories/icon.stories.ts +++ b/packages/components/icon/stories/icon.stories.ts @@ -34,6 +34,12 @@ export default { dataTest: { description: 'Set the data-test attribute', }, + isDisabled: { + description: 'If the icon is disable', + control: { + type: 'boolean', + }, + }, }, } as Meta @@ -56,6 +62,7 @@ export const Default = { fontSize: 24, nodeType: 'span', dataTest: '', + isDisabled: false, }, parameters: { diff --git a/packages/components/icon/test/icon.spec.ts b/packages/components/icon/test/icon.spec.ts index 2c872007..0b91801c 100644 --- a/packages/components/icon/test/icon.spec.ts +++ b/packages/components/icon/test/icon.spec.ts @@ -33,6 +33,16 @@ describe('Icon tests', () => { expect(findIcon().text()).toBe('check') }) + it('should set the icon disabled', async () => { + factory({ + icon: 'check', + color: 'red', + isDisabled: true, + }) + + expect(findIcon().element.style.color).toBe('rgb(187, 187, 187)') + }) + it('should set the color', async () => { factory({ icon: 'check', @@ -74,3 +84,6 @@ describe('Icon tests', () => { expect(findIcon().attributes('data-test')).toBe('test') }) }) +function resolveConfig(tailwindConfig: any) { + throw new Error('Function not implemented.') +} diff --git a/packages/puik/tsconfig.json b/packages/puik/tsconfig.json new file mode 100644 index 00000000..68bb7381 --- /dev/null +++ b/packages/puik/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "moduleResolution": "NodeNext", + "module": "NodeNext" + } +} diff --git a/packages/tailwind-preset/index.js b/packages/tailwind-preset/index.js index 92607c49..23cb9fe3 100644 --- a/packages/tailwind-preset/index.js +++ b/packages/tailwind-preset/index.js @@ -1,6 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const Puiktheme = require('./theme') +// const Puiktheme = require('./theme') +import PuikTheme from './theme' -module.exports = { - theme: Puiktheme, +export default { + theme: PuikTheme, } diff --git a/packages/tailwind-preset/theme.js b/packages/tailwind-preset/theme.js index 61568df3..7ebe549b 100644 --- a/packages/tailwind-preset/theme.js +++ b/packages/tailwind-preset/theme.js @@ -1,4 +1,5 @@ -module.exports = { +/** @type {import('tailwindcss').Config} */ +export default { extend: { colors: { primary: { diff --git a/packages/theme/tailwind.config.js b/packages/theme/tailwind.config.js index 6576bfeb..22f4999e 100644 --- a/packages/theme/tailwind.config.js +++ b/packages/theme/tailwind.config.js @@ -1,6 +1,8 @@ +import tailwindConfig from '@puik/tailwind-preset' + /* eslint-disable @typescript-eslint/no-var-requires */ module.exports = { - presets: [require('@puik/tailwind-preset')], + presets: [tailwindConfig], content: ['./src/**/*.scss'], plugins: [require('tailwind-scrollbar')({ nocompatible: true })], darkMode: 'class', // To remove if we wanna use the css' prefers-color-scheme feature (dark mode based on OS/browser preference) diff --git a/packages/theme/tsconfig.json b/packages/theme/tsconfig.json deleted file mode 100644 index 2f980427..00000000 --- a/packages/theme/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "esModuleInterop": true - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 828a42b7..24e9ba59 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -250,6 +250,9 @@ importers: '@pnpm/types': specifier: ^9.0.0 version: 9.0.0 + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@3.20.2) '@types/rollup-plugin-css-only': specifier: ^3.1.0 version: 3.1.0 @@ -3469,16 +3472,16 @@ packages: magic-string: 0.27.0 rollup: 3.20.2 - /@rollup/plugin-json@6.0.0(rollup@3.20.2): - resolution: {integrity: sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==} + /@rollup/plugin-json@6.1.0(rollup@3.20.2): + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} engines: {node: '>=14.0.0'} peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0 + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 peerDependenciesMeta: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@3.20.2) + '@rollup/pluginutils': 5.1.0(rollup@3.20.2) rollup: 3.20.2 dev: true @@ -3527,6 +3530,21 @@ packages: picomatch: 2.3.1 rollup: 3.20.2 + /@rollup/pluginutils@5.1.0(rollup@3.20.2): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.1 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 3.20.2 + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -14560,7 +14578,7 @@ packages: dependencies: '@rollup/plugin-alias': 4.0.4(rollup@3.20.2) '@rollup/plugin-commonjs': 24.1.0(rollup@3.20.2) - '@rollup/plugin-json': 6.0.0(rollup@3.20.2) + '@rollup/plugin-json': 6.1.0(rollup@3.20.2) '@rollup/plugin-node-resolve': 15.0.2(rollup@3.20.2) '@rollup/plugin-replace': 5.0.2(rollup@3.20.2) '@rollup/pluginutils': 5.0.2(rollup@3.20.2)