ag-common 0.0.771 → 0.0.773

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.
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ConfirmModal = void 0;
8
8
  const styled_1 = __importDefault(require("@emotion/styled"));
9
9
  const react_1 = __importDefault(require("react"));
10
- const Button_1 = require("../Button");
11
10
  const FlexColumn_1 = require("../FlexColumn");
12
11
  const FlexRow_1 = require("../FlexRow");
13
12
  const Modal_1 = require("../Modal/Modal");
13
+ const button_1 = require("../shadcn/button");
14
14
  const Base = styled_1.default.div `
15
15
  width: 95vw;
16
16
  max-width: 30rem;
@@ -47,7 +47,7 @@ const ConfirmModal = ({ onSubmit, bottomText, topText, okText = 'OK', cancelText
47
47
  topText && react_1.default.createElement(TopText, null, topText),
48
48
  react_1.default.createElement(BottomText, null, bottomText),
49
49
  react_1.default.createElement(Bottom, { noGrow: true },
50
- react_1.default.createElement(Button_1.Button, { onClick: () => onSubmit(true) }, okText),
51
- react_1.default.createElement(Button_1.Button, { invert: true, onClick: () => onSubmit(false) }, cancelText))))));
50
+ react_1.default.createElement(button_1.Button, { onClick: () => onSubmit(true) }, okText),
51
+ react_1.default.createElement(button_1.Button, { variant: "outline", onClick: () => onSubmit(false) }, cancelText))))));
52
52
  };
53
53
  exports.ConfirmModal = ConfirmModal;
@@ -40,10 +40,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.PromptModal = void 0;
41
41
  const styled_1 = __importDefault(require("@emotion/styled"));
42
42
  const react_1 = __importStar(require("react"));
43
- const Button_1 = require("../Button");
44
43
  const FlexColumn_1 = require("../FlexColumn");
45
44
  const FlexRow_1 = require("../FlexRow");
46
45
  const Modal_1 = require("../Modal/Modal");
46
+ const button_1 = require("../shadcn/button");
47
47
  const TextEdit_1 = require("../TextEdit");
48
48
  const Base = styled_1.default.div `
49
49
  width: 95vw;
@@ -105,7 +105,7 @@ const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', c
105
105
  }
106
106
  }, placeholder: placeholder, defaultEditing: { focus: true }, singleLine: true, noGrow: true, allowUndo: false }),
107
107
  react_1.default.createElement(Bottom, { noGrow: true },
108
- react_1.default.createElement(Button_1.Button, { onClick: () => ret(text) }, okText),
109
- react_1.default.createElement(Button_1.Button, { invert: true, onClick: () => ret(undefined) }, cancelText))))));
108
+ react_1.default.createElement(button_1.Button, { onClick: () => ret(text) }, okText),
109
+ react_1.default.createElement(button_1.Button, { variant: "outline", onClick: () => ret(undefined) }, cancelText))))));
110
110
  };
111
111
  exports.PromptModal = PromptModal;
@@ -4,8 +4,6 @@ declare const buttonVariants: (props?: ({
4
4
  variant?: "default" | "link" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
5
5
  size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
- asChild?: boolean;
9
- }
10
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>;
8
+ declare const Button: ({ className, variant, size, ...props }: ButtonProps) => React.JSX.Element;
11
9
  export { Button, buttonVariants };
@@ -45,7 +45,6 @@ var __rest = (this && this.__rest) || function (s, e) {
45
45
  };
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
47
  exports.buttonVariants = exports.Button = void 0;
48
- const react_slot_1 = require("@radix-ui/react-slot");
49
48
  const class_variance_authority_1 = require("class-variance-authority");
50
49
  const React = __importStar(require("react"));
51
50
  const utils_1 = require("../../helpers/utils");
@@ -72,10 +71,8 @@ const buttonVariants = (0, class_variance_authority_1.cva)('!cursor-pointer inli
72
71
  },
73
72
  });
74
73
  exports.buttonVariants = buttonVariants;
