@shipfox/react-ui 0.3.0 → 0.4.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/.storybook/preview.tsx +1 -1
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +11 -0
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/alert/alert.js +3 -3
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.stories.js +2 -2
- package/dist/components/alert/alert.stories.js.map +1 -1
- package/dist/components/avatar/avatar-group.js +3 -3
- package/dist/components/avatar/avatar-group.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +4 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +7 -8
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/avatar/avatar.stories.js +15 -3
- package/dist/components/avatar/avatar.stories.js.map +1 -1
- package/dist/components/badge/badge.d.ts +48 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +72 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/badge.stories.js +802 -0
- package/dist/components/badge/badge.stories.js.map +1 -0
- package/dist/components/badge/icon-badge.d.ts +9 -0
- package/dist/components/badge/icon-badge.d.ts.map +1 -0
- package/dist/components/badge/icon-badge.js +32 -0
- package/dist/components/badge/icon-badge.js.map +1 -0
- package/dist/components/badge/index.d.ts +5 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +6 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/badge/status-badge.d.ts +9 -0
- package/dist/components/badge/status-badge.d.ts.map +1 -0
- package/dist/components/badge/status-badge.js +29 -0
- package/dist/components/badge/status-badge.js.map +1 -0
- package/dist/components/badge/user-badge.d.ts +8 -0
- package/dist/components/badge/user-badge.d.ts.map +1 -0
- package/dist/components/badge/user-badge.js +24 -0
- package/dist/components/badge/user-badge.js.map +1 -0
- package/dist/components/{button.d.ts → button/button.d.ts} +1 -1
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/{button.js → button/button.js} +2 -2
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/{button.stories.js → button/button.stories.js} +1 -1
- package/dist/components/button/button.stories.js.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/checkbox/checkbox-label.d.ts +14 -0
- package/dist/components/checkbox/checkbox-label.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox-label.js +82 -0
- package/dist/components/checkbox/checkbox-label.js.map +1 -0
- package/dist/components/checkbox/checkbox-links.d.ts +18 -0
- package/dist/components/checkbox/checkbox-links.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox-links.js +58 -0
- package/dist/components/checkbox/checkbox-links.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +49 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/checkbox.stories.js +566 -0
- package/dist/components/checkbox/checkbox.stories.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +4 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/checkbox/index.js +5 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/code-block/code-block-footer.d.ts +26 -0
- package/dist/components/code-block/code-block-footer.d.ts.map +1 -0
- package/dist/components/code-block/code-block-footer.js +86 -0
- package/dist/components/code-block/code-block-footer.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +50 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.js +142 -0
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/code-block/code-block.stories.js +341 -0
- package/dist/components/code-block/code-block.stories.js.map +1 -0
- package/dist/components/code-block/code-content.d.ts +11 -0
- package/dist/components/code-block/code-content.d.ts.map +1 -0
- package/dist/components/code-block/code-content.js +29 -0
- package/dist/components/code-block/code-content.js.map +1 -0
- package/dist/components/code-block/code-copy-button.d.ts +11 -0
- package/dist/components/code-block/code-copy-button.d.ts.map +1 -0
- package/dist/components/code-block/code-copy-button.js +49 -0
- package/dist/components/code-block/code-copy-button.js.map +1 -0
- package/dist/components/code-block/code-tabs.d.ts +16 -0
- package/dist/components/code-block/code-tabs.d.ts.map +1 -0
- package/dist/components/code-block/code-tabs.js +98 -0
- package/dist/components/code-block/code-tabs.js.map +1 -0
- package/dist/components/code-block/index.d.ts +4 -0
- package/dist/components/code-block/index.d.ts.map +1 -0
- package/dist/components/code-block/index.js +5 -0
- package/dist/components/code-block/index.js.map +1 -0
- package/dist/components/dynamic-item/dynamic-item.d.ts +13 -0
- package/dist/components/dynamic-item/dynamic-item.d.ts.map +1 -0
- package/dist/components/dynamic-item/dynamic-item.js +43 -0
- package/dist/components/dynamic-item/dynamic-item.js.map +1 -0
- package/dist/components/dynamic-item/dynamic-item.stories.js +375 -0
- package/dist/components/dynamic-item/dynamic-item.stories.js.map +1 -0
- package/dist/components/dynamic-item/index.d.ts +2 -0
- package/dist/components/dynamic-item/index.d.ts.map +1 -0
- package/dist/components/dynamic-item/index.js +3 -0
- package/dist/components/dynamic-item/index.js.map +1 -0
- package/dist/components/icon/custom/index.d.ts +2 -0
- package/dist/components/icon/custom/index.d.ts.map +1 -1
- package/dist/components/icon/custom/index.js +2 -0
- package/dist/components/icon/custom/index.js.map +1 -1
- package/dist/components/icon/custom/slack-logo.d.ts +6 -0
- package/dist/components/icon/custom/slack-logo.d.ts.map +1 -0
- package/dist/components/icon/custom/slack-logo.js +34 -0
- package/dist/components/icon/custom/slack-logo.js.map +1 -0
- package/dist/components/icon/custom/stripe-logo.d.ts +8 -0
- package/dist/components/icon/custom/stripe-logo.d.ts.map +1 -0
- package/dist/components/icon/custom/stripe-logo.js +24 -0
- package/dist/components/icon/custom/stripe-logo.js.map +1 -0
- package/dist/components/icon/icon.d.ts +11 -2
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +12 -3
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/icon/icon.stories.js +6 -3
- package/dist/components/icon/icon.stories.js.map +1 -1
- package/dist/components/index.d.ts +9 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +10 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/inline-tips/inline-tips.d.ts +1 -1
- package/dist/components/inline-tips/inline-tips.d.ts.map +1 -1
- package/dist/components/inline-tips/inline-tips.js +1 -1
- package/dist/components/inline-tips/inline-tips.js.map +1 -1
- package/dist/components/inline-tips/inline-tips.stories.js +5 -5
- package/dist/components/inline-tips/inline-tips.stories.js.map +1 -1
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +3 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/{input.js → input/input.js} +2 -2
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/{input.stories.js → input/input.stories.js} +1 -1
- package/dist/components/input/input.stories.js.map +1 -0
- package/dist/components/item/index.d.ts +2 -0
- package/dist/components/item/index.d.ts.map +1 -0
- package/dist/components/item/index.js +3 -0
- package/dist/components/item/index.js.map +1 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.d.ts.map +1 -0
- package/dist/components/item/item.js +120 -0
- package/dist/components/item/item.js.map +1 -0
- package/dist/components/item/item.stories.js +232 -0
- package/dist/components/item/item.stories.js.map +1 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/index.d.ts.map +1 -0
- package/dist/components/label/index.js +3 -0
- package/dist/components/label/index.js.map +1 -0
- package/dist/components/label/label.d.ts +7 -0
- package/dist/components/label/label.d.ts.map +1 -0
- package/dist/components/label/label.js +13 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/label/label.stories.js +105 -0
- package/dist/components/label/label.stories.js.map +1 -0
- package/dist/components/moving-border/moving-border.d.ts +9 -0
- package/dist/components/moving-border/moving-border.d.ts.map +1 -0
- package/dist/components/moving-border/moving-border.js +54 -0
- package/dist/components/moving-border/moving-border.js.map +1 -0
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/theme/index.d.ts +2 -0
- package/dist/components/theme/index.d.ts.map +1 -0
- package/dist/components/theme/index.js +3 -0
- package/dist/components/theme/index.js.map +1 -0
- package/dist/components/{theme-provider.d.ts → theme/theme-provider.d.ts} +1 -1
- package/dist/components/theme/theme-provider.d.ts.map +1 -0
- package/dist/components/{theme-provider.js → theme/theme-provider.js} +1 -1
- package/dist/components/theme/theme-provider.js.map +1 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/index.js +4 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/toast/toast-custom.d.ts +19 -0
- package/dist/components/toast/toast-custom.d.ts.map +1 -0
- package/dist/components/toast/toast-custom.js +134 -0
- package/dist/components/toast/toast-custom.js.map +1 -0
- package/dist/components/toast/toast.d.ts +5 -0
- package/dist/components/toast/toast.d.ts.map +1 -0
- package/dist/components/toast/toast.js +40 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/toast/toast.stories.js +326 -0
- package/dist/components/toast/toast.stories.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +18 -5
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +63 -3
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/tooltip/tooltip.stories.js +560 -0
- package/dist/components/tooltip/tooltip.stories.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useResolvedTheme.d.ts +2 -0
- package/dist/hooks/useResolvedTheme.d.ts.map +1 -0
- package/dist/hooks/useResolvedTheme.js +24 -0
- package/dist/hooks/useResolvedTheme.js.map +1 -0
- package/dist/hooks/useShikiHighlight.d.ts +28 -0
- package/dist/hooks/useShikiHighlight.d.ts.map +1 -0
- package/dist/hooks/useShikiHighlight.js +106 -0
- package/dist/hooks/useShikiHighlight.js.map +1 -0
- package/dist/hooks/useShikiStyleInjection.d.ts +2 -0
- package/dist/hooks/useShikiStyleInjection.d.ts.map +1 -0
- package/dist/hooks/useShikiStyleInjection.js +34 -0
- package/dist/hooks/useShikiStyleInjection.js.map +1 -0
- package/index.css +101 -9
- package/package.json +6 -3
- package/src/assets/illustration-1.svg +92 -0
- package/src/assets/illustration-2.svg +14 -0
- package/src/assets/illustration-gradient.svg +7049 -0
- package/src/components/alert/alert.stories.tsx +2 -2
- package/src/components/alert/alert.tsx +3 -3
- package/src/components/avatar/avatar-group.tsx +3 -3
- package/src/components/avatar/avatar.stories.tsx +9 -2
- package/src/components/avatar/avatar.tsx +10 -6
- package/src/components/badge/badge.stories.tsx +468 -0
- package/src/components/badge/badge.tsx +147 -0
- package/src/components/badge/icon-badge.tsx +43 -0
- package/src/components/badge/index.ts +4 -0
- package/src/components/badge/status-badge.tsx +43 -0
- package/src/components/badge/user-badge.tsx +34 -0
- package/src/components/{button.tsx → button/button.tsx} +1 -1
- package/src/components/button/index.ts +1 -0
- package/src/components/checkbox/checkbox-label.tsx +125 -0
- package/src/components/checkbox/checkbox-links.tsx +90 -0
- package/src/components/checkbox/checkbox.stories.tsx +375 -0
- package/src/components/checkbox/checkbox.tsx +71 -0
- package/src/components/checkbox/index.ts +3 -0
- package/src/components/code-block/code-block-footer.tsx +173 -0
- package/src/components/code-block/code-block.stories.tsx +323 -0
- package/src/components/code-block/code-block.tsx +283 -0
- package/src/components/code-block/code-content.tsx +60 -0
- package/src/components/code-block/code-copy-button.tsx +73 -0
- package/src/components/code-block/code-tabs.tsx +170 -0
- package/src/components/code-block/index.ts +3 -0
- package/src/components/dynamic-item/dynamic-item.stories.tsx +261 -0
- package/src/components/dynamic-item/dynamic-item.tsx +68 -0
- package/src/components/dynamic-item/index.ts +1 -0
- package/src/components/icon/custom/index.ts +2 -0
- package/src/components/icon/custom/slack-logo.tsx +35 -0
- package/src/components/icon/custom/stripe-logo.tsx +27 -0
- package/src/components/icon/icon.stories.tsx +3 -1
- package/src/components/icon/icon.tsx +19 -1
- package/src/components/index.ts +9 -1
- package/src/components/inline-tips/inline-tips.stories.tsx +3 -3
- package/src/components/inline-tips/inline-tips.tsx +2 -2
- package/src/components/input/index.ts +1 -0
- package/src/components/{input.tsx → input/input.tsx} +1 -1
- package/src/components/item/index.ts +1 -0
- package/src/components/item/item.stories.tsx +150 -0
- package/src/components/item/item.tsx +182 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/label/label.stories.tsx +67 -0
- package/src/components/label/label.tsx +15 -0
- package/src/components/moving-border/moving-border.tsx +67 -0
- package/src/components/textarea/textarea.tsx +1 -1
- package/src/components/theme/index.ts +1 -0
- package/src/components/toast/index.ts +2 -0
- package/src/components/toast/toast-custom.tsx +154 -0
- package/src/components/toast/toast.stories.tsx +369 -0
- package/src/components/toast/toast.tsx +41 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/tooltip/tooltip.stories.tsx +284 -0
- package/src/components/tooltip/tooltip.tsx +79 -10
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useResolvedTheme.ts +34 -0
- package/src/hooks/useShikiHighlight.ts +140 -0
- package/src/hooks/useShikiStyleInjection.ts +34 -0
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/button.js.map +0 -1
- package/dist/components/button.stories.js.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/input.js.map +0 -1
- package/dist/components/input.stories.js.map +0 -1
- package/dist/components/theme-provider.d.ts.map +0 -1
- package/dist/components/theme-provider.js.map +0 -1
- /package/dist/components/{input.d.ts → input/input.d.ts} +0 -0
- /package/src/components/{button.stories.tsx → button/button.stories.tsx} +0 -0
- /package/src/components/{input.stories.tsx → input/input.stories.tsx} +0 -0
- /package/src/components/{theme-provider.tsx → theme/theme-provider.tsx} +0 -0
package/.storybook/preview.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
2
|
import type {Decorator, Preview} from '@storybook/react';
|
|
3
|
-
import {ThemeProvider} from '../src/components/theme
|
|
3
|
+
import {ThemeProvider} from '../src/components/theme';
|
|
4
4
|
|
|
5
5
|
const withTheme: Decorator = (Story, context) => {
|
|
6
6
|
return <ThemeProvider defaultTheme={context.globals.theme}>{Story()}</ThemeProvider>;
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
WARN Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.4.0 build /runnertmp/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> swc
|
|
5
5
|
|
|
6
|
-
Successfully compiled:
|
|
6
|
+
Successfully compiled: 103 files with swc (58.6ms)
|
package/.turbo/turbo-check.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
WARN Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.4.0 check /runnertmp/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> biome-check --fix
|
|
5
5
|
|
|
6
|
-
Checked
|
|
6
|
+
Checked 119 files in 309ms. No fixes applied.
|
package/.turbo/turbo-type.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
WARN Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.4.0 type /runnertmp/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> tsc-emit
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @shipfox/react-ui
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2cfbf33: Add Codeblock components
|
|
8
|
+
- dd023e1: Add checkbox and label components
|
|
9
|
+
- a808a32: Add toast components and refactor
|
|
10
|
+
- feeb725: Add Item and DynamicItem components
|
|
11
|
+
- 34000b7: Add Badge component
|
|
12
|
+
- 090e011: Add tooltip component
|
|
13
|
+
|
|
3
14
|
## 0.3.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
declare const alertVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "info" | "default" | "success" | "warning" | "error" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare const closeIconVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "info" | "default" | "success" | "warning" | "error" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
type AlertProps = ComponentProps<'div'> & VariantProps<typeof alertVariants>;
|
|
10
10
|
declare function Alert({ className, variant, children, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ const alertVariants = cva('relative w-full rounded-l-4 rounded-r-8 px-16 py-12 t
|
|
|
9
9
|
info: 'bg-tag-blue-bg text-foreground-neutral-base border-tag-blue-border',
|
|
10
10
|
success: 'bg-tag-success-bg text-foreground-neutral-base border-tag-success-border',
|
|
11
11
|
warning: 'bg-tag-warning-bg text-foreground-neutral-base border-tag-warning-border',
|
|
12
|
-
|
|
12
|
+
error: 'bg-tag-error-bg text-foreground-neutral-base border-tag-error-border'
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
defaultVariants: {
|
|
@@ -23,7 +23,7 @@ const alertLineVariants = cva('w-4 self-stretch rounded-full', {
|
|
|
23
23
|
info: 'bg-tag-blue-icon',
|
|
24
24
|
success: 'bg-tag-success-icon',
|
|
25
25
|
warning: 'bg-tag-warning-icon',
|
|
26
|
-
|
|
26
|
+
error: 'bg-tag-error-icon'
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
defaultVariants: {
|
|
@@ -37,7 +37,7 @@ const closeIconVariants = cva('w-16 h-16', {
|
|
|
37
37
|
info: 'text-tag-blue-icon',
|
|
38
38
|
success: 'text-tag-success-icon',
|
|
39
39
|
warning: 'text-tag-warning-icon',
|
|
40
|
-
|
|
40
|
+
error: 'text-tag-error-icon'
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
defaultVariants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import {cva, type VariantProps} from 'class-variance-authority';\nimport {Icon} from 'components/icon';\nimport type {ComponentProps} from 'react';\nimport {cn} from 'utils/cn';\n\nconst alertVariants = cva(\n 'relative w-full rounded-l-4 rounded-r-8 px-16 py-12 text-sm flex gap-12 items-start border',\n {\n variants: {\n variant: {\n default: 'bg-tag-neutral-bg text-foreground-neutral-base border-tag-neutral-border',\n info: 'bg-tag-blue-bg text-foreground-neutral-base border-tag-blue-border',\n success: 'bg-tag-success-bg text-foreground-neutral-base border-tag-success-border',\n warning: 'bg-tag-warning-bg text-foreground-neutral-base border-tag-warning-border',\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import {cva, type VariantProps} from 'class-variance-authority';\nimport {Icon} from 'components/icon';\nimport type {ComponentProps} from 'react';\nimport {cn} from 'utils/cn';\n\nconst alertVariants = cva(\n 'relative w-full rounded-l-4 rounded-r-8 px-16 py-12 text-sm flex gap-12 items-start border',\n {\n variants: {\n variant: {\n default: 'bg-tag-neutral-bg text-foreground-neutral-base border-tag-neutral-border',\n info: 'bg-tag-blue-bg text-foreground-neutral-base border-tag-blue-border',\n success: 'bg-tag-success-bg text-foreground-neutral-base border-tag-success-border',\n warning: 'bg-tag-warning-bg text-foreground-neutral-base border-tag-warning-border',\n error: 'bg-tag-error-bg text-foreground-neutral-base border-tag-error-border',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nconst alertLineVariants = cva('w-4 self-stretch rounded-full', {\n variants: {\n variant: {\n default: 'bg-tag-neutral-icon',\n info: 'bg-tag-blue-icon',\n success: 'bg-tag-success-icon',\n warning: 'bg-tag-warning-icon',\n error: 'bg-tag-error-icon',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nconst closeIconVariants = cva('w-16 h-16', {\n variants: {\n variant: {\n default: 'text-tag-neutral-icon',\n info: 'text-tag-blue-icon',\n success: 'text-tag-success-icon',\n warning: 'text-tag-warning-icon',\n error: 'text-tag-error-icon',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\ntype AlertProps = ComponentProps<'div'> & VariantProps<typeof alertVariants>;\n\nfunction Alert({className, variant, children, ...props}: AlertProps) {\n return (\n <div className=\"w-full flex items-start gap-4\">\n <div data-slot=\"alert-line\" className={cn(alertLineVariants({variant}))} aria-hidden=\"true\" />\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({variant}), className)}\n {...props}\n >\n {children}\n </div>\n </div>\n );\n}\n\nfunction AlertContent({className, ...props}: ComponentProps<'div'>) {\n return <div data-slot=\"alert-content\" className={cn('flex-1 min-w-0', className)} {...props} />;\n}\n\nfunction AlertTitle({className, ...props}: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn('font-medium text-sm leading-20 text-foreground-neutral-base mb-4', className)}\n {...props}\n />\n );\n}\n\nfunction AlertDescription({className, ...props}: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-xs leading-20 text-foreground-neutral-base [&_p]:leading-relaxed',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertActions({className, ...props}: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-actions\"\n className={cn('flex items-center gap-8 mt-8', className)}\n {...props}\n />\n );\n}\n\nfunction AlertAction({className, ...props}: ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"alert-action\"\n type=\"button\"\n className={cn(\n 'bg-transparent border-none p-0 cursor-pointer text-xs font-medium leading-20 text-foreground-neutral-base hover:text-foreground-neutral-subtle transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertClose({\n className,\n variant = 'default',\n ...props\n}: ComponentProps<'button'> & VariantProps<typeof closeIconVariants>) {\n return (\n <button\n data-slot=\"alert-close\"\n type=\"button\"\n className={cn(\n 'absolute cursor-pointer top-12 right-12 rounded-4 p-4 bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2',\n className,\n )}\n aria-label=\"Close\"\n {...props}\n >\n <Icon name=\"close\" className={cn(closeIconVariants({variant}))} />\n </button>\n );\n}\n\nexport {Alert, AlertContent, AlertTitle, AlertDescription, AlertActions, AlertAction, AlertClose};\n"],"names":["cva","Icon","cn","alertVariants","variants","variant","default","info","success","warning","error","defaultVariants","alertLineVariants","closeIconVariants","Alert","className","children","props","div","data-slot","aria-hidden","role","AlertContent","AlertTitle","AlertDescription","AlertActions","AlertAction","button","type","AlertClose","aria-label","name"],"mappings":";AAAA,SAAQA,GAAG,QAA0B,2BAA2B;AAChE,SAAQC,IAAI,QAAO,kBAAkB;AAErC,SAAQC,EAAE,QAAO,WAAW;AAE5B,MAAMC,gBAAgBH,IACpB,8FACA;IACEI,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,MAAM;YACNC,SAAS;YACTC,SAAS;YACTC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfN,SAAS;IACX;AACF;AAGF,MAAMO,oBAAoBZ,IAAI,iCAAiC;IAC7DI,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,MAAM;YACNC,SAAS;YACTC,SAAS;YACTC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfN,SAAS;IACX;AACF;AAEA,MAAMQ,oBAAoBb,IAAI,aAAa;IACzCI,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,MAAM;YACNC,SAAS;YACTC,SAAS;YACTC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfN,SAAS;IACX;AACF;AAIA,SAASS,MAAM,EAACC,SAAS,EAAEV,OAAO,EAAEW,QAAQ,EAAE,GAAGC,OAAkB;IACjE,qBACE,MAACC;QAAIH,WAAU;;0BACb,KAACG;gBAAIC,aAAU;gBAAaJ,WAAWb,GAAGU,kBAAkB;oBAACP;gBAAO;gBAAKe,eAAY;;0BACrF,KAACF;gBACCC,aAAU;gBACVE,MAAK;gBACLN,WAAWb,GAAGC,cAAc;oBAACE;gBAAO,IAAIU;gBACvC,GAAGE,KAAK;0BAERD;;;;AAIT;AAEA,SAASM,aAAa,EAACP,SAAS,EAAE,GAAGE,OAA6B;IAChE,qBAAO,KAACC;QAAIC,aAAU;QAAgBJ,WAAWb,GAAG,kBAAkBa;QAAa,GAAGE,KAAK;;AAC7F;AAEA,SAASM,WAAW,EAACR,SAAS,EAAE,GAAGE,OAA6B;IAC9D,qBACE,KAACC;QACCC,aAAU;QACVJ,WAAWb,GAAG,oEAAoEa;QACjF,GAAGE,KAAK;;AAGf;AAEA,SAASO,iBAAiB,EAACT,SAAS,EAAE,GAAGE,OAA6B;IACpE,qBACE,KAACC;QACCC,aAAU;QACVJ,WAAWb,GACT,yEACAa;QAED,GAAGE,KAAK;;AAGf;AAEA,SAASQ,aAAa,EAACV,SAAS,EAAE,GAAGE,OAA6B;IAChE,qBACE,KAACC;QACCC,aAAU;QACVJ,WAAWb,GAAG,gCAAgCa;QAC7C,GAAGE,KAAK;;AAGf;AAEA,SAASS,YAAY,EAACX,SAAS,EAAE,GAAGE,OAAgC;IAClE,qBACE,KAACU;QACCR,aAAU;QACVS,MAAK;QACLb,WAAWb,GACT,8RACAa;QAED,GAAGE,KAAK;;AAGf;AAEA,SAASY,WAAW,EAClBd,SAAS,EACTV,UAAU,SAAS,EACnB,GAAGY,OAC+D;IAClE,qBACE,KAACU;QACCR,aAAU;QACVS,MAAK;QACLb,WAAWb,GACT,sUACAa;QAEFe,cAAW;QACV,GAAGb,KAAK;kBAET,cAAA,KAAChB;YAAK8B,MAAK;YAAQhB,WAAWb,GAAGW,kBAAkB;gBAACR;YAAO;;;AAGjE;AAEA,SAAQS,KAAK,EAAEQ,YAAY,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,WAAW,EAAEG,UAAU,GAAE"}
|
|
@@ -15,7 +15,7 @@ const meta = {
|
|
|
15
15
|
'info',
|
|
16
16
|
'success',
|
|
17
17
|
'warning',
|
|
18
|
-
'
|
|
18
|
+
'error'
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
},
|
|
@@ -29,7 +29,7 @@ const variants = [
|
|
|
29
29
|
'info',
|
|
30
30
|
'success',
|
|
31
31
|
'warning',
|
|
32
|
-
'
|
|
32
|
+
'error'
|
|
33
33
|
];
|
|
34
34
|
export const Default = {
|
|
35
35
|
render: (args)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/alert/alert.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Header} from 'components/typography';\nimport {\n Alert,\n AlertAction,\n AlertActions,\n AlertClose,\n AlertContent,\n AlertDescription,\n AlertTitle,\n} from './alert';\n\nconst meta = {\n title: 'Components/Alert',\n component: Alert,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: ['default', 'info', 'success', 'warning', '
|
|
1
|
+
{"version":3,"sources":["../../../src/components/alert/alert.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Header} from 'components/typography';\nimport {\n Alert,\n AlertAction,\n AlertActions,\n AlertClose,\n AlertContent,\n AlertDescription,\n AlertTitle,\n} from './alert';\n\nconst meta = {\n title: 'Components/Alert',\n component: Alert,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: ['default', 'info', 'success', 'warning', 'error'],\n },\n },\n args: {\n variant: 'default',\n },\n} satisfies Meta<typeof Alert>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nconst variants = ['default', 'info', 'success', 'warning', 'error'] as const;\n\nexport const Default: Story = {\n render: (args) => {\n return (\n <Alert {...args}>\n <AlertContent>\n <AlertTitle>Title</AlertTitle>\n <AlertDescription>Description</AlertDescription>\n <AlertActions>\n <AlertAction>Download</AlertAction>\n <AlertAction>View</AlertAction>\n </AlertActions>\n </AlertContent>\n <AlertClose variant={args.variant} />\n </Alert>\n );\n },\n};\n\nexport const DesignMock: Story = {\n render: () => {\n return (\n <div className=\"flex flex-col gap-32 pb-64 pt-32 px-32 bg-background-neutral-base\">\n <Header variant=\"h3\" className=\"text-foreground-neutral-subtle\">\n ALERTS\n </Header>\n <div className=\"flex flex-col gap-16\">\n {variants.map((variant) => (\n <Alert key={variant} variant={variant}>\n <AlertContent>\n <AlertTitle>Title</AlertTitle>\n <AlertDescription>Description</AlertDescription>\n <AlertActions>\n <AlertAction>Download</AlertAction>\n <AlertAction>View</AlertAction>\n </AlertActions>\n </AlertContent>\n <AlertClose variant={variant} />\n </Alert>\n ))}\n </div>\n </div>\n );\n },\n};\n"],"names":["Header","Alert","AlertAction","AlertActions","AlertClose","AlertContent","AlertDescription","AlertTitle","meta","title","component","tags","argTypes","variant","control","options","args","variants","Default","render","DesignMock","div","className","map"],"mappings":";AACA,SAAQA,MAAM,QAAO,wBAAwB;AAC7C,SACEC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,gBAAgB,EAChBC,UAAU,QACL,UAAU;AAEjB,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWT;IACXU,MAAM;QAAC;KAAW;IAClBC,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,SAAS;gBAAC;gBAAW;gBAAQ;gBAAW;gBAAW;aAAQ;QAC7D;IACF;IACAC,MAAM;QACJH,SAAS;IACX;AACF;AAEA,eAAeL,KAAK;AAIpB,MAAMS,WAAW;IAAC;IAAW;IAAQ;IAAW;IAAW;CAAQ;AAEnE,OAAO,MAAMC,UAAiB;IAC5BC,QAAQ,CAACH;QACP,qBACE,MAACf;YAAO,GAAGe,IAAI;;8BACb,MAACX;;sCACC,KAACE;sCAAW;;sCACZ,KAACD;sCAAiB;;sCAClB,MAACH;;8CACC,KAACD;8CAAY;;8CACb,KAACA;8CAAY;;;;;;8BAGjB,KAACE;oBAAWS,SAASG,KAAKH,OAAO;;;;IAGvC;AACF,EAAE;AAEF,OAAO,MAAMO,aAAoB;IAC/BD,QAAQ;QACN,qBACE,MAACE;YAAIC,WAAU;;8BACb,KAACtB;oBAAOa,SAAQ;oBAAKS,WAAU;8BAAiC;;8BAGhE,KAACD;oBAAIC,WAAU;8BACZL,SAASM,GAAG,CAAC,CAACV,wBACb,MAACZ;4BAAoBY,SAASA;;8CAC5B,MAACR;;sDACC,KAACE;sDAAW;;sDACZ,KAACD;sDAAiB;;sDAClB,MAACH;;8DACC,KAACD;8DAAY;;8DACb,KAACA;8DAAY;;;;;;8CAGjB,KAACE;oCAAWS,SAASA;;;2BATXA;;;;IAetB;AACF,EAAE"}
|
|
@@ -10,8 +10,8 @@ const avatarGroupVariants = cva('flex items-start', {
|
|
|
10
10
|
'3xs': '-space-x-4',
|
|
11
11
|
'2xs': '-space-x-4',
|
|
12
12
|
xs: '-space-x-4',
|
|
13
|
-
sm: '-space-x-
|
|
14
|
-
md: '-space-x-
|
|
13
|
+
sm: '-space-x-6',
|
|
14
|
+
md: '-space-x-6',
|
|
15
15
|
lg: '-space-x-6',
|
|
16
16
|
xl: '-space-x-6',
|
|
17
17
|
'2xl': '-space-x-12',
|
|
@@ -47,7 +47,7 @@ function AvatarContainer({ children, zIndex, tooltipContent, tooltipProps, anima
|
|
|
47
47
|
asChild: true,
|
|
48
48
|
children: /*#__PURE__*/ _jsx("div", {
|
|
49
49
|
"data-slot": "avatar-container",
|
|
50
|
-
className: cn('relative', animateOnHover && 'transition-transform duration-300 ease-out hover:-translate-y-
|
|
50
|
+
className: cn('relative', animateOnHover && 'transition-transform duration-300 ease-in-out hover:-translate-y-4'),
|
|
51
51
|
style: {
|
|
52
52
|
zIndex
|
|
53
53
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["import * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport {cva, type VariantProps} from 'class-variance-authority';\nimport {\n Children,\n type ComponentProps,\n cloneElement,\n type ReactElement,\n type ReactNode,\n useMemo,\n} from 'react';\nimport {cn} from 'utils/cn';\nimport {TooltipContent, TooltipProvider, TooltipTrigger} from '../tooltip/tooltip';\n\nconst avatarGroupVariants = cva('flex items-start', {\n variants: {\n size: {\n '3xs': '-space-x-4',\n '2xs': '-space-x-4',\n xs: '-space-x-4',\n sm: '-space-x-
|
|
1
|
+
{"version":3,"sources":["../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["import * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport {cva, type VariantProps} from 'class-variance-authority';\nimport {\n Children,\n type ComponentProps,\n cloneElement,\n type ReactElement,\n type ReactNode,\n useMemo,\n} from 'react';\nimport {cn} from 'utils/cn';\nimport {TooltipContent, TooltipProvider, TooltipTrigger} from '../tooltip/tooltip';\n\nconst avatarGroupVariants = cva('flex items-start', {\n variants: {\n size: {\n '3xs': '-space-x-4',\n '2xs': '-space-x-4',\n xs: '-space-x-4',\n sm: '-space-x-6',\n md: '-space-x-6',\n lg: '-space-x-6',\n xl: '-space-x-6',\n '2xl': '-space-x-12',\n '3xl': '-space-x-12',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nconst avatarGroupOverflowVariants = cva(\n 'flex shrink-0 items-center justify-center rounded-full bg-background-components-base text-foreground-neutral-subtle font-medium ring-1 ring-border-neutral-base-component ring-offset-1 ring-offset-background-neutral-base shadow-button-neutral',\n {\n variants: {\n size: {\n '3xs': 'size-[18px] text-[10px] leading-[10px]',\n '2xs': 'size-[20px] text-[11px] leading-[11px]',\n xs: 'size-[24px] text-xs leading-4',\n sm: 'size-[28px] text-xs leading-5',\n md: 'size-[32px] text-sm leading-5',\n lg: 'size-[36px] text-sm leading-5',\n xl: 'size-[40px] text-base leading-6',\n '2xl': 'size-[80px] text-2xl leading-8',\n '3xl': 'size-[120px] text-4xl leading-[56px]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\ntype TooltipContentProps = ComponentProps<typeof TooltipContent>;\n\ntype AvatarContainerProps = {\n children: ReactNode;\n zIndex: number;\n tooltipContent?: ReactNode;\n tooltipProps?: Partial<TooltipContentProps>;\n animateOnHover?: boolean;\n};\n\nfunction AvatarContainer({\n children,\n zIndex,\n tooltipContent,\n tooltipProps,\n animateOnHover = false,\n}: AvatarContainerProps) {\n return (\n <TooltipPrimitive.Root>\n <TooltipTrigger asChild>\n <div\n data-slot=\"avatar-container\"\n className={cn(\n 'relative',\n animateOnHover && 'transition-transform duration-300 ease-in-out hover:-translate-y-4',\n )}\n style={{zIndex}}\n >\n {children}\n </div>\n </TooltipTrigger>\n {tooltipContent && (\n <AvatarGroupTooltip {...tooltipProps}>{tooltipContent}</AvatarGroupTooltip>\n )}\n </TooltipPrimitive.Root>\n );\n}\n\nfunction getTooltipContent(children: ReactNode): ReactNode | null {\n const tooltip = Children.toArray(children).find(\n (child) =>\n typeof child === 'object' &&\n child !== null &&\n 'type' in child &&\n child.type === AvatarGroupTooltip,\n ) as ReactElement<ComponentProps<typeof AvatarGroupTooltip>> | undefined;\n\n return tooltip?.props.children || null;\n}\n\ntype AvatarGroupTooltipProps = TooltipContentProps;\n\nfunction AvatarGroupTooltip(props: AvatarGroupTooltipProps) {\n return <TooltipContent {...props} />;\n}\n\ntype AvatarGroupProps = ComponentProps<'div'> &\n VariantProps<typeof avatarGroupVariants> & {\n children: ReactElement[];\n maxVisible?: number;\n animateOnHover?: boolean;\n tooltipProps?: Partial<TooltipContentProps>;\n };\n\nexport function AvatarGroup({\n className,\n size = 'md',\n children,\n maxVisible,\n animateOnHover = false,\n tooltipProps = {side: 'top', sideOffset: 8},\n ...props\n}: AvatarGroupProps) {\n const normalizedSize = size ?? 'md';\n\n const childrenArray = Children.toArray(children) as ReactElement[];\n\n const {visibleCount, visibleAvatars, overflowCount} = useMemo(() => {\n const count =\n maxVisible !== undefined ? Math.min(maxVisible, childrenArray.length) : childrenArray.length;\n return {\n visibleCount: count,\n visibleAvatars: childrenArray.slice(0, count),\n overflowCount: childrenArray.length - count,\n };\n }, [childrenArray, maxVisible]);\n\n return (\n <TooltipProvider delayDuration={0}>\n <div\n className={cn(avatarGroupVariants({size: normalizedSize}), className)}\n data-slot=\"avatar-group\"\n {...props}\n >\n {visibleAvatars.map((child, index) => {\n const zIndex = index + 1;\n const childProps = 'props' in child ? (child.props as {children?: ReactNode}) : {};\n const tooltipContent = getTooltipContent(childProps.children);\n\n return (\n <AvatarContainer\n key={child.key || index}\n zIndex={zIndex}\n tooltipContent={tooltipContent}\n tooltipProps={tooltipProps}\n animateOnHover={animateOnHover}\n >\n {cloneElement(child, {\n ...childProps,\n children: tooltipContent ? undefined : childProps.children,\n } as Partial<typeof childProps>)}\n </AvatarContainer>\n );\n })}\n {overflowCount > 0 && (\n <div\n className={cn(\n 'relative',\n avatarGroupOverflowVariants({size: normalizedSize}),\n 'rounded-full',\n )}\n style={{zIndex: visibleCount + 1}}\n >\n +{overflowCount}\n </div>\n )}\n </div>\n </TooltipProvider>\n );\n}\n\nexport {AvatarGroupTooltip, type AvatarGroupTooltipProps};\n"],"names":["TooltipPrimitive","cva","Children","cloneElement","useMemo","cn","TooltipContent","TooltipProvider","TooltipTrigger","avatarGroupVariants","variants","size","xs","sm","md","lg","xl","defaultVariants","avatarGroupOverflowVariants","AvatarContainer","children","zIndex","tooltipContent","tooltipProps","animateOnHover","Root","asChild","div","data-slot","className","style","AvatarGroupTooltip","getTooltipContent","tooltip","toArray","find","child","type","props","AvatarGroup","maxVisible","side","sideOffset","normalizedSize","childrenArray","visibleCount","visibleAvatars","overflowCount","count","undefined","Math","min","length","slice","delayDuration","map","index","childProps","key"],"mappings":";AAAA,YAAYA,sBAAsB,0BAA0B;AAC5D,SAAQC,GAAG,QAA0B,2BAA2B;AAChE,SACEC,QAAQ,EAERC,YAAY,EAGZC,OAAO,QACF,QAAQ;AACf,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQC,cAAc,EAAEC,eAAe,EAAEC,cAAc,QAAO,qBAAqB;AAEnF,MAAMC,sBAAsBR,IAAI,oBAAoB;IAClDS,UAAU;QACRC,MAAM;YACJ,OAAO;YACP,OAAO;YACPC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJ,OAAO;YACP,OAAO;QACT;IACF;IACAC,iBAAiB;QACfN,MAAM;IACR;AACF;AAEA,MAAMO,8BAA8BjB,IAClC,qPACA;IACES,UA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P,cAAcG;YACdF,gBAAgBF,cAAcS,KAAK,CAAC,GAAGL;YACvCD,eAAeH,cAAcQ,MAAM,GAAGJ;QACxC;IACF,GAAG;QAACJ;QAAeJ;KAAW;IAE9B,qBACE,KAACjC;QAAgB+C,eAAe;kBAC9B,cAAA,MAAC3B;YACCE,WAAWxB,GAAGI,oBAAoB;gBAACE,MAAMgC;YAAc,IAAId;YAC3DD,aAAU;YACT,GAAGU,KAAK;;gBAERQ,eAAeS,GAAG,CAAC,CAACnB,OAAOoB;oBAC1B,MAAMnC,SAASmC,QAAQ;oBACvB,MAAMC,aAAa,WAAWrB,QAASA,MAAME,KAAK,GAA8B,CAAC;oBACjF,MAAMhB,iBAAiBU,kBAAkByB,WAAWrC,QAAQ;oBAE5D,qBACE,KAACD;wBAECE,QAAQA;wBACRC,gBAAgBA;wBAChBC,cAAcA;wBACdC,gBAAgBA;kCAEfrB,cAAAA,aAAaiC,OAAO;4BACnB,GAAGqB,UAAU;4BACbrC,UAAUE,iBAAiB2B,YAAYQ,WAAWrC,QAAQ;wBAC5D;uBATKgB,MAAMsB,GAAG,IAAIF;gBAYxB;gBACCT,gBAAgB,mBACf,MAACpB;oBACCE,WAAWxB,GACT,YACAa,4BAA4B;wBAACP,MAAMgC;oBAAc,IACjD;oBAEFb,OAAO;wBAACT,QAAQwB,eAAe;oBAAC;;wBACjC;wBACGE;;;;;;AAMd;AAEA,SAAQhB,kBAAkB,GAAgC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import type { ComponentProps } from 'react';
|
|
4
|
+
import { type IconName } from '../icon/icon';
|
|
4
5
|
export declare const avatarVariants: (props?: ({
|
|
5
6
|
radius?: "full" | "rounded" | null | undefined;
|
|
6
7
|
size?: "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
@@ -15,7 +16,9 @@ export type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> & VariantP
|
|
|
15
16
|
alt?: string;
|
|
16
17
|
fallback?: string;
|
|
17
18
|
animateOnHover?: boolean;
|
|
19
|
+
logoName?: IconName;
|
|
20
|
+
logoClassName?: string;
|
|
18
21
|
};
|
|
19
|
-
export declare function Avatar({ className, radius, size, content, src, alt, fallback, animateOnHover, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function Avatar({ className, radius, size, content, src, alt, fallback, animateOnHover, logoName, logoClassName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
export { AvatarRoot, AvatarImage, AvatarFallback };
|
|
21
24
|
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAY,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEjD,eAAO,MAAM,cAAc;;;8EAyB1B,CAAC;AAqBF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,iBAAiB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAiBxF,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,MAAM,EACN,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,2CAQnF;AAED,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQvF;AAED,iBAAS,cAAc,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,QAAQ,CAAC,2CAQ7F;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GACnE,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,MAAM,EACN,IAAW,EACX,OAAmB,EACnB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,cAAsB,EACtB,QAAoB,EACpB,aAAa,EACb,GAAG,KAAK,EACT,EAAE,WAAW,2CAwFb;AAED,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAC,CAAC"}
|
|
@@ -80,7 +80,7 @@ function AvatarFallback({ className, ...props }) {
|
|
|
80
80
|
...props
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
export function Avatar({ className, radius, size = 'md', content = 'letters', src, alt, fallback, animateOnHover = false, ...props }) {
|
|
83
|
+
export function Avatar({ className, radius, size = 'md', content = 'letters', src, alt, fallback, animateOnHover = false, logoName = 'shipfox', logoClassName, ...props }) {
|
|
84
84
|
const innerClassName = 'flex h-full w-full items-center justify-center rounded-inherit relative bg-background-neutral-base dark:bg-background-components-base text-foreground-neutral-subtle';
|
|
85
85
|
const renderContent = ()=>{
|
|
86
86
|
if (content === 'image') {
|
|
@@ -109,21 +109,20 @@ export function Avatar({ className, radius, size = 'md', content = 'letters', sr
|
|
|
109
109
|
}
|
|
110
110
|
if (content === 'logo') {
|
|
111
111
|
return /*#__PURE__*/ _jsx(AvatarFallback, {
|
|
112
|
-
className: cn(innerClassName, 'p-[15%]'),
|
|
112
|
+
className: cn(innerClassName, logoClassName ?? 'p-[15%]'),
|
|
113
113
|
children: /*#__PURE__*/ _jsx(Icon, {
|
|
114
|
-
name:
|
|
115
|
-
|
|
116
|
-
className: "h-full w-full p-2"
|
|
114
|
+
name: logoName,
|
|
115
|
+
className: "h-full w-full"
|
|
117
116
|
})
|
|
118
117
|
});
|
|
119
118
|
}
|
|
120
119
|
if (content === 'logoPlaceholder') {
|
|
121
120
|
return /*#__PURE__*/ _jsx(AvatarFallback, {
|
|
122
|
-
className: cn(innerClassName, 'p-[15%]'),
|
|
121
|
+
className: cn(innerClassName, logoClassName ?? 'p-[15%]'),
|
|
123
122
|
children: /*#__PURE__*/ _jsx(Icon, {
|
|
124
|
-
name:
|
|
123
|
+
name: logoName,
|
|
125
124
|
color: "var(--foreground-neutral-subtle, #a1a1aa)",
|
|
126
|
-
className: "h-full w-full
|
|
125
|
+
className: "h-full w-full opacity-50"
|
|
127
126
|
})
|
|
128
127
|
});
|
|
129
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport {cva, type VariantProps} from 'class-variance-authority';\nimport type {ComponentProps, ReactNode} from 'react';\nimport {getInitial, getPlaceholderImageUrl} from 'utils';\nimport {cn} from 'utils/cn';\nimport {Icon} from '../icon/icon';\n\nexport const avatarVariants = cva(\n 'relative flex shrink-0 overflow-hidden bg-background-button-neutral-default text-foreground-neutral-base ring-1 ring-border-neutral-base-component ring-offset-1 ring-offset-background-neutral-base shadow-button-neutral',\n {\n variants: {\n radius: {\n full: 'rounded-full',\n rounded: 'rounded-6',\n },\n size: {\n '3xs': 'size-[18px]',\n '2xs': 'size-[20px]',\n xs: 'size-[24px]',\n sm: 'size-[28px]',\n md: 'size-[32px]',\n lg: 'size-[36px]',\n xl: 'size-[40px]',\n '2xl': 'size-[80px]',\n '3xl': 'size-[120px]',\n },\n },\n defaultVariants: {\n radius: 'full',\n size: 'md',\n },\n },\n);\n\nconst avatarInnerVariants = cva('flex h-full w-full items-center justify-center', {\n variants: {\n size: {\n '3xs': 'text-[10px] leading-[10px]',\n '2xs': 'text-[11px] leading-[11px]',\n xs: 'text-xs leading-4',\n sm: 'text-xs leading-5',\n md: 'text-sm leading-5',\n lg: 'text-sm leading-5',\n xl: 'text-base leading-6',\n '2xl': 'text-2xl leading-8',\n '3xl': 'text-4xl leading-[56px]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport type AvatarContent = 'letters' | 'logo' | 'logoPlaceholder' | 'image' | 'upload';\n\nconst UPLOAD_ICON_SIZE_MAP: Record<\n NonNullable<VariantProps<typeof avatarVariants>['size']>,\n string\n> = {\n '3xs': 'size-[10px]',\n '2xs': 'size-[12px]',\n xs: 'size-[14px]',\n sm: 'size-[16px]',\n md: 'size-[18px]',\n lg: 'size-[20px]',\n xl: 'size-[24px]',\n '2xl': 'size-[40px]',\n '3xl': 'size-[60px]',\n} as const;\n\nfunction AvatarRoot({\n className,\n radius,\n size,\n ...props\n}: ComponentProps<typeof AvatarPrimitive.Root> & VariantProps<typeof avatarVariants>) {\n return (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n className={cn(avatarVariants({radius, size}), className)}\n {...props}\n />\n );\n}\n\nfunction AvatarImage({className, ...props}: ComponentProps<typeof AvatarPrimitive.Image>) {\n return (\n <AvatarPrimitive.Image\n data-slot=\"avatar-image\"\n className={cn('aspect-square size-full', className)}\n {...props}\n />\n );\n}\n\nfunction AvatarFallback({className, ...props}: ComponentProps<typeof AvatarPrimitive.Fallback>) {\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-name\"\n className={cn('flex size-full items-center justify-center', className)}\n {...props}\n />\n );\n}\n\nexport type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> &\n VariantProps<typeof avatarVariants> & {\n content?: AvatarContent;\n src?: string;\n alt?: string;\n fallback?: string;\n animateOnHover?: boolean;\n };\n\nexport function Avatar({\n className,\n radius,\n size = 'md',\n content = 'letters',\n src,\n alt,\n fallback,\n animateOnHover = false,\n ...props\n}: AvatarProps) {\n const innerClassName =\n 'flex h-full w-full items-center justify-center rounded-inherit relative bg-background-neutral-base dark:bg-background-components-base text-foreground-neutral-subtle';\n\n const renderContent = (): ReactNode => {\n if (content === 'image') {\n const imageSrc = src || getPlaceholderImageUrl(fallback);\n return (\n <>\n <AvatarImage\n src={imageSrc}\n alt={alt || 'Avatar image'}\n className=\"object-scale-down rounded-inherit\"\n />\n <AvatarFallback className={innerClassName}>\n <div\n className={cn(\n 'absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2',\n avatarInnerVariants({size}),\n )}\n >\n <span className=\"font-medium\">{getInitial(fallback)}</span>\n </div>\n </AvatarFallback>\n </>\n );\n }\n\n if (content === 'logo') {\n return (\n <AvatarFallback className={cn(innerClassName, 'p-[15%]')}>\n <Icon name
|
|
1
|
+
{"version":3,"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport {cva, type VariantProps} from 'class-variance-authority';\nimport type {ComponentProps, ReactNode} from 'react';\nimport {getInitial, getPlaceholderImageUrl} from 'utils';\nimport {cn} from 'utils/cn';\nimport {Icon, type IconName} from '../icon/icon';\n\nexport const avatarVariants = cva(\n 'relative flex shrink-0 overflow-hidden bg-background-button-neutral-default text-foreground-neutral-base ring-1 ring-border-neutral-base-component ring-offset-1 ring-offset-background-neutral-base shadow-button-neutral',\n {\n variants: {\n radius: {\n full: 'rounded-full',\n rounded: 'rounded-6',\n },\n size: {\n '3xs': 'size-[18px]',\n '2xs': 'size-[20px]',\n xs: 'size-[24px]',\n sm: 'size-[28px]',\n md: 'size-[32px]',\n lg: 'size-[36px]',\n xl: 'size-[40px]',\n '2xl': 'size-[80px]',\n '3xl': 'size-[120px]',\n },\n },\n defaultVariants: {\n radius: 'full',\n size: 'md',\n },\n },\n);\n\nconst avatarInnerVariants = cva('flex h-full w-full items-center justify-center', {\n variants: {\n size: {\n '3xs': 'text-[10px] leading-[10px]',\n '2xs': 'text-[11px] leading-[11px]',\n xs: 'text-xs leading-4',\n sm: 'text-xs leading-5',\n md: 'text-sm leading-5',\n lg: 'text-sm leading-5',\n xl: 'text-base leading-6',\n '2xl': 'text-2xl leading-8',\n '3xl': 'text-4xl leading-[56px]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport type AvatarContent = 'letters' | 'logo' | 'logoPlaceholder' | 'image' | 'upload';\n\nconst UPLOAD_ICON_SIZE_MAP: Record<\n NonNullable<VariantProps<typeof avatarVariants>['size']>,\n string\n> = {\n '3xs': 'size-[10px]',\n '2xs': 'size-[12px]',\n xs: 'size-[14px]',\n sm: 'size-[16px]',\n md: 'size-[18px]',\n lg: 'size-[20px]',\n xl: 'size-[24px]',\n '2xl': 'size-[40px]',\n '3xl': 'size-[60px]',\n} as const;\n\nfunction AvatarRoot({\n className,\n radius,\n size,\n ...props\n}: ComponentProps<typeof AvatarPrimitive.Root> & VariantProps<typeof avatarVariants>) {\n return (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n className={cn(avatarVariants({radius, size}), className)}\n {...props}\n />\n );\n}\n\nfunction AvatarImage({className, ...props}: ComponentProps<typeof AvatarPrimitive.Image>) {\n return (\n <AvatarPrimitive.Image\n data-slot=\"avatar-image\"\n className={cn('aspect-square size-full', className)}\n {...props}\n />\n );\n}\n\nfunction AvatarFallback({className, ...props}: ComponentProps<typeof AvatarPrimitive.Fallback>) {\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-name\"\n className={cn('flex size-full items-center justify-center', className)}\n {...props}\n />\n );\n}\n\nexport type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> &\n VariantProps<typeof avatarVariants> & {\n content?: AvatarContent;\n src?: string;\n alt?: string;\n fallback?: string;\n animateOnHover?: boolean;\n logoName?: IconName;\n logoClassName?: string;\n };\n\nexport function Avatar({\n className,\n radius,\n size = 'md',\n content = 'letters',\n src,\n alt,\n fallback,\n animateOnHover = false,\n logoName = 'shipfox',\n logoClassName,\n ...props\n}: AvatarProps) {\n const innerClassName =\n 'flex h-full w-full items-center justify-center rounded-inherit relative bg-background-neutral-base dark:bg-background-components-base text-foreground-neutral-subtle';\n\n const renderContent = (): ReactNode => {\n if (content === 'image') {\n const imageSrc = src || getPlaceholderImageUrl(fallback);\n return (\n <>\n <AvatarImage\n src={imageSrc}\n alt={alt || 'Avatar image'}\n className=\"object-scale-down rounded-inherit\"\n />\n <AvatarFallback className={innerClassName}>\n <div\n className={cn(\n 'absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2',\n avatarInnerVariants({size}),\n )}\n >\n <span className=\"font-medium\">{getInitial(fallback)}</span>\n </div>\n </AvatarFallback>\n </>\n );\n }\n\n if (content === 'logo') {\n return (\n <AvatarFallback className={cn(innerClassName, logoClassName ?? 'p-[15%]')}>\n <Icon name={logoName} className=\"h-full w-full\" />\n </AvatarFallback>\n );\n }\n\n if (content === 'logoPlaceholder') {\n return (\n <AvatarFallback className={cn(innerClassName, logoClassName ?? 'p-[15%]')}>\n <Icon\n name={logoName}\n color=\"var(--foreground-neutral-subtle, #a1a1aa)\"\n className=\"h-full w-full opacity-50\"\n />\n </AvatarFallback>\n );\n }\n\n if (content === 'letters') {\n return (\n <AvatarFallback className={innerClassName}>\n <div\n className={cn(\n 'absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2',\n avatarInnerVariants({size}),\n )}\n >\n <span className=\"font-medium\">{getInitial(fallback)}</span>\n </div>\n </AvatarFallback>\n );\n }\n\n if (content === 'upload') {\n const iconSizeClass = UPLOAD_ICON_SIZE_MAP[size as keyof typeof UPLOAD_ICON_SIZE_MAP];\n return (\n <AvatarFallback className={innerClassName}>\n <Icon name=\"imageAdd\" className={cn('text-foreground-neutral-subtle', iconSizeClass)} />\n </AvatarFallback>\n );\n }\n\n return null;\n };\n\n return (\n <AvatarRoot\n className={cn(\n animateOnHover ? 'hover:-translate-y-8 transition-transform duration-300 ease-out' : '',\n className,\n )}\n radius={radius}\n size={size}\n {...props}\n >\n {renderContent()}\n </AvatarRoot>\n );\n}\n\nexport {AvatarRoot, AvatarImage, AvatarFallback};\n"],"names":["AvatarPrimitive","cva","getInitial","getPlaceholderImageUrl","cn","Icon","avatarVariants","variants","radius","full","rounded","size","xs","sm","md","lg","xl","defaultVariants","avatarInnerVariants","UPLOAD_ICON_SIZE_MAP","AvatarRoot","className","props","Root","data-slot","AvatarImage","Image","AvatarFallback","Fallback","Avatar","content","src","alt","fallback","animateOnHover","logoName","logoClassName","innerClassName","renderContent","imageSrc","div","span","name","color","iconSizeClass"],"mappings":";AAAA,YAAYA,qBAAqB,yBAAyB;AAC1D,SAAQC,GAAG,QAA0B,2BAA2B;AAEhE,SAAQC,UAAU,EAAEC,sBAAsB,QAAO,QAAQ;AACzD,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQC,IAAI,QAAsB,eAAe;AAEjD,OAAO,MAAMC,iBAAiBL,IAC5B,8NACA;IACEM,UAAU;QACRC,QAAQ;YACNC,MAAM;YACNC,SAAS;QACX;QACAC,MAAM;YACJ,OAAO;YACP,OAAO;YACPC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJ,OAAO;YACP,OAAO;QACT;IACF;IACAC,iBAAiB;QACfT,QAAQ;QACRG,MAAM;I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
+
'shipfox',
|
|
29
|
+
'slack',
|
|
30
|
+
'stripe',
|
|
31
|
+
'github'
|
|
32
|
+
];
|
|
27
33
|
const meta = {
|
|
28
34
|
title: 'Components/Avatar',
|
|
29
35
|
component: Avatar,
|
|
@@ -51,20 +57,26 @@ const meta = {
|
|
|
51
57
|
},
|
|
52
58
|
alt: {
|
|
53
59
|
control: 'text'
|
|
60
|
+
},
|
|
61
|
+
logoName: {
|
|
62
|
+
control: 'select',
|
|
63
|
+
options: logoNameOptions,
|
|
64
|
+
description: 'Logo icon name to display when content is "logo" or "logoPlaceholder"'
|
|
54
65
|
}
|
|
55
66
|
},
|
|
56
67
|
args: {
|
|
57
68
|
content: 'letters',
|
|
58
69
|
radius: 'full',
|
|
59
70
|
size: 'md',
|
|
60
|
-
fallback: 'John Doe'
|
|
71
|
+
fallback: 'John Doe',
|
|
72
|
+
logoName: 'shipfox'
|
|
61
73
|
}
|
|
62
74
|
};
|
|
63
75
|
export default meta;
|
|
64
76
|
export const Default = {
|
|
65
77
|
args: {
|
|
66
|
-
content: '
|
|
67
|
-
fallback: '
|
|
78
|
+
content: 'logo',
|
|
79
|
+
fallback: 'Shipfox'
|
|
68
80
|
},
|
|
69
81
|
render: (args)=>/*#__PURE__*/ _jsx("div", {
|
|
70
82
|
className: "flex flex-wrap items-end gap-16",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/avatar/avatar.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Code} from 'components/typography';\nimport {Avatar} from './avatar';\nimport {AvatarGroup, AvatarGroupTooltip} from './avatar-group';\n\nconst contentOptions = ['letters', 'logo', 'logoPlaceholder', 'image', 'upload'] as const;\nconst radiusOptions = ['full', 'rounded'] as const;\nconst sizeOptions = ['3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'] as const;\n\nconst meta = {\n title: 'Components/Avatar',\n component: Avatar,\n tags: ['autodocs'],\n argTypes: {\n content: {\n control: 'select',\n options: contentOptions,\n },\n radius: {\n control: 'select',\n options: radiusOptions,\n },\n size: {\n control: 'select',\n options: sizeOptions,\n },\n fallback: {\n control: 'text',\n },\n src: {\n control: 'text',\n },\n alt: {\n control: 'text',\n },\n },\n args: {\n content: 'letters',\n radius: 'full',\n size: 'md',\n fallback: 'John Doe',\n },\n} satisfies Meta<typeof Avatar>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n args: {\n content: '
|
|
1
|
+
{"version":3,"sources":["../../../src/components/avatar/avatar.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Code} from 'components/typography';\nimport {Avatar} from './avatar';\nimport {AvatarGroup, AvatarGroupTooltip} from './avatar-group';\n\nconst contentOptions = ['letters', 'logo', 'logoPlaceholder', 'image', 'upload'] as const;\nconst radiusOptions = ['full', 'rounded'] as const;\nconst sizeOptions = ['3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'] as const;\nconst logoNameOptions = ['shipfox', 'slack', 'stripe', 'github'] as const;\n\nconst meta = {\n title: 'Components/Avatar',\n component: Avatar,\n tags: ['autodocs'],\n argTypes: {\n content: {\n control: 'select',\n options: contentOptions,\n },\n radius: {\n control: 'select',\n options: radiusOptions,\n },\n size: {\n control: 'select',\n options: sizeOptions,\n },\n fallback: {\n control: 'text',\n },\n src: {\n control: 'text',\n },\n alt: {\n control: 'text',\n },\n logoName: {\n control: 'select',\n options: logoNameOptions,\n description: 'Logo icon name to display when content is \"logo\" or \"logoPlaceholder\"',\n },\n },\n args: {\n content: 'letters',\n radius: 'full',\n size: 'md',\n fallback: 'John Doe',\n logoName: 'shipfox',\n },\n} satisfies Meta<typeof Avatar>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n args: {\n content: 'logo',\n fallback: 'Shipfox',\n },\n\n render: (args) => (\n <div className=\"flex flex-wrap items-end gap-16\">\n {sizeOptions.map((size) => (\n <div key={size} className=\"flex flex-col items-center gap-8\">\n <Avatar {...args} size={size} />\n <Code variant=\"label\" className=\"text-foreground-neutral-base\">\n {size}\n </Code>\n </div>\n ))}\n </div>\n ),\n};\n\n// AvatarGroup Stories\nconst avatarGroupMeta = {\n title: 'Components/AvatarGroup',\n component: AvatarGroup,\n tags: ['autodocs'],\n argTypes: {\n size: {\n control: 'select',\n options: sizeOptions,\n },\n maxVisible: {\n control: 'number',\n },\n },\n args: {\n size: 'md',\n children: [],\n },\n} satisfies Meta<typeof AvatarGroup>;\n\nexport const AvatarGroupDefault: StoryObj<typeof avatarGroupMeta> = {\n args: {\n children: [],\n },\n render: () => {\n const avatars = [\n {name: 'John Doe', content: 'image'},\n {name: 'Jane Smith', content: 'image'},\n {name: 'Bob Johnson', content: 'image'},\n {name: 'Alice Brown', content: 'image'},\n ] as const;\n\n return (\n <div className=\"flex flex-col gap-16\">\n <div className=\"flex flex-col gap-8\">\n <Code variant=\"label\" className=\"text-foreground-neutral-base\">\n Default (without tooltips)\n </Code>\n <AvatarGroup size=\"md\">\n {avatars.map((avatar) => (\n <Avatar key={avatar.name} content={avatar.content} fallback={avatar.name} />\n ))}\n </AvatarGroup>\n </div>\n </div>\n );\n },\n};\n\nexport const AvatarGroupWithTooltips: StoryObj<typeof avatarGroupMeta> = {\n args: {\n children: [],\n },\n render: () => {\n const avatars = [\n {name: 'John Doe', content: 'image'},\n {name: 'Jane Smith', content: 'image'},\n {name: 'Bob Johnson', content: 'image'},\n {name: 'Alice Brown', content: 'image'},\n {name: 'Carlos Vega', content: 'image'},\n {name: 'Linda Tran', content: 'image'},\n ] as const;\n\n return (\n <div className=\"flex flex-col gap-16\">\n <div className=\"flex flex-col gap-8\">\n <Code variant=\"label\" className=\"text-foreground-neutral-base\">\n With Tooltips\n </Code>\n <AvatarGroup size=\"md\">\n {avatars.map((avatar) => (\n <Avatar key={avatar.name} content={avatar.content} fallback={avatar.name}>\n <AvatarGroupTooltip>{avatar.name}</AvatarGroupTooltip>\n </Avatar>\n ))}\n </AvatarGroup>\n </div>\n <div className=\"flex flex-col gap-8\">\n <Code variant=\"label\" className=\"text-foreground-neutral-base\">\n With Tooltips (maxVisible: 4)\n </Code>\n <AvatarGroup size=\"md\" maxVisible={4}>\n {avatars.map((avatar) => (\n <Avatar key={avatar.name} content={avatar.content} fallback={avatar.name}>\n <AvatarGroupTooltip>{avatar.name}</AvatarGroupTooltip>\n </Avatar>\n ))}\n </AvatarGroup>\n </div>\n <div className=\"flex flex-col gap-8\">\n <Code variant=\"label\" className=\"text-foreground-neutral-base\">\n With Tooltips and Hover Animation\n </Code>\n <AvatarGroup size=\"md\" maxVisible={4} animateOnHover>\n {avatars.map((avatar) => (\n <Avatar key={avatar.name} content={avatar.content} fallback={avatar.name}>\n <AvatarGroupTooltip>{avatar.name}</AvatarGroupTooltip>\n </Avatar>\n ))}\n </AvatarGroup>\n </div>\n </div>\n );\n },\n};\n"],"names":["Code","Avatar","AvatarGroup","AvatarGroupTooltip","contentOptions","radiusOptions","sizeOptions","logoNameOptions","meta","title","component","tags","argTypes","content","control","options","radius","size","fallback","src","alt","logoName","description","args","Default","render","div","className","map","variant","avatarGroupMeta","maxVisible","children","AvatarGroupDefault","avatars","name","avatar","AvatarGroupWithTooltips","animateOnHover"],"mappings":";AACA,SAAQA,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAO,WAAW;AAChC,SAAQC,WAAW,EAAEC,kBAAkB,QAAO,iBAAiB;AAE/D,MAAMC,iBAAiB;IAAC;IAAW;IAAQ;IAAmB;IAAS;CAAS;AAChF,MAAMC,gBAAgB;IAAC;IAAQ;CAAU;AACzC,MAAMC,cAAc;IAAC;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;IAAM;IAAO;CAAM;AAC9E,MAAMC,kBAAkB;IAAC;IAAW;IAAS;IAAU;CAAS;AAEhE,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWT;IACXU,MAAM;QAAC;KAAW;IAClBC,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IAAI;;;;8BAM9B,MAACT;oBAAIC,WAAU;;sCACb,KAAC3B;4BAAK6B,SAAQ;4BAAQF,WAAU;sCAA+B;;sCAG/D,KAACzB;4BAAYe,MAAK;4BAAKc,YAAY;4BAAGO,cAAc;sCACjDJ,QAAQN,GAAG,CAAC,CAACQ,uBACZ,KAACnC;oCAAyBY,SAASuB,OAAOvB,OAAO;oCAAEK,UAAUkB,OAAOD,IAAI;8CACtE,cAAA,KAAChC;kDAAoBiC,OAAOD,IAAI;;mCADrBC,OAAOD,IAAI;;;;;;IAQpC;AACF,EAAE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { type IconName } from '../../components/icon';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
export declare const badgeVariants: (props?: ({
|
|
5
|
+
variant?: "info" | "success" | "warning" | "error" | "neutral" | "feature" | null | undefined;
|
|
6
|
+
size?: "2xs" | "xs" | null | undefined;
|
|
7
|
+
radius?: "default" | "rounded" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>['variant'];
|
|
10
|
+
type BaseBadgeProps = ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type BadgePropsWithLeftClick = BaseBadgeProps & {
|
|
14
|
+
iconLeft: IconName;
|
|
15
|
+
onIconLeftClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
16
|
+
iconLeftAriaLabel: string;
|
|
17
|
+
iconRight?: IconName;
|
|
18
|
+
onIconRightClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
+
iconRightAriaLabel?: string;
|
|
20
|
+
};
|
|
21
|
+
type BadgePropsWithRightClick = BaseBadgeProps & {
|
|
22
|
+
iconRight: IconName;
|
|
23
|
+
onIconRightClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
24
|
+
iconRightAriaLabel: string;
|
|
25
|
+
iconLeft?: IconName;
|
|
26
|
+
onIconLeftClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
27
|
+
iconLeftAriaLabel?: string;
|
|
28
|
+
};
|
|
29
|
+
type BadgePropsWithBothClicks = BaseBadgeProps & {
|
|
30
|
+
iconLeft: IconName;
|
|
31
|
+
onIconLeftClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
32
|
+
iconLeftAriaLabel: string;
|
|
33
|
+
iconRight: IconName;
|
|
34
|
+
onIconRightClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
35
|
+
iconRightAriaLabel: string;
|
|
36
|
+
};
|
|
37
|
+
type BadgePropsWithoutClicks = BaseBadgeProps & {
|
|
38
|
+
iconLeft?: IconName;
|
|
39
|
+
iconRight?: IconName;
|
|
40
|
+
onIconLeftClick?: never;
|
|
41
|
+
onIconRightClick?: never;
|
|
42
|
+
iconLeftAriaLabel?: never;
|
|
43
|
+
iconRightAriaLabel?: never;
|
|
44
|
+
};
|
|
45
|
+
export type BadgeProps = BadgePropsWithLeftClick | BadgePropsWithRightClick | BadgePropsWithBothClicks | BadgePropsWithoutClicks;
|
|
46
|
+
export declare function Badge({ className, variant, size, radius, asChild, children, iconLeft, iconRight, onIconLeftClick, onIconRightClick, iconLeftAriaLabel, iconRightAriaLabel, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM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iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,QAAQ,CAAC;IACpB,gBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACnE,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG,cAAc,GAAG;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,eAAe,CAAC,EAAE,KAAK,CAAC;IACxB,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAC1B,kBAAkB,CAAC,EAAE,KAAK,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,GACxB,uBAAuB,CAAC;AAE5B,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,MAAM,EACN,OAAe,EACf,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,UAAU,2CA2CZ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { Icon } from '../../components/icon/index.js';
|
|
5
|
+
import { cn } from '../../utils/cn.js';
|
|
6
|
+
export const badgeVariants = cva('inline-flex select-none items-center justify-center font-medium transition-colors shrink-0 leading-20', {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
neutral: 'bg-tag-neutral-bg text-tag-neutral-text border border-tag-neutral-border hover:bg-tag-neutral-bg-hover',
|
|
10
|
+
info: 'bg-tag-blue-bg text-tag-blue-text border border-tag-blue-border hover:bg-tag-blue-bg-hover',
|
|
11
|
+
feature: 'bg-tag-purple-bg text-tag-purple-text border border-tag-purple-border hover:bg-tag-purple-bg-hover',
|
|
12
|
+
success: 'bg-tag-success-bg text-tag-success-text border border-tag-success-border hover:bg-tag-success-bg-hover',
|
|
13
|
+
warning: 'bg-tag-warning-bg text-tag-warning-text border border-tag-warning-border hover:bg-tag-warning-bg-hover',
|
|
14
|
+
error: 'bg-tag-error-bg text-tag-error-text border border-tag-error-border hover:bg-tag-error-bg-hover'
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
'2xs': 'h-20 px-6 text-xs gap-4',
|
|
18
|
+
xs: 'h-24 px-8 text-xs gap-6'
|
|
19
|
+
},
|
|
20
|
+
radius: {
|
|
21
|
+
default: 'rounded-6',
|
|
22
|
+
rounded: 'rounded-full'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: 'neutral',
|
|
27
|
+
size: '2xs',
|
|
28
|
+
radius: 'default'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export function Badge({ className, variant, size, radius, asChild = false, children, iconLeft, iconRight, onIconLeftClick, onIconRightClick, iconLeftAriaLabel, iconRightAriaLabel, ...props }) {
|
|
32
|
+
const Comp = asChild ? Slot : 'span';
|
|
33
|
+
const renderIcon = (iconName, position, onClick, ariaLabel)=>{
|
|
34
|
+
const isInteractive = Boolean(onClick);
|
|
35
|
+
if (isInteractive) {
|
|
36
|
+
if (!ariaLabel) {
|
|
37
|
+
// biome-ignore lint/suspicious/noConsole: Development warning for accessibility
|
|
38
|
+
console.warn(`Badge: Missing aria-label for interactive ${position} icon. Please provide icon${position === 'left' ? 'Left' : 'Right'}AriaLabel prop.`);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: onClick,
|
|
44
|
+
className: "inline-flex items-center justify-center transition-colors shrink-0 hover:opacity-70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-500",
|
|
45
|
+
"aria-label": ariaLabel,
|
|
46
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
47
|
+
name: iconName,
|
|
48
|
+
className: "size-12"
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/ _jsx(Icon, {
|
|
53
|
+
name: iconName,
|
|
54
|
+
className: "size-12"
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/ _jsxs(Comp, {
|
|
58
|
+
className: cn(badgeVariants({
|
|
59
|
+
variant,
|
|
60
|
+
size,
|
|
61
|
+
radius
|
|
62
|
+
}), className),
|
|
63
|
+
...props,
|
|
64
|
+
children: [
|
|
65
|
+
iconLeft && renderIcon(iconLeft, 'left', onIconLeftClick, iconLeftAriaLabel),
|
|
66
|
+
children,
|
|
67
|
+
iconRight && renderIcon(iconRight, 'right', onIconRightClick, iconRightAriaLabel)
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=badge.js.map
|