@caspeco/casper-ui-library 7.5.0 → 7.7.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.
Files changed (27) hide show
  1. package/README.md +3 -2
  2. package/dist/components/button/helper.d.ts +4 -1
  3. package/dist/components/button/helper.d.ts.map +1 -1
  4. package/dist/components/button/helper.js +18 -16
  5. package/dist/components/button/types.d.ts +5 -2
  6. package/dist/components/button/types.d.ts.map +1 -1
  7. package/dist/components/icon-button/helper.d.ts +4 -1
  8. package/dist/components/icon-button/helper.d.ts.map +1 -1
  9. package/dist/components/icon-button/helper.js +13 -11
  10. package/dist/components/icon-button/icon-button.d.ts +1 -1
  11. package/dist/components/icon-button/types.d.ts +2 -1
  12. package/dist/components/icon-button/types.d.ts.map +1 -1
  13. package/dist/components/toggle-button/toggle-button.d.ts +1 -1
  14. package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
  15. package/dist/components/toggle-button/toggle-button.js +7 -5
  16. package/dist/components/toggle-button/types.d.ts +23 -5
  17. package/dist/components/toggle-button/types.d.ts.map +1 -1
  18. package/dist/components/toggle-button/use-button-children.d.ts +9 -0
  19. package/dist/components/toggle-button/use-button-children.d.ts.map +1 -0
  20. package/dist/components/toggle-button/use-button-children.js +27 -0
  21. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +0 -10
  22. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +0 -10
  23. package/dist/theme/theme-config/components/button-theme.d.ts.map +1 -1
  24. package/dist/theme/theme-config/components/button-theme.js +46 -33
  25. package/dist/theme/theme-config/components/combobox-theme.d.ts +1 -1
  26. package/dist/theme/theme-config/components/drawer-theme.d.ts +1 -1
  27. package/package.json +11 -11