75
- const Button = React.forwardRef((_a, ref) => {
76
- var { className, variant, size, asChild = false } = _a, props = __rest(_a, ["className", "variant", "size", "asChild"]);
77
- const Comp = asChild ? react_slot_1.Slot : 'button';
78
- return (React.createElement(Comp, Object.assign({ className: (0, utils_1.cn)(buttonVariants({ variant, size, className })), ref: ref }, props)));
79
- });
74
+ const Button = (_a) => {
75
+ var { className, variant, size } = _a, props = __rest(_a, ["className", "variant", "size"]);
76
+ return (React.createElement("button", Object.assign({ className: (0, utils_1.cn)(buttonVariants({ variant, size, className })) }, props)));
77
+ };
80
78
  exports.Button = Button;
81
- Button.displayName = 'Button';
@@ -14,4 +14,5 @@ export * from './popover';
14
14
  export * from './scroll-area';
15
15
  export * from './select';
16
16
  export * from './sheet';
17
+ export * from './switch';
17
18
  export * from './textarea';
@@ -30,4 +30,5 @@ __exportStar(require("./popover"), exports);
30
30
  __exportStar(require("./scroll-area"), exports);
31
31
  __exportStar(require("./select"), exports);
32
32
  __exportStar(require("./sheet"), exports);
33
+ __exportStar(require("./switch"), exports);
33
34
  __exportStar(require("./textarea"), exports);
@@ -0,0 +1,7 @@
1
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
2
+ import * as React from 'react';
3
+ interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
4
+ icon?: React.ReactNode;
5
+ }
6
+ declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export { Switch };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Switch = void 0;
49
+ const SwitchPrimitive = __importStar(require("@radix-ui/react-switch"));
50
+ const React = __importStar(require("react"));
51
+ const utils_1 = require("../../helpers/utils");
52
+ const Switch = React.forwardRef((_a, ref) => {
53
+ var { className, icon } = _a, props = __rest(_a, ["className", "icon"]);
54
+ return (React.createElement(SwitchPrimitive.Root, Object.assign({ className: (0, utils_1.cn)('peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-sm border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input', className) }, props, { ref: ref }),
55
+ React.createElement(SwitchPrimitive.Thumb, { className: (0, utils_1.cn)('pointer-events-none flex items-center justify-center h-4 w-4 rounded-sm bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0') }, icon)));
56
+ });
57
+ exports.Switch = Switch;
58
+ Switch.displayName = SwitchPrimitive.Root.displayName;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.771",
2
+ "version": "0.0.773",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
@@ -17,70 +17,71 @@
17
17
  "test": "globstar -- node --import tsx --test \"src/**/*.test.ts\""
18
18
  },
