@kkkarsss/ui 1.0.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/.storybook/main.d.ts +3 -0
- package/dist/.storybook/main.js +34 -0
- package/dist/.storybook/preview.d.ts +4 -0
- package/dist/.storybook/preview.js +19 -0
- package/dist/index.css +238 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/providers/alert/alert-context.d.ts +16 -0
- package/dist/providers/alert/alert-context.js +2 -0
- package/dist/providers/alert/alert-provider.d.ts +6 -0
- package/dist/providers/alert/alert-provider.js +50 -0
- package/dist/providers/alert/use-alerts.d.ts +1 -0
- package/dist/providers/alert/use-alerts.js +9 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +9 -0
- package/dist/providers/theme/index.d.ts +3 -0
- package/dist/providers/theme/index.js +3 -0
- package/dist/providers/theme/theme-context.d.ts +7 -0
- package/dist/providers/theme/theme-context.js +6 -0
- package/dist/providers/theme/theme-provider.d.ts +9 -0
- package/dist/providers/theme/theme-provider.js +27 -0
- package/dist/providers/theme/use-theme.d.ts +4 -0
- package/dist/providers/theme/use-theme.js +8 -0
- package/dist/providers/widget/index.d.ts +3 -0
- package/dist/providers/widget/index.js +3 -0
- package/dist/providers/widget/use-widgets.d.ts +4 -0
- package/dist/providers/widget/use-widgets.js +8 -0
- package/dist/providers/widget/widget-context.d.ts +12 -0
- package/dist/providers/widget/widget-context.js +6 -0
- package/dist/providers/widget/widget-provider.d.ts +6 -0
- package/dist/providers/widget/widget-provider.js +13 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/providers/alert/alert-context.d.ts +16 -0
- package/dist/src/providers/alert/alert-context.js +2 -0
- package/dist/src/providers/alert/alert-provider.d.ts +6 -0
- package/dist/src/providers/alert/alert-provider.js +50 -0
- package/dist/src/providers/alert/use-alerts.d.ts +1 -0
- package/dist/src/providers/alert/use-alerts.js +9 -0
- package/dist/src/providers/index.d.ts +9 -0
- package/dist/src/providers/index.js +9 -0
- package/dist/src/providers/theme/theme-context.d.ts +7 -0
- package/dist/src/providers/theme/theme-context.js +6 -0
- package/dist/src/providers/theme/theme-provider.d.ts +9 -0
- package/dist/src/providers/theme/theme-provider.js +27 -0
- package/dist/src/providers/theme/use-theme.d.ts +4 -0
- package/dist/src/providers/theme/use-theme.js +8 -0
- package/dist/src/providers/widget/use-widgets.d.ts +4 -0
- package/dist/src/providers/widget/use-widgets.js +8 -0
- package/dist/src/providers/widget/widget-context.d.ts +12 -0
- package/dist/src/providers/widget/widget-context.js +6 -0
- package/dist/src/providers/widget/widget-provider.d.ts +6 -0
- package/dist/src/providers/widget/widget-provider.js +15 -0
- package/dist/src/ui/controls/button/button.d.ts +10 -0
- package/dist/src/ui/controls/button/button.js +11 -0
- package/dist/src/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/src/ui/controls/button/button.stories.js +38 -0
- package/dist/src/ui/controls/chip/chip.d.ts +12 -0
- package/dist/src/ui/controls/chip/chip.js +11 -0
- package/dist/src/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/src/ui/controls/chip/chip.stories.js +42 -0
- package/dist/src/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/src/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/src/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/src/ui/controls/copy/copy.d.ts +6 -0
- package/dist/src/ui/controls/copy/copy.js +20 -0
- package/dist/src/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/src/ui/controls/copy/copy.stories.js +20 -0
- package/dist/src/ui/controls/index.d.ts +7 -0
- package/dist/src/ui/controls/index.js +7 -0
- package/dist/src/ui/controls/input/input.d.ts +14 -0
- package/dist/src/ui/controls/input/input.js +12 -0
- package/dist/src/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/src/ui/controls/input/input.stories.js +46 -0
- package/dist/src/ui/controls/select/select.d.ts +14 -0
- package/dist/src/ui/controls/select/select.js +80 -0
- package/dist/src/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/src/ui/controls/select/select.stories.js +40 -0
- package/dist/src/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/src/ui/controls/textarea/textarea.js +20 -0
- package/dist/src/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/src/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/src/ui/index.d.ts +3 -0
- package/dist/src/ui/index.js +3 -0
- package/dist/src/ui/information/block/block.d.ts +10 -0
- package/dist/src/ui/information/block/block.js +10 -0
- package/dist/src/ui/information/block/block.stories.d.ts +8 -0
- package/dist/src/ui/information/block/block.stories.js +38 -0
- package/dist/src/ui/information/cell/cell.d.ts +26 -0
- package/dist/src/ui/information/cell/cell.js +31 -0
- package/dist/src/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/src/ui/information/cell/cell.stories.js +62 -0
- package/dist/src/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/src/ui/information/cell/cells-block.js +5 -0
- package/dist/src/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/src/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/src/ui/information/index.d.ts +6 -0
- package/dist/src/ui/information/index.js +6 -0
- package/dist/src/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/src/ui/information/spinner/spinner.js +5 -0
- package/dist/src/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/src/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/src/ui/information/tag/tag.d.ts +6 -0
- package/dist/src/ui/information/tag/tag.js +7 -0
- package/dist/src/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/src/ui/information/tag/tag.stories.js +25 -0
- package/dist/src/ui/information/text/typo.d.ts +12 -0
- package/dist/src/ui/information/text/typo.js +41 -0
- package/dist/src/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/src/ui/information/text/typo.stories.js +60 -0
- package/dist/src/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/src/ui/layout/dropdown/dropdown.js +59 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/src/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/src/ui/layout/flex/flex.d.ts +12 -0
- package/dist/src/ui/layout/flex/flex.js +36 -0
- package/dist/src/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/src/ui/layout/flex/flex.stories.js +53 -0
- package/dist/src/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/src/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/src/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/src/ui/layout/index.d.ts +5 -0
- package/dist/src/ui/layout/index.js +5 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/src/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/src/ui/layout/offset/offset.d.ts +6 -0
- package/dist/src/ui/layout/offset/offset.js +10 -0
- package/dist/src/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/src/ui/layout/offset/offset.stories.js +33 -0
- package/dist/src/utils/classes.d.ts +1 -0
- package/dist/src/utils/classes.js +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.js +7 -0
- package/dist/stories/Button.stories.d.ts +23 -0
- package/dist/stories/Button.stories.js +44 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.js +4 -0
- package/dist/stories/Header.stories.d.ts +18 -0
- package/dist/stories/Header.stories.js +26 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.js +8 -0
- package/dist/stories/Page.stories.d.ts +12 -0
- package/dist/stories/Page.stories.js +24 -0
- package/dist/ui/controls/button/button.d.ts +10 -0
- package/dist/ui/controls/button/button.js +11 -0
- package/dist/ui/controls/button/button.stories.d.ts +9 -0
- package/dist/ui/controls/button/button.stories.js +38 -0
- package/dist/ui/controls/chip/chip.d.ts +12 -0
- package/dist/ui/controls/chip/chip.js +11 -0
- package/dist/ui/controls/chip/chip.stories.d.ts +9 -0
- package/dist/ui/controls/chip/chip.stories.js +42 -0
- package/dist/ui/controls/color-picker/color-picker.d.ts +8 -0
- package/dist/ui/controls/color-picker/color-picker.js +21 -0
- package/dist/ui/controls/color-picker/color-picker.stories.d.ts +7 -0
- package/dist/ui/controls/color-picker/color-picker.stories.js +21 -0
- package/dist/ui/controls/copy/copy.d.ts +6 -0
- package/dist/ui/controls/copy/copy.js +20 -0
- package/dist/ui/controls/copy/copy.stories.d.ts +7 -0
- package/dist/ui/controls/copy/copy.stories.js +20 -0
- package/dist/ui/controls/date-input/date-input.d.ts +10 -0
- package/dist/ui/controls/date-input/date-input.js +25 -0
- package/dist/ui/controls/date-picker/date-picker.d.ts +7 -0
- package/dist/ui/controls/date-picker/date-picker.js +32 -0
- package/dist/ui/controls/index.d.ts +9 -0
- package/dist/ui/controls/index.js +9 -0
- package/dist/ui/controls/input/input.d.ts +15 -0
- package/dist/ui/controls/input/input.js +12 -0
- package/dist/ui/controls/input/input.stories.d.ts +9 -0
- package/dist/ui/controls/input/input.stories.js +46 -0
- package/dist/ui/controls/select/select.d.ts +14 -0
- package/dist/ui/controls/select/select.js +80 -0
- package/dist/ui/controls/select/select.stories.d.ts +8 -0
- package/dist/ui/controls/select/select.stories.js +40 -0
- package/dist/ui/controls/textarea/textarea.d.ts +11 -0
- package/dist/ui/controls/textarea/textarea.js +20 -0
- package/dist/ui/controls/textarea/textarea.stories.d.ts +8 -0
- package/dist/ui/controls/textarea/textarea.stories.js +35 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.d.ts +2 -0
- package/dist/ui/controls/theme-toggle/theme-toggle.js +10 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/information/block/block.d.ts +13 -0
- package/dist/ui/information/block/block.js +10 -0
- package/dist/ui/information/block/block.stories.d.ts +9 -0
- package/dist/ui/information/block/block.stories.js +47 -0
- package/dist/ui/information/calendar-like/calendar-like.d.ts +24 -0
- package/dist/ui/information/calendar-like/calendar-like.js +71 -0
- package/dist/ui/information/cell/cell.d.ts +26 -0
- package/dist/ui/information/cell/cell.js +31 -0
- package/dist/ui/information/cell/cell.stories.d.ts +11 -0
- package/dist/ui/information/cell/cell.stories.js +62 -0
- package/dist/ui/information/cell/cells-block.d.ts +9 -0
- package/dist/ui/information/cell/cells-block.js +5 -0
- package/dist/ui/information/cell/cells-block.stories.d.ts +6 -0
- package/dist/ui/information/cell/cells-block.stories.js +20 -0
- package/dist/ui/information/index.d.ts +8 -0
- package/dist/ui/information/index.js +8 -0
- package/dist/ui/information/not-found/not-found.d.ts +2 -0
- package/dist/ui/information/not-found/not-found.js +6 -0
- package/dist/ui/information/spinner/spinner.d.ts +2 -0
- package/dist/ui/information/spinner/spinner.js +5 -0
- package/dist/ui/information/spinner/spinner.stories.d.ts +6 -0
- package/dist/ui/information/spinner/spinner.stories.js +8 -0
- package/dist/ui/information/tag/tag.d.ts +6 -0
- package/dist/ui/information/tag/tag.js +7 -0
- package/dist/ui/information/tag/tag.stories.d.ts +8 -0
- package/dist/ui/information/tag/tag.stories.js +25 -0
- package/dist/ui/information/text/typo.d.ts +13 -0
- package/dist/ui/information/text/typo.js +41 -0
- package/dist/ui/information/text/typo.stories.d.ts +10 -0
- package/dist/ui/information/text/typo.stories.js +60 -0
- package/dist/ui/information/typo.d.ts +12 -0
- package/dist/ui/information/typo.js +41 -0
- package/dist/ui/layout/dropdown/dropdown.d.ts +11 -0
- package/dist/ui/layout/dropdown/dropdown.js +44 -0
- package/dist/ui/layout/dropdown/dropdown.stories.d.ts +6 -0
- package/dist/ui/layout/dropdown/dropdown.stories.js +24 -0
- package/dist/ui/layout/flex/flex.d.ts +13 -0
- package/dist/ui/layout/flex/flex.js +36 -0
- package/dist/ui/layout/flex/flex.stories.d.ts +8 -0
- package/dist/ui/layout/flex/flex.stories.js +53 -0
- package/dist/ui/layout/icon-action/icon-action.d.ts +9 -0
- package/dist/ui/layout/icon-action/icon-action.js +11 -0
- package/dist/ui/layout/icon-action/icon-action.stories.d.ts +7 -0
- package/dist/ui/layout/icon-action/icon-action.stories.js +23 -0
- package/dist/ui/layout/index.d.ts +5 -0
- package/dist/ui/layout/index.js +5 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.d.ts +7 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.js +8 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.d.ts +6 -0
- package/dist/ui/layout/main-page-layout/main-page-layout.stories.js +19 -0
- package/dist/ui/layout/offset/offset.d.ts +7 -0
- package/dist/ui/layout/offset/offset.js +10 -0
- package/dist/ui/layout/offset/offset.stories.d.ts +8 -0
- package/dist/ui/layout/offset/offset.stories.js +33 -0
- package/dist/utils/classes.d.ts +1 -0
- package/dist/utils/classes.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = path.dirname(__filename);
|
|
5
|
+
const config = {
|
|
6
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
7
|
+
addons: [
|
|
8
|
+
'@chromatic-com/storybook',
|
|
9
|
+
'@storybook/addon-vitest',
|
|
10
|
+
'@storybook/addon-a11y',
|
|
11
|
+
'@storybook/addon-docs',
|
|
12
|
+
'@storybook/addon-onboarding',
|
|
13
|
+
],
|
|
14
|
+
framework: '@storybook/react-vite',
|
|
15
|
+
async viteFinal(config) {
|
|
16
|
+
if (config.resolve) {
|
|
17
|
+
const alias = config.resolve.alias || {};
|
|
18
|
+
if (Array.isArray(alias)) {
|
|
19
|
+
alias.push({
|
|
20
|
+
find: '@kars',
|
|
21
|
+
replacement: path.resolve(__dirname, '../../kars-modules/src'),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
config.resolve.alias = {
|
|
26
|
+
...alias,
|
|
27
|
+
'@kars': path.resolve(__dirname, '../../kars-modules/src'),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return config;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export default config;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeProvider, WidgetProvider } from '../src';
|
|
3
|
+
import '../src/index.css';
|
|
4
|
+
const preview = {
|
|
5
|
+
decorators: [
|
|
6
|
+
(Story) => {
|
|
7
|
+
return React.createElement(ThemeProvider, null, React.createElement(WidgetProvider, null, Story()));
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
parameters: {
|
|
11
|
+
controls: {
|
|
12
|
+
matchers: {
|
|
13
|
+
color: /(background|color)$/i,
|
|
14
|
+
date: /Date$/i,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export default preview;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
|
|
2
|
+
|
|
3
|
+
@tailwind base;
|
|
4
|
+
@tailwind components;
|
|
5
|
+
@tailwind utilities;
|
|
6
|
+
|
|
7
|
+
@layer utilities {
|
|
8
|
+
/* Text Sizes */
|
|
9
|
+
.text-xxs { font-size: 8px; line-height: 8px; }
|
|
10
|
+
.text-xs { font-size: var(--text-xs); line-height: var(--text-xs); }
|
|
11
|
+
.text-s { font-size: var(--text-s); line-height: var(--text-s); }
|
|
12
|
+
.text-m { font-size: var(--text-m); line-height: var(--text-m); }
|
|
13
|
+
.text-l { font-size: var(--text-l); line-height: var(--text-l); }
|
|
14
|
+
.text-xl { font-size: var(--text-xl); line-height: var(--text-xl); }
|
|
15
|
+
|
|
16
|
+
/* Padding Sizes (Unified) */
|
|
17
|
+
.p-none { padding: 0; }
|
|
18
|
+
.p-xs { padding: 2px; }
|
|
19
|
+
.p-s { padding: 4px; }
|
|
20
|
+
.p-m { padding: 8px; }
|
|
21
|
+
.p-l { padding: 16px; }
|
|
22
|
+
.p-xl { padding: 32px; }
|
|
23
|
+
|
|
24
|
+
/* Padding Top */
|
|
25
|
+
.pt-none { padding-top: 0; }
|
|
26
|
+
.pt-xs { padding-top: 2px; }
|
|
27
|
+
.pt-s { padding-top: 4px; }
|
|
28
|
+
.pt-m { padding-top: 8px; }
|
|
29
|
+
.pt-l { padding-top: 16px; }
|
|
30
|
+
.pt-xl { padding-top: 32px; }
|
|
31
|
+
|
|
32
|
+
/* Padding Bottom */
|
|
33
|
+
.pb-none { padding-bottom: 0; }
|
|
34
|
+
.pb-xs { padding-bottom: 2px; }
|
|
35
|
+
.pb-s { padding-bottom: 4px; }
|
|
36
|
+
.pb-m { padding-bottom: 8px; }
|
|
37
|
+
.pb-l { padding-bottom: 16px; }
|
|
38
|
+
.pb-xl { padding-bottom: 32px; }
|
|
39
|
+
|
|
40
|
+
/* Padding Left */
|
|
41
|
+
.pl-none { padding-left: 0; }
|
|
42
|
+
.pl-xs { padding-left: 2px; }
|
|
43
|
+
.pl-s { padding-left: 4px; }
|
|
44
|
+
.pl-m { padding-left: 8px; }
|
|
45
|
+
.pl-l { padding-left: 16px; }
|
|
46
|
+
.pl-xl { padding-left: 32px; }
|
|
47
|
+
|
|
48
|
+
/* Padding Right */
|
|
49
|
+
.pr-none { padding-right: 0; }
|
|
50
|
+
.pr-xs { padding-right: 2px; }
|
|
51
|
+
.pr-s { padding-right: 4px; }
|
|
52
|
+
.pr-m { padding-right: 8px; }
|
|
53
|
+
.pr-l { padding-right: 16px; }
|
|
54
|
+
.pr-xl { padding-right: 32px; }
|
|
55
|
+
|
|
56
|
+
/* Padding X */
|
|
57
|
+
.px-none { padding-left: 0; padding-right: 0; }
|
|
58
|
+
.px-xs { padding-left: 2px; padding-right: 2px; }
|
|
59
|
+
.px-s { padding-left: 4px; padding-right: 4px; }
|
|
60
|
+
.px-m { padding-left: 8px; padding-right: 8px; }
|
|
61
|
+
.px-l { padding-left: 16px; padding-right: 16px; }
|
|
62
|
+
.px-xl { padding-left: 32px; padding-right: 32px; }
|
|
63
|
+
|
|
64
|
+
/* Padding Y */
|
|
65
|
+
.py-none { padding-top: 0; padding-bottom: 0; }
|
|
66
|
+
.py-xs { padding-top: 2px; padding-bottom: 2px; }
|
|
67
|
+
.py-s { padding-top: 4px; padding-bottom: 4px; }
|
|
68
|
+
.py-m { padding-top: 8px; padding-bottom: 8px; }
|
|
69
|
+
.py-l { padding-top: 16px; padding-bottom: 16px; }
|
|
70
|
+
.py-xl { padding-top: 32px; padding-bottom: 32px; }
|
|
71
|
+
|
|
72
|
+
/* Margin Sizes (Unified) */
|
|
73
|
+
.m-none { margin: 0; }
|
|
74
|
+
.m-xs { margin: 2px; }
|
|
75
|
+
.m-s { margin: 4px; }
|
|
76
|
+
.m-m { margin: 8px; }
|
|
77
|
+
.m-l { margin: 16px; }
|
|
78
|
+
.m-xl { margin: 32px; }
|
|
79
|
+
|
|
80
|
+
/* margin Top */
|
|
81
|
+
.mt-none { margin-top: 0; }
|
|
82
|
+
.mt-xs { margin-top: 2px; }
|
|
83
|
+
.mt-s { margin-top: 4px; }
|
|
84
|
+
.mt-m { margin-top: 8px; }
|
|
85
|
+
.mt-l { margin-top: 16px; }
|
|
86
|
+
.mt-xl { margin-top: 32px; }
|
|
87
|
+
|
|
88
|
+
/* margin Bottom */
|
|
89
|
+
.mb-none { margin-bottom: 0; }
|
|
90
|
+
.mb-xs { margin-bottom: 2px; }
|
|
91
|
+
.mb-s { margin-bottom: 4px; }
|
|
92
|
+
.mb-m { margin-bottom: 8px; }
|
|
93
|
+
.mb-l { margin-bottom: 16px; }
|
|
94
|
+
.mb-xl { margin-bottom: 32px; }
|
|
95
|
+
|
|
96
|
+
/* margin Left */
|
|
97
|
+
.ml-none { margin-left: 0; }
|
|
98
|
+
.ml-xs { margin-left: 2px; }
|
|
99
|
+
.ml-s { margin-left: 4px; }
|
|
100
|
+
.ml-m { margin-left: 8px; }
|
|
101
|
+
.ml-l { margin-left: 16px; }
|
|
102
|
+
.ml-xl { margin-left: 32px; }
|
|
103
|
+
|
|
104
|
+
/* margin Right */
|
|
105
|
+
.mr-none { margin-right: 0; }
|
|
106
|
+
.mr-xs { margin-right: 2px; }
|
|
107
|
+
.mr-s { margin-right: 4px; }
|
|
108
|
+
.mr-m { margin-right: 8px; }
|
|
109
|
+
.mr-l { margin-right: 16px; }
|
|
110
|
+
.mr-xl { margin-right: 32px; }
|
|
111
|
+
|
|
112
|
+
/* margin X */
|
|
113
|
+
.mx-none { margin-left: 0; margin-right: 0; }
|
|
114
|
+
.mx-xs { margin-left: 2px; margin-right: 2px; }
|
|
115
|
+
.mx-s { margin-left: 4px; margin-right: 4px; }
|
|
116
|
+
.mx-m { margin-left: 8px; margin-right: 8px; }
|
|
117
|
+
.mx-l { margin-left: 16px; margin-right: 16px; }
|
|
118
|
+
.mx-xl { margin-left: 32px; margin-right: 32px; }
|
|
119
|
+
|
|
120
|
+
/* margin Y */
|
|
121
|
+
.my-none { margin-top: 0; margin-bottom: 0; }
|
|
122
|
+
.my-xs { margin-top: 2px; margin-bottom: 2px; }
|
|
123
|
+
.my-s { margin-top: 4px; margin-bottom: 4px; }
|
|
124
|
+
.my-m { margin-top: 8px; margin-bottom: 8px; }
|
|
125
|
+
.my-l { margin-top: 16px; margin-bottom: 16px; }
|
|
126
|
+
.my-xl { margin-top: 32px; margin-bottom: 32px; }
|
|
127
|
+
|
|
128
|
+
/* Gap Sizes */
|
|
129
|
+
.gap-none { gap: 0; }
|
|
130
|
+
.gap-xs { gap: 2px; }
|
|
131
|
+
.gap-s { gap: 4px; }
|
|
132
|
+
.gap-m { gap: 8px; }
|
|
133
|
+
.gap-l { gap: 16px; }
|
|
134
|
+
.gap-xl { gap: 32px; }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:root {
|
|
138
|
+
font-family: Roboto, sans-serif;
|
|
139
|
+
|
|
140
|
+
/* Text Sizes */
|
|
141
|
+
--text-xl: 18px;
|
|
142
|
+
--text-l: 16px;
|
|
143
|
+
--text-m: 14px;
|
|
144
|
+
--text-s: 12px;
|
|
145
|
+
--text-xs: 10px;
|
|
146
|
+
|
|
147
|
+
/* Dark theme (default) */
|
|
148
|
+
--background: #232323;
|
|
149
|
+
--background-accent: #272727;
|
|
150
|
+
--foreground: #d9d9d9;
|
|
151
|
+
|
|
152
|
+
--secondary: #3b3b3b;
|
|
153
|
+
--secondary-foreground: #999;
|
|
154
|
+
|
|
155
|
+
--accent: #ed3a64;
|
|
156
|
+
--accent-foreground: #ffffff;
|
|
157
|
+
--shadow: rgba(0, 0, 0, 0.1);
|
|
158
|
+
|
|
159
|
+
--success: #22c55e;
|
|
160
|
+
--warning: #f59e0b;
|
|
161
|
+
--error: #ef4444;
|
|
162
|
+
|
|
163
|
+
font-synthesis: none;
|
|
164
|
+
text-rendering: optimizeLegibility;
|
|
165
|
+
-webkit-font-smoothing: antialiased;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.dark {
|
|
169
|
+
color-scheme: dark;
|
|
170
|
+
--background: #232323;
|
|
171
|
+
--background-accent: #272727;
|
|
172
|
+
--foreground: #d9d9d9;
|
|
173
|
+
|
|
174
|
+
--secondary: #3b3b3b;
|
|
175
|
+
--secondary-foreground: #999;
|
|
176
|
+
|
|
177
|
+
--accent: #ed3a64;
|
|
178
|
+
--accent-foreground: #ffffff;
|
|
179
|
+
--shadow: rgba(0, 0, 0, 0.1);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.light {
|
|
183
|
+
color-scheme: light;
|
|
184
|
+
--background: #f4f4f4;
|
|
185
|
+
--background-accent: #fafafa;
|
|
186
|
+
--foreground: #080809;
|
|
187
|
+
|
|
188
|
+
--secondary: #e5e7eb;
|
|
189
|
+
--secondary-foreground: #919191;
|
|
190
|
+
--shadow: rgba(0, 0, 0, 0.03);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
* {
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
margin: 0;
|
|
196
|
+
padding: 0;
|
|
197
|
+
font-family: Roboto, sans-serif;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.cursor {
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
a {
|
|
205
|
+
text-decoration: none;
|
|
206
|
+
color: inherit;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
body {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 100vh;
|
|
212
|
+
background-color: var(--background);
|
|
213
|
+
color: var(--foreground);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.scrollbar-custom {
|
|
217
|
+
scrollbar-width: thin;
|
|
218
|
+
scrollbar-color: var(--secondary) transparent;
|
|
219
|
+
}
|
|
220
|
+
.scrollbar-custom::-webkit-scrollbar {
|
|
221
|
+
width: 4px;
|
|
222
|
+
height: 4px;
|
|
223
|
+
}
|
|
224
|
+
.scrollbar-custom::-webkit-scrollbar-track {
|
|
225
|
+
background: transparent;
|
|
226
|
+
}
|
|
227
|
+
.scrollbar-custom::-webkit-scrollbar-thumb {
|
|
228
|
+
background-color: var(--secondary);
|
|
229
|
+
border-radius: 10px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.scrollbar-none {
|
|
233
|
+
scrollbar-width: none;
|
|
234
|
+
-ms-overflow-style: none;
|
|
235
|
+
}
|
|
236
|
+
.scrollbar-none::-webkit-scrollbar {
|
|
237
|
+
display: none;
|
|
238
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TAlert = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
isRead: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type TAlertContext = {
|
|
9
|
+
currentAlert: TAlert | null;
|
|
10
|
+
history: TAlert[];
|
|
11
|
+
addAlert: (alert: Omit<TAlert, 'id' | 'timestamp' | 'isRead'>) => void;
|
|
12
|
+
clearHistory: () => void;
|
|
13
|
+
dismissCurrentAlert: (isRead?: boolean) => void;
|
|
14
|
+
markAllAsRead: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const AlertContext: import("react").Context<TAlertContext | undefined>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useRef } from 'react';
|
|
3
|
+
import { AlertContext } from './alert-context';
|
|
4
|
+
export function AlertProvider({ children }) {
|
|
5
|
+
const [currentAlert, setCurrentAlert] = useState(null);
|
|
6
|
+
const [history, setHistory] = useState([]);
|
|
7
|
+
const timerRef = useRef(null);
|
|
8
|
+
const dismissCurrentAlert = useCallback((isRead = false) => {
|
|
9
|
+
if (timerRef.current) {
|
|
10
|
+
clearTimeout(timerRef.current);
|
|
11
|
+
timerRef.current = null;
|
|
12
|
+
}
|
|
13
|
+
if (isRead && currentAlert) {
|
|
14
|
+
setHistory((prev) => prev.map((a) => (a.id === currentAlert.id ? { ...a, isRead: true } : a)));
|
|
15
|
+
}
|
|
16
|
+
setCurrentAlert(null);
|
|
17
|
+
}, [currentAlert]);
|
|
18
|
+
const addAlert = useCallback((alertData) => {
|
|
19
|
+
const newAlert = {
|
|
20
|
+
...alertData,
|
|
21
|
+
id: Math.random().toString(36).substring(2, 9),
|
|
22
|
+
timestamp: new Date(),
|
|
23
|
+
isRead: false,
|
|
24
|
+
};
|
|
25
|
+
setHistory((prev) => [newAlert, ...prev]);
|
|
26
|
+
setCurrentAlert(newAlert);
|
|
27
|
+
if (timerRef.current) {
|
|
28
|
+
clearTimeout(timerRef.current);
|
|
29
|
+
}
|
|
30
|
+
timerRef.current = setTimeout(() => {
|
|
31
|
+
setCurrentAlert(null);
|
|
32
|
+
timerRef.current = null;
|
|
33
|
+
}, 5000);
|
|
34
|
+
}, []);
|
|
35
|
+
const clearHistory = useCallback(() => {
|
|
36
|
+
setHistory([]);
|
|
37
|
+
}, []);
|
|
38
|
+
const markAllAsRead = useCallback(() => {
|
|
39
|
+
setHistory((prev) => prev.map((a) => ({ ...a, isRead: true })));
|
|
40
|
+
}, []);
|
|
41
|
+
const value = {
|
|
42
|
+
currentAlert,
|
|
43
|
+
history,
|
|
44
|
+
addAlert,
|
|
45
|
+
clearHistory,
|
|
46
|
+
dismissCurrentAlert,
|
|
47
|
+
markAllAsRead,
|
|
48
|
+
};
|
|
49
|
+
return _jsx(AlertContext.Provider, { value: value, children: children });
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAlerts: () => import("./alert-context").TAlertContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { AlertContext } from './alert-context';
|
|
3
|
+
export const useAlerts = () => {
|
|
4
|
+
const context = useContext(AlertContext);
|
|
5
|
+
if (context === undefined) {
|
|
6
|
+
throw new Error('useAlerts must be used within an AlertProvider');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { WidgetsProviderContext } from './widget/widget-context';
|
|
2
|
+
export { WidgetProvider } from './widget/widget-provider';
|
|
3
|
+
export { useWidget } from './widget/use-widgets';
|
|
4
|
+
export { type TTheme, ThemeProviderContext } from './theme/theme-context';
|
|
5
|
+
export { useTheme } from './theme/use-theme';
|
|
6
|
+
export { ThemeProvider } from './theme/theme-provider';
|
|
7
|
+
export { AlertContext, type TAlert } from './alert/alert-context';
|
|
8
|
+
export { AlertProvider } from './alert/alert-provider';
|
|
9
|
+
export { useAlerts } from './alert/use-alerts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { WidgetsProviderContext } from './widget/widget-context';
|
|
2
|
+
export { WidgetProvider } from './widget/widget-provider';
|
|
3
|
+
export { useWidget } from './widget/use-widgets';
|
|
4
|
+
export { ThemeProviderContext } from './theme/theme-context';
|
|
5
|
+
export { useTheme } from './theme/use-theme';
|
|
6
|
+
export { ThemeProvider } from './theme/theme-provider';
|
|
7
|
+
export { AlertContext } from './alert/alert-context';
|
|
8
|
+
export { AlertProvider } from './alert/alert-provider';
|
|
9
|
+
export { useAlerts } from './alert/use-alerts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type TTheme } from './theme-context';
|
|
3
|
+
type TThemeProviderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
defaultTheme?: TTheme;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: TThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ThemeProviderContext } from './theme-context';
|
|
4
|
+
export function ThemeProvider({ children, defaultTheme = 'system', storageKey = 'theme', ...props }) {
|
|
5
|
+
const [theme, setTheme] = useState(() => localStorage.getItem(storageKey) || defaultTheme);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const root = window.document.documentElement;
|
|
8
|
+
root.classList.remove('light', 'dark');
|
|
9
|
+
if (theme === 'system') {
|
|
10
|
+
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
|
|
11
|
+
.matches
|
|
12
|
+
? 'dark'
|
|
13
|
+
: 'light';
|
|
14
|
+
root.classList.add(systemTheme);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
root.classList.add(theme);
|
|
18
|
+
}, [theme]);
|
|
19
|
+
const value = {
|
|
20
|
+
theme,
|
|
21
|
+
setTheme: (theme) => {
|
|
22
|
+
localStorage.setItem(storageKey, theme);
|
|
23
|
+
setTheme(theme);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return (_jsx(ThemeProviderContext.Provider, { ...props, value: value, children: children }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ThemeProviderContext } from './theme-context';
|
|
3
|
+
export const useTheme = () => {
|
|
4
|
+
const context = useContext(ThemeProviderContext);
|
|
5
|
+
if (context === undefined)
|
|
6
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
7
|
+
return context;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { WidgetsProviderContext } from './widget-context';
|
|
3
|
+
export const useWidget = () => {
|
|
4
|
+
const context = useContext(WidgetsProviderContext);
|
|
5
|
+
if (context === undefined)
|
|
6
|
+
throw new Error('useWidget must be used within a WidgetsProvider');
|
|
7
|
+
return context;
|
|
8
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { TBlockProps } from '../../ui';
|
|
3
|
+
export type TWidget = {
|
|
4
|
+
ui: ReactElement<TBlockProps>;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
type TWidgetProviderState = {
|
|
8
|
+
widget: TWidget | null;
|
|
9
|
+
setWidget: (widgets: TWidget | null) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const WidgetsProviderContext: import("react").Context<TWidgetProviderState>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { WidgetsProviderContext } from './widget-context';
|
|
4
|
+
export function WidgetProvider({ children }) {
|
|
5
|
+
const [widget, setWidget] = useState(null);
|
|
6
|
+
const value = useMemo(() => ({
|
|
7
|
+
widget,
|
|
8
|
+
setWidget: (newWidget) => {
|
|
9
|
+
setWidget(newWidget);
|
|
10
|
+
},
|
|
11
|
+
}), [widget]);
|
|
12
|
+
return _jsx(WidgetsProviderContext.Provider, { value: value, children: children });
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TAlert = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
timestamp: Date;
|
|
6
|
+
isRead: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type TAlertContext = {
|
|
9
|
+
currentAlert: TAlert | null;
|
|
10
|
+
history: TAlert[];
|
|
11
|
+
addAlert: (alert: Omit<TAlert, 'id' | 'timestamp' | 'isRead'>) => void;
|
|
12
|
+
clearHistory: () => void;
|
|
13
|
+
dismissCurrentAlert: (isRead?: boolean) => void;
|
|
14
|
+
markAllAsRead: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const AlertContext: import("react").Context<TAlertContext | undefined>;
|