package/README.md CHANGED
@@ -61,6 +61,7 @@ export default defineConfig({
61
61
  git checkout -b UTF-837-add-checkbox-component
62
62
  ```
63
63
  3. Make your changes.
64
- 4. Bump the `version` field in `package.json` (following [Semantic versioning](https://semver.org/)) and run `npm install`.
64
+ 4. Bump the `version` field in `package.json` (following [Semantic versioning](https://semver.org/)) and run `npm install`. The version reflects API changes only (e.g. removing a prop → MAJOR, adding a prop → MINOR, no public API changes → PATCH). UI changes are **NOT** API changes.
65
65
  5. Open a [pull request](https://github.com/Caspeco/casper-ui-library/pulls) using the template and assign a reviewer.
66
- 6. When you have gotten your PR approved, merge the PR. If you have a new version in package.json it will automatically publish your changes to npm. A new version of the documentation website will always be built.
66
+ 6. If the PR makes significant changes to the UI (e.g. changes the sizes for all buttons), clearly announce this in the [Mattermost channel](https://snack.azure.caspeco.com/default/channels/casper-ui-20---devs).
67
+ 7. After approval, merge the PR. If you have a new version in package.json it will automatically publish your changes to npm. The documentation website is always rebuilt.
@@ -1,9 +1,12 @@
1
+ import { ButtonSize } from './types.js';
1
2
  import { ThemeIconSizeVariable } from '../../theme/index.js';
2
3
  import { ResponsiveValue } from '@chakra-ui/react';
3
4
  export declare const iconSizeMap: {
5
+ xl: ThemeIconSizeVariable;
4
6
  lg: ThemeIconSizeVariable;
5
7
  md: ThemeIconSizeVariable;
6
8
  sm: ThemeIconSizeVariable;
9
+ xs: ThemeIconSizeVariable;
7
10
  };
8
11
  /**
9
12
  * Maps a ResponsiveValue of button sizes to corresponding icon sizes.
@@ -11,5 +14,5 @@ export declare const iconSizeMap: {
11
14
  * @param size - The ResponsiveValue of the button size.
12
15
  * @returns A ResponsiveValue of icon sizes.
13
16
  */
14
- export declare function getIconSizeFromButtonSize(size: ResponsiveValue<"lg" | "sm" | "md">): ThemeIconSizeVariable | (ThemeIconSizeVariable | null)[] | Record<string, ThemeIconSizeVariable | undefined> | undefined;
17
+ export declare function getIconSizeFromButtonSize(size: ResponsiveValue<ButtonSize>): ThemeIconSizeVariable | (ThemeIconSizeVariable | null)[] | Record<string, ThemeIconSizeVariable | undefined> | undefined;
15
18
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../lib/components/button/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,4HA2BlF"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../lib/components/button/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,CAAC,4HA2B1E"}
@@ -1,23 +1,25 @@
1
- import { ThemeIconSizeVariable as e } from "../../theme/theme-types.js";
1
+ import { ThemeIconSizeVariable as t } from "../../theme/theme-types.js";
2
2
  const o = {
3
- lg: e.Medium,
4
- md: e.Medium,
5
- sm: e.Small
3
+ xl: t.Medium,
4
+ lg: t.Medium,
5
+ md: t.Medium,
6
+ sm: t.Small,
7
+ xs: t.Small
6
8
  };
7
- function a(r) {
8
- if (typeof r == "string")
9
- return o[r];
10
- if (Array.isArray(r))
11
- return r.map((t) => t && o[t]);
12
- if (typeof r == "object") {
13
- const t = {};
14
- return Object.keys(r).forEach((n) => {
15
- const i = r[n];
16
- i && (t[n] = o[i]);
17
- }), t;
9
+ function c(e) {
10
+ if (typeof e == "string")
11
+ return o[e];
12
+ if (Array.isArray(e))
13
+ return e.map((r) => r && o[r]);
14
+ if (typeof e == "object") {
15
+ const r = {};
16
+ return Object.keys(e).forEach((n) => {
17
+ const i = e[n];
18
+ i && (r[n] = o[i]);
19
+ }), r;
18
20
  }
19
21
  }
20
22
  export {
21
- a as getIconSizeFromButtonSize,
23
+ c as getIconSizeFromButtonSize,
22
24
  o as iconSizeMap
23
25
  };
@@ -1,6 +1,7 @@
1
1
  import { Icons } from '../icon/index.js';
2
2
  import { CustomChakraBoxProps, LayoutProps, MarginProps, PaddingProps } from '../../theme/index.js';
3
3
  import { ButtonProps as ChakraButtonProps, LinkProps as ChakraLinkProps, ResponsiveValue } from '@chakra-ui/react';
4
+ export type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl";
4
5
  export type ButtonProps = CustomChakraBoxProps & LayoutProps & MarginProps & PaddingProps & Pick<ChakraLinkProps, "href" | "target" | "rel"> & Pick<ChakraButtonProps, "children" | "isDisabled" | "onClick" | "type" | "isLoading" | "loadingText"> & {
5
6
  /**
6
7
  * Appearance variant for Button.
@@ -8,8 +9,10 @@ export type ButtonProps = CustomChakraBoxProps & LayoutProps & MarginProps & Pad
8
9
  * @note The 'card' variant is deprecated, use the component ToggleButton instead.
9
10
  */
10
11
  variant?: ResponsiveValue<"primary" | "secondary" | "link" | "ghost" | "tertiary" | "segmentedControl" | "card" | "alert"> | undefined;
11
- /** The size of the button, default: md */
12
- size?: ResponsiveValue<"lg" | "sm" | "md"> | undefined;
12
+ /**
13
+ * The size of the button, default: md
14
+ */
15
+ size?: ResponsiveValue<ButtonSize> | undefined;
13
16
  /**
14
17
  * When set to true or false, will indicate to screen readers that this is a toggle button, with a selected state that can be true or false.
15
18
  * Only compatible with the "card"-variant. Defaults to undefined (not a toggle button).
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EACN,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAC7C,WAAW,GACX,WAAW,GACX,YAAY,GACZ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,GAChD,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG;IACvG;;;;OAIG;IACH,OAAO,CAAC,EACL,eAAe,CACf,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAC9F,GACD,SAAS,CAAC;IAEb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAEvD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC;IAEjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EACN,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAC7C,WAAW,GACX,WAAW,GACX,YAAY,GACZ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,GAChD,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG;IACvG;;;;OAIG;IACH,OAAO,CAAC,EACL,eAAe,CACf,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAC9F,GACD,SAAS,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAE/C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC;IAEjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC"}
@@ -1,9 +1,12 @@
1
+ import { ButtonSize } from '../button/types.js';
1
2
  import { ThemeIconSizeVariable } from '../../theme/index.js';
2
3
  import { ResponsiveValue } from '@chakra-ui/react';
3
4
  export declare const iconSizeMap: {
5
+ xl: ThemeIconSizeVariable;
4
6
  lg: ThemeIconSizeVariable;
5
7
  md: ThemeIconSizeVariable;
6
8
  sm: ThemeIconSizeVariable;
9
+ xs: ThemeIconSizeVariable;
7
10
  };
8
11
  /**
9
12
  * Maps a ResponsiveValue of button sizes to corresponding icon sizes.
@@ -11,5 +14,5 @@ export declare const iconSizeMap: {
11
14
  * @param size - The ResponsiveValue of the button size.
12
15
  * @returns A ResponsiveValue of icon sizes.
13
16
  */
14
- export declare function getIconSizeFromButtonSize(size: ResponsiveValue<"lg" | "sm" | "md">): ThemeIconSizeVariable | (ThemeIconSizeVariable | null)[] | Record<string, ThemeIconSizeVariable | undefined> | undefined;
17
+ export declare function getIconSizeFromButtonSize(size: ResponsiveValue<ButtonSize>): ThemeIconSizeVariable | (ThemeIconSizeVariable | null)[] | Record<string, ThemeIconSizeVariable | undefined> | undefined;
15
18
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,4HA2BlF"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,CAAC,4HA2B1E"}
@@ -1,23 +1,25 @@
1
- import { ThemeIconSizeVariable as e } from "../../theme/theme-types.js";
1
+ import { ThemeIconSizeVariable as t } from "../../theme/theme-types.js";
2
2
  const o = {
3
- lg: e.Medium,
4
- md: e.Medium,
5
- sm: e.Small
3
+ xl: t.Large,
4
+ lg: t.Medium,
5
+ md: t.Medium,
6
+ sm: t.Small,
7
+ xs: t.Small
6
8
  };
7
- function a(r) {
9
+ function c(r) {
8
10
  if (typeof r == "string")
9
11
  return o[r];
10
12
  if (Array.isArray(r))
11
- return r.map((t) => t && o[t]);
13
+ return r.map((e) => e && o[e]);
12
14
  if (typeof r == "object") {
13
- const t = {};
15
+ const e = {};
14
16
  return Object.keys(r).forEach((n) => {
15
- const i = r[n];
16
- i && (t[n] = o[i]);
17
- }), t;
17
+ const a = r[n];
18
+ a && (e[n] = o[a]);
19
+ }), e;
18
20
  }
19
21
  }
20
22
  export {
21
- a as getIconSizeFromButtonSize,
23
+ c as getIconSizeFromButtonSize,
22
24
  o as iconSizeMap
23
25
  };
@@ -8,7 +8,7 @@
8
8
  export declare const IconButton: import('react').ForwardRefExoticComponent<{
9
9
  icon: import('../icon/index.js').Icons;
10
10
  variant?: Exclude<import('../button/index.js').ButtonProps["variant"], "link" | "segmentedControl" | import('@chakra-ui/styled-system').ResponsiveArray<unknown> | Partial<Record<string, unknown>>>;
11
- size?: import('@chakra-ui/styled-system').ResponsiveValue<"lg" | "sm" | "md">;
11
+ size?: import('@chakra-ui/styled-system').ResponsiveValue<import('../button/types.js').ButtonSize>;
12
12
  } & {
13
13
  "aria-label": string;
14
14
  onKeyDown?: import('react').KeyboardEventHandler<HTMLButtonElement> | undefined;
@@ -1,3 +1,4 @@
1
+ import { ButtonSize } from '../button/types.js';
1
2
  import { Icons } from '../icon/index.js';
2
3
  import { CustomChakraBoxProps, MarginProps, PaddingProps } from '../../theme/index.js';
3
4
  import { IconButtonProps as ChakraIconButtonProps, ResponsiveArray, ResponsiveValue } from '@chakra-ui/react';
@@ -15,7 +16,7 @@ type CustomProperties = {
15
16
  /**
16
17
  * The size of the button, defaults to md
17
18
  */
18
- size?: ResponsiveValue<"lg" | "sm" | "md">;
19
+ size?: ResponsiveValue<ButtonSize>;
19
20
  };
20
21
  type ChakraIconButtonProperties = Pick<ChakraIconButtonProps, "aria-label" | "isDisabled" | "onClick" | "type" | "isLoading" | "onKeyDown">;
21
22
  export type IconButtonProps = CustomProperties & ChakraIconButtonProperties & CustomStyleProps;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EACX,eAAe,IAAI,qBAAqB,EACxC,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE1E,KAAK,gBAAgB,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAChB,WAAW,CAAC,SAAS,CAAC,EACtB,MAAM,GAAG,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACzF,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACrC,qBAAqB,EACrB,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAC5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EACX,eAAe,IAAI,qBAAqB,EACxC,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE1E,KAAK,gBAAgB,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAChB,WAAW,CAAC,SAAS,CAAC,EACtB,MAAM,GAAG,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACzF,CAAC;IACF;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACrC,qBAAqB,EACrB,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAC5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,gBAAgB,CAAC"}
@@ -5,5 +5,5 @@ import { ToggleButtonProps } from './types.js';
5
5
  * @see Toggle button role on MDN: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#toggle_buttons
6
6
  * @see Docs https://caspeco.github.io/casper-ui-library/components/toggle-button
7
7
  */
8
- export declare function ToggleButton({ isPressed, children, ...props }: ToggleButtonProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ToggleButton(props: ToggleButtonProps): import("react/jsx-runtime").JSX.Element;
9
9
  //# sourceMappingURL=toggle-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAMxF"}
1
+ {"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAUpD"}
@@ -1,8 +1,10 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Button as n } from "@chakra-ui/react";
3
- function p({ isPressed: t = !1, children: o, ...r }) {
4
- return /* @__PURE__ */ e(n, { "aria-pressed": t, type: "button", variant: "toggle", ...r, children: o });
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { Button as s } from "@chakra-ui/react";
3
+ import { useButtonChildren as i } from "./use-button-children.js";
4
+ function c(t) {
5
+ const { isPressed: r = !1, subText: u, children: l, ...e } = t, o = i(t);
6
+ return /* @__PURE__ */ n(s, { "aria-pressed": r, type: "button", variant: "toggle", ...e, children: o });
5
7
  }
6
8
  export {
7
- p as ToggleButton
9
+ c as ToggleButton
8
10
  };
@@ -1,13 +1,31 @@
1
+ import { ButtonSize } from '../button/types.js';
1
2
  import { CustomChakraBoxProps, LayoutProps, MarginProps, PaddingProps } from '../../theme/index.js';
2
3
  import { ButtonProps as ChakraButtonProps, ResponsiveValue } from '@chakra-ui/react';
3
4
  type CustomStyleProps = CustomChakraBoxProps & LayoutProps & MarginProps & PaddingProps;
4
- type CustomProperties = {
5
- /** Indicate wether button is pressed or not. Defaults to false. */
5
+ type ToggleButtonPropsBase = {
6
+ /** Indicate whether button is pressed or not. Defaults to false. */
6
7
  isPressed?: boolean;
7
8
  /** The size of the button, default: md */
8
- size?: ResponsiveValue<"lg" | "sm" | "md"> | undefined;
9
+ size?: ResponsiveValue<ButtonSize> | undefined;
10
+ } & Pick<ChakraButtonProps, "children" | "isDisabled" | "onClick" | "type"> & CustomStyleProps;
11
+ type ToggleButtonPropsWithSubText = ToggleButtonPropsBase & {
12
+ /**
13
+ * Adds a subtext below the button text.
14
+ * Does not work for sm size.
15
+ * When subText is provided, aria-label is required for accessibility
16
+ * since the button content will be hidden from screen readers.
17
+ */
18
+ subText: string;
19
+ /**
20
+ * Accessible label for the button. Required when using subText
21
+ * since the button content will be aria-hidden.
22
+ */
23
+ "aria-label": string;
9
24
  };
10
- type ChakraButtonProperties = Pick<ChakraButtonProps, "children" | "isDisabled" | "onClick" | "type">;
11
- export type ToggleButtonProps = CustomProperties & ChakraButtonProperties & CustomStyleProps;
25
+ type ToggleButtonPropsWithoutSubText = ToggleButtonPropsBase & {
26
+ subText?: never;
27
+ "aria-label"?: string;
28
+ };
29
+ export type ToggleButtonProps = ToggleButtonPropsWithSubText | ToggleButtonPropsWithoutSubText;
12
30
  export {};
13
31
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/toggle-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1F,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC;AAExF,KAAK,gBAAgB,GAAG;IACvB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,KAAK,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;AAEtG,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/toggle-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1F,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC;AAExF,KAAK,qBAAqB,GAAG;IAC5B,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;CAC/C,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,GAC1E,gBAAgB,CAAC;AAElB,KAAK,4BAA4B,GAAG,qBAAqB,GAAG;IAC3D;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,+BAA+B,GAAG,qBAAqB,GAAG;IAC9D,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG,4BAA4B,GAAG,+BAA+B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { ToggleButtonProps } from './types.js';
3
+ /**
4
+ * Custom hook that returns the children elements for the button, including subText if applicable.
5
+ * For responsive size values, dynamically shows/hides subText based on the current breakpoint.
6
+ * @returns If subText is provided and the current size is allowed, returns a container with the main text and subText. Otherwise it returns just the children.
7
+ */
8
+ export declare function useButtonChildren(props: ToggleButtonProps): ReactNode;
9
+ //# sourceMappingURL=use-button-children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-button-children.d.ts","sourceRoot":"","sources":["../../../lib/components/toggle-button/use-button-children.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKjD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAoCrE"}
@@ -0,0 +1,27 @@
1
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
+ import { useBreakpointValue as u, Flex as d, Text as r } from "@chakra-ui/react";
3
+ import { ThemeFontSizeVariable as f } from "../../theme/theme-types.js";
4
+ const m = ["md", "lg"];
5
+ function T(s) {
6
+ const { size: l, children: t, subText: n } = s, e = l ?? "md", i = u(
7
+ typeof e == "string" || e === void 0 ? { base: e } : e,
8
+ { ssr: !1 }
9
+ ), c = i && m.includes(i);
10
+ return n && c ? /* @__PURE__ */ a(d, { "aria-hidden": "true", flexDirection: "column", alignItems: "center", overflow: "hidden", children: [
11
+ /* @__PURE__ */ o(r, { children: t }),
12
+ /* @__PURE__ */ o(
13
+ r,
14
+ {
15
+ fontSize: f.XSmall,
16
+ textOverflow: "ellipsis",
17
+ whiteSpace: "nowrap",
18
+ overflow: "hidden",
19
+ width: "100%",
20
+ children: n
21
+ }
22
+ )
23
+ ] }) : t;
24
+ }
25
+ export {
26
+ T as useButtonChildren
27
+ };
@@ -1,16 +1,6 @@
1
1
  import * as o from "react";
2
2
  import { createTable as u } from "../../../table-core/build/lib/index.js";
3
3
  import { ColumnFaceting as C, ColumnFiltering as S, ColumnGrouping as w, ColumnOrdering as b, ColumnPinning as y, ColumnSizing as F, ColumnVisibility as x, GlobalFaceting as h, GlobalFiltering as O, Headers as E, RowExpanding as M, RowPagination as v, RowPinning as G, RowSelection as P, RowSorting as $, _getVisibleLeafColumns as A, aggregationFns as H, buildHeaderGroups as V, createCell as j, createColumn as k, createColumnHelper as z, createRow as N, defaultColumnSizing as T, expandRows as U, filterFns as _, flattenBy as B, functionalUpdate as L, getCoreRowModel as q, getExpandedRowModel as D, getFilteredRowModel as I, getMemoOptions as J, getSortedRowModel as K, isFunction as Q, isNumberArray as W, isRowSelected as X, isSubRowSelected as Y, makeStateUpdater as Z, memo as ee, orderColumns as te, passiveEventSupported as ne, reSplitAlphaNumeric as oe, selectRowsFn as re, shouldAutoRemoveFilter as ae, sortingFns as ie } from "../../../table-core/build/lib/index.js";
4
- /**
5
- * react-table
6
- *
7
- * Copyright (c) TanStack
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE.md file in the root directory of this source tree.
11
- *
12
- * @license MIT
13
- */
14
4
  function f(e, t) {
15
5
  return e ? s(e) ? /* @__PURE__ */ o.createElement(e, t) : e : null;
16
6
  }
@@ -1,13 +1,3 @@
1
- /**
2
- * table-core
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
1
  function ot() {
12
2
  return {
13
3
  accessor: (e, o) => typeof e == "function" ? {
@@ -1 +1 @@
1
- {"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/button-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAA6C,MAAM,kBAAkB,CAAC;AAuO9G,eAAO,MAAM,YAAY,EAAE,0BAgCzB,CAAC"}
1
+ {"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/button-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAA6C,MAAM,kBAAkB,CAAC;AAyO9G,eAAO,MAAM,YAAY,EAAE,0BA4CzB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { defineStyleConfig as i } from "@chakra-ui/react";
2
- import { isTouchScreenDevice as r } from "../../theme-helper.js";
3
- import { ThemeColorToken as o, ThemeBorderToken as a, ThemeRadiusToken as d, ThemeFontToken as t, ThemeFontSizeToken as c } from "../theme-tokens.js";
4
- const l = {
2
+ import { isTouchScreenDevice as e } from "../../theme-helper.js";
3
+ import { ThemeColorToken as o, ThemeSpaceToken as l, ThemeBorderToken as a, ThemeRadiusToken as d, ThemeFontToken as t, ThemeFontSizeToken as r } from "../theme-tokens.js";
4
+ const g = {
5
5
  fontFamily: t.SubHeader,
6
6
  borderRadius: d.XLarge,
7
7
  border: a.XSmall,
@@ -21,7 +21,7 @@ const l = {
21
21
  background: o.Accent,
22
22
  color: o.OnAccent,
23
23
  _hover: {
24
- background: r() ? o.Accent : o.AccentHover,
24
+ background: e() ? o.Accent : o.AccentHover,
25
25
  _disabled: {
26
26
  background: o.Accent,
27
27
  color: o.OnAccent
@@ -35,8 +35,8 @@ const l = {
35
35
  background: o.AccentContainer,
36
36
  color: o.OnAccentContainer,
37
37
  _hover: {
38
- background: r() ? o.AccentContainer : o.AccentHover,
39
- color: r() ? o.OnAccentContainer : o.OnAccent,
38
+ background: e() ? o.AccentContainer : o.AccentHover,
39
+ color: e() ? o.OnAccentContainer : o.OnAccent,
40
40
  _disabled: {
41
41
  background: o.AccentContainer,
42
42
  color: o.OnAccentContainer
@@ -46,12 +46,12 @@ const l = {
46
46
  background: o.AccentActive,
47
47
  color: o.OnAccent
48
48
  }
49
- }, g = {
49
+ }, s = {
50
50
  color: o.OnBackground,
51
51
  fontWeight: "medium",
52
52
  _hover: {
53
53
  color: o.OnBackground,
54
- bg: r() ? "none" : o.AccentHoverAlpha,
54
+ bg: e() ? "none" : o.AccentHoverAlpha,
55
55
  textDecoration: "none"
56
56
  },
57
57
  _active: {
@@ -62,7 +62,7 @@ const l = {
62
62
  background: o.Error,
63
63
  color: o.OnAccent,
64
64
  _hover: {
65
- background: r() ? o.Error : o.ErrorHover,
65
+ background: e() ? o.Error : o.ErrorHover,
66
66
  _disabled: {
67
67
  background: o.Error,
68
68
  color: o.OnAccent
@@ -72,7 +72,7 @@ const l = {
72
72
  background: o.ErrorActive,
73
73
  color: o.OnAccent
74
74
  }
75
- }, s = {
75
+ }, h = {
76
76
  color: o.OnBackground,
77
77
  fontFamily: t.Body,
78
78
  borderRadius: 0,
@@ -83,7 +83,7 @@ const l = {
83
83
  width: "fit-content",
84
84
  border: 0,
85
85
  _hover: {
86
- color: r() ? o.OnBackground : o.AccentHover
86
+ color: e() ? o.OnBackground : o.AccentHover
87
87
  },
88
88
  _active: {
89
89
  color: o.AccentActive,
@@ -148,24 +148,25 @@ const l = {
148
148
  }
149
149
  }
150
150
  }
151
- }, e = '&[aria-pressed="true"]', n = '&[aria-pressed="false"]', h = {
151
+ }, n = '&[aria-pressed="true"]', c = '&[aria-pressed="false"]', p = {
152
152
  // Base style
153
153
  borderRadius: d.Small,
154
154
  borderWidth: a.XSmall,
155
155
  borderColor: o.OnSurfaceBorder,
156
+ paddingX: l.Small,
156
157
  // Pressed state
157
- [`${e}`]: {
158
+ [`${n}`]: {
158
159
  background: o.Accent,
159
160
  color: o.OnAccent
160
161
  },
161
162
  // Not pressed state
162
- [`${n}`]: {
163
+ [`${c}`]: {
163
164
  background: o.Surface,
164
165
  color: o.OnSurface
165
166
  },
166
167
  // Hover styles
167
168
  "@media(hover: hover)": {
168
- [`${e}&:hover`]: {
169
+ [`${n}&:hover`]: {
169
170
  background: o.AccentHover,
170
171
  borderColor: o.AccentHover,
171
172
  _disabled: {
@@ -173,7 +174,7 @@ const l = {
173
174
  borderColor: o.Accent
174
175
  }
175
176
  },
176
- [`${n}&:hover`]: {
177
+ [`${c}&:hover`]: {
177
178
  background: o.AccentHoverAlpha,
178
179
  color: o.OnSurface,
179
180
  _disabled: {
@@ -183,57 +184,69 @@ const l = {
183
184
  }
184
185
  },
185
186
  // Active styles
186
- [`${e}:active`]: {
187
+ [`${n}:active`]: {
187
188
  color: o.OnAccent,
188
189
  background: o.AccentActive
189
190
  },
190
- [`${n}:active`]: {
191
+ [`${c}:active`]: {
191
192
  color: o.OnSurface,
192
193
  background: o.AccentActiveAlpha
193
194
  },
194
195
  // Define general disabled styles last to ensure they are not overridden
195
- [`${e}:disabled`]: {
196
+ [`${n}:disabled`]: {
196
197
  color: o.OnAccent,
197
198
  background: o.Accent,
198
199
  borderColor: o.Accent
199
200
  },
200
- [`${n}:disabled`]: {
201
+ [`${c}:disabled`]: {
201
202
  color: o.OnSurface,
202
203
  background: o.Surface
203
204
  }
204
- }, f = i({
205
- baseStyle: l,
205
+ }, S = i({
206
+ baseStyle: g,
206
207
  sizes: {
207
- lg: {
208
- px: "24px",
208
+ xl: {
209
+ paddingX: "24px",
209
210
  height: "56px",
210
211
  minWidth: "56px",
211
- fontSize: c.Large
212
+ fontSize: r.Large
213
+ },
214
+ lg: {
215
+ paddingX: "16px",
216
+ height: "48px",
217
+ minWidth: "48px",
218
+ fontSize: r.Medium
212
219
  },
213
220
  md: {
214
- px: "16px",
221
+ paddingX: "16px",
215
222
  height: "40px",
216
223
  minWidth: "40px",
217
- fontSize: c.Medium
224
+ fontSize: r.Medium
218
225
  },
219
226
  sm: {
220
- px: "8px",
227
+ paddingX: "8px",
228
+ height: "32px",
229
+ minWidth: "32px",
230
+ fontSize: r.Small
231
+ },
232
+ xs: {
233
+ paddingX: "8px",
221
234
  height: "24px",
222
235
  minWidth: "24px",
223
- fontSize: c.Small
236
+ fontSize: r.Small
224
237
  }
225
238
  },
226
239
  variants: {
227
240
  primary: u,
228
241
  secondary: b,
229
- ghost: g,
230
- link: s,
242
+ ghost: s,
243
+ link: h,
231
244
  segmentedControl: v,
232
245
  tertiary: k,
233
- toggle: h,
246
+ toggle: p,
234
247
  alert: A
235
248
  }
236
249
  });
237
250
  export {
238
- f as buttonConfig
251
+ S as buttonConfig
239
252
  };
@@ -51,7 +51,7 @@ export declare const comboboxConfig: {
51
51
  };
52
52
  } | undefined;
53
53
  defaultProps?: {
54
- size?: "md" | "sm" | "lg" | "xs" | "xl" | undefined;
54
+ size?: "md" | "sm" | "xl" | "lg" | "xs" | undefined;
55
55
  variant?: "outline" | "ghost" | undefined;
56
56
  colorScheme?: string | undefined;
57
57
  } | undefined;
@@ -39,7 +39,7 @@ export declare const drawerConfig: {
39
39
  }>;
40
40
  } | undefined;
41
41
  defaultProps?: {
42
- size?: "md" | "sm" | "lg" | "xs" | "xl" | undefined;
42
+ size?: "md" | "sm" | "xl" | "lg" | "xs" | undefined;
43
43
  variant?: string | number | undefined;
44
44
  colorScheme?: string | undefined;
45
45
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "7.5.0",
3
+ "version": "7.7.0",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -28,29 +28,29 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@arethetypeswrong/cli": "^0.18.2",
31
- "@caspeco/eslint-config": "^4.1.1",
31
+ "@caspeco/eslint-config-react": "^5.0.0",
32
32
  "@caspeco/prettier-config": "^1.0.7",
33
- "@eslint/js": "^9.39.0",
33
+ "@eslint/js": "^9.39.1",
34
34
  "@testing-library/jest-dom": "^6.9.1",
35
35
  "@testing-library/react": "^16.3.0",
36
36
  "@testing-library/user-event": "^14.6.1",
37
37
  "@types/jest": "^30.0.0",
38
- "@types/node": "^24.10.0",
38
+ "@types/node": "^24.10.1",
39
39
  "@types/react": "^18.3.12",
40
40
  "@types/react-dom": "^18.3.1",
41
- "@vitejs/plugin-react-swc": "^4.2.0",
42
- "eslint": "^9.39.0",
41
+ "@vitejs/plugin-react-swc": "^4.2.2",
42
+ "eslint": "^9.39.1",
43
43
  "eslint-plugin-react-hooks": "^7.0.1",
44
44
  "eslint-plugin-react-refresh": "^0.4.24",
45
45
  "globals": "^16.5.0",
46
- "jsdom": "^27.1.0",
46
+ "jsdom": "^27.2.0",
47
47
  "tsc-alias": "^1.8.16",
48
48
  "typescript": "~5.9.3",
49
- "typescript-eslint": "^8.46.2",
50
- "vite": "^7.1.12",
49
+ "typescript-eslint": "^8.46.4",
50
+ "vite": "^7.2.2",
51
51
  "vite-plugin-dts": "^4.5.4",
52
52
  "vite-tsconfig-paths": "^5.1.4",
53
- "vitest": "^4.0.6"
53
+ "vitest": "^4.0.9"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@chakra-ui/react": "^2.8.2",
@@ -62,7 +62,7 @@
62
62
  "@chakra-ui/anatomy": "^2.3.4",
63
63
  "@floating-ui/dom": "^1.7.4",
64
64
  "@tanstack/react-table": "^8.21.3",
65
- "csstype": "^3.1.3",
65
+ "csstype": "^3.2.2",
66
66
  "date-fns": "^4.1.0"
67
67
  }
68
68
  }