@shohojdhara/atomix 0.4.0 → 0.4.2
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/atomix.css +0 -14
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +12 -19
- package/dist/charts.js +555 -359
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +98 -28
- package/dist/core.js +1082 -733
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +26 -21
- package/dist/forms.js +937 -350
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +14 -21
- package/dist/heavy.js +409 -256
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +518 -284
- package/dist/index.esm.js +1993 -1237
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1994 -1237
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
- package/scripts/atomix-cli.js +43 -1
- package/scripts/cli/__tests__/utils.test.js +6 -2
- package/scripts/cli/migration-tools.js +2 -2
- package/scripts/cli/theme-bridge.js +7 -9
- package/scripts/cli/utils.js +2 -1
- package/src/components/Accordion/Accordion.stories.tsx +40 -0
- package/src/components/Accordion/Accordion.tsx +174 -56
- package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
- package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
- package/src/components/AtomixGlass/README.md +5 -5
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +185 -65
- package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
- package/src/components/Breadcrumb/index.ts +2 -2
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/README.md +2 -2
- package/src/components/Callout/Callout.stories.tsx +166 -1011
- package/src/components/Callout/Callout.test.tsx +3 -3
- package/src/components/Callout/Callout.tsx +196 -84
- package/src/components/Callout/CalloutCompound.test.tsx +72 -0
- package/src/components/Callout/README.md +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Chart/Chart.tsx +5 -5
- package/src/components/Chart/TreemapChart.tsx +37 -29
- package/src/components/DatePicker/readme.md +3 -3
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +133 -20
- package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
- package/src/components/EdgePanel/EdgePanel.tsx +164 -112
- package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
- package/src/components/Form/Checkbox.stories.tsx +1 -1
- package/src/components/Form/Checkbox.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/Radio.stories.tsx +1 -1
- package/src/components/Form/Radio.tsx +1 -1
- package/src/components/Form/Select.stories.tsx +24 -1
- package/src/components/Form/Select.test.tsx +99 -0
- package/src/components/Form/Select.tsx +145 -94
- package/src/components/Form/SelectOption.tsx +88 -0
- package/src/components/Form/Textarea.stories.tsx +1 -1
- package/src/components/Form/Textarea.tsx +1 -1
- package/src/components/Hero/Hero.stories.tsx +39 -2
- package/src/components/Hero/Hero.test.tsx +142 -0
- package/src/components/Hero/Hero.tsx +143 -4
- package/src/components/List/List.test.tsx +62 -0
- package/src/components/List/List.tsx +16 -5
- package/src/components/List/ListItem.tsx +20 -0
- package/src/components/Messages/Messages.stories.tsx +1 -1
- package/src/components/Messages/Messages.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +66 -2
- package/src/components/Modal/Modal.tsx +115 -35
- package/src/components/Modal/ModalCompound.test.tsx +94 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +1 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
- package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Rating/Rating.stories.tsx +1 -1
- package/src/components/Rating/Rating.test.tsx +73 -0
- package/src/components/Rating/Rating.tsx +25 -37
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +125 -22
- package/src/components/Steps/StepsCompound.test.tsx +81 -0
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +198 -45
- package/src/components/Tabs/TabsCompound.test.tsx +64 -0
- package/src/components/Todo/Todo.tsx +0 -1
- package/src/components/Toggle/Toggle.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
- package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
- package/src/lib/composables/__tests__/useChart.test.ts +50 -0
- package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
- package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
- package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
- package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
- package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
- package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
- package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
- package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
- package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
- package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
- package/src/lib/composables/glass-styles.ts +302 -0
- package/src/lib/composables/index.ts +0 -8
- package/src/lib/composables/useAtomixGlass.ts +331 -537
- package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
- package/src/lib/composables/useBarChart.ts +1 -1
- package/src/lib/composables/useBreadcrumb.ts +6 -6
- package/src/lib/composables/useChart.ts +104 -21
- package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
- package/src/lib/composables/useSlider.ts +66 -34
- package/src/lib/theme/devtools/CLI.ts +2 -10
- package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
- package/src/lib/types/components.ts +21 -23
- package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
- package/src/lib/utils/__tests__/dom.test.ts +100 -0
- package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
- package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.accordion.scss +0 -2
- package/src/styles/06-components/_components.chart.scss +0 -1
- package/src/styles/06-components/_components.dropdown.scss +0 -1
- package/src/styles/06-components/_components.edge-panel.scss +0 -2
- package/src/styles/06-components/_components.photoviewer.scss +0 -1
- package/src/styles/06-components/_components.river.scss +0 -1
- package/src/styles/06-components/_components.slider.scss +0 -3
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { hasClass, addClass, removeClass, toggleClass } from '../dom';
|
|
3
|
+
|
|
4
|
+
describe('dom utils', () => {
|
|
5
|
+
let element: HTMLElement;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
element = document.createElement('div');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
describe('hasClass', () => {
|
|
12
|
+
it('should return true if element has class', () => {
|
|
13
|
+
element.className = 'test-class';
|
|
14
|
+
expect(hasClass(element, 'test-class')).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return false if element does not have class', () => {
|
|
18
|
+
element.className = 'other-class';
|
|
19
|
+
expect(hasClass(element, 'test-class')).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should return false if element has no classes', () => {
|
|
23
|
+
expect(hasClass(element, 'test-class')).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('addClass', () => {
|
|
28
|
+
it('should add class if not present', () => {
|
|
29
|
+
addClass(element, 'new-class');
|
|
30
|
+
expect(element.classList.contains('new-class')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should not add duplicate class', () => {
|
|
34
|
+
element.className = 'existing-class';
|
|
35
|
+
addClass(element, 'existing-class');
|
|
36
|
+
expect(element.className).toBe('existing-class');
|
|
37
|
+
expect(element.classList.length).toBe(1);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should preserve existing classes', () => {
|
|
41
|
+
element.className = 'existing-class';
|
|
42
|
+
addClass(element, 'new-class');
|
|
43
|
+
expect(element.classList.contains('existing-class')).toBe(true);
|
|
44
|
+
expect(element.classList.contains('new-class')).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('removeClass', () => {
|
|
49
|
+
it('should remove existing class', () => {
|
|
50
|
+
element.className = 'test-class';
|
|
51
|
+
removeClass(element, 'test-class');
|
|
52
|
+
expect(element.classList.contains('test-class')).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should do nothing if class does not exist', () => {
|
|
56
|
+
element.className = 'other-class';
|
|
57
|
+
removeClass(element, 'test-class');
|
|
58
|
+
expect(element.className).toBe('other-class');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should preserve other classes', () => {
|
|
62
|
+
element.className = 'keep-me remove-me';
|
|
63
|
+
removeClass(element, 'remove-me');
|
|
64
|
+
expect(element.classList.contains('keep-me')).toBe(true);
|
|
65
|
+
expect(element.classList.contains('remove-me')).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('toggleClass', () => {
|
|
70
|
+
it('should add class if not present', () => {
|
|
71
|
+
toggleClass(element, 'test-class');
|
|
72
|
+
expect(element.classList.contains('test-class')).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should remove class if present', () => {
|
|
76
|
+
element.className = 'test-class';
|
|
77
|
+
toggleClass(element, 'test-class');
|
|
78
|
+
expect(element.classList.contains('test-class')).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should add class if force is true', () => {
|
|
82
|
+
toggleClass(element, 'test-class', true);
|
|
83
|
+
expect(element.classList.contains('test-class')).toBe(true);
|
|
84
|
+
|
|
85
|
+
// Should stay added if already present
|
|
86
|
+
toggleClass(element, 'test-class', true);
|
|
87
|
+
expect(element.classList.contains('test-class')).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should remove class if force is false', () => {
|
|
91
|
+
element.className = 'test-class';
|
|
92
|
+
toggleClass(element, 'test-class', false);
|
|
93
|
+
expect(element.classList.contains('test-class')).toBe(false);
|
|
94
|
+
|
|
95
|
+
// Should stay removed if not present
|
|
96
|
+
toggleClass(element, 'test-class', false);
|
|
97
|
+
expect(element.classList.contains('test-class')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
createFontPreloadLink,
|
|
4
|
+
preloadFonts,
|
|
5
|
+
generateFontPreloadTags,
|
|
6
|
+
type FontPreloadConfig,
|
|
7
|
+
} from '../fontPreloader';
|
|
8
|
+
|
|
9
|
+
describe('fontPreloader', () => {
|
|
10
|
+
describe('createFontPreloadLink', () => {
|
|
11
|
+
it('should create a link element with correct attributes', () => {
|
|
12
|
+
const config: FontPreloadConfig = {
|
|
13
|
+
family: 'Test Font',
|
|
14
|
+
path: '/fonts/test.woff2',
|
|
15
|
+
weight: 400,
|
|
16
|
+
style: 'normal',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const link = createFontPreloadLink(config);
|
|
20
|
+
|
|
21
|
+
expect(link).toBeInstanceOf(HTMLLinkElement);
|
|
22
|
+
expect(link.rel).toBe('preload');
|
|
23
|
+
expect(link.as).toBe('font');
|
|
24
|
+
expect(link.href).toContain('/fonts/test.woff2');
|
|
25
|
+
expect(link.type).toBe('font/woff2');
|
|
26
|
+
expect(link.crossOrigin).toBe('anonymous');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should use default values for optional properties', () => {
|
|
30
|
+
const config: FontPreloadConfig = {
|
|
31
|
+
family: 'Test Font',
|
|
32
|
+
path: '/fonts/test.woff2',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const link = createFontPreloadLink(config);
|
|
36
|
+
|
|
37
|
+
expect(link.type).toBe('font/woff2');
|
|
38
|
+
expect(link.crossOrigin).toBe('anonymous');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should respect custom format and crossorigin', () => {
|
|
42
|
+
const config: FontPreloadConfig = {
|
|
43
|
+
family: 'Test Font',
|
|
44
|
+
path: '/fonts/test.woff',
|
|
45
|
+
format: 'woff',
|
|
46
|
+
crossorigin: 'use-credentials',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const link = createFontPreloadLink(config);
|
|
50
|
+
|
|
51
|
+
expect(link.type).toBe('font/woff');
|
|
52
|
+
expect(link.crossOrigin).toBe('use-credentials');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('preloadFonts', () => {
|
|
57
|
+
it('should create multiple link elements', () => {
|
|
58
|
+
const configs: FontPreloadConfig[] = [
|
|
59
|
+
{ family: 'Font 1', path: '/f1.woff2' },
|
|
60
|
+
{ family: 'Font 2', path: '/f2.woff2' },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const links = preloadFonts(configs);
|
|
64
|
+
|
|
65
|
+
expect(links).toHaveLength(2);
|
|
66
|
+
expect(links[0]).toBeInstanceOf(HTMLLinkElement);
|
|
67
|
+
expect(links[1]).toBeInstanceOf(HTMLLinkElement);
|
|
68
|
+
expect(links[0].href).toContain('/f1.woff2');
|
|
69
|
+
expect(links[1].href).toContain('/f2.woff2');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('generateFontPreloadTags', () => {
|
|
74
|
+
it('should generate HTML strings for preload links', () => {
|
|
75
|
+
const configs: FontPreloadConfig[] = [
|
|
76
|
+
{ family: 'Font 1', path: '/f1.woff2' },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const tags = generateFontPreloadTags(configs);
|
|
80
|
+
|
|
81
|
+
expect(tags).toHaveLength(1);
|
|
82
|
+
expect(tags[0]).toContain('<link rel="preload" as="font"');
|
|
83
|
+
expect(tags[0]).toContain('href="/f1.woff2"');
|
|
84
|
+
expect(tags[0]).toContain('type="font/woff2"');
|
|
85
|
+
expect(tags[0]).toContain('crossorigin="anonymous"');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should handle multiple configurations', () => {
|
|
89
|
+
const configs: FontPreloadConfig[] = [
|
|
90
|
+
{ family: 'Font 1', path: '/f1.woff2' },
|
|
91
|
+
{ family: 'Font 2', path: '/f2.woff', format: 'woff' },
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const tags = generateFontPreloadTags(configs);
|
|
95
|
+
|
|
96
|
+
expect(tags).toHaveLength(2);
|
|
97
|
+
expect(tags[0]).toContain('href="/f1.woff2"');
|
|
98
|
+
expect(tags[1]).toContain('href="/f2.woff"');
|
|
99
|
+
expect(tags[1]).toContain('type="font/woff"');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
+
import { ThemeNaming } from '../themeNaming';
|
|
3
|
+
|
|
4
|
+
describe('ThemeNaming', () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
// Reset prefix to default after each test
|
|
7
|
+
ThemeNaming.setPrefix('atomix');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
describe('setPrefix / getPrefix', () => {
|
|
11
|
+
it('should have default prefix "atomix"', () => {
|
|
12
|
+
expect(ThemeNaming.getPrefix()).toBe('atomix');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should update prefix', () => {
|
|
16
|
+
ThemeNaming.setPrefix('custom');
|
|
17
|
+
expect(ThemeNaming.getPrefix()).toBe('custom');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('camelToKebab', () => {
|
|
22
|
+
it('should convert camelCase to kebab-case', () => {
|
|
23
|
+
expect(ThemeNaming.camelToKebab('camelCase')).toBe('camel-case');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should handle PascalCase', () => {
|
|
27
|
+
expect(ThemeNaming.camelToKebab('PascalCase')).toBe('pascal-case');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should handle simple strings', () => {
|
|
31
|
+
expect(ThemeNaming.camelToKebab('simple')).toBe('simple');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should handle empty string', () => {
|
|
35
|
+
expect(ThemeNaming.camelToKebab('')).toBe('');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('kebabToCamel', () => {
|
|
40
|
+
it('should convert kebab-case to camelCase', () => {
|
|
41
|
+
expect(ThemeNaming.kebabToCamel('kebab-case')).toBe('kebabCase');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should handle simple strings', () => {
|
|
45
|
+
expect(ThemeNaming.kebabToCamel('simple')).toBe('simple');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should handle empty string', () => {
|
|
49
|
+
expect(ThemeNaming.kebabToCamel('')).toBe('');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('cssVar', () => {
|
|
54
|
+
it('should create CSS variable with default prefix', () => {
|
|
55
|
+
expect(ThemeNaming.cssVar('tokenName')).toBe('--atomix-token-name');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should create CSS variable with custom prefix', () => {
|
|
59
|
+
ThemeNaming.setPrefix('custom');
|
|
60
|
+
expect(ThemeNaming.cssVar('tokenName')).toBe('--custom-token-name');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('bemClass', () => {
|
|
65
|
+
it('should create block class', () => {
|
|
66
|
+
expect(ThemeNaming.bemClass('block')).toBe('c-block');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should create block element class', () => {
|
|
70
|
+
expect(ThemeNaming.bemClass('block', 'element')).toBe('c-block__element');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should create block modifier class', () => {
|
|
74
|
+
expect(ThemeNaming.bemClass('block', undefined, 'mod')).toBe('c-block--mod');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should create block element modifier class', () => {
|
|
78
|
+
expect(ThemeNaming.bemClass('block', 'element', 'mod')).toBe('c-block__element--mod');
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('variantClass', () => {
|
|
83
|
+
it('should create variant class', () => {
|
|
84
|
+
expect(ThemeNaming.variantClass('button', 'primary')).toBe('c-button--primary');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('sizeClass', () => {
|
|
89
|
+
it('should create size class', () => {
|
|
90
|
+
expect(ThemeNaming.sizeClass('button', 'lg')).toBe('c-button--lg');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('stateClass', () => {
|
|
95
|
+
it('should create state class', () => {
|
|
96
|
+
expect(ThemeNaming.stateClass('input', 'disabled')).toBe('c-input--disabled');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('utilityClass', () => {
|
|
101
|
+
it('should create utility class', () => {
|
|
102
|
+
expect(ThemeNaming.utilityClass('flex')).toBe('u-flex');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('layoutClass', () => {
|
|
107
|
+
it('should create layout class', () => {
|
|
108
|
+
expect(ThemeNaming.layoutClass('grid')).toBe('l-grid');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('objectClass', () => {
|
|
113
|
+
it('should create object class', () => {
|
|
114
|
+
expect(ThemeNaming.objectClass('container')).toBe('o-container');
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -28,7 +28,7 @@ export class ThemeNaming {
|
|
|
28
28
|
* @param str - String to convert
|
|
29
29
|
*/
|
|
30
30
|
static camelToKebab(str: string): string {
|
|
31
|
-
return str.replace(/([a-z0-9]
|
|
31
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
&__icon {
|
|
84
84
|
color: var(--#{config.$prefix}accordion-icon-color);
|
|
85
85
|
font-size: var(--#{config.$prefix}accordion-icon-size);
|
|
86
|
-
will-change: transform;
|
|
87
86
|
flex-shrink: 0;
|
|
88
87
|
display: inline-flex;
|
|
89
88
|
align-items: center;
|
|
@@ -95,7 +94,6 @@
|
|
|
95
94
|
&__panel {
|
|
96
95
|
height: var(--panel-height);
|
|
97
96
|
overflow: hidden;
|
|
98
|
-
will-change: height;
|
|
99
97
|
|
|
100
98
|
@if accordion.$accordion-enable-smooth-scroll {
|
|
101
99
|
scroll-behavior: smooth;
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
opacity: 0;
|
|
40
40
|
z-index: map.get($z-layers, 1);
|
|
41
41
|
transition: opacity var(--#{$prefix}edge-panel-animation-duration) ease;
|
|
42
|
-
will-change: opacity;
|
|
43
42
|
|
|
44
43
|
&.is-animating {
|
|
45
44
|
animation: fadeIn 0.3s ease forwards;
|
|
@@ -62,7 +61,6 @@
|
|
|
62
61
|
overflow: hidden;
|
|
63
62
|
display: flex;
|
|
64
63
|
flex-direction: column;
|
|
65
|
-
will-change: transform, opacity;
|
|
66
64
|
|
|
67
65
|
&.is-animating {
|
|
68
66
|
animation: slideIn var(--#{$prefix}edge-panel-animation-duration)
|
|
@@ -43,8 +43,6 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.c-slider__wrapper {
|
|
46
|
-
will-change: transform;
|
|
47
|
-
|
|
48
46
|
&.transitioning {
|
|
49
47
|
transition: transform var(--#{config.$prefix}slider-speed)
|
|
50
48
|
var(--#{config.$prefix}slider-easing);
|
|
@@ -85,7 +83,6 @@
|
|
|
85
83
|
z-index: slider.$slider-z-index-base;
|
|
86
84
|
display: flex;
|
|
87
85
|
box-sizing: content-box;
|
|
88
|
-
will-change: transform;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
.c-slider__slide {
|