@udixio/ui-react 2.10.13 → 2.10.15
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/package.json +4 -2
- package/.eslintrc.mjs +0 -22
- package/.storybook/main.ts +0 -20
- package/.storybook/preview.ts +0 -1
- package/CHANGELOG.md +0 -1144
- package/postcss.config.mjs +0 -5
- package/src/index.css +0 -4
- package/src/index.ts +0 -1
- package/src/lib/components/AnchorPositioner.tsx +0 -185
- package/src/lib/components/Button.tsx +0 -208
- package/src/lib/components/Card.tsx +0 -47
- package/src/lib/components/Carousel.tsx +0 -437
- package/src/lib/components/CarouselItem.tsx +0 -61
- package/src/lib/components/Checkbox.tsx +0 -120
- package/src/lib/components/Chip.tsx +0 -341
- package/src/lib/components/Chips.tsx +0 -331
- package/src/lib/components/ContextMenu.tsx +0 -109
- package/src/lib/components/DatePicker.tsx +0 -432
- package/src/lib/components/Divider.tsx +0 -20
- package/src/lib/components/Fab.tsx +0 -127
- package/src/lib/components/FabMenu.tsx +0 -239
- package/src/lib/components/IconButton.tsx +0 -146
- package/src/lib/components/Menu.tsx +0 -88
- package/src/lib/components/MenuGroup.tsx +0 -34
- package/src/lib/components/MenuHeadline.tsx +0 -9
- package/src/lib/components/MenuItem.tsx +0 -215
- package/src/lib/components/NavigationRail.tsx +0 -186
- package/src/lib/components/NavigationRailItem.tsx +0 -227
- package/src/lib/components/ProgressIndicator.tsx +0 -214
- package/src/lib/components/SideSheet.tsx +0 -135
- package/src/lib/components/Slider.tsx +0 -374
- package/src/lib/components/Snackbar.tsx +0 -77
- package/src/lib/components/Switch.tsx +0 -107
- package/src/lib/components/Tab.tsx +0 -123
- package/src/lib/components/TabGroup.tsx +0 -66
- package/src/lib/components/TabGroupContext.tsx +0 -16
- package/src/lib/components/TabPanel.tsx +0 -27
- package/src/lib/components/TabPanels.tsx +0 -76
- package/src/lib/components/Tabs.tsx +0 -105
- package/src/lib/components/TextField.tsx +0 -586
- package/src/lib/components/Tooltip.tsx +0 -217
- package/src/lib/components/index.ts +0 -34
- package/src/lib/config/config.interface.ts +0 -9
- package/src/lib/config/define-config.ts +0 -16
- package/src/lib/config/index.ts +0 -2
- package/src/lib/effects/AnimateOnScroll.ts +0 -391
- package/src/lib/effects/State.tsx +0 -90
- package/src/lib/effects/SyncedFixedWrapper.tsx +0 -62
- package/src/lib/effects/ThemeProvider.tsx +0 -174
- package/src/lib/effects/block-scroll.effect.tsx +0 -313
- package/src/lib/effects/custom-scroll/custom-scroll.effect.tsx +0 -407
- package/src/lib/effects/custom-scroll/custom-scroll.interface.ts +0 -29
- package/src/lib/effects/custom-scroll/custom-scroll.style.ts +0 -32
- package/src/lib/effects/custom-scroll/index.ts +0 -3
- package/src/lib/effects/index.ts +0 -7
- package/src/lib/effects/ripple/RippleEffect.tsx +0 -116
- package/src/lib/effects/ripple/index.tsx +0 -1
- package/src/lib/effects/scrollDriven.ts +0 -239
- package/src/lib/effects/smooth-scroll.effect.tsx +0 -112
- package/src/lib/effects/theme.worker.ts +0 -97
- package/src/lib/hooks/index.ts +0 -10
- package/src/lib/hooks/useTooltipTrigger.ts +0 -270
- package/src/lib/icon/icon.tsx +0 -125
- package/src/lib/icon/index.ts +0 -1
- package/src/lib/index.ts +0 -8
- package/src/lib/interfaces/button.interface.ts +0 -65
- package/src/lib/interfaces/card.interface.ts +0 -11
- package/src/lib/interfaces/carousel-item.interface.ts +0 -12
- package/src/lib/interfaces/carousel.interface.ts +0 -41
- package/src/lib/interfaces/checkbox.interface.ts +0 -39
- package/src/lib/interfaces/chip.interface.ts +0 -97
- package/src/lib/interfaces/chips.interface.ts +0 -37
- package/src/lib/interfaces/date-picker.interface.ts +0 -79
- package/src/lib/interfaces/divider.interface.ts +0 -7
- package/src/lib/interfaces/fab-menu.interface.ts +0 -12
- package/src/lib/interfaces/fab.interface.ts +0 -27
- package/src/lib/interfaces/icon-button.interface.ts +0 -38
- package/src/lib/interfaces/index.ts +0 -26
- package/src/lib/interfaces/menu-group.interface.ts +0 -13
- package/src/lib/interfaces/menu-item.interface.ts +0 -29
- package/src/lib/interfaces/menu.interface.ts +0 -19
- package/src/lib/interfaces/navigation-rail-item.interface.ts +0 -39
- package/src/lib/interfaces/navigation-rail.interface.ts +0 -39
- package/src/lib/interfaces/progress-indicator.interface.ts +0 -41
- package/src/lib/interfaces/side-sheet.interface.tsx +0 -28
- package/src/lib/interfaces/slider.interface.ts +0 -27
- package/src/lib/interfaces/snackbar.interface.ts +0 -13
- package/src/lib/interfaces/switch.interface.ts +0 -14
- package/src/lib/interfaces/tab-group.interface.ts +0 -13
- package/src/lib/interfaces/tab-panels.interface.ts +0 -21
- package/src/lib/interfaces/tab.interface.ts +0 -31
- package/src/lib/interfaces/tabs.interface.ts +0 -22
- package/src/lib/interfaces/text-field.interface.ts +0 -61
- package/src/lib/interfaces/tooltip.interface.ts +0 -61
- package/src/lib/styles/button.style.ts +0 -136
- package/src/lib/styles/card.style.ts +0 -29
- package/src/lib/styles/carousel-item.style.ts +0 -24
- package/src/lib/styles/carousel.style.ts +0 -22
- package/src/lib/styles/checkbox.style.ts +0 -64
- package/src/lib/styles/chip.style.ts +0 -62
- package/src/lib/styles/chips.style.ts +0 -20
- package/src/lib/styles/date-picker.style.ts +0 -43
- package/src/lib/styles/divider.style.ts +0 -31
- package/src/lib/styles/fab-menu.style.ts +0 -29
- package/src/lib/styles/fab.style.ts +0 -49
- package/src/lib/styles/icon-button.style.ts +0 -168
- package/src/lib/styles/index.ts +0 -25
- package/src/lib/styles/menu-group.style.ts +0 -34
- package/src/lib/styles/menu-headline.style.ts +0 -20
- package/src/lib/styles/menu-item.style.ts +0 -45
- package/src/lib/styles/menu.style.ts +0 -32
- package/src/lib/styles/navigation-rail-item.style.ts +0 -56
- package/src/lib/styles/navigation-rail.style.ts +0 -36
- package/src/lib/styles/progress-indicator.style.ts +0 -72
- package/src/lib/styles/side-sheet.style.ts +0 -45
- package/src/lib/styles/slider.style.ts +0 -41
- package/src/lib/styles/snackbar.style.ts +0 -26
- package/src/lib/styles/switch.style.ts +0 -67
- package/src/lib/styles/tab-panels.style.ts +0 -35
- package/src/lib/styles/tab.style.ts +0 -78
- package/src/lib/styles/tabs.style.ts +0 -22
- package/src/lib/styles/text-field.style.ts +0 -115
- package/src/lib/styles/tooltip.style.ts +0 -48
- package/src/lib/utils/component-helper.ts +0 -134
- package/src/lib/utils/component.ts +0 -34
- package/src/lib/utils/index.ts +0 -7
- package/src/lib/utils/string.ts +0 -9
- package/src/lib/utils/styles/classnames.ts +0 -49
- package/src/lib/utils/styles/get-classname.ts +0 -96
- package/src/lib/utils/styles/index.ts +0 -4
- package/src/lib/utils/styles/use-classnames.ts +0 -25
- package/src/stories/action/button.stories.tsx +0 -86
- package/src/stories/action/fab.stories.tsx +0 -54
- package/src/stories/action/icon-button.stories.tsx +0 -134
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/communication/ProgressIndicator.stories.tsx +0 -57
- package/src/stories/communication/SnackBar.stories.tsx +0 -32
- package/src/stories/communication/tool-tip.stories.tsx +0 -133
- package/src/stories/containment/card.stories.tsx +0 -42
- package/src/stories/containment/carousel.stories.tsx +0 -65
- package/src/stories/containment/divider.stories.tsx +0 -35
- package/src/stories/containment/slide-sheet.stories.tsx +0 -45
- package/src/stories/effect/smooth-scroll.stories.tsx +0 -54
- package/src/stories/navigation/navigation-rail/navigation-rail-item.stories.tsx +0 -65
- package/src/stories/navigation/navigation-rail/navigation-rail.stories.tsx +0 -122
- package/src/stories/navigation/tabs/tab.stories.tsx +0 -57
- package/src/stories/navigation/tabs/tabs.stories.tsx +0 -102
- package/src/stories/selection/slider.stories.tsx +0 -85
- package/src/stories/selection/switch.stories.tsx +0 -46
- package/src/stories/text-inputs/text-field.stories.tsx +0 -135
- package/src/tests/Button.spec.tsx +0 -67
- package/src/tests/useClassNames.spec.tsx +0 -82
- package/src/udixio.css +0 -120
- package/theme.config.ts +0 -7
- package/tsconfig.json +0 -16
- package/tsconfig.lib.json +0 -51
- package/tsconfig.spec.json +0 -37
- package/tsconfig.storybook.json +0 -38
- package/vite.config.ts +0 -96
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
import {
|
|
6
|
-
faCircleXmark,
|
|
7
|
-
faMagnifyingGlass,
|
|
8
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
9
|
-
import {
|
|
10
|
-
IconButton,
|
|
11
|
-
ReactProps,
|
|
12
|
-
TextField,
|
|
13
|
-
TextFieldInterface,
|
|
14
|
-
TextFieldVariant,
|
|
15
|
-
} from '../../';
|
|
16
|
-
|
|
17
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
18
|
-
const meta = {
|
|
19
|
-
title: 'Text Inputs/TextField',
|
|
20
|
-
component: TextField,
|
|
21
|
-
parameters: {
|
|
22
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
23
|
-
},
|
|
24
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
25
|
-
tags: ['autodocs'],
|
|
26
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
27
|
-
argTypes: {},
|
|
28
|
-
} satisfies Meta<typeof TextField>;
|
|
29
|
-
|
|
30
|
-
export default meta;
|
|
31
|
-
type Story = StoryObj<typeof meta>;
|
|
32
|
-
|
|
33
|
-
// Function to create TextField stories
|
|
34
|
-
const createTextFieldStory = (
|
|
35
|
-
variant: TextFieldVariant,
|
|
36
|
-
args?: Partial<ReactProps<TextFieldInterface>>,
|
|
37
|
-
) => {
|
|
38
|
-
const TextFieldStory: Story = (args: ReactProps<TextFieldInterface>) => (
|
|
39
|
-
<div className="">
|
|
40
|
-
<div className="flex m-4 gap-4 items-center">
|
|
41
|
-
<TextField {...args} name={'example' + uuidv4()} value="Input" />
|
|
42
|
-
<TextField
|
|
43
|
-
{...args}
|
|
44
|
-
name={'example' + uuidv4()}
|
|
45
|
-
value="Input"
|
|
46
|
-
errorText="invalid value"
|
|
47
|
-
/>
|
|
48
|
-
<TextField
|
|
49
|
-
{...args}
|
|
50
|
-
name={'example' + uuidv4()}
|
|
51
|
-
value="Input"
|
|
52
|
-
disabled
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
<div className="flex m-4 gap-4 items-center">
|
|
56
|
-
<TextField {...args} name={'example' + uuidv4()} />
|
|
57
|
-
<TextField
|
|
58
|
-
{...args}
|
|
59
|
-
name={'example' + uuidv4()}
|
|
60
|
-
errorText="invalid value"
|
|
61
|
-
/>
|
|
62
|
-
<TextField {...args} name={'example' + uuidv4()} disabled />
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
TextFieldStory.args = {
|
|
67
|
-
variant: variant,
|
|
68
|
-
label: 'Label',
|
|
69
|
-
placeholder: 'Placeholder',
|
|
70
|
-
supportingText: 'Supporting text',
|
|
71
|
-
...args,
|
|
72
|
-
};
|
|
73
|
-
return TextFieldStory;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const Filled = createTextFieldStory('filled');
|
|
77
|
-
|
|
78
|
-
export const FilledTrailingIcon = createTextFieldStory('filled', {
|
|
79
|
-
trailingIcon: (
|
|
80
|
-
<IconButton
|
|
81
|
-
onClick={() => console.log('clicked')}
|
|
82
|
-
arialLabel="Action description"
|
|
83
|
-
icon={faCircleXmark}
|
|
84
|
-
/>
|
|
85
|
-
),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export const FilledLealingIconAndTrailingIcon = createTextFieldStory('filled', {
|
|
89
|
-
leadingIcon: faMagnifyingGlass,
|
|
90
|
-
trailingIcon: (
|
|
91
|
-
<IconButton
|
|
92
|
-
onClick={() => console.log('clicked')}
|
|
93
|
-
arialLabel="Action description"
|
|
94
|
-
icon={faCircleXmark}
|
|
95
|
-
/>
|
|
96
|
-
),
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
export const FilledLealingIcon = createTextFieldStory('filled', {
|
|
100
|
-
leadingIcon: faMagnifyingGlass,
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
export const Outlined = createTextFieldStory('outlined');
|
|
104
|
-
|
|
105
|
-
export const OutlinedTrailingIcon = createTextFieldStory('outlined', {
|
|
106
|
-
trailingIcon: (
|
|
107
|
-
<IconButton
|
|
108
|
-
onClick={() => console.log('clicked')}
|
|
109
|
-
arialLabel="Action description"
|
|
110
|
-
icon={faCircleXmark}
|
|
111
|
-
/>
|
|
112
|
-
),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export const OutlinedLealingIconAndTrailingIcon = createTextFieldStory(
|
|
116
|
-
'outlined',
|
|
117
|
-
{
|
|
118
|
-
leadingIcon: faMagnifyingGlass,
|
|
119
|
-
trailingIcon: (
|
|
120
|
-
<IconButton
|
|
121
|
-
onClick={() => console.log('clicked')}
|
|
122
|
-
arialLabel="Action description"
|
|
123
|
-
icon={faCircleXmark}
|
|
124
|
-
/>
|
|
125
|
-
),
|
|
126
|
-
},
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
export const OutlinedLealingIcon = createTextFieldStory('outlined', {
|
|
130
|
-
leadingIcon: faMagnifyingGlass,
|
|
131
|
-
className: () => ({
|
|
132
|
-
textField: 'w-full md:w-fit md:flex-1 ',
|
|
133
|
-
content: 'rounded-full overflow-hidden bg-surface',
|
|
134
|
-
}),
|
|
135
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
-
import { Button } from '../lib/index.js';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import { vi } from 'vitest';
|
|
6
|
-
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
-
|
|
8
|
-
describe('Button', () => {
|
|
9
|
-
it('renders correctly with default props', () => {
|
|
10
|
-
render(<Button label="Test Button" />);
|
|
11
|
-
|
|
12
|
-
const button = screen.getByText('Test Button');
|
|
13
|
-
expect(button).toBeInTheDocument();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('disables the button when disabled prop is true', () => {
|
|
17
|
-
render(<Button label="Test Button" disabled />);
|
|
18
|
-
|
|
19
|
-
const button = screen.getByText('Test Button').closest('button');
|
|
20
|
-
expect(button).toBeDisabled();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('calls onClick handler when clicked', () => {
|
|
24
|
-
const handleClick = vi.fn();
|
|
25
|
-
render(<Button label="Test Button" onClick={handleClick} />);
|
|
26
|
-
|
|
27
|
-
const button = screen.getByText('Test Button');
|
|
28
|
-
fireEvent.click(button);
|
|
29
|
-
|
|
30
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('does not call onClick handler when disabled', () => {
|
|
34
|
-
const handleClick = vi.fn();
|
|
35
|
-
render(<Button label="Test Button" onClick={handleClick} disabled />);
|
|
36
|
-
|
|
37
|
-
const button = screen.getByText('Test Button');
|
|
38
|
-
fireEvent.click(button);
|
|
39
|
-
|
|
40
|
-
expect(handleClick).not.toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('renders with an icon when icon prop is provided', () => {
|
|
44
|
-
render(<Button label="Test Button" icon={faPlus} />);
|
|
45
|
-
|
|
46
|
-
// This is a mock test, so we're not actually checking for the icon
|
|
47
|
-
// In a real test, you would check for the icon element
|
|
48
|
-
const button = screen.getByText('Test Button').closest('button');
|
|
49
|
-
expect(button).toBeInTheDocument();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('renders as an anchor tag when href is provided', () => {
|
|
53
|
-
render(<Button label="Test Button" href="https://example.com" />);
|
|
54
|
-
|
|
55
|
-
const link = screen.getByText('Test Button').closest('a');
|
|
56
|
-
expect(link).toHaveAttribute('href', 'https://example.com');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('shows loading indicator when loading prop is true', () => {
|
|
60
|
-
render(<Button label="Test Button" loading />);
|
|
61
|
-
|
|
62
|
-
// This is a mock test, so we're not actually checking for the loading indicator
|
|
63
|
-
// In a real test, you would check for the ProgressIndicator component
|
|
64
|
-
const button = screen.getByText('Test Button').closest('button');
|
|
65
|
-
expect(button).toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { renderHook } from '@testing-library/react';
|
|
4
|
-
import { useClassNames } from '../lib/utils/styles/use-classnames';
|
|
5
|
-
import type { ComponentInterface } from '../lib/utils/component';
|
|
6
|
-
import type { ClassNameComponent } from '../lib/utils/styles/get-classname';
|
|
7
|
-
|
|
8
|
-
// Minimal fake component interface for testing the hook
|
|
9
|
-
interface TestComp extends ComponentInterface {
|
|
10
|
-
type: 'div';
|
|
11
|
-
elements: ['root', 'label'];
|
|
12
|
-
props: { label?: string };
|
|
13
|
-
states: { active?: boolean };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const defaultConfig: ClassNameComponent<TestComp> = (s) => ({
|
|
17
|
-
root: 'bg-default',
|
|
18
|
-
label: s.active ? 'text-active' : 'text-inactive',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('useClassNames', () => {
|
|
22
|
-
it('merges string default with function override; override wins', () => {
|
|
23
|
-
const override: ClassNameComponent<TestComp> = () => ({
|
|
24
|
-
root: 'px-2 custom-override',
|
|
25
|
-
label: 'text-red-500',
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const { result, rerender } = renderHook(
|
|
29
|
-
(props: any) =>
|
|
30
|
-
useClassNames<TestComp>('root', 'bg-default-root', {
|
|
31
|
-
...props,
|
|
32
|
-
className: override,
|
|
33
|
-
}),
|
|
34
|
-
{ initialProps: { active: false } },
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
expect(result.current.root).toContain('root'); // kebab-case prefix
|
|
38
|
-
expect(result.current.root).toContain('relative'); // default relative
|
|
39
|
-
// override precedence should keep both but allow override to win on conflicts; here no conflict
|
|
40
|
-
expect(result.current.root).toContain('custom-override');
|
|
41
|
-
|
|
42
|
-
// label from default function should be present and overridden by override
|
|
43
|
-
// default for inactive: text-inactive, but override sets text-red-500
|
|
44
|
-
// since we didn't include defaultConfig, this ensures hook handles function override w/ string default
|
|
45
|
-
|
|
46
|
-
rerender({ active: true });
|
|
47
|
-
// Memo invalidated due to states change; new value produced
|
|
48
|
-
expect(result.current.root).toContain('custom-override');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('merges function default with string override on default element', () => {
|
|
52
|
-
const { result } = renderHook(() =>
|
|
53
|
-
useClassNames<TestComp>('root', defaultConfig, {
|
|
54
|
-
active: true,
|
|
55
|
-
className: 'p-4',
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
expect(result.current.root).toContain('root');
|
|
59
|
-
expect(result.current.root).toContain('relative');
|
|
60
|
-
expect(result.current.root).toContain('p-4');
|
|
61
|
-
expect(result.current.label).toContain('label');
|
|
62
|
-
expect(result.current.label).toContain('text-active');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('memoizes: same inputs => stable reference', () => {
|
|
66
|
-
const states = { active: false, className: 'm-1' } as any;
|
|
67
|
-
const { result, rerender } = renderHook(
|
|
68
|
-
(p: any) => useClassNames<TestComp>('root', defaultConfig, p.states),
|
|
69
|
-
{ initialProps: { states } },
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const first = result.current;
|
|
73
|
-
rerender({ states }); // same reference
|
|
74
|
-
const second = result.current;
|
|
75
|
-
expect(second).toBe(first);
|
|
76
|
-
|
|
77
|
-
// change shallow reference -> new object allocated
|
|
78
|
-
rerender({ states: { ...states } });
|
|
79
|
-
const third = result.current;
|
|
80
|
-
expect(third).not.toBe(first);
|
|
81
|
-
});
|
|
82
|
-
});
|
package/src/udixio.css
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
@plugin "@udixio/tailwind" {
|
|
2
|
-
colorKeys: surface, surface-dim, surface-bright, surface-container-lowest, surface-container-low, surface-container, surface-container-high, surface-container-highest, on-surface, on-surface-variant, outline, outline-variant, inverse-surface, inverse-on-surface, primary, primary-dim, on-primary, primary-container, on-primary-container, primary-fixed, primary-fixed-dim, on-primary-fixed, on-primary-fixed-variant, inverse-primary, secondary, secondary-dim, on-secondary, secondary-container, on-secondary-container, secondary-fixed, secondary-fixed-dim, on-secondary-fixed, on-secondary-fixed-variant, tertiary, tertiary-dim, on-tertiary, tertiary-container, on-tertiary-container, tertiary-fixed, tertiary-fixed-dim, on-tertiary-fixed, on-tertiary-fixed-variant, error, error-dim, on-error, error-container, on-error-container, surface-variant, surface-tint, background, on-background;
|
|
3
|
-
fontStyles: display-large fontWeight[400] fontSize[3.5625] lineHeight[4] letterSpacing[-0.015625] fontFamily[expressive], display-medium fontWeight[400] fontSize[2.8125] lineHeight[3.25] fontFamily[expressive], display-small fontWeight[400] fontSize[2.25] lineHeight[2.75] fontFamily[expressive], headline-large fontWeight[400] fontSize[2] lineHeight[2.5] fontFamily[expressive], headline-medium fontWeight[400] fontSize[1.75] lineHeight[2.25] fontFamily[expressive], headline-small fontWeight[400] fontSize[1.5] lineHeight[2] fontFamily[expressive], title-large fontWeight[400] fontSize[1.375] lineHeight[1.75] fontFamily[neutral], title-medium fontWeight[500] fontSize[1] lineHeight[1.5] fontFamily[neutral] letterSpacing[0.009375], title-small fontWeight[500] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.00625], label-large fontWeight[500] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.00625], label-medium fontWeight[500] fontSize[0.75] lineHeight[1] fontFamily[neutral] letterSpacing[0.03125], label-small fontWeight[500] fontSize[0.6875] lineHeight[1] fontFamily[neutral] letterSpacing[0.03125], body-large fontWeight[400] fontSize[1] lineHeight[1.5625] fontFamily[neutral] letterSpacing[0.03125], body-medium fontWeight[400] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.015625], body-small fontWeight[400] fontSize[0.75] lineHeight[1] fontFamily[neutral] letterSpacing[0.025];
|
|
4
|
-
responsiveBreakPoints: lg 1.125;
|
|
5
|
-
}
|
|
6
|
-
@custom-variant dark (&:where(.dark, .dark *));
|
|
7
|
-
@theme {
|
|
8
|
-
--color-*: initial;
|
|
9
|
-
--color-surface: #fdf7fe;
|
|
10
|
-
--color-surface-dim: #ded8e4;
|
|
11
|
-
--color-surface-bright: #fdf7fe;
|
|
12
|
-
--color-surface-container-lowest: #ffffff;
|
|
13
|
-
--color-surface-container-low: #f8f1fa;
|
|
14
|
-
--color-surface-container: #f2ecf5;
|
|
15
|
-
--color-surface-container-high: #ece6f0;
|
|
16
|
-
--color-surface-container-highest: #e7e0ec;
|
|
17
|
-
--color-on-surface: #34313a;
|
|
18
|
-
--color-on-surface-variant: #625c6f;
|
|
19
|
-
--color-outline: #7e788c;
|
|
20
|
-
--color-outline-variant: #b6aec4;
|
|
21
|
-
--color-inverse-surface: #0f0d12;
|
|
22
|
-
--color-inverse-on-surface: #f5eff5;
|
|
23
|
-
--color-primary: #655789;
|
|
24
|
-
--color-primary-dim: #594b7c;
|
|
25
|
-
--color-on-primary: #fdf7ff;
|
|
26
|
-
--color-primary-container: #d4c3fd;
|
|
27
|
-
--color-on-primary-container: #493c6c;
|
|
28
|
-
--color-primary-fixed: #d4c3fd;
|
|
29
|
-
--color-primary-fixed-dim: #c6b6ee;
|
|
30
|
-
--color-on-primary-fixed: #352857;
|
|
31
|
-
--color-on-primary-fixed-variant: #524576;
|
|
32
|
-
--color-inverse-primary: #d4c3fd;
|
|
33
|
-
--color-secondary: #625c71;
|
|
34
|
-
--color-secondary-dim: #565065;
|
|
35
|
-
--color-on-secondary: #fdf7ff;
|
|
36
|
-
--color-secondary-container: #e8def8;
|
|
37
|
-
--color-on-secondary-container: #554f63;
|
|
38
|
-
--color-secondary-fixed: #e8def8;
|
|
39
|
-
--color-secondary-fixed-dim: #dad0ea;
|
|
40
|
-
--color-on-secondary-fixed: #423c50;
|
|
41
|
-
--color-on-secondary-fixed-variant: #5f586e;
|
|
42
|
-
--color-tertiary: #7b5270;
|
|
43
|
-
--color-tertiary-dim: #6e4664;
|
|
44
|
-
--color-on-tertiary: #fff7f9;
|
|
45
|
-
--color-tertiary-container: #f4bfe3;
|
|
46
|
-
--color-on-tertiary-container: #5f3956;
|
|
47
|
-
--color-tertiary-fixed: #f4bfe3;
|
|
48
|
-
--color-tertiary-fixed-dim: #e5b2d5;
|
|
49
|
-
--color-on-tertiary-fixed: #4a2642;
|
|
50
|
-
--color-on-tertiary-fixed-variant: #694260;
|
|
51
|
-
--color-error: #a8364b;
|
|
52
|
-
--color-error-dim: #6b0221;
|
|
53
|
-
--color-on-error: #fff7f7;
|
|
54
|
-
--color-error-container: #f97386;
|
|
55
|
-
--color-on-error-container: #6e0523;
|
|
56
|
-
--color-surface-variant: #e7e0ec;
|
|
57
|
-
--color-surface-tint: #655789;
|
|
58
|
-
--color-background: #fdf7fe;
|
|
59
|
-
--color-on-background: #34313a;
|
|
60
|
-
}
|
|
61
|
-
@layer theme {
|
|
62
|
-
.dark {
|
|
63
|
-
--color-surface: #0f0d12;
|
|
64
|
-
--color-surface-dim: #0f0d12;
|
|
65
|
-
--color-surface-bright: #2e2b34;
|
|
66
|
-
--color-surface-container-lowest: #000000;
|
|
67
|
-
--color-surface-container-low: #141218;
|
|
68
|
-
--color-surface-container: #1b181f;
|
|
69
|
-
--color-surface-container-high: #211e26;
|
|
70
|
-
--color-surface-container-highest: #27242d;
|
|
71
|
-
--color-on-surface: #eae3ef;
|
|
72
|
-
--color-on-surface-variant: #afa8bd;
|
|
73
|
-
--color-outline: #797286;
|
|
74
|
-
--color-outline-variant: #4b4557;
|
|
75
|
-
--color-inverse-surface: #fdf7fe;
|
|
76
|
-
--color-inverse-on-surface: #322f34;
|
|
77
|
-
--color-primary: #cdc0ec;
|
|
78
|
-
--color-primary-dim: #bfb2de;
|
|
79
|
-
--color-on-primary: #443a5f;
|
|
80
|
-
--color-primary-container: #574d72;
|
|
81
|
-
--color-on-primary-container: #e9deff;
|
|
82
|
-
--color-primary-fixed: #ded0fe;
|
|
83
|
-
--color-primary-fixed-dim: #d0c3ef;
|
|
84
|
-
--color-on-primary-fixed: #3c3256;
|
|
85
|
-
--color-on-primary-fixed-variant: #594e74;
|
|
86
|
-
--color-inverse-primary: #645980;
|
|
87
|
-
--color-secondary: #cbc2db;
|
|
88
|
-
--color-secondary-dim: #beb5cd;
|
|
89
|
-
--color-on-secondary: #433d51;
|
|
90
|
-
--color-secondary-container: #3e384c;
|
|
91
|
-
--color-on-secondary-container: #c4bbd4;
|
|
92
|
-
--color-secondary-fixed: #e8def8;
|
|
93
|
-
--color-secondary-fixed-dim: #dad0ea;
|
|
94
|
-
--color-on-secondary-fixed: #423c50;
|
|
95
|
-
--color-on-secondary-fixed-variant: #5f586e;
|
|
96
|
-
--color-tertiary: #ffcfef;
|
|
97
|
-
--color-tertiary-dim: #f4bfe3;
|
|
98
|
-
--color-on-tertiary: #69415f;
|
|
99
|
-
--color-tertiary-container: #f4bfe3;
|
|
100
|
-
--color-on-tertiary-container: #5f3956;
|
|
101
|
-
--color-tertiary-fixed: #f4bfe3;
|
|
102
|
-
--color-tertiary-fixed-dim: #e5b2d5;
|
|
103
|
-
--color-on-tertiary-fixed: #4a2642;
|
|
104
|
-
--color-on-tertiary-fixed-variant: #694260;
|
|
105
|
-
--color-error: #f97386;
|
|
106
|
-
--color-error-dim: #c44b5f;
|
|
107
|
-
--color-on-error: #490013;
|
|
108
|
-
--color-error-container: #871c34;
|
|
109
|
-
--color-on-error-container: #ff97a3;
|
|
110
|
-
--color-surface-variant: #27242d;
|
|
111
|
-
--color-surface-tint: #cdc0ec;
|
|
112
|
-
--color-background: #0f0d12;
|
|
113
|
-
--color-on-background: #eae3ef;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@theme {
|
|
118
|
-
--font-expressive: "Roboto", "sans-serif";
|
|
119
|
-
--font-neutral: "Roboto", "sans-serif";
|
|
120
|
-
}
|
package/theme.config.ts
DELETED
package/tsconfig.json
DELETED
package/tsconfig.lib.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"rootDir": "src",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
8
|
-
"emitDeclarationOnly": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"jsx": "react-jsx",
|
|
11
|
-
"types": [
|
|
12
|
-
"node",
|
|
13
|
-
"vite/client"
|
|
14
|
-
],
|
|
15
|
-
"lib": [
|
|
16
|
-
"es2022",
|
|
17
|
-
"dom",
|
|
18
|
-
"dom.iterable"
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
"include": [
|
|
22
|
-
"src/**/*.ts",
|
|
23
|
-
"src/**/*.tsx"
|
|
24
|
-
],
|
|
25
|
-
"references": [
|
|
26
|
-
{
|
|
27
|
-
"path": "../tailwind/tsconfig.lib.json"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../theme/tsconfig.lib.json"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"exclude": [
|
|
34
|
-
"vite.config.ts",
|
|
35
|
-
"vite.config.mts",
|
|
36
|
-
"vitest.config.ts",
|
|
37
|
-
"vitest.config.mts",
|
|
38
|
-
"src/**/*.test.ts",
|
|
39
|
-
"src/**/*.spec.ts",
|
|
40
|
-
"src/**/*.test.tsx",
|
|
41
|
-
"src/**/*.spec.tsx",
|
|
42
|
-
"src/**/*.test.js",
|
|
43
|
-
"src/**/*.spec.js",
|
|
44
|
-
"src/**/*.test.jsx",
|
|
45
|
-
"src/**/*.spec.jsx",
|
|
46
|
-
"**/*.stories.ts",
|
|
47
|
-
"**/*.stories.js",
|
|
48
|
-
"**/*.stories.jsx",
|
|
49
|
-
"**/*.stories.tsx"
|
|
50
|
-
]
|
|
51
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./out-tsc/vitest",
|
|
5
|
-
"types": [
|
|
6
|
-
"vitest/globals",
|
|
7
|
-
"vitest/importMeta",
|
|
8
|
-
"vite/client",
|
|
9
|
-
"node",
|
|
10
|
-
"vitest"
|
|
11
|
-
],
|
|
12
|
-
"module": "nodenext",
|
|
13
|
-
"moduleResolution": "nodenext",
|
|
14
|
-
"forceConsistentCasingInFileNames": true,
|
|
15
|
-
"jsx": "react-jsx"
|
|
16
|
-
},
|
|
17
|
-
"include": [
|
|
18
|
-
"vite.config.ts",
|
|
19
|
-
"vite.config.mts",
|
|
20
|
-
"vitest.config.ts",
|
|
21
|
-
"vitest.config.mts",
|
|
22
|
-
"src/**/*.test.ts",
|
|
23
|
-
"src/**/*.spec.ts",
|
|
24
|
-
"src/**/*.test.tsx",
|
|
25
|
-
"src/**/*.spec.tsx",
|
|
26
|
-
"src/**/*.test.js",
|
|
27
|
-
"src/**/*.spec.js",
|
|
28
|
-
"src/**/*.test.jsx",
|
|
29
|
-
"src/**/*.spec.jsx",
|
|
30
|
-
"src/**/*.d.ts"
|
|
31
|
-
],
|
|
32
|
-
"references": [
|
|
33
|
-
{
|
|
34
|
-
"path": "./tsconfig.lib.json"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
package/tsconfig.storybook.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "out-tsc/storybook",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "bundler",
|
|
7
|
-
"jsx": "preserve"
|
|
8
|
-
},
|
|
9
|
-
"exclude": [
|
|
10
|
-
"src/**/*.spec.ts",
|
|
11
|
-
"src/**/*.test.ts",
|
|
12
|
-
"src/**/*.spec.js",
|
|
13
|
-
"src/**/*.test.js",
|
|
14
|
-
"src/**/*.spec.tsx",
|
|
15
|
-
"src/**/*.test.tsx",
|
|
16
|
-
"src/**/*.spec.jsx",
|
|
17
|
-
"src/**/*.test.js"
|
|
18
|
-
],
|
|
19
|
-
"include": [
|
|
20
|
-
"src/**/*.stories.ts",
|
|
21
|
-
"src/**/*.stories.js",
|
|
22
|
-
"src/**/*.stories.jsx",
|
|
23
|
-
"src/**/*.stories.tsx",
|
|
24
|
-
"src/**/*.stories.mdx",
|
|
25
|
-
".storybook/*.js",
|
|
26
|
-
".storybook/*.ts"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "./tsconfig.lib.json"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"files": [
|
|
34
|
-
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
|
|
35
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
36
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
37
|
-
]
|
|
38
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/// <reference types='vitest' />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import react from '@vitejs/plugin-react';
|
|
4
|
-
import dts from 'vite-plugin-dts';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import { visualizer } from 'rollup-plugin-visualizer';
|
|
7
|
-
|
|
8
|
-
const getUdixioVite = async () => {
|
|
9
|
-
// @ts-expect-error - NX_GRAPH_CREATION is a global variable set by Nx
|
|
10
|
-
if (global.NX_GRAPH_CREATION) {
|
|
11
|
-
return;
|
|
12
|
-
} else {
|
|
13
|
-
const dynamicPath = '@udixio/theme';
|
|
14
|
-
return (await import(dynamicPath)).vitePlugin;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default defineConfig(async () => ({
|
|
19
|
-
root: __dirname,
|
|
20
|
-
base: './',
|
|
21
|
-
cacheDir: '../../node_modules/.vite/packages/ui-react',
|
|
22
|
-
plugins: [
|
|
23
|
-
await getUdixioVite(),
|
|
24
|
-
react(),
|
|
25
|
-
dts({
|
|
26
|
-
entryRoot: 'src',
|
|
27
|
-
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
28
|
-
}),
|
|
29
|
-
visualizer({
|
|
30
|
-
filename: '../../stats/ui-react.html',
|
|
31
|
-
open: false,
|
|
32
|
-
gzipSize: true,
|
|
33
|
-
brotliSize: true,
|
|
34
|
-
}),
|
|
35
|
-
],
|
|
36
|
-
worker: {
|
|
37
|
-
format: 'es' as const,
|
|
38
|
-
rollupOptions: {
|
|
39
|
-
output: {
|
|
40
|
-
entryFileNames: '[name].js',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
// Configuration for building your library.
|
|
45
|
-
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
46
|
-
build: {
|
|
47
|
-
outDir: './dist',
|
|
48
|
-
emptyOutDir: true,
|
|
49
|
-
reportCompressedSize: true,
|
|
50
|
-
commonjsOptions: {
|
|
51
|
-
transformMixedEsModules: true,
|
|
52
|
-
},
|
|
53
|
-
lib: {
|
|
54
|
-
ssr: true,
|
|
55
|
-
// Could also be a dictionary or array of multiple entry points.
|
|
56
|
-
entry: 'src/index.ts',
|
|
57
|
-
name: '@udixio/ui-react',
|
|
58
|
-
fileName: 'index',
|
|
59
|
-
// Change this to the formats you want to support.
|
|
60
|
-
// Don't forget to update your package.json as well.
|
|
61
|
-
formats: ['es' as const, 'cjs' as const],
|
|
62
|
-
},
|
|
63
|
-
rollupOptions: {
|
|
64
|
-
output: {
|
|
65
|
-
// Worker JS emis sans hash pour que la référence dans dist/index.js soit stable
|
|
66
|
-
assetFileNames: '[name][extname]',
|
|
67
|
-
chunkFileNames: '[name].js',
|
|
68
|
-
},
|
|
69
|
-
// External packages that should not be bundled into your library.
|
|
70
|
-
external: [
|
|
71
|
-
'react',
|
|
72
|
-
'clsx',
|
|
73
|
-
'throttle-debounce',
|
|
74
|
-
'react-dom',
|
|
75
|
-
'react/jsx-runtime',
|
|
76
|
-
'react-textarea-autosize',
|
|
77
|
-
'tailwind-merge',
|
|
78
|
-
'motion',
|
|
79
|
-
'@udixio/theme',
|
|
80
|
-
'@udixio/tailwind',
|
|
81
|
-
'motion/react',
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
test: {
|
|
86
|
-
watch: false,
|
|
87
|
-
globals: true,
|
|
88
|
-
environment: 'jsdom',
|
|
89
|
-
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
90
|
-
reporters: ['default'],
|
|
91
|
-
coverage: {
|
|
92
|
-
reportsDirectory: './test-output/vitest/coverage',
|
|
93
|
-
provider: 'v8' as const,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
}));
|