@dsn-starter-kit/core 2.0.0 → 3.1.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/dist/index.cjs ADDED
@@ -0,0 +1,57 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/classNames.ts
3
+ /**
4
+ * Combines class names conditionally
5
+ * Similar to the popular 'classnames' package
6
+ *
7
+ * @example
8
+ * classNames('btn', 'btn--primary') // 'btn btn--primary'
9
+ * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'
10
+ * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'
11
+ */
12
+ function classNames(...args) {
13
+ const classes = [];
14
+ args.forEach((arg) => {
15
+ if (!arg) return;
16
+ if (typeof arg === "string") classes.push(arg);
17
+ else if (typeof arg === "object") Object.entries(arg).forEach(([key, value]) => {
18
+ if (value) classes.push(key);
19
+ });
20
+ });
21
+ return classes.join(" ");
22
+ }
23
+ /**
24
+ * BEM (Block Element Modifier) class name helper
25
+ *
26
+ * @example
27
+ * bem('button') // 'button'
28
+ * bem('button', 'icon') // 'button__icon'
29
+ * bem('button', null, 'primary') // 'button--primary'
30
+ * bem('button', 'icon', 'large') // 'button__icon--large'
31
+ */
32
+ function bem(block, element, modifier) {
33
+ let className = block;
34
+ if (element) className += `__${element}`;
35
+ if (modifier) className += `--${modifier}`;
36
+ return className;
37
+ }
38
+ /**
39
+ * Generates BEM class names with multiple modifiers
40
+ *
41
+ * @example
42
+ * bemModifiers('button', ['primary', 'large'])
43
+ * // 'button button--primary button--large'
44
+ */
45
+ function bemModifiers(block, modifiers) {
46
+ const classes = [block];
47
+ modifiers.forEach((modifier) => {
48
+ if (modifier) classes.push(`${block}--${modifier}`);
49
+ });
50
+ return classes.join(" ");
51
+ }
52
+ //#endregion
53
+ exports.bem = bem;
54
+ exports.bemModifiers = bemModifiers;
55
+ exports.classNames = classNames;
56
+
57
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/utils/classNames.ts"],"sourcesContent":["/**\n * Combines class names conditionally\n * Similar to the popular 'classnames' package\n *\n * @example\n * classNames('btn', 'btn--primary') // 'btn btn--primary'\n * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'\n * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'\n */\nexport function classNames(\n ...args: (string | Record<string, boolean> | null | undefined | false)[]\n): string {\n const classes: string[] = [];\n\n args.forEach((arg) => {\n if (!arg) return;\n\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (typeof arg === 'object') {\n Object.entries(arg).forEach(([key, value]) => {\n if (value) {\n classes.push(key);\n }\n });\n }\n });\n\n return classes.join(' ');\n}\n\n/**\n * BEM (Block Element Modifier) class name helper\n *\n * @example\n * bem('button') // 'button'\n * bem('button', 'icon') // 'button__icon'\n * bem('button', null, 'primary') // 'button--primary'\n * bem('button', 'icon', 'large') // 'button__icon--large'\n */\nexport function bem(\n block: string,\n element?: string | null,\n modifier?: string | null\n): string {\n let className = block;\n\n if (element) {\n className += `__${element}`;\n }\n\n if (modifier) {\n className += `--${modifier}`;\n }\n\n return className;\n}\n\n/**\n * Generates BEM class names with multiple modifiers\n *\n * @example\n * bemModifiers('button', ['primary', 'large'])\n * // 'button button--primary button--large'\n */\nexport function bemModifiers(\n block: string,\n modifiers: (string | null | undefined | false)[]\n): string {\n const classes = [block];\n\n modifiers.forEach((modifier) => {\n if (modifier) {\n classes.push(`${block}--${modifier}`);\n }\n });\n\n return classes.join(' ');\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAgB,WACd,GAAG,MACK;CACR,MAAM,UAAoB,CAAC;CAE3B,KAAK,SAAS,QAAQ;EACpB,IAAI,CAAC,KAAK;EAEV,IAAI,OAAO,QAAQ,UACjB,QAAQ,KAAK,GAAG;OACX,IAAI,OAAO,QAAQ,UACxB,OAAO,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAC5C,IAAI,OACF,QAAQ,KAAK,GAAG;EAEpB,CAAC;CAEL,CAAC;CAED,OAAO,QAAQ,KAAK,GAAG;AACzB;;;;;;;;;;AAWA,SAAgB,IACd,OACA,SACA,UACQ;CACR,IAAI,YAAY;CAEhB,IAAI,SACF,aAAa,KAAK;CAGpB,IAAI,UACF,aAAa,KAAK;CAGpB,OAAO;AACT;;;;;;;;AASA,SAAgB,aACd,OACA,WACQ;CACR,MAAM,UAAU,CAAC,KAAK;CAEtB,UAAU,SAAS,aAAa;EAC9B,IAAI,UACF,QAAQ,KAAK,GAAG,MAAM,IAAI,UAAU;CAExC,CAAC;CAED,OAAO,QAAQ,KAAK,GAAG;AACzB"}
@@ -1,3 +1,4 @@
1
+ //#region src/utils/classNames.d.ts
1
2
  /**
2
3
  * Combines class names conditionally
3
4
  * Similar to the popular 'classnames' package
@@ -7,7 +8,7 @@
7
8
  * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'
8
9
  * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'
9
10
  */
10
- export declare function classNames(...args: (string | Record<string, boolean> | null | undefined | false)[]): string;
11
+ declare function classNames(...args: (string | Record<string, boolean> | null | undefined | false)[]): string;
11
12
  /**
12
13
  * BEM (Block Element Modifier) class name helper
13
14
  *
@@ -17,7 +18,7 @@ export declare function classNames(...args: (string | Record<string, boolean> |
17
18
  * bem('button', null, 'primary') // 'button--primary'
18
19
  * bem('button', 'icon', 'large') // 'button__icon--large'
19
20
  */
20
- export declare function bem(block: string, element?: string | null, modifier?: string | null): string;
21
+ declare function bem(block: string, element?: string | null, modifier?: string | null): string;
21
22
  /**
22
23
  * Generates BEM class names with multiple modifiers
23
24
  *
@@ -25,5 +26,17 @@ export declare function bem(block: string, element?: string | null, modifier?: s
25
26
  * bemModifiers('button', ['primary', 'large'])
26
27
  * // 'button button--primary button--large'
27
28
  */
28
- export declare function bemModifiers(block: string, modifiers: (string | null | undefined | false)[]): string;
29
- //# sourceMappingURL=classNames.d.ts.map
29
+ declare function bemModifiers(block: string, modifiers: (string | null | undefined | false)[]): string;
30
+ //#endregion
31
+ //#region src/types/form.d.ts
32
+ /**
33
+ * Form-related type definitions
34
+ */
35
+ /**
36
+ * Width variants for form controls (inputs, textareas, etc.)
37
+ * Based on design tokens: dsn.form-control.width.*
38
+ */
39
+ type FormControlWidth = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
40
+ //#endregion
41
+ export { type FormControlWidth, bem, bemModifiers, classNames };
42
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/utils/classNames.ts","../src/types/form.ts"],"mappings":";;;;;;;;;;iBASgB,cACX,gBAAgB;;;;;;;;;;iBA8BL,IACd,eACA,yBACA;;;;;;;;iBAsBc,aACd,eACA;;;;;;;;;;KC3DU"}
@@ -0,0 +1,42 @@
1
+ //#region src/utils/classNames.d.ts
2
+ /**
3
+ * Combines class names conditionally
4
+ * Similar to the popular 'classnames' package
5
+ *
6
+ * @example
7
+ * classNames('btn', 'btn--primary') // 'btn btn--primary'
8
+ * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'
9
+ * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'
10
+ */
11
+ declare function classNames(...args: (string | Record<string, boolean> | null | undefined | false)[]): string;
12
+ /**
13
+ * BEM (Block Element Modifier) class name helper
14
+ *
15
+ * @example
16
+ * bem('button') // 'button'
17
+ * bem('button', 'icon') // 'button__icon'
18
+ * bem('button', null, 'primary') // 'button--primary'
19
+ * bem('button', 'icon', 'large') // 'button__icon--large'
20
+ */
21
+ declare function bem(block: string, element?: string | null, modifier?: string | null): string;
22
+ /**
23
+ * Generates BEM class names with multiple modifiers
24
+ *
25
+ * @example
26
+ * bemModifiers('button', ['primary', 'large'])
27
+ * // 'button button--primary button--large'
28
+ */
29
+ declare function bemModifiers(block: string, modifiers: (string | null | undefined | false)[]): string;
30
+ //#endregion
31
+ //#region src/types/form.d.ts
32
+ /**
33
+ * Form-related type definitions
34
+ */
35
+ /**
36
+ * Width variants for form controls (inputs, textareas, etc.)
37
+ * Based on design tokens: dsn.form-control.width.*
38
+ */
39
+ type FormControlWidth = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
40
+ //#endregion
41
+ export { type FormControlWidth, bem, bemModifiers, classNames };
42
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils/classNames.ts","../src/types/form.ts"],"mappings":";;;;;;;;;;iBASgB,cACX,gBAAgB;;;;;;;;;;iBA8BL,IACd,eACA,yBACA;;;;;;;;iBAsBc,aACd,eACA;;;;;;;;;;KC3DU"}
package/dist/index.mjs ADDED
@@ -0,0 +1,54 @@
1
+ //#region src/utils/classNames.ts
2
+ /**
3
+ * Combines class names conditionally
4
+ * Similar to the popular 'classnames' package
5
+ *
6
+ * @example
7
+ * classNames('btn', 'btn--primary') // 'btn btn--primary'
8
+ * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'
9
+ * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'
10
+ */
11
+ function classNames(...args) {
12
+ const classes = [];
13
+ args.forEach((arg) => {
14
+ if (!arg) return;
15
+ if (typeof arg === "string") classes.push(arg);
16
+ else if (typeof arg === "object") Object.entries(arg).forEach(([key, value]) => {
17
+ if (value) classes.push(key);
18
+ });
19
+ });
20
+ return classes.join(" ");
21
+ }
22
+ /**
23
+ * BEM (Block Element Modifier) class name helper
24
+ *
25
+ * @example
26
+ * bem('button') // 'button'
27
+ * bem('button', 'icon') // 'button__icon'
28
+ * bem('button', null, 'primary') // 'button--primary'
29
+ * bem('button', 'icon', 'large') // 'button__icon--large'
30
+ */
31
+ function bem(block, element, modifier) {
32
+ let className = block;
33
+ if (element) className += `__${element}`;
34
+ if (modifier) className += `--${modifier}`;
35
+ return className;
36
+ }
37
+ /**
38
+ * Generates BEM class names with multiple modifiers
39
+ *
40
+ * @example
41
+ * bemModifiers('button', ['primary', 'large'])
42
+ * // 'button button--primary button--large'
43
+ */
44
+ function bemModifiers(block, modifiers) {
45
+ const classes = [block];
46
+ modifiers.forEach((modifier) => {
47
+ if (modifier) classes.push(`${block}--${modifier}`);
48
+ });
49
+ return classes.join(" ");
50
+ }
51
+ //#endregion
52
+ export { bem, bemModifiers, classNames };
53
+
54
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/classNames.ts"],"sourcesContent":["/**\n * Combines class names conditionally\n * Similar to the popular 'classnames' package\n *\n * @example\n * classNames('btn', 'btn--primary') // 'btn btn--primary'\n * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'\n * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'\n */\nexport function classNames(\n ...args: (string | Record<string, boolean> | null | undefined | false)[]\n): string {\n const classes: string[] = [];\n\n args.forEach((arg) => {\n if (!arg) return;\n\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (typeof arg === 'object') {\n Object.entries(arg).forEach(([key, value]) => {\n if (value) {\n classes.push(key);\n }\n });\n }\n });\n\n return classes.join(' ');\n}\n\n/**\n * BEM (Block Element Modifier) class name helper\n *\n * @example\n * bem('button') // 'button'\n * bem('button', 'icon') // 'button__icon'\n * bem('button', null, 'primary') // 'button--primary'\n * bem('button', 'icon', 'large') // 'button__icon--large'\n */\nexport function bem(\n block: string,\n element?: string | null,\n modifier?: string | null\n): string {\n let className = block;\n\n if (element) {\n className += `__${element}`;\n }\n\n if (modifier) {\n className += `--${modifier}`;\n }\n\n return className;\n}\n\n/**\n * Generates BEM class names with multiple modifiers\n *\n * @example\n * bemModifiers('button', ['primary', 'large'])\n * // 'button button--primary button--large'\n */\nexport function bemModifiers(\n block: string,\n modifiers: (string | null | undefined | false)[]\n): string {\n const classes = [block];\n\n modifiers.forEach((modifier) => {\n if (modifier) {\n classes.push(`${block}--${modifier}`);\n }\n });\n\n return classes.join(' ');\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,WACd,GAAG,MACK;CACR,MAAM,UAAoB,CAAC;CAE3B,KAAK,SAAS,QAAQ;EACpB,IAAI,CAAC,KAAK;EAEV,IAAI,OAAO,QAAQ,UACjB,QAAQ,KAAK,GAAG;OACX,IAAI,OAAO,QAAQ,UACxB,OAAO,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAC5C,IAAI,OACF,QAAQ,KAAK,GAAG;EAEpB,CAAC;CAEL,CAAC;CAED,OAAO,QAAQ,KAAK,GAAG;AACzB;;;;;;;;;;AAWA,SAAgB,IACd,OACA,SACA,UACQ;CACR,IAAI,YAAY;CAEhB,IAAI,SACF,aAAa,KAAK;CAGpB,IAAI,UACF,aAAa,KAAK;CAGpB,OAAO;AACT;;;;;;;;AASA,SAAgB,aACd,OACA,WACQ;CACR,MAAM,UAAU,CAAC,KAAK;CAEtB,UAAU,SAAS,aAAa;EAC9B,IAAI,UACF,QAAQ,KAAK,GAAG,MAAM,IAAI,UAAU;CAExC,CAAC;CAED,OAAO,QAAQ,KAAK,GAAG;AACzB"}
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "@dsn-starter-kit/core",
3
- "version": "2.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Core styles and utilities for the design system",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.mts",
7
9
  "style": "dist/core.css",
8
10
  "exports": {
9
11
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "default": "./dist/index.js"
12
+ "import": {
13
+ "types": "./dist/index.d.mts",
14
+ "default": "./dist/index.mjs"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
13
20
  },
14
- "./css": "./dist/core.css"
21
+ "./css": "./dist/core.css",
22
+ "./package.json": "./package.json"
15
23
  },
24
+ "sideEffects": false,
16
25
  "files": [
17
26
  "dist"
18
27
  ],
@@ -28,17 +37,18 @@
28
37
  "access": "public"
29
38
  },
30
39
  "dependencies": {
31
- "@dsn-starter-kit/design-tokens": "2.0.0"
40
+ "@dsn-starter-kit/design-tokens": "3.1.0"
32
41
  },
33
42
  "devDependencies": {
34
- "typescript": "^5.3.3"
43
+ "typescript": "^5.3.3",
44
+ "tsdown": "^0.22.14"
35
45
  },
36
46
  "scripts": {
37
- "build": "npm run build:css && npm run build:js",
47
+ "build": "npm run build:js && npm run build:css",
38
48
  "build:css": "mkdir -p dist && cat src/styles/reset.css src/styles/utilities.css > dist/core.css",
39
- "build:js": "tsc",
49
+ "build:js": "tsdown",
40
50
  "clean": "rm -rf dist",
41
51
  "type-check": "tsc --noEmit",
42
- "watch": "tsc --watch"
52
+ "watch": "tsdown --watch"
43
53
  }
44
54
  }
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @dsn-starter-kit/core
3
- * Core utilities and helpers for the design system
4
- */
5
- export { classNames, bem, bemModifiers } from './utils/classNames';
6
- export type { FormControlWidth } from './types/form';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * @dsn-starter-kit/core
3
- * Core utilities and helpers for the design system
4
- */
5
- export { classNames, bem, bemModifiers } from './utils/classNames';
6
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Form-related type definitions
3
- */
4
- /**
5
- * Width variants for form controls (inputs, textareas, etc.)
6
- * Based on design tokens: dsn.form-control.width.*
7
- */
8
- export type FormControlWidth = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
9
- //# sourceMappingURL=form.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/types/form.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Form-related type definitions
3
- */
4
- export {};
5
- //# sourceMappingURL=form.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/types/form.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"classNames.d.ts","sourceRoot":"","sources":["../../src/utils/classNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,EAAE,GACvE,MAAM,CAkBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GACvB,MAAM,CAYR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,EAAE,GAC/C,MAAM,CAUR"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Combines class names conditionally
3
- * Similar to the popular 'classnames' package
4
- *
5
- * @example
6
- * classNames('btn', 'btn--primary') // 'btn btn--primary'
7
- * classNames('btn', { 'btn--active': true, 'btn--disabled': false }) // 'btn btn--active'
8
- * classNames('btn', null, undefined, 'btn--large') // 'btn btn--large'
9
- */
10
- export function classNames(...args) {
11
- const classes = [];
12
- args.forEach((arg) => {
13
- if (!arg)
14
- return;
15
- if (typeof arg === 'string') {
16
- classes.push(arg);
17
- }
18
- else if (typeof arg === 'object') {
19
- Object.entries(arg).forEach(([key, value]) => {
20
- if (value) {
21
- classes.push(key);
22
- }
23
- });
24
- }
25
- });
26
- return classes.join(' ');
27
- }
28
- /**
29
- * BEM (Block Element Modifier) class name helper
30
- *
31
- * @example
32
- * bem('button') // 'button'
33
- * bem('button', 'icon') // 'button__icon'
34
- * bem('button', null, 'primary') // 'button--primary'
35
- * bem('button', 'icon', 'large') // 'button__icon--large'
36
- */
37
- export function bem(block, element, modifier) {
38
- let className = block;
39
- if (element) {
40
- className += `__${element}`;
41
- }
42
- if (modifier) {
43
- className += `--${modifier}`;
44
- }
45
- return className;
46
- }
47
- /**
48
- * Generates BEM class names with multiple modifiers
49
- *
50
- * @example
51
- * bemModifiers('button', ['primary', 'large'])
52
- * // 'button button--primary button--large'
53
- */
54
- export function bemModifiers(block, modifiers) {
55
- const classes = [block];
56
- modifiers.forEach((modifier) => {
57
- if (modifier) {
58
- classes.push(`${block}--${modifier}`);
59
- }
60
- });
61
- return classes.join(' ');
62
- }
63
- //# sourceMappingURL=classNames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classNames.js","sourceRoot":"","sources":["../../src/utils/classNames.ts"],"names":[],"mappings":"AAAA;;;;;;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AAK,QAAQ,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=classNames.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classNames.test.d.ts","sourceRoot":"","sources":["../../src/utils/classNames.test.ts"],"names":[],"mappings":""}
@@ -1,57 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { classNames, bem, bemModifiers } from './classNames';
3
- describe('classNames', () => {
4
- it('joins string arguments', () => {
5
- expect(classNames('a', 'b', 'c')).toBe('a b c');
6
- });
7
- it('filters out falsy values', () => {
8
- expect(classNames('a', null, undefined, false, 'b')).toBe('a b');
9
- });
10
- it('handles object arguments', () => {
11
- expect(classNames('btn', { 'btn--active': true, 'btn--disabled': false })).toBe('btn btn--active');
12
- });
13
- it('handles mixed arguments', () => {
14
- expect(classNames('btn', null, { 'btn--active': true }, 'extra')).toBe('btn btn--active extra');
15
- });
16
- it('returns empty string when no valid classes', () => {
17
- expect(classNames(null, undefined, false)).toBe('');
18
- });
19
- it('returns empty string when called with no arguments', () => {
20
- expect(classNames()).toBe('');
21
- });
22
- });
23
- describe('bem', () => {
24
- it('returns block name only', () => {
25
- expect(bem('button')).toBe('button');
26
- });
27
- it('returns block__element', () => {
28
- expect(bem('button', 'icon')).toBe('button__icon');
29
- });
30
- it('returns block--modifier', () => {
31
- expect(bem('button', null, 'primary')).toBe('button--primary');
32
- });
33
- it('returns block__element--modifier', () => {
34
- expect(bem('button', 'icon', 'large')).toBe('button__icon--large');
35
- });
36
- it('ignores null element', () => {
37
- expect(bem('button', null)).toBe('button');
38
- });
39
- it('ignores null modifier', () => {
40
- expect(bem('button', 'icon', null)).toBe('button__icon');
41
- });
42
- });
43
- describe('bemModifiers', () => {
44
- it('returns block with modifiers', () => {
45
- expect(bemModifiers('button', ['primary', 'large'])).toBe('button button--primary button--large');
46
- });
47
- it('filters out falsy modifiers', () => {
48
- expect(bemModifiers('button', ['primary', null, undefined, false, 'large'])).toBe('button button--primary button--large');
49
- });
50
- it('returns only block when no valid modifiers', () => {
51
- expect(bemModifiers('button', [null, undefined, false])).toBe('button');
52
- });
53
- it('returns only block when modifiers array is empty', () => {
54
- expect(bemModifiers('button', [])).toBe('button');
55
- });
56
- });
57
- //# sourceMappingURL=classNames.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classNames.test.js","sourceRoot":"","sources":["../../src/utils/classNames.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CACJ,UAAU,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CACnE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,UAAU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