@lotte-innovate/ui-component-test 0.1.66 → 0.1.67
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +133 -133
- package/dist/globals.css +4 -4
- package/dist/lib/Typography/Header/index.d.ts +1 -1
- package/dist/lib/Typography/Text/index.d.ts +1 -1
- package/dist/lib/components/Accordion/index.d.ts +1 -0
- package/dist/lib/components/Accordion/index.js +18 -4
- package/dist/lib/components/Accordion/index.mjs +1 -1
- package/dist/lib/components/Accordion/index.mjs.map +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogAction.d.ts +2 -2
- package/dist/lib/components/AlertDialog/AlertDialogCancel.d.ts +2 -2
- package/dist/lib/components/AlertDialog/AlertDialogContent.d.ts +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogRoot.js +9 -6
- package/dist/lib/components/AlertDialog/AlertDialogRoot.mjs +2 -1
- package/dist/lib/components/AlertDialog/AlertDialogRoot.mjs.map +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogTrigger.d.ts +2 -2
- package/dist/lib/components/AspectRatio/index.js +3 -1
- package/dist/lib/components/AspectRatio/index.mjs +1 -1
- package/dist/lib/components/AspectRatio/index.mjs.map +1 -1
- package/dist/lib/components/Avatar/index.d.ts +1 -1
- package/dist/lib/components/Avatar/index.js +9 -1
- package/dist/lib/components/Avatar/index.mjs +2 -1
- package/dist/lib/components/Avatar/index.mjs.map +1 -1
- package/dist/lib/components/Badge/index.d.ts +2 -2
- package/dist/lib/components/Badge/index.js +10 -1
- package/dist/lib/components/Badge/index.mjs +1 -1
- package/dist/lib/components/Badge/index.mjs.map +1 -1
- package/dist/lib/components/Button/index.d.ts +2 -2
- package/dist/lib/components/Button/index.js +10 -1
- package/dist/lib/components/Button/index.mjs +1 -1
- package/dist/lib/components/Button/index.mjs.map +1 -1
- package/dist/lib/components/Callout/CalloutRoot.d.ts +1 -1
- package/dist/lib/components/Callout/CalloutRoot.js +11 -3
- package/dist/lib/components/Callout/CalloutRoot.mjs +2 -1
- package/dist/lib/components/Callout/CalloutRoot.mjs.map +1 -1
- package/dist/lib/components/Card/index.d.ts +2 -2
- package/dist/lib/components/Card/index.js +8 -1
- package/dist/lib/components/Card/index.mjs +1 -1
- package/dist/lib/components/Card/index.mjs.map +1 -1
- package/dist/lib/components/Checkbox/index.d.ts +1 -1
- package/dist/lib/components/Checkbox/index.js +10 -2
- package/dist/lib/components/Checkbox/index.mjs +1 -1
- package/dist/lib/components/Checkbox/index.mjs.map +1 -1
- package/dist/lib/components/CheckboxCard/index.d.ts +1 -1
- package/dist/lib/components/CheckboxCard/index.js +8 -1
- package/dist/lib/components/CheckboxCard/index.mjs +1 -1
- package/dist/lib/components/CheckboxCard/index.mjs.map +1 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.js +11 -2
- package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.mjs +2 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.mjs.map +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuContent.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuItem.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuItemIndicator.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuRadioGroup.js +1 -0
- package/dist/lib/components/ContextMenu/ContextMenuRadioGroup.mjs +1 -0
- package/dist/lib/components/ContextMenu/ContextMenuRadioGroup.mjs.map +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuRoot.js +11 -2
- package/dist/lib/components/ContextMenu/ContextMenuRoot.mjs +2 -1
- package/dist/lib/components/ContextMenu/ContextMenuRoot.mjs.map +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuSubContent.d.ts +1 -1
- package/dist/lib/components/DataList/DataListLabel.d.ts +1 -1
- package/dist/lib/components/DataList/DataListRoot.js +9 -2
- package/dist/lib/components/DataList/DataListRoot.mjs +2 -1
- package/dist/lib/components/DataList/DataListRoot.mjs.map +1 -1
- package/dist/lib/components/DataList/DataListValue.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogAction.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogCancel.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogContent.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogRoot.js +9 -1
- package/dist/lib/components/Dialog/DialogRoot.mjs +2 -1
- package/dist/lib/components/Dialog/DialogRoot.mjs.map +1 -1
- package/dist/lib/components/DropdownMenu/DropdonMenuSubContent.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuContent.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuItem.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuItemIndicator.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuRoot.js +10 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuRoot.mjs +2 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
- package/dist/lib/components/HoverCard/HoverCardContent.d.ts +2 -2
- package/dist/lib/components/HoverCard/HoverCardRoot.js +10 -1
- package/dist/lib/components/HoverCard/HoverCardRoot.mjs +2 -1
- package/dist/lib/components/HoverCard/HoverCardRoot.mjs.map +1 -1
- package/dist/lib/components/IconButton/index.d.ts +1 -1
- package/dist/lib/components/IconButton/index.js +9 -1
- package/dist/lib/components/IconButton/index.mjs +1 -1
- package/dist/lib/components/IconButton/index.mjs.map +1 -1
- package/dist/lib/components/Inset/index.d.ts +1 -1
- package/dist/lib/components/Inset/index.js +7 -1
- package/dist/lib/components/Inset/index.mjs +1 -1
- package/dist/lib/components/Inset/index.mjs.map +1 -1
- package/dist/lib/components/Label/index.d.ts +1 -1
- package/dist/lib/components/Label/index.js +11 -3
- package/dist/lib/components/Label/index.mjs +1 -1
- package/dist/lib/components/Label/index.mjs.map +1 -1
- package/dist/lib/components/Menubar/MenubarContent.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarItem.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarItemIndicator.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarRadioGroup.js +1 -0
- package/dist/lib/components/Menubar/MenubarRadioGroup.mjs +1 -0
- package/dist/lib/components/Menubar/MenubarRadioGroup.mjs.map +1 -1
- package/dist/lib/components/Menubar/MenubarRoot.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarRoot.js +13 -3
- package/dist/lib/components/Menubar/MenubarRoot.mjs +2 -1
- package/dist/lib/components/Menubar/MenubarRoot.mjs.map +1 -1
- package/dist/lib/components/Menubar/MenubarSubContent.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarTrigger.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuContent.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuLink.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuList.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuRoot.js +11 -2
- package/dist/lib/components/NavigationMenu/NavigationMenuRoot.mjs +2 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuRoot.mjs.map +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuTrigger.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuViewport.d.ts +2 -2
- package/dist/lib/components/Popover/PopoverClose.d.ts +1 -1
- package/dist/lib/components/Popover/PopoverContent.d.ts +1 -1
- package/dist/lib/components/Popover/PopoverRoot.js +8 -1
- package/dist/lib/components/Popover/PopoverRoot.mjs +2 -1
- package/dist/lib/components/Popover/PopoverRoot.mjs.map +1 -1
- package/dist/lib/components/Progress/index.d.ts +1 -1
- package/dist/lib/components/Progress/index.js +11 -1
- package/dist/lib/components/Progress/index.mjs +1 -1
- package/dist/lib/components/Progress/index.mjs.map +1 -1
- package/dist/lib/components/Radio/index.js +10 -4
- package/dist/lib/components/Radio/index.mjs +1 -1
- package/dist/lib/components/Radio/index.mjs.map +1 -1
- package/dist/lib/components/RadioCards/RadioCardsItem.d.ts +1 -1
- package/dist/lib/components/RadioCards/RadioCardsRoot.js +12 -2
- package/dist/lib/components/RadioCards/RadioCardsRoot.mjs +2 -1
- package/dist/lib/components/RadioCards/RadioCardsRoot.mjs.map +1 -1
- package/dist/lib/components/RadioGroup/RadioGroupRoot.js +11 -2
- package/dist/lib/components/RadioGroup/RadioGroupRoot.mjs +2 -1
- package/dist/lib/components/RadioGroup/RadioGroupRoot.mjs.map +1 -1
- package/dist/lib/components/ScrollArea/index.js +3 -1
- package/dist/lib/components/ScrollArea/index.mjs +1 -1
- package/dist/lib/components/ScrollArea/index.mjs.map +1 -1
- package/dist/lib/components/SegmentedControl/SegmentedControlRoot.js +7 -1
- package/dist/lib/components/SegmentedControl/SegmentedControlRoot.mjs +1 -1
- package/dist/lib/components/SegmentedControl/SegmentedControlRoot.mjs.map +1 -1
- package/dist/lib/components/Select/index.d.ts +4 -2
- package/dist/lib/components/Select/index.js +30 -13
- package/dist/lib/components/Select/index.mjs +1 -1
- package/dist/lib/components/Select/index.mjs.map +1 -1
- package/dist/lib/components/Separator/index.js +7 -1
- package/dist/lib/components/Separator/index.mjs +1 -1
- package/dist/lib/components/Separator/index.mjs.map +1 -1
- package/dist/lib/components/Skeleton/index.d.ts +1 -1
- package/dist/lib/components/Skeleton/index.js +4 -1
- package/dist/lib/components/Skeleton/index.mjs +1 -1
- package/dist/lib/components/Skeleton/index.mjs.map +1 -1
- package/dist/lib/components/Slider/index.d.ts +1 -1
- package/dist/lib/components/Slider/index.js +13 -5
- package/dist/lib/components/Slider/index.mjs +1 -1
- package/dist/lib/components/Slider/index.mjs.map +1 -1
- package/dist/lib/components/Spinner/index.js +3 -1
- package/dist/lib/components/Spinner/index.mjs +1 -1
- package/dist/lib/components/Spinner/index.mjs.map +1 -1
- package/dist/lib/components/TabNav/index.js +6 -4
- package/dist/lib/components/TabNav/index.mjs +1 -1
- package/dist/lib/components/TabNav/index.mjs.map +1 -1
- package/dist/lib/components/Table/index.d.ts +1 -1
- package/dist/lib/components/Table/index.js +7 -1
- package/dist/lib/components/Table/index.mjs +1 -1
- package/dist/lib/components/Table/index.mjs.map +1 -1
- package/dist/lib/components/Tabs/index.d.ts +1 -1
- package/dist/lib/components/Tabs/index.js +4 -4
- package/dist/lib/components/Tabs/index.mjs +1 -1
- package/dist/lib/components/Tabs/index.mjs.map +1 -1
- package/dist/lib/components/TextArea/index.d.ts +1 -1
- package/dist/lib/components/TextArea/index.js +11 -4
- package/dist/lib/components/TextArea/index.mjs +1 -1
- package/dist/lib/components/TextArea/index.mjs.map +1 -1
- package/dist/lib/components/TextField/index.d.ts +1 -1
- package/dist/lib/components/TextField/index.js +11 -4
- package/dist/lib/components/TextField/index.mjs +1 -1
- package/dist/lib/components/TextField/index.mjs.map +1 -1
- package/dist/lib/components/Toast/ToastActionButton.d.ts +1 -1
- package/dist/lib/components/Toast/ToastActionButton.js +2 -2
- package/dist/lib/components/Toast/ToastActionButton.mjs +1 -1
- package/dist/lib/components/Toast/ToastActionButton.mjs.map +1 -1
- package/dist/lib/components/Toast/ToastRoot.d.ts +1 -1
- package/dist/lib/components/Toast/ToastRoot.js +11 -3
- package/dist/lib/components/Toast/ToastRoot.mjs +2 -1
- package/dist/lib/components/Toast/ToastRoot.mjs.map +1 -1
- package/dist/lib/components/Toggle/ToggleWithText.d.ts +1 -1
- package/dist/lib/components/Toggle/ToggleWithText.js +9 -1
- package/dist/lib/components/Toggle/ToggleWithText.mjs +1 -1
- package/dist/lib/components/Toggle/ToggleWithText.mjs.map +1 -1
- package/dist/lib/components/Toggle/index.d.ts +1 -1
- package/dist/lib/components/Toggle/index.js +9 -1
- package/dist/lib/components/Toggle/index.mjs +1 -1
- package/dist/lib/components/Toggle/index.mjs.map +1 -1
- package/dist/lib/components/ToggleGroup/ToggleGroupRoot.js +10 -2
- package/dist/lib/components/ToggleGroup/ToggleGroupRoot.mjs +2 -1
- package/dist/lib/components/ToggleGroup/ToggleGroupRoot.mjs.map +1 -1
- package/dist/lib/components/ToggleSwitch/index.d.ts +1 -1
- package/dist/lib/components/ToggleSwitch/index.js +13 -1
- package/dist/lib/components/ToggleSwitch/index.mjs +1 -1
- package/dist/lib/components/ToggleSwitch/index.mjs.map +1 -1
- package/dist/lib/components/Tooltip/index.d.ts +2 -2
- package/dist/lib/components/Tooltip/index.js +13 -8
- package/dist/lib/components/Tooltip/index.mjs +1 -1
- package/dist/lib/components/Tooltip/index.mjs.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/theme/ThemeProvider.d.ts +16 -0
- package/dist/lib/theme/ThemeProvider.js +29 -0
- package/dist/lib/theme/ThemeProvider.mjs +3 -0
- package/dist/lib/theme/ThemeProvider.mjs.map +1 -0
- package/dist/lib/theme/index.d.ts +2 -0
- package/dist/lib/theme/index.js +2 -0
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/utils/useDarkMode.js +1 -0
- package/dist/lib/utils/useDarkMode.mjs +1 -0
- package/dist/lib/utils/useDarkMode.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +141 -141
- package/dist/.storybook/main.d.ts +0 -3
- package/dist/.storybook/main.js +0 -22
- package/dist/.storybook/manager.d.ts +0 -1
- package/dist/.storybook/manager.js +0 -12
- package/dist/.storybook/preview.d.ts +0 -8
- package/dist/.storybook/preview.js +0 -81
@@ -26,6 +26,7 @@ import { cva } from 'class-variance-authority';
|
|
26
26
|
import { cn } from '../../../lib/utils/utils';
|
27
27
|
import { bgColorStyle, radiusVariants } from '../../../lib/constants';
|
28
28
|
import { Theme, TextField as TextFieldTheme } from '@radix-ui/themes';
|
29
|
+
import { useTheme } from '../../../lib/theme';
|
29
30
|
var textFieldVariants = cva('', {
|
30
31
|
variants: {
|
31
32
|
radius: __assign({}, radiusVariants['base']),
|
@@ -33,15 +34,21 @@ var textFieldVariants = cva('', {
|
|
33
34
|
},
|
34
35
|
});
|
35
36
|
export var Root = React.forwardRef(function (_a, forwardedRef) {
|
36
|
-
var className = _a.className,
|
37
|
-
|
38
|
-
color = 'red';
|
37
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? 'red' : _b, size = _a.size, appearance = _a.appearance, _c = _a.scaling, scaling = _c === void 0 ? '100%' : _c, radius = _a.radius, children = _a.children, sliderProps = __rest(_a, ["className", "color", "size", "appearance", "scaling", "radius", "children"]);
|
38
|
+
var theme = useTheme().theme;
|
39
39
|
var sizeTheme = '2';
|
40
40
|
if (size === 'small')
|
41
41
|
sizeTheme = '1';
|
42
42
|
if (size === 'large')
|
43
43
|
sizeTheme = '3';
|
44
|
-
|
44
|
+
var contextValue = {
|
45
|
+
scaling: theme.themeScaling || scaling,
|
46
|
+
radius: theme.themeRadius || radius,
|
47
|
+
color: theme.themeColor || color,
|
48
|
+
};
|
49
|
+
return (_jsx(Theme, { scaling: contextValue.scaling, accentColor: color, hasBackground: false, children: _jsx(TextFieldTheme.Root, __assign({ ref: forwardedRef, variant: appearance, size: sizeTheme, radius: contextValue.radius,
|
50
|
+
// @ts-ignore
|
51
|
+
color: contextValue.color, className: cn(textFieldVariants({ radius: contextValue.radius }), className) }, sliderProps, { children: children })) }));
|
45
52
|
});
|
46
53
|
Root.displayName = 'TextField.Root';
|
47
54
|
export var Slot = React.forwardRef(function (_a, forwardedRef) {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import e from"react";import{cva as a}from"class-variance-authority";import{cn as o}from"../../utils/utils.mjs";import{radiusVariants as t,bgColorStyle as i}from"../../constants.mjs";import{Theme as s,TextField as l}from"@radix-ui/themes";import{useTheme as c}from"../../theme/ThemeProvider.mjs";var n=function(){return n=Object.assign||function(r){for(var e,a=1,o=arguments.length;a<o;a++)for(var t in e=arguments[a])Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r},n.apply(this,arguments)},d=function(r,e){var a={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(o=Object.getOwnPropertySymbols(r);t<o.length;t++)e.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(r,o[t])&&(a[o[t]]=r[o[t]])}return a},m=a("",{variants:{radius:n({},t.base),color:i()}}),u=e.forwardRef((function(e,a){var t=e.className,i=e.color,u=void 0===i?"red":i,p=e.size,f=e.appearance,h=e.scaling,v=void 0===h?"100%":h,y=e.radius,g=e.children,O=d(e,["className","color","size","appearance","scaling","radius","children"]),b=c().theme,j="2";"small"===p&&(j="1"),"large"===p&&(j="3");var x={scaling:b.themeScaling||v,radius:b.themeRadius||y,color:b.themeColor||u};return r(s,{scaling:x.scaling,accentColor:u,hasBackground:!1,children:r(l.Root,n({ref:a,variant:f,size:j,radius:x.radius,color:x.color,className:o(m({radius:x.radius}),t)},O,{children:g}))})}));u.displayName="TextField.Root";var p=e.forwardRef((function(e,a){var t=e.className,i=e.color,s=e.side,c=e.radius,u=e.children,p=d(e,["className","color","side","radius","children"]);return r(l.Slot,n({ref:a,color:i,side:s,className:o(m({radius:c}),t)},p,{children:u}))}));p.displayName="TextField.Slot";var f={Root:u,Slot:p};export{u as Root,p as Slot,f as default};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../lib/components/TextField/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport { cva } from 'class-variance-authority';\nimport { cn } from '../../../lib/utils/utils';\nimport { bgColorStyle, radiusVariants } from '../../../lib/constants';\nimport { Theme, TextField as TextFieldTheme } from '@radix-ui/themes';\nvar textFieldVariants = cva('', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n color: bgColorStyle(),\n },\n});\nexport var Root = React.forwardRef(function (_a, forwardedRef) {\n var className = _a.className,
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../lib/components/TextField/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport { cva } from 'class-variance-authority';\nimport { cn } from '../../../lib/utils/utils';\nimport { bgColorStyle, radiusVariants } from '../../../lib/constants';\nimport { Theme, TextField as TextFieldTheme } from '@radix-ui/themes';\nimport { useTheme } from '../../../lib/theme';\nvar textFieldVariants = cva('', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n color: bgColorStyle(),\n },\n});\nexport var Root = React.forwardRef(function (_a, forwardedRef) {\n var className = _a.className, _b = _a.color, color = _b === void 0 ? 'red' : _b, size = _a.size, appearance = _a.appearance, _c = _a.scaling, scaling = _c === void 0 ? '100%' : _c, radius = _a.radius, children = _a.children, sliderProps = __rest(_a, [\"className\", \"color\", \"size\", \"appearance\", \"scaling\", \"radius\", \"children\"]);\n var theme = useTheme().theme;\n var sizeTheme = '2';\n if (size === 'small')\n sizeTheme = '1';\n if (size === 'large')\n sizeTheme = '3';\n var contextValue = {\n scaling: theme.themeScaling || scaling,\n radius: theme.themeRadius || radius,\n color: theme.themeColor || color,\n };\n return (_jsx(Theme, { scaling: contextValue.scaling, accentColor: color, hasBackground: false, children: _jsx(TextFieldTheme.Root, __assign({ ref: forwardedRef, variant: appearance, size: sizeTheme, radius: contextValue.radius, \n // @ts-ignore\n color: contextValue.color, className: cn(textFieldVariants({ radius: contextValue.radius }), className) }, sliderProps, { children: children })) }));\n});\nRoot.displayName = 'TextField.Root';\nexport var Slot = React.forwardRef(function (_a, forwardedRef) {\n var className = _a.className, color = _a.color, side = _a.side, radius = _a.radius, children = _a.children, sliderProps = __rest(_a, [\"className\", \"color\", \"side\", \"radius\", \"children\"]);\n return (_jsx(TextFieldTheme.Slot, __assign({ ref: forwardedRef, color: color, side: side, className: cn(textFieldVariants({ radius: radius }), className) }, sliderProps, { children: children })));\n});\nSlot.displayName = 'TextField.Slot';\nvar TextField = {\n Root: Root,\n Slot: Slot,\n};\nexport default TextField;\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","textFieldVariants","cva","variants","radius","radiusVariants","color","bgColorStyle","Root","React","forwardRef","_a","forwardedRef","className","_b","size","appearance","_c","scaling","children","sliderProps","theme","useTheme","sizeTheme","contextValue","themeScaling","themeRadius","themeColor","_jsx","Theme","accentColor","hasBackground","TextFieldT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OAAQ,aAAc,UAAW,SAAU,aACxTU,EAAQC,IAAWD,MACnBE,EAAY,IACH,UAATR,IACAQ,EAAY,KACH,UAATR,IACAQ,EAAY,KAChB,IAAIC,EAAe,CACfN,QAASG,EAAMI,cAAgBP,EAC/Bd,OAAQiB,EAAMK,aAAetB,EAC7BE,MAAOe,EAAMM,YAAcrB,GAE/B,OAAQsB,EAAKC,EAAO,CAAEX,QAASM,EAAaN,QAASY,YAAaxB,EAAOyB,eAAe,EAAOZ,SAAUS,EAAKI,EAAexB,KAAM3B,EAAS,CAAEoD,IAAKrB,EAAcsB,QAASlB,EAAYD,KAAMQ,EAAWnB,OAAQoB,EAAapB,OAEpNE,MAAOkB,EAAalB,MAAOO,UAAWsB,EAAGlC,EAAkB,CAAEG,OAAQoB,EAAapB,SAAWS,IAAcO,EAAa,CAAED,SAAUA,MAChJ,IACAX,EAAK4B,YAAc,iBACT,IAACC,EAAO5B,EAAMC,YAAW,SAAUC,EAAIC,GAC7C,IAAIC,EAAYF,EAAGE,UAAWP,EAAQK,EAAGL,MAAOgC,EAAO3B,EAAG2B,KAAMlC,EAASO,EAAGP,OAAQe,EAAWR,EAAGQ,SAAUC,EAAcxB,EAAOe,EAAI,CAAC,YAAa,QAAS,OAAQ,SAAU,aAC9K,OAAQiB,EAAKI,EAAeK,KAAMxD,EAAS,CAAEoD,IAAKrB,EAAcN,MAAOA,EAAOgC,KAAMA,EAAMzB,UAAWsB,EAAGlC,EAAkB,CAAEG,OAAQA,IAAWS,IAAcO,EAAa,CAAED,SAAUA,IAC1L,IACAkB,EAAKD,YAAc,iBAChB,IAACG,EAAY,CACZ/B,KAAMA,EACN6B,KAAMA"}
|
@@ -7,7 +7,7 @@ export interface ToastActionButtonProps extends VariantProps<typeof toastActionB
|
|
7
7
|
appearance?: IAppearance;
|
8
8
|
}
|
9
9
|
export declare const toastActionButtonVariants: (props?: ({
|
10
|
-
radius?: "
|
10
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
11
11
|
size?: "small" | "medium" | "large" | "x-large" | null | undefined;
|
12
12
|
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
13
13
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
@@ -46,8 +46,8 @@ export var toastActionButtonVariants = cva("absolute items-center justify-center
|
|
46
46
|
},
|
47
47
|
});
|
48
48
|
export var ToastActionButton = forwardRef(function (_a, ref) {
|
49
|
-
var className = _a.className, children = _a.children,
|
50
|
-
var _d = useToastContext(), scaling = _d.scaling, size = _d.size, _e = _d.color, color = _e === void 0 ? 'danger' : _e;
|
49
|
+
var className = _a.className, children = _a.children, _b = _a.appearance, appearance = _b === void 0 ? 'surface' : _b, _c = _a.altText, altText = _c === void 0 ? 'altText' : _c, props = __rest(_a, ["className", "children", "appearance", "altText"]);
|
50
|
+
var _d = useToastContext(), radius = _d.radius, scaling = _d.scaling, size = _d.size, _e = _d.color, color = _e === void 0 ? 'danger' : _e;
|
51
51
|
var semantics = ['danger', 'warning', 'success', 'information'];
|
52
52
|
var colorMap = {
|
53
53
|
danger: 'red',
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{forwardRef as r}from"react";import*as e from"@radix-ui/react-toast";import{cva as i}from"class-variance-authority";import{cn as
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{forwardRef as r}from"react";import*as e from"@radix-ui/react-toast";import{cva as i}from"class-variance-authority";import{cn as n}from"../../utils/utils.mjs";import{Button as a}from"../Button/index.mjs";import{radiusVariants as o,scalingVariants as s,appearanceStyle as m}from"../../constants.mjs";import{useToastContext as l}from"./ToastRoot.mjs";var c=function(){return c=Object.assign||function(t){for(var r,e=1,i=arguments.length;e<i;e++)for(var n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t},c.apply(this,arguments)},p=function(t,r){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)r.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(e[i[n]]=t[i[n]])}return e},u=i("absolute items-center justify-center",{variants:{radius:c({},o.base),size:{small:"text-xs min-w-[56px] h-[25px] font-normal right-3",medium:"text-xs min-w-[56px] h-[25px] font-normal right-3",large:"text-[15px] min-w-[76px] h-[35px] font-medium right-4","x-large":"text-[15px] min-w-[76px] h-[35px] font-medium right-4"},scaling:c({},s)},defaultVariants:{radius:"medium",scaling:"100%",size:"medium"}}),f=r((function(r,i){var o=r.className,s=r.children,f=r.appearance,d=void 0===f?"surface":f,x=r.altText,g=void 0===x?"altText":x,h=p(r,["className","children","appearance","altText"]),y=l(),v=y.radius,b=y.scaling,j=y.size,O=y.color,w=void 0===O?"danger":O,T={danger:"red",information:"sky",success:"green",warning:"amber"},z=n(u({size:j,radius:v,scaling:b}),w&&["danger","warning","success","information"].includes(w)?function(t){var r=T[t];return r?m("outline",r):void 0}(w):m(d,null!=w?w:"red"),o);return t(e.Action,c({ref:i,altText:g},h,{className:z,asChild:!0,children:t(a,{children:s})}))}));f.displayName="Toast.ActionButton";export{f as ToastActionButton,u as toastActionButtonVariants};
|
2
2
|
//# sourceMappingURL=ToastActionButton.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToastActionButton.mjs","sources":["../../../lib/components/Toast/ToastActionButton.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef } from 'react';\nimport * as ToastPrimitive from '@radix-ui/react-toast';\nimport { cva } from 'class-variance-authority';\nimport { cn } from '../../../lib/utils/utils';\nimport Button from '../../../lib/components/Button';\nimport { appearanceStyle, radiusVariants, scalingVariants } from '../../../lib/constants';\nimport { useToastContext } from './ToastRoot';\nexport var toastActionButtonVariants = cva(\"absolute items-center justify-center\", {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'text-xs min-w-[56px] h-[25px] font-normal right-3',\n medium: 'text-xs min-w-[56px] h-[25px] font-normal right-3',\n large: 'text-[15px] min-w-[76px] h-[35px] font-medium right-4',\n 'x-large': 'text-[15px] min-w-[76px] h-[35px] font-medium right-4',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n scaling: '100%',\n size: 'medium',\n },\n});\nexport var ToastActionButton = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children,
|
1
|
+
{"version":3,"file":"ToastActionButton.mjs","sources":["../../../lib/components/Toast/ToastActionButton.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { forwardRef } from 'react';\nimport * as ToastPrimitive from '@radix-ui/react-toast';\nimport { cva } from 'class-variance-authority';\nimport { cn } from '../../../lib/utils/utils';\nimport Button from '../../../lib/components/Button';\nimport { appearanceStyle, radiusVariants, scalingVariants } from '../../../lib/constants';\nimport { useToastContext } from './ToastRoot';\nexport var toastActionButtonVariants = cva(\"absolute items-center justify-center\", {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'text-xs min-w-[56px] h-[25px] font-normal right-3',\n medium: 'text-xs min-w-[56px] h-[25px] font-normal right-3',\n large: 'text-[15px] min-w-[76px] h-[35px] font-medium right-4',\n 'x-large': 'text-[15px] min-w-[76px] h-[35px] font-medium right-4',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n scaling: '100%',\n size: 'medium',\n },\n});\nexport var ToastActionButton = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children, _b = _a.appearance, appearance = _b === void 0 ? 'surface' : _b, _c = _a.altText, altText = _c === void 0 ? 'altText' : _c, props = __rest(_a, [\"className\", \"children\", \"appearance\", \"altText\"]);\n var _d = useToastContext(), radius = _d.radius, scaling = _d.scaling, size = _d.size, _e = _d.color, color = _e === void 0 ? 'danger' : _e;\n var semantics = ['danger', 'warning', 'success', 'information'];\n var colorMap = {\n danger: 'red',\n information: 'sky',\n success: 'green',\n warning: 'amber',\n };\n var getSemanticsStyle = function (color) {\n var mappedColor = colorMap[color];\n return mappedColor ? appearanceStyle('outline', mappedColor) : undefined;\n };\n var buttonClassName = cn(toastActionButtonVariants({ size: size, radius: radius, scaling: scaling }), color && semantics.includes(color)\n ? getSemanticsStyle(color)\n : appearanceStyle(appearance, color !== null && color !== void 0 ? color : 'red'), className);\n return (_jsx(ToastPrimitive.Action, __assign({ ref: ref, altText: altText }, props, { className: buttonClassName, asChild: true, children: _jsx(Button, { children: children }) })));\n});\nToastActionButton.displayName = 'Toast.ActionButton';\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","toastActionButtonVariants","cva","variants","radius","radiusVariants","size","small","medium","large","scaling","scalingVariants","defaultVariants","ToastActionButton","forwardRef","_a","ref","className","children","_b","appearance","_c","altText","props","_d","useToastContext","_e","color","colorMap","danger","information","success","warning","buttonClassName","cn","includes","mappedColor","appearanceStyle","undefined","getSemanticsStyle","_jsx","ToastPrimitive","Action","asChild","Button","displayName"],"mappings":"2YAAA,IAAIA,EAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACf,EACWH,EAASa,MAAMC,KAAMP,UAChC,EACIQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAA,EACR,IAAK,IAAIM,KAAKL,EAAOH,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,IAAMO,EAAEC,QAAQR,GAAK,IAC9EN,EAAEM,GAAKL,EAAEK,IACb,GAAS,MAALL,GAAqD,mBAAjCH,OAAOiB,sBACtB,KAAIb,EAAI,EAAb,IAAgBI,EAAIR,OAAOiB,sBAAsBd,GAAIC,EAAII,EAAED,OAAQH,IAC3DW,EAAEC,QAAQR,EAAEJ,IAAM,GAAKJ,OAAOS,UAAUS,qBAAqBP,KAAKR,EAAGK,EAAEJ,MACvEF,EAAEM,EAAEJ,IAAMD,EAAEK,EAAEJ,IAF4B,CAItD,OAAOF,CACX,EASWiB,EAA4BC,EAAI,uC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|
setOpenToast?: Dispatch<SetStateAction<boolean>>;
|
15
15
|
}
|
16
16
|
export declare const toastVariants: (props?: ({
|
17
|
-
radius?: "
|
17
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
18
18
|
size?: "small" | "medium" | "large" | "x-large" | null | undefined;
|
19
19
|
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
20
20
|
color?: "danger" | "warning" | "success" | "information" | null | undefined;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
'use client';
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
2
3
|
__assign = Object.assign || function(t) {
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
@@ -21,11 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
22
|
return t;
|
22
23
|
};
|
23
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
-
import { forwardRef, createContext, useContext,
|
25
|
+
import { forwardRef, createContext, useContext, } from 'react';
|
25
26
|
import { cva } from 'class-variance-authority';
|
26
27
|
import { cn } from '../../../lib/utils/utils';
|
27
28
|
import { scalingVariants } from '../../../lib/constants';
|
28
29
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
30
|
+
import { useTheme } from '../../../lib/theme';
|
29
31
|
export var toastVariants = cva('flex bg-white dark:bg-slateDark-1', {
|
30
32
|
variants: {
|
31
33
|
radius: {
|
@@ -81,9 +83,15 @@ export var useToastContext = function () {
|
|
81
83
|
};
|
82
84
|
export var ToastRoot = forwardRef(function (_a, ref) {
|
83
85
|
var className = _a.className, children = _a.children, openToast = _a.openToast, radius = _a.radius, scaling = _a.scaling, size = _a.size, color = _a.color, _b = _a.duration, duration = _b === void 0 ? 3000 : _b, _c = _a.toastPosition, toastPosition = _c === void 0 ? 'top_right' : _c, setOpenToast = _a.setOpenToast, props = __rest(_a, ["className", "children", "openToast", "radius", "scaling", "size", "color", "duration", "toastPosition", "setOpenToast"]);
|
84
|
-
var
|
86
|
+
var theme = useTheme().theme;
|
87
|
+
var contextValue = {
|
88
|
+
radius: theme.themeRadius || radius,
|
89
|
+
scaling: theme.themeScaling || scaling,
|
90
|
+
color: color,
|
91
|
+
size: size,
|
92
|
+
};
|
85
93
|
var toastRootStyle = "\n shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] \n flex flex-col px-[15px] relative justify-center\n data-[state=open]:animate-slideIn \n data-[state=closed]:animate-hide \n data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] \n data-[swipe=cancel]:translate-x-0 \n data-[swipe=cancel]:transition-[transform_200ms_ease-out] \n data-[swipe=end]:animate-swipeOut\n ";
|
86
|
-
var toastClassName = cn(toastVariants(
|
94
|
+
var toastClassName = cn(toastVariants(contextValue), toastRootStyle, className);
|
87
95
|
return (_jsx(ToastContext.Provider, { value: contextValue, children: _jsxs(ToastPrimitive.Provider, { swipeDirection: "right", duration: duration, children: [_jsx(ToastPrimitive.Root, __assign({ ref: ref, className: toastClassName, open: openToast, onOpenChange: setOpenToast }, props, { children: children })), _jsx(ToastPrimitive.Viewport, { className: cn(toastViewportVariants({ toastPosition: toastPosition })) })] }) }));
|
88
96
|
});
|
89
97
|
ToastRoot.displayName = 'Toast.Root';
|
@@ -1,2 +1,3 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{createContext as r,forwardRef as a,useContext as o}from"react";import{cva as n}from"class-variance-authority";import{cn as i}from"../../utils/utils.mjs";import{scalingVariants as s}from"../../constants.mjs";import*as l from"@radix-ui/react-toast";import{useTheme as p}from"../../theme/ThemeProvider.mjs";var d=function(){return d=Object.assign||function(t){for(var e,r=1,a=arguments.length;r<a;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},d.apply(this,arguments)},m=function(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(t);o<a.length;o++)e.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(t,a[o])&&(r[a[o]]=t[a[o]])}return r},c=n("flex bg-white dark:bg-slateDark-1",{variants:{radius:{none:"rounded-none",small:"rounded-[3px]",medium:"rounded",large:"rounded-md",full:"rounded-md"},size:{small:"w-[300px] min-h-[55px] p-3",medium:"w-[400px] min-h-[63px] p-3",large:"w-[400px] min-h-[84px] p-4","x-large":"w-[400px] min-h-[88px] p-4"},scaling:d({},s),color:{danger:"bg-red-3 dark:bg-redDark-3",warning:"bg-amber-3 dark:bg-amberDark-3",success:"bg-green-3 dark:bg-greenDark-3",information:"bg-sky-3 dark:bg-skyDark-3"}},defaultVariants:{radius:"medium",scaling:"100%",size:"medium"}}),u=n("[--viewport-padding:_25px] fixed flex flex-col outline-none gap-[10px]\n p-[var(--viewport-padding)] m-0 list-none z-[987654321]",{variants:{toastPosition:{top_center:"top-0 left-1/2 transform -translate-x-1/2",top_left:"top-0 left-0",top_right:"top-0 right-0",bottom_center:"bottom-0 left-1/2 transform -translate-x-1/2",bottom_left:"bottom-0 left-0",bottom_right:"bottom-0 right-0"}},defaultVariants:{toastPosition:"top_right"}}),f=r({radius:"medium",scaling:"100%",size:"medium",color:null}),g=function(){return o(f)},x=a((function(r,a){var o=r.className,n=r.children,s=r.openToast,g=r.radius,x=r.scaling,h=r.size,_=r.color,b=r.duration,v=void 0===b?3e3:b,w=r.toastPosition,y=void 0===w?"top_right":w,O=r.setOpenToast,k=m(r,["className","children","openToast","radius","scaling","size","color","duration","toastPosition","setOpenToast"]),P=p().theme,j={radius:P.themeRadius||g,scaling:P.themeScaling||x,color:_,size:h},z=i(c(j),"\n shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] \n flex flex-col px-[15px] relative justify-center\n data-[state=open]:animate-slideIn \n data-[state=closed]:animate-hide \n data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] \n data-[swipe=cancel]:translate-x-0 \n data-[swipe=cancel]:transition-[transform_200ms_ease-out] \n data-[swipe=end]:animate-swipeOut\n ",o);return t(f.Provider,{value:j,children:e(l.Provider,{swipeDirection:"right",duration:v,children:[t(l.Root,d({ref:a,className:z,open:s,onOpenChange:O},k,{children:n})),t(l.Viewport,{className:i(u({toastPosition:y}))})]})})}));x.displayName="Toast.Root";export{x as ToastRoot,x as default,c as toastVariants,u as toastViewportVariants,g as useToastContext};
|
2
3
|
//# sourceMappingURL=ToastRoot.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToastRoot.mjs","sources":[
|
1
|
+
{"version":3,"file":"ToastRoot.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
@@ -8,7 +8,7 @@ export interface ToggleWithTextProps extends VariantProps<typeof toggleWithTextV
|
|
8
8
|
size?: 'small' | 'medium' | 'large';
|
9
9
|
}
|
10
10
|
declare const toggleWithTextVariants: (props?: ({
|
11
|
-
radius?: "
|
11
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
12
12
|
size?: "small" | "medium" | "large" | null | undefined;
|
13
13
|
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
14
14
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
@@ -27,6 +27,7 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
27
27
|
import { radiusVariants, toggleAppearanceStyle } from '../../../lib/constants';
|
28
28
|
import { scalingVariants } from '../../../lib/constants';
|
29
29
|
import { cn } from '../../../lib/utils/utils';
|
30
|
+
import { useTheme } from '../../../lib/theme';
|
30
31
|
var toggleWithTextVariants = cva('flex items-center justify-center box-border font-medium w-fit', {
|
31
32
|
variants: {
|
32
33
|
radius: __assign({}, radiusVariants['base']),
|
@@ -50,7 +51,14 @@ export var IconScaling = {
|
|
50
51
|
};
|
51
52
|
export var ToggleWithText = forwardRef(function (_a, ref) {
|
52
53
|
var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, text = _a.text, props = __rest(_a, ["className", "children", "radius", "size", "scaling", "color", "appearance", "text"]);
|
53
|
-
|
54
|
+
var theme = useTheme().theme;
|
55
|
+
var contextValue = {
|
56
|
+
radius: theme.themeRadius || radius,
|
57
|
+
scaling: theme.themeScaling || scaling,
|
58
|
+
color: theme.themeColor || color,
|
59
|
+
size: size,
|
60
|
+
};
|
61
|
+
return (_jsxs(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleWithTextVariants(contextValue), toggleAppearanceStyle(appearance, contextValue.color, true, 'data-[state=on]:'), className) }, props, { children: [Children.map(children, function (child) {
|
54
62
|
return React.cloneElement(child, { className: IconScaling[size] });
|
55
63
|
}), text] })));
|
56
64
|
});
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsxs as e}from"react/jsx-runtime";import
|
1
|
+
import{jsxs as e}from"react/jsx-runtime";import r,{forwardRef as t,Children as a}from"react";import{cva as i}from"class-variance-authority";import*as o from"@radix-ui/react-toggle";import{radiusVariants as s,scalingVariants as n,toggleAppearanceStyle as m}from"../../constants.mjs";import{cn as l}from"../../utils/utils.mjs";import{useTheme as c}from"../../theme/ThemeProvider.mjs";var p=function(){return p=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},p.apply(this,arguments)},u=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)r.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t},f=i("flex items-center justify-center box-border font-medium w-fit",{variants:{radius:p({},s.base),size:{small:"h-6 px-2 text-xs gap-1",medium:"h-8 px-3 text-sm gap-2",large:"h-10 px-4 text-base gap-3"},scaling:p({},n)},defaultVariants:{radius:"medium",size:"medium",scaling:"100%"}}),d={small:"w-[14px]",medium:"w-4",large:"w-[18px]"},g=t((function(t,i){var s=t.className,n=t.children,g=t.radius,h=t.size,x=void 0===h?"medium":h,y=t.scaling,b=t.color,v=void 0===b?"red":b,O=t.appearance,j=void 0===O?"surface":O,w=t.text,z=u(t,["className","children","radius","size","scaling","color","appearance","text"]),N=c().theme,P={radius:N.themeRadius||g,scaling:N.themeScaling||y,color:N.themeColor||v,size:x};return e(o.Root,p({ref:i,className:l(f(P),m(j,P.color,!0,"data-[state=on]:"),s)},z,{children:[a.map(n,(function(e){return r.cloneElement(e,{className:d[x]})})),w]}))}));g.displayName="ToggleWithText";export{d as IconScaling,g as ToggleWithText,g as default};
|
2
2
|
//# sourceMappingURL=ToggleWithText.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToggleWithText.mjs","sources":["../../../lib/components/Toggle/ToggleWithText.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React, { Children, forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport * as TogglePrimitive from '@radix-ui/react-toggle';\nimport { radiusVariants, toggleAppearanceStyle } from '../../../lib/constants';\nimport { scalingVariants } from '../../../lib/constants';\nimport { cn } from '../../../lib/utils/utils';\nvar toggleWithTextVariants = cva('flex items-center justify-center box-border font-medium w-fit', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'h-6 px-2 text-xs gap-1',\n medium: 'h-8 px-3 text-sm gap-2',\n large: 'h-10 px-4 text-base gap-3',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n size: 'medium',\n scaling: '100%',\n },\n});\nexport var IconScaling = {\n small: 'w-[14px]',\n medium: 'w-4',\n large: 'w-[18px]',\n};\nexport var ToggleWithText = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, text = _a.text, props = __rest(_a, [\"className\", \"children\", \"radius\", \"size\", \"scaling\", \"color\", \"appearance\", \"text\"]);\n return (_jsxs(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleWithTextVariants(
|
1
|
+
{"version":3,"file":"ToggleWithText.mjs","sources":["../../../lib/components/Toggle/ToggleWithText.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React, { Children, forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport * as TogglePrimitive from '@radix-ui/react-toggle';\nimport { radiusVariants, toggleAppearanceStyle } from '../../../lib/constants';\nimport { scalingVariants } from '../../../lib/constants';\nimport { cn } from '../../../lib/utils/utils';\nimport { useTheme } from '../../../lib/theme';\nvar toggleWithTextVariants = cva('flex items-center justify-center box-border font-medium w-fit', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'h-6 px-2 text-xs gap-1',\n medium: 'h-8 px-3 text-sm gap-2',\n large: 'h-10 px-4 text-base gap-3',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n size: 'medium',\n scaling: '100%',\n },\n});\nexport var IconScaling = {\n small: 'w-[14px]',\n medium: 'w-4',\n large: 'w-[18px]',\n};\nexport var ToggleWithText = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, text = _a.text, props = __rest(_a, [\"className\", \"children\", \"radius\", \"size\", \"scaling\", \"color\", \"appearance\", \"text\"]);\n var theme = useTheme().theme;\n var contextValue = {\n radius: theme.themeRadius || radius,\n scaling: theme.themeScaling || scaling,\n color: theme.themeColor || color,\n size: size,\n };\n return (_jsxs(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleWithTextVariants(contextValue), toggleAppearanceStyle(appearance, contextValue.color, true, 'data-[state=on]:'), className) }, props, { children: [Children.map(children, function (child) {\n return React.cloneElement(child, { className: IconScaling[size] });\n }), text] })));\n});\nToggleWithText.displayName = 'ToggleWithText';\nexport default ToggleWithText;\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","toggleWithTextVariants","cva","variants","radius","radiusVariants","size","small","medium","large","scaling","scalingVariants","defaultVariants","IconScaling","ToggleWithText","forwardRef","_a","ref","className","children","_b","_c","color","_d","appearance","text","props","theme","useTheme","contextValue","themeRadius","themeScaling","themeColor","_jsxs","TogglePrimitive","Root","cn","toggleAppearanceStyle","Children","map","child","React","cloneElement","displayName"],"mappings":"8XAAA,IAAIA,EAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACf,EACWH,EAASa,MAAMC,KAAMP,UAChC,EACIQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAA,EACR,IAAK,IAAIM,KAAKL,EAAOH,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,IAAMO,EAAEC,QAAQR,GAAK,IAC9EN,EAAEM,GAAKL,EAAEK,IACb,GAAS,MAALL,GAAqD,mBAAjCH,OAAOiB,sBACtB,KAAIb,EAAI,EAAb,IAAgBI,EAAIR,OAAOiB,sBAAsBd,GAAIC,EAAII,EAAED,OAAQH,IAC3DW,EAAEC,QAAQR,EAAEJ,IAAM,GAAKJ,OAAOS,UAAUS,qBAAqBP,KAAKR,EAAGK,EAAEJ,MACvEF,EAAEM,EAAEJ,IAAMD,EAAEK,EAAEJ,IAF4B,CAItD,OAAOF,CACX,EASIiB,EAAy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|
10
10
|
declare const toggleVariants: (props?: ({
|
11
|
-
radius?: "
|
11
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
12
12
|
size?: "small" | "medium" | "large" | null | undefined;
|
13
13
|
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
14
14
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
@@ -26,6 +26,7 @@ import { cva } from 'class-variance-authority';
|
|
26
26
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
27
27
|
import { radiusVariants, scalingVariants, toggleAppearanceStyle } from '../../../lib/constants';
|
28
28
|
import { cn } from '../../../lib/utils/utils';
|
29
|
+
import { useTheme } from '../../../lib/theme';
|
29
30
|
export * from './ToggleWithText';
|
30
31
|
var toggleVariants = cva('grid place-content-center items-center justify-center box-border"', {
|
31
32
|
variants: {
|
@@ -50,7 +51,14 @@ export var IconScaling = {
|
|
50
51
|
};
|
51
52
|
export var Toggle = forwardRef(function (_a, ref) {
|
52
53
|
var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, props = __rest(_a, ["className", "children", "radius", "size", "scaling", "color", "appearance"]);
|
53
|
-
|
54
|
+
var theme = useTheme().theme;
|
55
|
+
var contextValue = {
|
56
|
+
radius: theme.themeRadius || radius,
|
57
|
+
scaling: theme.themeScaling || scaling,
|
58
|
+
color: theme.themeColor || color,
|
59
|
+
size: size,
|
60
|
+
};
|
61
|
+
return (_jsx(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleVariants(contextValue), toggleAppearanceStyle(appearance, contextValue.color, true, 'data-[state=on]:'), className) }, props, { children: Children.map(children, function (child) {
|
54
62
|
return React.cloneElement(child, { className: IconScaling[size] });
|
55
63
|
}) })));
|
56
64
|
});
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import r,{forwardRef as t,Children as a}from"react";import{cva as
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import r,{forwardRef as t,Children as a}from"react";import{cva as o}from"class-variance-authority";import*as i from"@radix-ui/react-toggle";import{radiusVariants as n,scalingVariants as s,toggleAppearanceStyle as l}from"../../constants.mjs";import{cn as m}from"../../utils/utils.mjs";import{useTheme as c}from"../../theme/ThemeProvider.mjs";export{ToggleWithText}from"./ToggleWithText.mjs";var p=function(){return p=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},p.apply(this,arguments)},u=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)r.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t},d=o('grid place-content-center items-center justify-center box-border"',{variants:{radius:p({},n.base),size:{small:"w-6 h-6 p-[6px]",medium:"w-8 h-8 p-2",large:"w-10 h-10 p-[11px]"},scaling:p({},s)},defaultVariants:{radius:"medium",size:"medium",scaling:"100%"}}),f={small:"w-[14px]",medium:"w-4",large:"w-[18px]"},g=t((function(t,o){var n=t.className,s=t.children,g=t.radius,h=t.size,y=void 0===h?"medium":h,v=t.scaling,x=t.color,b=void 0===x?"red":x,j=t.appearance,O=void 0===j?"surface":j,w=u(t,["className","children","radius","size","scaling","color","appearance"]),T=c().theme,z={radius:T.themeRadius||g,scaling:T.themeScaling||v,color:T.themeColor||b,size:y};return e(i.Root,p({ref:o,className:m(d(z),l(O,z.color,!0,"data-[state=on]:"),n)},w,{children:a.map(s,(function(e){return r.cloneElement(e,{className:f[y]})}))}))}));g.displayName="Toggle";export{f as IconScaling,g as Toggle,g as default};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../lib/components/Toggle/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { Children, forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport * as TogglePrimitive from '@radix-ui/react-toggle';\nimport { radiusVariants, scalingVariants, toggleAppearanceStyle } from '../../../lib/constants';\nimport { cn } from '../../../lib/utils/utils';\nexport * from './ToggleWithText';\nvar toggleVariants = cva('grid place-content-center items-center justify-center box-border\"', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'w-6 h-6 p-[6px]',\n medium: 'w-8 h-8 p-2',\n large: 'w-10 h-10 p-[11px]',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n size: 'medium',\n scaling: '100%',\n },\n});\nexport var IconScaling = {\n small: 'w-[14px]',\n medium: 'w-4',\n large: 'w-[18px]',\n};\nexport var Toggle = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, props = __rest(_a, [\"className\", \"children\", \"radius\", \"size\", \"scaling\", \"color\", \"appearance\"]);\n return (_jsx(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleVariants(
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../lib/components/Toggle/index.js"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { Children, forwardRef } from 'react';\nimport { cva } from 'class-variance-authority';\nimport * as TogglePrimitive from '@radix-ui/react-toggle';\nimport { radiusVariants, scalingVariants, toggleAppearanceStyle } from '../../../lib/constants';\nimport { cn } from '../../../lib/utils/utils';\nimport { useTheme } from '../../../lib/theme';\nexport * from './ToggleWithText';\nvar toggleVariants = cva('grid place-content-center items-center justify-center box-border\"', {\n variants: {\n radius: __assign({}, radiusVariants['base']),\n size: {\n small: 'w-6 h-6 p-[6px]',\n medium: 'w-8 h-8 p-2',\n large: 'w-10 h-10 p-[11px]',\n },\n scaling: __assign({}, scalingVariants),\n },\n defaultVariants: {\n radius: 'medium',\n size: 'medium',\n scaling: '100%',\n },\n});\nexport var IconScaling = {\n small: 'w-[14px]',\n medium: 'w-4',\n large: 'w-[18px]',\n};\nexport var Toggle = forwardRef(function (_a, ref) {\n var className = _a.className, children = _a.children, radius = _a.radius, _b = _a.size, size = _b === void 0 ? 'medium' : _b, scaling = _a.scaling, _c = _a.color, color = _c === void 0 ? 'red' : _c, _d = _a.appearance, appearance = _d === void 0 ? 'surface' : _d, props = __rest(_a, [\"className\", \"children\", \"radius\", \"size\", \"scaling\", \"color\", \"appearance\"]);\n var theme = useTheme().theme;\n var contextValue = {\n radius: theme.themeRadius || radius,\n scaling: theme.themeScaling || scaling,\n color: theme.themeColor || color,\n size: size,\n };\n return (_jsx(TogglePrimitive.Root, __assign({ ref: ref, className: cn(toggleVariants(contextValue), toggleAppearanceStyle(appearance, contextValue.color, true, 'data-[state=on]:'), className) }, props, { children: Children.map(children, function (child) {\n return React.cloneElement(child, { className: IconScaling[size] });\n }) })));\n});\nToggle.displayName = 'Toggle';\nexport default Toggle;\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","toggleVariants","cva","variants","radius","radiusVariants","size","small","medium","large","scaling","scalingVariants","defaultVariants","IconScaling","Toggle","forwardRef","_a","ref","className","children","_b","_c","color","_d","appearance","props","theme","useTheme","contextValue","themeRadius","themeScaling","themeColor","_jsx","TogglePrimitive","Root","cn","toggleAppearanceStyle","Children","map","child","React","cloneElement","displayName"],"mappings":"8aAAA,IAAIA,EAAsC,WAStC,OARAA,EAAWC,OAAOC,QAAU,SAASC,GACjC,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KACzDN,EAAEM,GAAKL,EAAEK,IAEjB,OAAON,CACf,EACWH,EAASa,MAAMC,KAAMP,UAChC,EACIQ,EAAkC,SAAUX,EAAGY,GAC/C,IAAIb,EAAI,CAAA,EACR,IAAK,IAAIM,KAAKL,EAAOH,O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CAAEoC,IAAKA,EAAKC,UAAWiB,EAAGlC,EAAe2B,GAAeQ,EAAsBZ,EAAYI,EAAaN,OAAO,EAAM,oBAAqBJ,IAAcO,EAAO,CAAEN,SAAUkB,EAASC,IAAInB,GAAU,SAAUoB,GAC/O,OAAOC,EAAMC,aAAaF,EAAO,CAAErB,UAAWL,EAAYP,IACtE,MACA,IACAQ,EAAO4B,YAAc"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
'use client';
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
2
3
|
__assign = Object.assign || function(t) {
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
@@ -26,6 +27,7 @@ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
26
27
|
import { cva } from 'class-variance-authority';
|
27
28
|
import { scalingVariants } from '../../../lib/constants';
|
28
29
|
import { cn } from '../../../lib/utils/utils';
|
30
|
+
import { useTheme } from '../../../lib/theme';
|
29
31
|
var toggleVariants = cva('inline-flex', {
|
30
32
|
variants: {
|
31
33
|
scaling: __assign({}, scalingVariants),
|
@@ -41,8 +43,14 @@ export var ToggleGroupContext = createContext({
|
|
41
43
|
});
|
42
44
|
export var ToggleGroupRoot = forwardRef(function (_a, ref) {
|
43
45
|
var className = _a.className, children = _a.children, scaling = _a.scaling, size = _a.size, color = _a.color, appearance = _a.appearance, props = __rest(_a, ["className", "children", "scaling", "size", "color", "appearance"]);
|
46
|
+
var theme = useTheme().theme;
|
44
47
|
var type = __assign({}, props).type;
|
45
|
-
var contextValue = {
|
46
|
-
|
48
|
+
var contextValue = {
|
49
|
+
scaling: theme.themeScaling || scaling,
|
50
|
+
color: theme.themeColor || color,
|
51
|
+
size: size,
|
52
|
+
appearance: appearance,
|
53
|
+
};
|
54
|
+
return (_jsx(ToggleGroupContext.Provider, { value: contextValue, children: type === 'single' ? (_jsx(ToggleGroupPrimitive.Root, __assign({ className: cn(toggleVariants(contextValue), className) }, props, { ref: ref, children: children }))) : (_jsx(ToggleGroupPrimitive.Root, __assign({ className: cn(toggleVariants(contextValue), className) }, props, { ref: ref, children: children }))) }));
|
47
55
|
});
|
48
56
|
ToggleGroupRoot.displayName = 'ToggleGroup.Root';
|
@@ -1,2 +1,3 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{createContext as e,forwardRef as t}from"react";import*as o from"@radix-ui/react-toggle-group";import{cva as a}from"class-variance-authority";import{scalingVariants as n}from"../../constants.mjs";import{cn as i}from"../../utils/utils.mjs";import{useTheme as c}from"../../theme/ThemeProvider.mjs";var l=function(){return l=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++)for(var a in e=arguments[t])Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r},l.apply(this,arguments)},s=function(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(r);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(r,o[a])&&(t[o[a]]=r[o[a]])}return t},p=a("inline-flex",{variants:{scaling:l({},n)},defaultVariants:{scaling:"100%"}}),m=e({size:"medium",color:"red",appearance:"surface"}),f=t((function(e,t){var a=e.className,n=e.children,f=e.scaling,u=e.size,g=e.color,h=e.appearance,y=s(e,["className","children","scaling","size","color","appearance"]),d=c().theme,v=(l({},y).type,{scaling:d.themeScaling||f,color:d.themeColor||g,size:u,appearance:h});return r(m.Provider,{value:v,children:r(o.Root,l({className:i(p(v),a)},y,{ref:t,children:n}))})}));f.displayName="ToggleGroup.Root";export{m as ToggleGroupContext,f as ToggleGroupRoot};
|
2
3
|
//# sourceMappingURL=ToggleGroupRoot.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToggleGroupRoot.mjs","sources":[
|
1
|
+
{"version":3,"file":"ToggleGroupRoot.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
@@ -6,7 +6,7 @@ export interface ToggleSwitchProps extends VariantProps<typeof toggleSwitchVaria
|
|
6
6
|
}
|
7
7
|
declare const toggleSwitchVariants: (props?: ({
|
8
8
|
scaling?: "90%" | "95%" | "100%" | "105%" | "110%" | null | undefined;
|
9
|
-
radius?: "
|
9
|
+
radius?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
|
10
10
|
size?: "small" | "medium" | "large" | null | undefined;
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
12
12
|
export declare const ToggleSwitch: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/themes").SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref">, "size"> & ToggleSwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
@@ -27,6 +27,7 @@ import { cn } from '../../../lib/utils/utils';
|
|
27
27
|
import { radiusVariants, scalingVariants } from '../../../lib/constants';
|
28
28
|
import { Switch as SwitchTheme, Theme } from '@radix-ui/themes';
|
29
29
|
import { Text } from '../../../lib/Typography/Text';
|
30
|
+
import { useTheme } from '../../../lib/theme';
|
30
31
|
var toggleSwitchVariants = cva('', {
|
31
32
|
variants: {
|
32
33
|
scaling: __assign({}, scalingVariants),
|
@@ -58,6 +59,7 @@ var SwitchLabelVariants = cva('flex items-center justify-start text-slate-12 fon
|
|
58
59
|
});
|
59
60
|
export var ToggleSwitch = React.forwardRef(function (_a, forwardedRef) {
|
60
61
|
var className = _a.className, _b = _a.color, color = _b === void 0 ? 'red' : _b, scaling = _a.scaling, size = _a.size, _c = _a.appearance, appearance = _c === void 0 ? 'surface' : _c, radius = _a.radius, tabIndex = _a.tabIndex, children = _a.children, switchProps = __rest(_a, ["className", "color", "scaling", "size", "appearance", "radius", "tabIndex", "children"]);
|
62
|
+
var theme = useTheme().theme;
|
61
63
|
if (radius === 'medium' || radius === 'large')
|
62
64
|
radius = 'full';
|
63
65
|
var sizeTheme = '2';
|
@@ -65,7 +67,17 @@ export var ToggleSwitch = React.forwardRef(function (_a, forwardedRef) {
|
|
65
67
|
sizeTheme = '1';
|
66
68
|
if (size === 'large')
|
67
69
|
sizeTheme = '3';
|
68
|
-
|
70
|
+
var contextValue = {
|
71
|
+
radius: theme.themeRadius || radius,
|
72
|
+
scaling: theme.themeScaling || scaling,
|
73
|
+
color: theme.themeColor || color,
|
74
|
+
size: size,
|
75
|
+
};
|
76
|
+
return (
|
77
|
+
// @ts-ignore
|
78
|
+
_jsx(Theme, { className: "flex", accentColor: contextValue.color, hasBackground: false, children: _jsxs(Text, { as: "label", className: cn('flex items-center', SwitchLabelVariants({ size: size, scaling: contextValue.scaling })), children: [_jsx(SwitchTheme, __assign({ ref: forwardedRef }, switchProps, { variant: appearance, radius: contextValue.radius, size: sizeTheme,
|
79
|
+
// @ts-ignore
|
80
|
+
color: contextValue.color, className: cn(toggleSwitchVariants(contextValue), className), "aria-label": "Switch" })), children] }) }));
|
69
81
|
});
|
70
82
|
ToggleSwitch.displayName = 'ToggleSwitch';
|
71
83
|
export default ToggleSwitch;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{jsx as
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import r from"react";import{cva as t}from"class-variance-authority";import{cn as i}from"../../utils/utils.mjs";import{scalingVariants as s,radiusVariants as l}from"../../constants.mjs";import{Theme as o,Switch as n}from"@radix-ui/themes";import{Text as m}from"../../Typography/Text/index.mjs";import{useTheme as c}from"../../theme/ThemeProvider.mjs";var p=function(){return p=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var i in a=arguments[r])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);return e},p.apply(this,arguments)},u=function(e,a){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)a.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(r[t[i]]=e[t[i]])}return r},f=t("",{variants:{scaling:p({},s),radius:p({},l.base),size:{small:"w-[28px] h-[16px]",medium:"w-[35px] h-[20px]",large:"w-[42px] h-[24px]"}},defaultVariants:{radius:"full",size:"medium"}}),d=t("flex items-center justify-start text-slate-12 font-normal dark:text-white",{variants:{size:{small:"text-xs gap-2",medium:"text-sm gap-2",large:"text-base gap-3"},scaling:p({},s)},defaultVariants:{size:"medium",scaling:"100%"}}),g=r.forwardRef((function(r,t){var s=r.className,l=r.color,g=void 0===l?"red":l,h=r.scaling,x=r.size,v=r.appearance,y=void 0===v?"surface":v,b=r.radius;r.tabIndex;var j=r.children,O=u(r,["className","color","scaling","size","appearance","radius","tabIndex","children"]),w=c().theme;"medium"!==b&&"large"!==b||(b="full");var z="2";"small"===x&&(z="1"),"large"===x&&(z="3");var N={radius:w.themeRadius||b,scaling:w.themeScaling||h,color:w.themeColor||g,size:x};return e(o,{className:"flex",accentColor:N.color,hasBackground:!1,children:a(m,{as:"label",className:i("flex items-center",d({size:x,scaling:N.scaling})),children:[e(n,p({ref:t},O,{variant:y,radius:N.radius,size:z,color:N.color,className:i(f(N),s),"aria-label":"Switch"})),j]})})}));g.displayName="ToggleSwitch";export{g as ToggleSwitch,g as default};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|