19
19
  "dependencies": {
20
- "@aws-sdk/client-apigatewaymanagementapi": "^3.879.0",
21
- "@aws-sdk/client-dynamodb": "^3.879.0",
22
- "@aws-sdk/client-s3": "^3.879.0",
23
- "@aws-sdk/client-ses": "^3.879.0",
24
- "@aws-sdk/client-sqs": "^3.879.0",
25
- "@aws-sdk/client-sts": "^3.879.0",
26
- "@aws-sdk/lib-dynamodb": "^3.879.0",
27
- "@aws-sdk/s3-presigned-post": "^3.879.0",
20
+ "@aws-sdk/client-apigatewaymanagementapi": "^3.901.0",
21
+ "@aws-sdk/client-dynamodb": "^3.901.0",
22
+ "@aws-sdk/client-s3": "^3.901.0",
23
+ "@aws-sdk/client-ses": "^3.901.0",
24
+ "@aws-sdk/client-sqs": "^3.901.0",
25
+ "@aws-sdk/client-sts": "^3.901.0",
26
+ "@aws-sdk/lib-dynamodb": "^3.901.0",
27
+ "@aws-sdk/s3-presigned-post": "^3.901.0",
28
28
  "@azure/cosmos": "^4.5.1",
29
29
  "@storybook/addon-styling-webpack": "^2.0.0",
30
30
  "@storybook/react-vite": "^9.1.10",
31
- "aws-cdk-lib": "^2.213.0",
31
+ "aws-cdk-lib": "^2.219.0",
32
32
  "buffer": "^6.0.3",
33
33
  "jsonwebtoken": "^9.0.2",
34
34
  "jwks-rsa": "^3.2.0",
35
35
  "node-cache": "^5.1.2",
36
- "react": "^19.1.1",
37
- "react-dom": "^19.1.1",
38
- "typescript": "^5.9.2"
36
+ "react": "^19.2.0",
37
+ "react-dom": "^19.2.0",
38
+ "typescript": "^5.9.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.1",
43
- "@radix-ui/react-accordion": "1.2.12",
44
- "@radix-ui/react-avatar": "1.1.10",
45
- "@radix-ui/react-checkbox": "1.3.3",
46
- "@radix-ui/react-dialog": "1.1.15",
47
- "@radix-ui/react-dropdown-menu": "2.1.16",
48
- "@radix-ui/react-icons": "1.3.2",
49
- "@radix-ui/react-label": "2.1.7",
50
- "@radix-ui/react-popover": "1.1.15",
51
- "@radix-ui/react-scroll-area": "1.2.10",
52
- "@radix-ui/react-select": "2.2.6",
53
- "@radix-ui/react-slot": "1.2.3",
54
- "@smithy/types": "^4.3.2",
55
- "@storybook/addon-docs": "^9.1.3",
56
- "@storybook/addon-links": "^9.1.3",
43
+ "@radix-ui/react-accordion": "^1.2.12",
44
+ "@radix-ui/react-avatar": "^1.1.10",
45
+ "@radix-ui/react-checkbox": "^1.3.3",
46
+ "@radix-ui/react-dialog": "^1.1.15",
47
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
48
+ "@radix-ui/react-icons": "^1.3.2",
49
+ "@radix-ui/react-label": "^2.1.7",
50
+ "@radix-ui/react-popover": "^1.1.15",
51
+ "@radix-ui/react-scroll-area": "^1.2.10",
52
+ "@radix-ui/react-select": "^2.2.6",
53
+ "@radix-ui/react-slot": "^1.2.3",
54
+ "@radix-ui/react-switch": "^1.2.6",
55
+ "@smithy/types": "^4.6.0",
56
+ "@storybook/addon-docs": "^9.1.10",
57
+ "@storybook/addon-links": "^9.1.10",
57
58
  "@storybook/addons": "^7.6.17",
58
59
  "@storybook/manager-api": "^8.6.14",
59
- "@storybook/react": "^9.1.3",
60
- "@storybook/react-webpack5": "^9.1.3",
60
+ "@storybook/react": "^9.1.10",
61
+ "@storybook/react-webpack5": "^9.1.10",
61
62
  "@storybook/theming": "^8.6.14",
62
- "@tailwindcss/postcss": "4.1.13",
63
+ "@tailwindcss/postcss": "^4.1.14",
63
64
  "@types/jsonwebtoken": "^9.0.10",
64
- "@types/node": "^24.3.0",
65
- "@types/react": "^19.1.12",
66
- "@types/react-dom": "^19.1.9",
67
- "@typescript-eslint/eslint-plugin": "^8.41.0",
68
- "@typescript-eslint/parser": "^8.41.0",
69
- "autoprefixer": "10.4.21",
65
+ "@types/node": "^24.6.2",
66
+ "@types/react": "^19.2.0",
67
+ "@types/react-dom": "^19.2.0",
68
+ "@typescript-eslint/eslint-plugin": "^8.45.0",
69
+ "@typescript-eslint/parser": "^8.45.0",
70
+ "autoprefixer": "^10.4.21",
70
71
  "class-variance-authority": "^0.7.1",
71
72
  "clsx": "^2.1.1",
72
- "cross-env": "^10.0.0",
73
- "eslint": "^9.34.0",
74
- "eslint-config-e7npm": "^0.1.24",
75
- "eslint-plugin-storybook": "^9.1.3",
73
+ "cross-env": "^10.1.0",
74
+ "eslint": "^9.36.0",
75
+ "eslint-config-e7npm": "^0.1.25",
76
+ "eslint-plugin-storybook": "^9.1.10",
76
77
  "globstar": "^1.0.0",
77
78
  "lucide-react": "^0.544.0",
78
79
  "rimraf": "^6.0.1",
79
- "storybook": "^9.1.3",
80
- "tailwind-merge": "3.3.1",
81
- "tailwindcss": "4.1.13",
82
- "tailwindcss-animate": "1.0.7",
83
- "tsx": "^4.20.5"
80
+ "storybook": "^9.1.10",
81
+ "tailwind-merge": "^3.3.1",
82
+ "tailwindcss": "^4.1.14",
83
+ "tailwindcss-animate": "^1.0.7",
84
+ "tsx": "^4.20.6"
84
85
  },
85
86
  "resolutions": {
86
87
  "globals": "16.4.0"
@@ -1,14 +0,0 @@
1
- import type { JSX, KeyboardEventHandler, MouseEventHandler } from 'react';
2
- export declare const ButtonBase: import("@emotion/react").SerializedStyles;
3
- export interface IButton {
4
- title?: string;
5
- invert?: boolean;
6
- disabled?: boolean;
7
- className?: string;
8
- onClick?: MouseEventHandler<HTMLButtonElement>;
9
- onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
10
- children: string | JSX.Element;
11
- href?: string;
12
- colourTheme?: 'green' | 'red';
13
- }
14
- export declare const Button: (props: IButton) => JSX.Element;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Button = exports.ButtonBase = void 0;
8
- const react_1 = require("@emotion/react");
9
- const styled_1 = __importDefault(require("@emotion/styled"));
10
- const react_2 = __importDefault(require("react"));
11
- const colours_1 = require("../../styles/colours");
12
- exports.ButtonBase = (0, react_1.css) `
13
- text-decoration: none;
14
- display: flex;
15
- justify-content: center;
16
- align-items: center;
17
- border: 0;
18
- font-weight: bold;
19
- font-family: inherit;
20
- font-size: 1.2rem;
21
- border-radius: 0.5rem;
22
- cursor: pointer;
23
- height: 3rem;
24
- line-height: 1rem;
25
- &:hover {
26
- filter: saturate(1.5);
27
- }
28
- padding-left: 1rem;
29
- padding-right: 1rem;
30
- color: white;
31
-
32
- &[data-disabled='true'] {
33
- cursor: default !important;
34
- background-color: #888 !important;
35
- }
36
-
37
- &[data-theme='green'] {
38
- background-color: ${colours_1.colours.darkGreen};
39
- &[data-invert='true'] {
40
- color: ${colours_1.colours.darkGreen};
41
- background-color: white;
42
- border: solid 1px ${colours_1.colours.darkGreen};
43
- }
44
- }
45
-
46
- &[data-theme='red'] {
47
- background-color: ${colours_1.colours.orangeRed};
48
- &[data-invert='true'] {
49
- color: ${colours_1.colours.orangeRed};
50
- background-color: white;
51
- border: solid 1px ${colours_1.colours.orangeRed};
52
- }
53
- }
54
- `;
55
- const BaseButton = styled_1.default.button `
56
- ${exports.ButtonBase}
57
- `;
58
- const BaseA = styled_1.default.a `
59
- ${exports.ButtonBase}
60
- `;
61
- const Button = (props) => {
62
- var _a, _b;
63
- const Component = props.href
64
- ? BaseA
65
- : BaseButton;
66
- return (react_2.default.createElement(Component, Object.assign({ className: props.className, "data-invert": props.invert, "data-disabled": (_a = props.disabled) !== null && _a !== void 0 ? _a : false, role: "button", title: props.title || undefined, "data-theme": (_b = props.colourTheme) !== null && _b !== void 0 ? _b : 'green' }, props), props.children));
67
- };
68
- exports.Button = Button;