diff --git a/.storybook/components/ColorSwatches/index.ts b/.storybook/components/ColorSwatches/index.ts
deleted file mode 100644
index a000fa8a9b..0000000000
--- a/.storybook/components/ColorSwatches/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { ColorSwatches } from "./ColorSwatches";
diff --git a/.storybook/components/ColorSwatches/ColorSwatches.module.css b/.storybook/components/StorybookColorSwatches/StorybookColorSwatches.module.css
similarity index 100%
rename from .storybook/components/ColorSwatches/ColorSwatches.module.css
rename to .storybook/components/StorybookColorSwatches/StorybookColorSwatches.module.css
diff --git a/.storybook/components/ColorSwatches/ColorSwatches.module.css.d.ts b/.storybook/components/StorybookColorSwatches/StorybookColorSwatches.module.css.d.ts
similarity index 100%
rename from .storybook/components/ColorSwatches/ColorSwatches.module.css.d.ts
rename to .storybook/components/StorybookColorSwatches/StorybookColorSwatches.module.css.d.ts
diff --git a/.storybook/components/ColorSwatches/ColorSwatches.tsx b/.storybook/components/StorybookColorSwatches/StorybookColorSwatches.tsx
similarity index 89%
rename from .storybook/components/ColorSwatches/ColorSwatches.tsx
rename to .storybook/components/StorybookColorSwatches/StorybookColorSwatches.tsx
index fbe3977375..68864bf207 100644
--- a/.storybook/components/ColorSwatches/ColorSwatches.tsx
+++ b/.storybook/components/StorybookColorSwatches/StorybookColorSwatches.tsx
@@ -5,14 +5,14 @@ import { Flex } from "@jobber/components/Flex";
import { Text } from "@jobber/components/Text";
import { Content } from "@jobber/components/Content";
import { showToast } from "@jobber/components/Toast";
-import styles from "./ColorSwatches.module.css";
+import styles from "./StorybookColorSwatches.module.css";
-interface ColorSwatchesProps {
+interface StorybookColorSwatchesProps {
readonly colors: string[];
readonly description?: string;
}
-export function ColorSwatches({ colors }: ColorSwatchesProps) {
+export function StorybookColorSwatches({ colors }: StorybookColorSwatchesProps) {
return (
{colors.map((color: string) => (
diff --git a/.storybook/components/StorybookColorSwatches/index.ts b/.storybook/components/StorybookColorSwatches/index.ts
new file mode 100644
index 0000000000..09af4538fd
--- /dev/null
+++ b/.storybook/components/StorybookColorSwatches/index.ts
@@ -0,0 +1 @@
+export { StorybookColorSwatches } from "./StorybookColorSwatches";
diff --git a/docs/components/Chip/Chip.stories.mdx b/docs/components/Chip/Chip.stories.mdx
index 72ebb596f4..b4129e4904 100644
--- a/docs/components/Chip/Chip.stories.mdx
+++ b/docs/components/Chip/Chip.stories.mdx
@@ -241,6 +241,18 @@ out of view in a single row, depending on your use case.
Chip can truncate if its' container is limited in space, but does not inherently
cap its own width and will default to "hug" its contents.
+## Base Chip Color Overrides
+
+If you wish to modify the colors of the Base variant, you may do so with CSS
+custom properties (variables).
+
+For the resting background color: `--public-chip-base-bg-color`
+
+For the hover/focused background color: `--public-chip-base-hover-bg-color`
+
+For the text content and miscellaneous content such as the line separator
+between the `label` and `heading`: `--public-chip-base-content-color`
+
## Notes
Chip is in the process of being applied to the more opinionated Chips
diff --git a/docs/components/Chips/Chips.stories.mdx b/docs/components/Chips/Chips.stories.mdx
index d74ba6f8ee..cb9cf61473 100644
--- a/docs/components/Chips/Chips.stories.mdx
+++ b/docs/components/Chips/Chips.stories.mdx
@@ -139,8 +139,37 @@ out of view in a single row, depending on your use case.
## Notes
-There was some consideration to bring the ability to "accent" Chips with certain
-colors for parity with Jobber's mobile platform, but we will not be implementing
-this is for the web components as of this first iteration of our web Chip. The
-mobile use-case is very specific to a filtering use case that we as of now do
-not anticipate will be required for the web.
+To override the appearance of the selected Chip(s) you may use
+[Base Chip Color Overrides](../?path=/docs/components-selections-chip--docs#base-chip-color-overrides)
+since the selected Chip is a Base Chip.
+
+### Chips composition with standalone Chip
+
+Standalone Chip's `role`, ``, `` `heading` and
+`variation` will not work specifically when used within a `Chips`.
+
+If you wish to use a prefix, please use `Chip` from `Chips/Chip`.
+
+#### ✅ Do
+
+```
+import { Chip, Chips } from "@jobber/components/Chips";
+...
+
+
+
+
+```
+
+#### ❌ Don't
+
+```
+import { Chip, Chips } from "@jobber/components";
+
+...
+
+
+ ...
+
+
+```
diff --git a/docs/components/Chips/Web.stories.tsx b/docs/components/Chips/Web.stories.tsx
index 40f8528a6c..d2b10e3800 100644
--- a/docs/components/Chips/Web.stories.tsx
+++ b/docs/components/Chips/Web.stories.tsx
@@ -2,9 +2,7 @@ import React, { useState } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { Content } from "@jobber/components/Content";
import { Chip, Chips } from "@jobber/components/Chips";
-import { Icon } from "@jobber/components/Icon";
import { Text } from "@jobber/components/Text";
-import { Avatar } from "@jobber/components/Avatar";
import { useFakeOptionQuery } from "./utils/storyUtils";
export default {
@@ -32,22 +30,15 @@ const BasicTemplate: ComponentStory = args => {
You are {selected ? selected : "_______"}
-
- }
- label="Amazing"
- value="Amazing"
- />
- }
- label="Wonderful"
- value="Wonderful"
- />
- }
- label="Brilliant"
- value="Brilliant"
- />
+
+
+
+
@@ -97,6 +88,7 @@ const SelectionTemplate: ComponentStory = args => {
return (
{
setCallbackCallCount(callbackCallCount + 1);
});
- return
I am the AlertMountedComponent and my callback has been called {callbackCallCount} time
;
+ return (
+
+ I am the AlertMountedComponent and my callback has been called{" "}
+ {callbackCallCount} time
+
+ );
}
const [shouldMount, setShouldMount] = useState(false);
let component = <>>;
diff --git a/package-lock.json b/package-lock.json
index 240fa77bc3..d62af85c1e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -38046,7 +38046,7 @@
},
"packages/components": {
"name": "@jobber/components",
- "version": "5.37.1",
+ "version": "5.40.2",
"license": "MIT",
"dependencies": {
"@jobber/formatters": "^0.3.0",
@@ -38120,7 +38120,7 @@
},
"packages/components-native": {
"name": "@jobber/components-native",
- "version": "0.72.2",
+ "version": "0.72.3",
"license": "MIT",
"dependencies": {
"@react-native-clipboard/clipboard": "^1.11.2",
@@ -39020,7 +39020,7 @@
},
"packages/design": {
"name": "@jobber/design",
- "version": "0.65.1",
+ "version": "0.66.0",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
@@ -39312,7 +39312,7 @@
},
"packages/docx": {
"name": "@jobber/docx",
- "version": "0.3.1",
+ "version": "0.4.0",
"license": "MIT"
},
"packages/eslint-config": {
diff --git a/packages/components-native/CHANGELOG.md b/packages/components-native/CHANGELOG.md
index 4b00789970..7cad4a83f6 100644
--- a/packages/components-native/CHANGELOG.md
+++ b/packages/components-native/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [0.72.3](https://github.com/GetJobber/atlantis/compare/@jobber/components-native@0.72.2...@jobber/components-native@0.72.3) (2024-10-04)
+
+
+### Bug Fixes
+
+* **components-native:** Restore success Text variation type ([#2059](https://github.com/GetJobber/atlantis/issues/2059)) ([f29667f](https://github.com/GetJobber/atlantis/commit/f29667f616a5c9e5bbb0458fbe29ae2a04ebe050))
+
+
+
+
+
## [0.72.2](https://github.com/GetJobber/atlantis/compare/@jobber/components-native@0.72.1...@jobber/components-native@0.72.2) (2024-09-24)
**Note:** Version bump only for package @jobber/components-native
diff --git a/packages/components-native/package.json b/packages/components-native/package.json
index c38300d806..2050506872 100644
--- a/packages/components-native/package.json
+++ b/packages/components-native/package.json
@@ -1,6 +1,6 @@
{
"name": "@jobber/components-native",
- "version": "0.72.2",
+ "version": "0.72.3",
"license": "MIT",
"description": "React Native implementation of Atlantis",
"repository": {
diff --git a/packages/components-native/src/Typography/Typography.tsx b/packages/components-native/src/Typography/Typography.tsx
index 021d6dfd4c..73c371a2fe 100644
--- a/packages/components-native/src/Typography/Typography.tsx
+++ b/packages/components-native/src/Typography/Typography.tsx
@@ -356,7 +356,6 @@ export type TextColor =
| "informative"
| "informativeSurface"
| "informativeOnSurface"
- | "success"
| "successSurface"
| "successOnSurface"
@@ -414,6 +413,7 @@ export type TextVariation =
// Deprecated
| "base" // Use "text" instead
+ | "success" // Use "successOnSurface" instead (except for when reverseTheme=true)
| "subdued" // Use "textSecondary" instead
| "error" // Use "critical" instead
| "warn" // Use "warningOnSurface" instead
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 5ad1733e45..4cf7ad7acd 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -3,6 +3,66 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+## [5.40.2](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.40.1...@jobber/components@5.40.2) (2024-10-08)
+
+**Note:** Version bump only for package @jobber/components
+
+
+
+
+
+## [5.40.1](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.40.0...@jobber/components@5.40.1) (2024-10-03)
+
+
+### Bug Fixes
+
+* **components:** Remove center alignment in FormField ([#2057](https://github.com/GetJobber/atlantis/issues/2057)) ([7259a09](https://github.com/GetJobber/atlantis/commit/7259a09e191fab94d25e011b8840bbb3458aaf38))
+
+
+
+
+
+# [5.40.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.39.1...@jobber/components@5.40.0) (2024-10-02)
+
+
+### Features
+
+* **components:** Make Suffix Optional on Single and Multi Select Chips ([#2047](https://github.com/GetJobber/atlantis/issues/2047)) ([e4b9e06](https://github.com/GetJobber/atlantis/commit/e4b9e064126d9ec6747060afd35770cb2274930c)), closes [#2028](https://github.com/GetJobber/atlantis/issues/2028)
+
+
+
+
+
+## [5.39.1](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.39.0...@jobber/components@5.39.1) (2024-10-02)
+
+**Note:** Version bump only for package @jobber/components
+
+
+
+
+
+# [5.39.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.38.0...@jobber/components@5.39.0) (2024-10-02)
+
+
+### Features
+
+* **components:** Re-separate Chip from Chips w/Background Color Fixes ([#2035](https://github.com/GetJobber/atlantis/issues/2035)) ([7e7d6a6](https://github.com/GetJobber/atlantis/commit/7e7d6a61429609f77f9fe2351252b10217ccf940)), closes [#2028](https://github.com/GetJobber/atlantis/issues/2028)
+
+
+
+
+
+# [5.38.0](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.37.1...@jobber/components@5.38.0) (2024-10-02)
+
+
+### Features
+
+* **deps:** Update storybook to the latest patch version (7.6.20) ([#2049](https://github.com/GetJobber/atlantis/issues/2049)) ([52b1458](https://github.com/GetJobber/atlantis/commit/52b145833ec3d5452b5d1cf5e2f536a222fc3f1f))
+
+
+
+
+
## [5.37.1](https://github.com/GetJobber/atlantis/compare/@jobber/components@5.37.0...@jobber/components@5.37.1) (2024-09-30)
diff --git a/packages/components/package.json b/packages/components/package.json
index 20a5c49c52..9f4dd24697 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@jobber/components",
- "version": "5.37.1",
+ "version": "5.40.2",
"license": "MIT",
"type": "module",
"main": "dist/index.cjs",
diff --git a/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.css b/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.module.css
similarity index 100%
rename from packages/components/src/AtlantisThemeContext/AtlantisThemeContext.css
rename to packages/components/src/AtlantisThemeContext/AtlantisThemeContext.module.css
diff --git a/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.css.d.ts b/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.module.css.d.ts
similarity index 100%
rename from packages/components/src/AtlantisThemeContext/AtlantisThemeContext.css.d.ts
rename to packages/components/src/AtlantisThemeContext/AtlantisThemeContext.module.css.d.ts
diff --git a/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.tsx b/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.tsx
index b7c3b67542..7cd06aa9ed 100644
--- a/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.tsx
+++ b/packages/components/src/AtlantisThemeContext/AtlantisThemeContext.tsx
@@ -15,7 +15,7 @@ import {
Theme,
ThemeChangeDetails,
} from "./types";
-import styles from "./AtlantisThemeContext.css";
+import styles from "./AtlantisThemeContext.module.css";
export const atlantisThemeContextDefaultValues: AtlantisThemeContextValue = {
theme: "light",
diff --git a/packages/components/src/Autocomplete/Autocomplete.css b/packages/components/src/Autocomplete/Autocomplete.module.css
similarity index 100%
rename from packages/components/src/Autocomplete/Autocomplete.css
rename to packages/components/src/Autocomplete/Autocomplete.module.css
diff --git a/packages/components/src/Autocomplete/Autocomplete.css.d.ts b/packages/components/src/Autocomplete/Autocomplete.module.css.d.ts
similarity index 100%
rename from packages/components/src/Autocomplete/Autocomplete.css.d.ts
rename to packages/components/src/Autocomplete/Autocomplete.module.css.d.ts
diff --git a/packages/components/src/Autocomplete/Autocomplete.tsx b/packages/components/src/Autocomplete/Autocomplete.tsx
index 9ac40c8c7c..e83a18f666 100644
--- a/packages/components/src/Autocomplete/Autocomplete.tsx
+++ b/packages/components/src/Autocomplete/Autocomplete.tsx
@@ -1,6 +1,6 @@
import React, { Ref, forwardRef, useEffect, useRef, useState } from "react";
import { XOR } from "ts-xor";
-import styles from "./Autocomplete.css";
+import styles from "./Autocomplete.module.css";
import { Menu } from "./Menu";
import { AnyOption, GroupOption, Option } from "./Option";
import { InputText, InputTextRef } from "../InputText";
diff --git a/packages/components/src/Autocomplete/Menu.tsx b/packages/components/src/Autocomplete/Menu.tsx
index dc45ed16cd..0ed69b8601 100644
--- a/packages/components/src/Autocomplete/Menu.tsx
+++ b/packages/components/src/Autocomplete/Menu.tsx
@@ -6,7 +6,7 @@ import { useOnKeyDown } from "@jobber/hooks/useOnKeyDown";
import { useSafeLayoutEffect } from "@jobber/hooks/useSafeLayoutEffect";
import { useIsMounted } from "@jobber/hooks/useIsMounted";
import { AnyOption, Option } from "./Option";
-import styles from "./Autocomplete.css";
+import styles from "./Autocomplete.module.css";
import { Text } from "../Text";
import { Icon } from "../Icon";
import { Heading } from "../Heading";
diff --git a/packages/components/src/Avatar/Avatar.css b/packages/components/src/Avatar/Avatar.module.css
similarity index 100%
rename from packages/components/src/Avatar/Avatar.css
rename to packages/components/src/Avatar/Avatar.module.css
diff --git a/packages/components/src/Avatar/Avatar.css.d.ts b/packages/components/src/Avatar/Avatar.module.css.d.ts
similarity index 100%
rename from packages/components/src/Avatar/Avatar.css.d.ts
rename to packages/components/src/Avatar/Avatar.module.css.d.ts
diff --git a/packages/components/src/Avatar/Avatar.tsx b/packages/components/src/Avatar/Avatar.tsx
index e5c238b354..77cbe0711a 100644
--- a/packages/components/src/Avatar/Avatar.tsx
+++ b/packages/components/src/Avatar/Avatar.tsx
@@ -1,7 +1,7 @@
import React, { CSSProperties } from "react";
import classnames from "classnames";
import { XOR } from "ts-xor";
-import styles from "./Avatar.css";
+import styles from "./Avatar.module.css";
import { isDark } from "./utilities";
import { Icon } from "../Icon";
diff --git a/packages/components/src/Banner/Banner.css b/packages/components/src/Banner/Banner.module.css
similarity index 100%
rename from packages/components/src/Banner/Banner.css
rename to packages/components/src/Banner/Banner.module.css
diff --git a/packages/components/src/Banner/Banner.css.d.ts b/packages/components/src/Banner/Banner.module.css.d.ts
similarity index 100%
rename from packages/components/src/Banner/Banner.css.d.ts
rename to packages/components/src/Banner/Banner.module.css.d.ts
diff --git a/packages/components/src/Banner/Banner.tsx b/packages/components/src/Banner/Banner.tsx
index 6c00d9dfb4..aa4bd548a9 100644
--- a/packages/components/src/Banner/Banner.tsx
+++ b/packages/components/src/Banner/Banner.tsx
@@ -2,7 +2,7 @@ import React, { ReactNode, useState } from "react";
import classnames from "classnames";
import { IconNames } from "@jobber/design";
import { useResizeObserver } from "@jobber/hooks/useResizeObserver";
-import styles from "./Banner.css";
+import styles from "./Banner.module.css";
import { BannerIcon } from "./components/BannerIcon";
import { BannerType } from "./Banner.types";
import { Text } from "../Text";
diff --git a/packages/components/src/Banner/components/BannerIcon/BannerIcon.css b/packages/components/src/Banner/components/BannerIcon/BannerIcon.module.css
similarity index 100%
rename from packages/components/src/Banner/components/BannerIcon/BannerIcon.css
rename to packages/components/src/Banner/components/BannerIcon/BannerIcon.module.css
diff --git a/packages/components/src/Banner/components/BannerIcon/BannerIcon.css.d.ts b/packages/components/src/Banner/components/BannerIcon/BannerIcon.module.css.d.ts
similarity index 100%
rename from packages/components/src/Banner/components/BannerIcon/BannerIcon.css.d.ts
rename to packages/components/src/Banner/components/BannerIcon/BannerIcon.module.css.d.ts
diff --git a/packages/components/src/Banner/components/BannerIcon/BannerIcon.tsx b/packages/components/src/Banner/components/BannerIcon/BannerIcon.tsx
index 8d1a7a0ba3..d3fdc8999d 100644
--- a/packages/components/src/Banner/components/BannerIcon/BannerIcon.tsx
+++ b/packages/components/src/Banner/components/BannerIcon/BannerIcon.tsx
@@ -1,8 +1,8 @@
import React from "react";
import { IconNames } from "@jobber/design";
import classNames from "classnames";
-import iconStyles from "./BannerIcon.css";
-import bannerStyles from "../../Banner.css";
+import iconStyles from "./BannerIcon.module.css";
+import bannerStyles from "../../Banner.module.css";
import { Icon } from "../../../Icon";
import { BannerType } from "../../Banner.types";
diff --git a/packages/components/src/Box/Box.tsx b/packages/components/src/Box/Box.tsx
index 49a2fdbb01..2d848373fb 100644
--- a/packages/components/src/Box/Box.tsx
+++ b/packages/components/src/Box/Box.tsx
@@ -14,9 +14,9 @@ import {
getPaddingVars,
} from "./utils/getBoxSpaces";
import type { BoxProps } from "./Box.types";
-import styles from "./styles/Box.css";
-import gapStyles from "./styles/BoxGap.css";
-import radiusStyles from "./styles/BoxRadius.css";
+import styles from "./styles/Box.module.css";
+import gapStyles from "./styles/BoxGap.module.css";
+import radiusStyles from "./styles/BoxRadius.module.css";
export function Box({
alignItems,
diff --git a/packages/components/src/Box/styles/Box.css b/packages/components/src/Box/styles/Box.module.css
similarity index 100%
rename from packages/components/src/Box/styles/Box.css
rename to packages/components/src/Box/styles/Box.module.css
diff --git a/packages/components/src/Box/styles/Box.css.d.ts b/packages/components/src/Box/styles/Box.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/Box.css.d.ts
rename to packages/components/src/Box/styles/Box.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxBorder.css b/packages/components/src/Box/styles/BoxBorder.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxBorder.css
rename to packages/components/src/Box/styles/BoxBorder.module.css
diff --git a/packages/components/src/Box/styles/BoxBorder.css.d.ts b/packages/components/src/Box/styles/BoxBorder.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxBorder.css.d.ts
rename to packages/components/src/Box/styles/BoxBorder.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxDimension.css b/packages/components/src/Box/styles/BoxDimension.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxDimension.css
rename to packages/components/src/Box/styles/BoxDimension.module.css
diff --git a/packages/components/src/Box/styles/BoxDimension.css.d.ts b/packages/components/src/Box/styles/BoxDimension.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxDimension.css.d.ts
rename to packages/components/src/Box/styles/BoxDimension.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxGap.css b/packages/components/src/Box/styles/BoxGap.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxGap.css
rename to packages/components/src/Box/styles/BoxGap.module.css
diff --git a/packages/components/src/Box/styles/BoxGap.css.d.ts b/packages/components/src/Box/styles/BoxGap.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxGap.css.d.ts
rename to packages/components/src/Box/styles/BoxGap.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxMargin.css b/packages/components/src/Box/styles/BoxMargin.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxMargin.css
rename to packages/components/src/Box/styles/BoxMargin.module.css
diff --git a/packages/components/src/Box/styles/BoxMargin.css.d.ts b/packages/components/src/Box/styles/BoxMargin.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxMargin.css.d.ts
rename to packages/components/src/Box/styles/BoxMargin.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxPadding.css b/packages/components/src/Box/styles/BoxPadding.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxPadding.css
rename to packages/components/src/Box/styles/BoxPadding.module.css
diff --git a/packages/components/src/Box/styles/BoxPadding.css.d.ts b/packages/components/src/Box/styles/BoxPadding.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxPadding.css.d.ts
rename to packages/components/src/Box/styles/BoxPadding.module.css.d.ts
diff --git a/packages/components/src/Box/styles/BoxRadius.css b/packages/components/src/Box/styles/BoxRadius.module.css
similarity index 100%
rename from packages/components/src/Box/styles/BoxRadius.css
rename to packages/components/src/Box/styles/BoxRadius.module.css
diff --git a/packages/components/src/Box/styles/BoxRadius.css.d.ts b/packages/components/src/Box/styles/BoxRadius.module.css.d.ts
similarity index 100%
rename from packages/components/src/Box/styles/BoxRadius.css.d.ts
rename to packages/components/src/Box/styles/BoxRadius.module.css.d.ts
diff --git a/packages/components/src/Box/utils/getBoxConfig.ts b/packages/components/src/Box/utils/getBoxConfig.ts
index baa6888058..9a978d0490 100644
--- a/packages/components/src/Box/utils/getBoxConfig.ts
+++ b/packages/components/src/Box/utils/getBoxConfig.ts
@@ -1,5 +1,5 @@
import classnames from "classnames";
-import borderStyles from "../styles/BoxBorder.css";
+import borderStyles from "../styles/BoxBorder.module.css";
// Borders
export const getBorderClassNames = (size: T) =>
diff --git a/packages/components/src/Box/utils/getBoxDimension.ts b/packages/components/src/Box/utils/getBoxDimension.ts
index 3326a99de4..20c36df263 100644
--- a/packages/components/src/Box/utils/getBoxDimension.ts
+++ b/packages/components/src/Box/utils/getBoxDimension.ts
@@ -1,5 +1,5 @@
import type { BoxDimension } from "../Box.types";
-import styles from "../styles/BoxDimension.css";
+import styles from "../styles/BoxDimension.module.css";
export const getHeightClassName = (value: BoxDimension) =>
getClassName(value, "height");
diff --git a/packages/components/src/Box/utils/getBoxSpaces.ts b/packages/components/src/Box/utils/getBoxSpaces.ts
index aceee35a42..ae60a144d3 100644
--- a/packages/components/src/Box/utils/getBoxSpaces.ts
+++ b/packages/components/src/Box/utils/getBoxSpaces.ts
@@ -1,7 +1,7 @@
import classNames from "classnames";
import type { BoxProps, Sizes } from "../Box.types";
-import marginStyles from "../styles/BoxMargin.css";
-import paddingStyles from "../styles/BoxPadding.css";
+import marginStyles from "../styles/BoxMargin.module.css";
+import paddingStyles from "../styles/BoxPadding.module.css";
type Size = BoxProps["padding"] | BoxProps["margin"];
diff --git a/packages/components/src/Button/Button.css b/packages/components/src/Button/Button.module.css
similarity index 100%
rename from packages/components/src/Button/Button.css
rename to packages/components/src/Button/Button.module.css
diff --git a/packages/components/src/Button/Button.css.d.ts b/packages/components/src/Button/Button.module.css.d.ts
similarity index 100%
rename from packages/components/src/Button/Button.css.d.ts
rename to packages/components/src/Button/Button.module.css.d.ts
diff --git a/packages/components/src/Button/Button.tsx b/packages/components/src/Button/Button.tsx
index 043dd093d4..bdc045c092 100644
--- a/packages/components/src/Button/Button.tsx
+++ b/packages/components/src/Button/Button.tsx
@@ -3,7 +3,7 @@ import classnames from "classnames";
import { XOR } from "ts-xor";
import { Link, LinkProps } from "react-router-dom";
import { IconNames } from "@jobber/design";
-import styles from "./Button.css";
+import styles from "./Button.module.css";
import { Icon } from "../Icon";
import { Typography } from "../Typography";
diff --git a/packages/components/src/Card/Card.css b/packages/components/src/Card/Card.module.css
similarity index 100%
rename from packages/components/src/Card/Card.css
rename to packages/components/src/Card/Card.module.css
diff --git a/packages/components/src/Card/Card.css.d.ts b/packages/components/src/Card/Card.module.css.d.ts
similarity index 100%
rename from packages/components/src/Card/Card.css.d.ts
rename to packages/components/src/Card/Card.module.css.d.ts
diff --git a/packages/components/src/Card/Card.tsx b/packages/components/src/Card/Card.tsx
index 041a5625ee..83696e524d 100644
--- a/packages/components/src/Card/Card.tsx
+++ b/packages/components/src/Card/Card.tsx
@@ -1,8 +1,8 @@
import React from "react";
import classnames from "classnames";
import { XOR } from "ts-xor";
-import styles from "./Card.css";
-import colors from "./cardcolors.css";
+import styles from "./Card.module.css";
+import colors from "./cardcolors.module.css";
import { CardClickable } from "./CardClickable";
import { CardHeader } from "./CardHeader";
import { CardProps } from "./types";
diff --git a/packages/components/src/Card/CardHeader.tsx b/packages/components/src/Card/CardHeader.tsx
index 580e5e010d..2f090a952b 100644
--- a/packages/components/src/Card/CardHeader.tsx
+++ b/packages/components/src/Card/CardHeader.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { ActionProps, CardProps } from "./types";
-import styles from "./Card.css";
+import styles from "./Card.module.css";
import { Heading } from "../Heading";
import { Button, ButtonProps } from "../Button";
import { Menu, MenuProps } from "../Menu";
diff --git a/packages/components/src/Card/cardcolors.css b/packages/components/src/Card/cardcolors.module.css
similarity index 100%
rename from packages/components/src/Card/cardcolors.css
rename to packages/components/src/Card/cardcolors.module.css
diff --git a/packages/components/src/Card/cardcolors.css.d.ts b/packages/components/src/Card/cardcolors.module.css.d.ts
similarity index 100%
rename from packages/components/src/Card/cardcolors.css.d.ts
rename to packages/components/src/Card/cardcolors.module.css.d.ts
diff --git a/packages/components/src/Card/types.ts b/packages/components/src/Card/types.ts
index 866c5f1d23..81fcbc2221 100644
--- a/packages/components/src/Card/types.ts
+++ b/packages/components/src/Card/types.ts
@@ -1,5 +1,5 @@
import { ReactElement, ReactNode } from "react";
-import colors from "./cardcolors.css";
+import colors from "./cardcolors.module.css";
import { ButtonProps } from "../Button";
import { MenuProps } from "../Menu";
diff --git a/packages/components/src/Checkbox/Checkbox.css b/packages/components/src/Checkbox/Checkbox.module.css
similarity index 100%
rename from packages/components/src/Checkbox/Checkbox.css
rename to packages/components/src/Checkbox/Checkbox.module.css
diff --git a/packages/components/src/Checkbox/Checkbox.css.d.ts b/packages/components/src/Checkbox/Checkbox.module.css.d.ts
similarity index 100%
rename from packages/components/src/Checkbox/Checkbox.css.d.ts
rename to packages/components/src/Checkbox/Checkbox.module.css.d.ts
diff --git a/packages/components/src/Checkbox/Checkbox.tsx b/packages/components/src/Checkbox/Checkbox.tsx
index 95321d44e8..b92b336d8a 100644
--- a/packages/components/src/Checkbox/Checkbox.tsx
+++ b/packages/components/src/Checkbox/Checkbox.tsx
@@ -8,7 +8,7 @@ import React, {
import classnames from "classnames";
import { XOR } from "ts-xor";
import { Controller, useForm, useFormContext } from "react-hook-form";
-import styles from "./Checkbox.css";
+import styles from "./Checkbox.module.css";
import { Icon } from "../Icon";
import { Text } from "../Text";
diff --git a/packages/components/src/Chip/Chip.css b/packages/components/src/Chip/Chip.module.css
similarity index 53%
rename from packages/components/src/Chip/Chip.css
rename to packages/components/src/Chip/Chip.module.css
index fcb088d3e4..e2f95c0b66 100644
--- a/packages/components/src/Chip/Chip.css
+++ b/packages/components/src/Chip/Chip.module.css
@@ -1,28 +1,39 @@
+:root {
+ --public-chip-base-bg-color: var(--color-surface--background);
+ --public-chip-base-hover-bg-color: var(--color-surface--background--hover);
+ --public-chip-base-content-color: var(--color-heading);
+}
+
.chip {
- --chip--gradient-color-variation: var(--chip-base-bg);
- --chip--gradient-color-variation--hover: var(--chip-base--hover);
+ --chip-base-bg-color: var(--public-chip-base-bg-color);
+ --chip-base-hover-bg-color: var(--public-chip-base-hover-bg-color);
+ --chip-base-content-color: var(--public-chip-base-content-color);
+ --chip-border-color: transparent;
--chip-height: 40px;
--chip-radius: 20px;
- --chip-base-bg: var(--color-surface--background);
- --chip-base--hover: var(--color-surface--background--hover);
- display: flex;
+ display: inline-flex;
position: relative;
height: var(--chip-height);
min-width: 0;
- padding: var(--space-small) var(--base-unit);
- border: var(--border-base) solid transparent;
+ box-sizing: border-box;
+ padding: 0 var(--base-unit);
+ border: var(--border-base) solid var(--chip-border-color);
border-radius: var(--chip-radius);
color: var(--color-heading);
text-align: left;
+ background-color: var(--chip-base-bg-color);
cursor: pointer;
transition: all var(--timing-base);
align-items: center;
}
+.chip:hover,
.chip:focus,
.chip:focus-visible,
.clickableSuffix:focus-visible {
+ border: var(--border-base) solid var(--chip-border-color);
outline: transparent;
+ background-color: var(--chip-base-hover-bg-color);
}
.chip .clickableSuffix {
@@ -81,79 +92,59 @@
background-color: var(--color-surface);
}
-.base {
- border: var(--border-base) solid transparent;
- color: var(--color-heading);
- background-color: var(--chip-base-bg);
- --chip--gradient-color-variation: var(--chip-base-bg);
+.base,
+.base p {
+ color: var(--chip-base-content-color);
}
-.base:hover,
-.base:focus-visible {
- background-color: var(--chip-base--hover);
- --chip--gradient-color-variation--hover: var(--chip-base--hover);
+.base .chipBar {
+ background-color: var(--chip-base-content-color);
}
.invalid,
-.invalid:hover,
-.invalid:focus-visible,
-.subtle.invalid,
-.subtle.invalid:hover,
-.subtle.invalid:focus-visible {
- border: var(--border-base) solid var(--color-critical);
- background-color: var(--color-critical--surface);
- --chip--gradient-color-variation: var(--color-critical--surface);
- --chip--gradient-color-variation--hover: var(--color-critical--surface);
+.subtle.invalid {
+ --chip-border-color: var(--color-critical);
+ --chip-base-bg-color: var(--color-critical--surface);
}
+/* If these change, please update InternalChip.css focus-visible rules */
.invalid:hover,
.invalid:focus-visible,
.subtle.invalid:hover,
.subtle.invalid:focus-visible {
- background-color: var(--color-surface--background--hover);
- --chip--gradient-color-variation: var(--color-surface--background--hover);
- --chip--gradient-color-variation--hover: var(
- --color-surface--background--hover
- );
+ --chip-border-color: var(--color-critical);
+ --chip-base-hover-bg-color: var(--color-surface--background--hover);
}
.subtle {
- border: var(--border-base) solid var(--color-border--interactive);
- background-color: var(--color-surface);
- --chip--gradient-color-variation: var(--color-surface);
-}
-
-/* CAUTION: Order is important here since
-* there is are different styles for subtle:focus and subtle:hover
-* and we want hover to take priority
-*/
-
-.subtle:focus-visible {
- --chip--gradient-color-variation--hover: var(--color-surface);
+ --chip-border-color: var(--color-border--interactive);
+ --chip-base-bg-color: var(--color-surface);
}
+/* If these change, please update InternalChip.css focus-visible rules */
+.subtle:focus-visible,
.subtle:hover {
- border: var(--border-base) solid var(--chip-base-bg);
- background-color: var(--chip-base-bg);
- --chip--gradient-color-variation--hover: var(--chip-base-bg);
+ --chip-border-color: var(--chip-base-bg-color);
+ --chip-base-hover-bg-color: var(--color-surface--background);
}
.invalid.disabled,
.invalid.disabled:hover,
.invalid.disabled:focus-visible {
- background-color: var(--color-disabled--secondary);
- cursor: auto;
+ --chip-base-bg-color: var(--color-disabled--secondary);
+ --chip-base-hover-bg-color: var(--color-disabled--secondary);
+ cursor: not-allowed;
}
+/* If these change, please update InternalChip.css focus-visible rules */
.disabled,
.disabled:hover,
.disabled:focus-visible {
- border: var(--border-base) solid var(--color-disabled--secondary);
+ --chip-border-color: var(--color-disabled--secondary);
color: var(--color-disabled);
- background-color: var(--color-disabled--secondary);
- cursor: auto;
- --chip--gradient-color-variation: var(--color-disabled--secondary);
- --chip--gradient-color-variation--hover: var(--color-disabled--secondary);
+ --chip-base-bg-color: var(--color-disabled--secondary);
+ --chip-base-hover-bg-color: var(--color-disabled--secondary);
+ cursor: not-allowed;
}
.disabled .chipBar {
@@ -192,16 +183,17 @@
height: 100%;
background: linear-gradient(
to left,
- var(--chip--gradient-color-variation) 5%,
+ var(--chip-base-bg-color) 5%,
rgba(255, 255, 255, 0)
);
+ transition: all var(--timing-base);
}
.chip:focus-visible .truncateGradient,
.chip:hover .truncateGradient {
background: linear-gradient(
to left,
- var(--chip--gradient-color-variation--hover) 5%,
+ var(--chip-base-hover-bg-color) 5%,
rgba(255, 255, 255, 0)
);
}
diff --git a/packages/components/src/Chip/Chip.css.d.ts b/packages/components/src/Chip/Chip.module.css.d.ts
similarity index 100%
rename from packages/components/src/Chip/Chip.css.d.ts
rename to packages/components/src/Chip/Chip.module.css.d.ts
diff --git a/packages/components/src/Chip/Chip.test.tsx b/packages/components/src/Chip/Chip.test.tsx
index 8b05b28bdf..132afa8955 100644
--- a/packages/components/src/Chip/Chip.test.tsx
+++ b/packages/components/src/Chip/Chip.test.tsx
@@ -2,7 +2,7 @@ import React from "react";
import { fireEvent, render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { Chip } from "./Chip";
-import styles from "./Chip.css";
+import styles from "./Chip.module.css";
import { Avatar } from "../Avatar";
let mockIsInView = jest.fn(() => true);
@@ -49,13 +49,14 @@ describe("Chip", () => {
it("should have a role of button when role not provided", () => {
const { getByRole } = render();
- expect(getByRole("button")).toBeInstanceOf(HTMLButtonElement);
+ expect(getByRole("button")).toBeInstanceOf(HTMLDivElement);
});
it("should have a tabIndex of zero if one is not provided", () => {
const { getByRole } = render();
expect(getByRole("button")).toHaveAttribute("tabIndex", "0");
+ expect(getByRole("button")).toBeInstanceOf(HTMLDivElement);
});
it("should set aria-label if one is provided", () => {
@@ -65,12 +66,6 @@ describe("Chip", () => {
expect(getByRole("button")).toHaveAttribute("aria-label", "Test Label");
});
-
- it("should default aria-label to provided label if not provided", () => {
- const { getByRole } = render();
-
- expect(getByRole("button")).toHaveAttribute("aria-label", "Test Chip");
- });
});
describe("Chip Children", () => {
diff --git a/packages/components/src/Chip/Chip.tsx b/packages/components/src/Chip/Chip.tsx
index 6e55418010..1633c56a7d 100644
--- a/packages/components/src/Chip/Chip.tsx
+++ b/packages/components/src/Chip/Chip.tsx
@@ -1,7 +1,7 @@
import React from "react";
import classnames from "classnames";
import { useInView } from "@jobber/hooks/useInView";
-import styles from "./Chip.css";
+import styles from "./Chip.module.css";
import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
import { ChipProps } from "./Chip.types";
@@ -16,6 +16,7 @@ export const Chip = ({
invalid,
label,
value,
+ testID,
onClick,
onKeyDown,
children,
@@ -41,19 +42,21 @@ export const Chip = ({
label,
heading,
);
+ const Tag = onClick ? "button" : "div";
return (
-
-
+
);
};
diff --git a/packages/components/src/Chip/Chip.types.d.ts b/packages/components/src/Chip/Chip.types.d.ts
index f6d0d66b00..ac36469bc3 100644
--- a/packages/components/src/Chip/Chip.types.d.ts
+++ b/packages/components/src/Chip/Chip.types.d.ts
@@ -6,6 +6,11 @@ export interface ChipProps extends PropsWithChildren {
*/
readonly ariaLabel?: string;
+ /**
+ * The testing id for the chip if necessary.
+ */
+ testID?: string;
+
/**
* Disables both mouse and keyboard functionality, and updates the visual style of the Chip to appear disabled.
*/
@@ -53,13 +58,15 @@ export interface ChipProps extends PropsWithChildren {
*/
readonly onClick?: (
value: string | number | undefined,
- ev: React.MouseEvent,
+ ev: React.MouseEvent,
) => void;
/**
* Callback. Called when you keydown on Chip. Ships the event, so you can get the key pushed.
*/
- readonly onKeyDown?: (ev: React.KeyboardEvent) => void;
+ readonly onKeyDown?: (
+ ev: React.KeyboardEvent,
+ ) => void;
}
export type ChipVariations = "subtle" | "base";
diff --git a/packages/components/src/Chip/components/ChipPrefix/Chip.Prefix.tsx b/packages/components/src/Chip/components/ChipPrefix/Chip.Prefix.tsx
index b78e2c99fb..4a55874812 100644
--- a/packages/components/src/Chip/components/ChipPrefix/Chip.Prefix.tsx
+++ b/packages/components/src/Chip/components/ChipPrefix/Chip.Prefix.tsx
@@ -3,7 +3,7 @@ import classNames from "classnames";
import { Avatar } from "@jobber/components/Avatar";
import { Icon } from "@jobber/components/Icon";
import { useChildComponent } from "../../hooks/index";
-import styles from "../../Chip.css";
+import styles from "../../Chip.module.css";
export function ChipPrefix({ children }: PropsWithChildren) {
const avatarOrIcon = useChildComponent(
diff --git a/packages/components/src/Chip/components/ChipSelectable/ChipSelectable.tsx b/packages/components/src/Chip/components/ChipSelectable/ChipSelectable.tsx
index acb524df7f..91f3f852b1 100644
--- a/packages/components/src/Chip/components/ChipSelectable/ChipSelectable.tsx
+++ b/packages/components/src/Chip/components/ChipSelectable/ChipSelectable.tsx
@@ -2,7 +2,7 @@ import React from "react";
import { Icon } from "@jobber/components/Icon";
import { Chip } from "../../Chip";
import { ChipSelectableProps } from "../../Chip.types";
-import styles from "../../Chip.css";
+import styles from "../../Chip.module.css";
export function ChipSelectable({ selected, ...rest }: ChipSelectableProps) {
return (
@@ -11,7 +11,7 @@ export function ChipSelectable({ selected, ...rest }: ChipSelectableProps) {
diff --git a/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.test.tsx b/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.test.tsx
index 192e3c384e..51961ae466 100644
--- a/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.test.tsx
+++ b/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.test.tsx
@@ -2,7 +2,7 @@ import React from "react";
import { render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { Chip } from "../../Chip";
-import styles from "../../Chip.css";
+import styles from "../../Chip.module.css";
import { Avatar } from "../../../Avatar";
import { Icon } from "../../../Icon";
diff --git a/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.tsx b/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.tsx
index 30888c00db..a4641b9ee9 100644
--- a/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.tsx
+++ b/packages/components/src/Chip/components/ChipSuffix/Chip.Suffix.tsx
@@ -1,8 +1,9 @@
import React, { PropsWithChildren } from "react";
import classNames from "classnames";
import { Icon } from "@jobber/components/Icon";
+import { InternalChipButton } from "@jobber/components/Chips/InternalChipButton";
import { useChildComponent } from "../../hooks";
-import styles from "../../Chip.css";
+import styles from "../../Chip.module.css";
export function ChipSuffix({
children,
@@ -11,7 +12,10 @@ export function ChipSuffix({
testID,
ariaLabel,
}: ChipSuffixProps) {
- let singleChild = useChildComponent(children, d => d.type === Icon);
+ let singleChild = useChildComponent(
+ children,
+ d => d.type === Icon || d.type == InternalChipButton,
+ );
const handleClick = (
event:
@@ -26,7 +30,9 @@ export function ChipSuffix({
onClick(event);
};
- if (!allowedSuffixIcons.includes(singleChild?.props?.name)) {
+ const iconName = singleChild?.props?.name || singleChild?.props?.icon;
+
+ if (!allowedSuffixIcons.includes(iconName)) {
singleChild = undefined;
}
@@ -60,4 +66,10 @@ export interface ChipSuffixProps extends PropsWithChildren {
) => void;
}
-export const allowedSuffixIcons = ["cross", "add", "checkmark", "arrowDown"];
+export const allowedSuffixIcons = [
+ "cross",
+ "add",
+ "checkmark",
+ "remove",
+ "arrowDown",
+];
diff --git a/packages/components/src/Chips/ChipsTypes.tsx b/packages/components/src/Chips/ChipsTypes.tsx
index 69cabc3fb0..a16232d313 100644
--- a/packages/components/src/Chips/ChipsTypes.tsx
+++ b/packages/components/src/Chips/ChipsTypes.tsx
@@ -1,5 +1,4 @@
import { MouseEvent, ReactElement } from "react";
-import { XOR } from "ts-xor";
import { ChipProps } from "./Chip";
interface ChipFoundationProps {
@@ -38,6 +37,11 @@ interface ChipFoundationProps {
export interface ChipSingleSelectProps extends ChipFoundationProps {
readonly type?: "singleselect";
readonly selected?: string;
+ /**
+ * Show the checkmark suffix on the selected Chip(s)
+ * defaults to true
+ */
+ readonly showSelectedSuffix?: boolean;
onChange(value?: string): void;
/**
@@ -51,6 +55,11 @@ export interface ChipSingleSelectProps extends ChipFoundationProps {
export interface ChipMultiSelectProps extends ChipFoundationProps {
readonly type: "multiselect";
readonly selected: string[];
+ /**
+ * Show the checkmark suffix on the selected Chip(s)
+ * defaults to true
+ */
+ readonly showSelectedSuffix?: boolean;
onChange(value: string[]): void;
}
@@ -96,7 +105,6 @@ export interface ChipDismissibleProps extends ChipFoundationProps {
onLoadMore?(searchValue: string): void;
}
-export type ChipsProps = XOR<
- ChipSingleSelectProps,
- XOR
->;
+export type ChipsProps =
+ | ChipSingleSelectProps
+ | (ChipMultiSelectProps | ChipDismissibleProps);
diff --git a/packages/components/src/Chips/InternalChip.css b/packages/components/src/Chips/InternalChip.css
deleted file mode 100644
index fae9f28489..0000000000
--- a/packages/components/src/Chips/InternalChip.css
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Used in the wrapping chips component:
- * - InternalChipSingleSelect
- * - InternalChipMultiSelect
- */
-
-.wrapper {
- display: flex;
- gap: var(--space-small);
- flex-wrap: wrap;
- align-items: center;
-}
-
-.chip {
- display: inline-grid;
- position: relative;
- max-width: 100%;
- box-sizing: border-box;
- padding: var(--space-small);
- border: var(--border-base) solid var(--color-border--interactive);
- border-radius: var(--radius-larger);
- color: var(--color-text--secondary);
- text-align: left;
- vertical-align: middle;
- background-color: var(--color-surface);
- transition: var(--timing-base) ease-in-out;
- transition-property: background-color, box-shadow, color;
- grid-template-columns: max-content;
- align-items: center;
- gap: var(--space-small);
-}
-
-.hasPrefix,
-.hasSuffix {
- padding: calc(var(--space-smaller) + var(--space-smallest)) var(--space-small);
-}
-
-.hasPrefix {
- grid-template-columns: min-content 1fr;
-}
-
-.hasSuffix {
- grid-template-columns: 1fr min-content;
-}
-
-.hasPrefix.hasSuffix {
- grid-template-columns: min-content 1fr min-content;
-}
-
-.clickable,
-.input ~ .chip {
- box-shadow: var(--shadow-base);
- cursor: pointer;
- appearance: none;
-}
-
-/**
- * Interaction
- */
-
-.chip:focus,
-.input:focus ~ .chip {
- box-shadow: var(--shadow-focus);
- outline: none;
-}
-
-.clickable:hover,
-.input ~ .chip:not(.active):hover,
-.input:focus ~ .chip:not(.active) {
- background-color: var(--color-surface--hover);
-}
-
-/**
- * States
- */
-
-.chip.active {
- border-color: var(--color-surface--reverse);
- color: var(--color-text--reverse);
- background-color: var(--color-surface--reverse);
-}
-
-.chip.invalid {
- border-color: var(--color-critical--onSurface);
- color: var(--color-critical--onSurface);
- background-color: var(--color-critical--surface);
-}
-
-.chip.disabled {
- border-color: var(--color-disabled--secondary);
- color: var(--color-disabled);
- background-color: var(--color-disabled--secondary);
-}
-
-.active.disabled {
- border-color: var(--color-disabled);
- color: var(--color-white);
- background-color: var(--color-disabled);
-}
-
-.invalid.disabled {
- border-color: var(--color-critical);
-}
-
-/**
- * Input checkbox/radio
- *
- * Hide checkbox on UI but not screen readers and still allow focus state
- */
-
-.input {
- position: absolute;
- width: 1px;
- height: 1px;
- overflow: hidden;
- clip: rect(0 0 0 0);
- clip-path: inset(100%);
- white-space: nowrap;
-}
-
-/**
- * Button
- */
-
-.button {
- display: flex;
- border-radius: var(--radius-base);
- cursor: pointer;
- transition: background-color 200ms ease;
-}
-
-.button:hover,
-.button:focus {
- background-color: var(--color-surface--hover);
-}
-
-.button:focus,
-.clickable .button:hover {
- box-shadow: var(--shadow-focus);
- outline: none;
-}
-
-/**
- * Override icon default colors.
- *
- * NOTE: This is a workaround since some icons have default colors that we don't
- * want to override until the component color prop overrides it.
- * DO NOT COPY!
- */
-
-.icon > svg {
- fill: var(--color-interactive--subtle);
-}
-
-.icon {
- display: flex;
-}
diff --git a/packages/components/src/Chips/InternalChip.module.css b/packages/components/src/Chips/InternalChip.module.css
new file mode 100644
index 0000000000..9e69d77b29
--- /dev/null
+++ b/packages/components/src/Chips/InternalChip.module.css
@@ -0,0 +1,94 @@
+/**
+ * Used in the wrapping chips component:
+ * - InternalChipSingleSelect
+ * - InternalChipMultiSelect
+ */
+
+.wrapper {
+ display: flex;
+ gap: var(--space-small);
+ flex-wrap: wrap;
+ align-items: center;
+}
+
+/**
+ * Interaction
+ *
+ * NOTE:
+ * Since the Chip component is not being focused, rather it's the input
+ * We are copying the styles from the Chip component to ensure the same experience
+ */
+
+.input:focus-visible ~ div[role="option"],
+.input:focus-visible ~ div[role="button"] {
+ box-shadow: var(--shadow-focus);
+ outline: none;
+}
+
+.input.inactive:focus-visible ~ div[role="option"],
+.input.inactive:focus-visible ~ div[role="button"] {
+ background-color: var(--color-surface--background);
+}
+
+.input.invalid:focus-visible ~ div[role="option"],
+.input.invalid:focus-visible ~ div[role="button"] {
+ background-color: var(--color-surface--background--hover);
+}
+
+.input.disabled:focus-visible ~ div[role="option"],
+.input.disabled:focus-visible ~ div[role="button"] {
+ background-color: var(--color-disabled--secondary);
+}
+
+/**
+ * Input checkbox/radio
+ *
+ * Hide checkbox on UI but not screen readers and still allow focus state
+ */
+
+.input {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ clip: rect(0 0 0 0);
+ clip-path: inset(100%);
+ white-space: nowrap;
+}
+
+/**
+ * Button
+ */
+
+.button {
+ display: flex;
+ border-radius: var(--radius-base);
+ cursor: pointer;
+ transition: background-color 200ms ease;
+}
+
+.button:hover,
+.button:focus {
+ background-color: var(--color-surface--hover);
+}
+
+.button:focus {
+ box-shadow: var(--shadow-focus);
+ outline: none;
+}
+
+/**
+ * Override icon default colors.
+ *
+ * NOTE: This is a workaround since some icons have default colors that we don't
+ * want to override until the component color prop overrides it.
+ * DO NOT COPY!
+ */
+
+.icon > svg {
+ fill: var(--color-interactive--subtle);
+}
+
+.icon {
+ display: flex;
+}
diff --git a/packages/components/src/Chips/InternalChip.css.d.ts b/packages/components/src/Chips/InternalChip.module.css.d.ts
similarity index 59%
rename from packages/components/src/Chips/InternalChip.css.d.ts
rename to packages/components/src/Chips/InternalChip.module.css.d.ts
index d127c62f85..deda9c5b74 100644
--- a/packages/components/src/Chips/InternalChip.css.d.ts
+++ b/packages/components/src/Chips/InternalChip.module.css.d.ts
@@ -1,11 +1,7 @@
declare const styles: {
readonly "wrapper": string;
- readonly "chip": string;
- readonly "hasPrefix": string;
- readonly "hasSuffix": string;
- readonly "clickable": string;
readonly "input": string;
- readonly "active": string;
+ readonly "inactive": string;
readonly "invalid": string;
readonly "disabled": string;
readonly "button": string;
diff --git a/packages/components/src/Chips/InternalChip.tsx b/packages/components/src/Chips/InternalChip.tsx
index d4e93bc20f..6fd5b8aa3d 100644
--- a/packages/components/src/Chips/InternalChip.tsx
+++ b/packages/components/src/Chips/InternalChip.tsx
@@ -1,10 +1,6 @@
-import React, { useState } from "react";
-import classnames from "classnames";
-import styles from "./InternalChip.css";
+import React from "react";
import { InternalChipProps } from "./ChipTypes";
-import { InternalChipAffix } from "./InternalChipAffix";
-import { Typography } from "../Typography";
-import { Tooltip } from "../Tooltip";
+import { Chip } from "../Chip";
export function InternalChip({
label,
@@ -18,43 +14,21 @@ export function InternalChip({
onClick,
onKeyDown,
}: InternalChipProps) {
- const [truncateRef, setTruncateRef] = useState();
- const isClickable = onClick && !disabled;
- const classNames = classnames(styles.chip, {
- [styles.clickable]: isClickable,
- [styles.active]: active,
- [styles.disabled]: disabled,
- [styles.invalid]: invalid,
- [styles.hasPrefix]: prefix,
- [styles.hasSuffix]: suffix,
- });
- const affixProps = { active, invalid, disabled };
- const Tag = onClick ? "button" : "div";
-
- const chip = (
- onClick(ev) : undefined}
+ label={label}
>
-
-
- {label}
-
-
-
+ {prefix && {prefix}}
+ {suffix && {suffix}}
+
);
-
- return isTruncated() ? {chip} : chip;
-
- function isTruncated() {
- const truncateParentHeight = truncateRef?.parentElement?.offsetHeight || 0;
- const truncateChildHeight = truncateRef?.offsetHeight || 0;
-
- return truncateChildHeight >= truncateParentHeight * 2;
- }
}
diff --git a/packages/components/src/Chips/InternalChipAffix.tsx b/packages/components/src/Chips/InternalChipAffix.tsx
index 80478c9414..99d300eae1 100644
--- a/packages/components/src/Chips/InternalChipAffix.tsx
+++ b/packages/components/src/Chips/InternalChipAffix.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from "react";
import { useAssert } from "@jobber/hooks/useAssert";
import { ChipButtonProps, InternalChipButton } from "./InternalChipButton";
-import styles from "./InternalChip.css";
+import styles from "./InternalChip.module.css";
import { InternalChipProps } from "./ChipTypes";
import { Avatar, AvatarProps } from "../Avatar";
import { Icon, IconProps } from "../Icon";
diff --git a/packages/components/src/Chips/InternalChipButton.tsx b/packages/components/src/Chips/InternalChipButton.tsx
index ec14caeb37..4d78323569 100644
--- a/packages/components/src/Chips/InternalChipButton.tsx
+++ b/packages/components/src/Chips/InternalChipButton.tsx
@@ -5,7 +5,7 @@ import React, {
useRef,
} from "react";
import { IconNames } from "@jobber/design";
-import styles from "./InternalChip.css";
+import styles from "./InternalChip.module.css";
import { Icon } from "../Icon";
export interface ChipButtonProps {
@@ -39,7 +39,7 @@ export function InternalChipButton({
aria-disabled={disabled}
data-testid="remove-chip-button"
>
-
+
);
@@ -64,7 +64,7 @@ export function InternalChipButton({
if (disabled) return "disabled";
if (invalid) return "critical";
- return "greyBlue";
+ return "interactiveSubtle";
}
function handleClick(event: MouseEvent) {
diff --git a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.css b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.module.css
similarity index 100%
rename from packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.css
rename to packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.module.css
diff --git a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.css.d.ts b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.module.css.d.ts
similarity index 100%
rename from packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.css.d.ts
rename to packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.module.css.d.ts
diff --git a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.tsx b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.tsx
index 1661cf085d..9a988f045e 100644
--- a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.tsx
+++ b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissible.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import styles from "./InternalChipDismissible.css";
+import styles from "./InternalChipDismissible.module.css";
import { useInternalChipDismissible } from "./hooks";
import { InternalChipDismissibleInput } from "./InternalChipDismissibleInput";
import { InternalChipDismissibleProps } from "./InternalChipDismissibleTypes";
diff --git a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissibleInput.tsx b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissibleInput.tsx
index 039dd5fa78..05f2e427a9 100644
--- a/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissibleInput.tsx
+++ b/packages/components/src/Chips/InternalChipDismissible/InternalChipDismissibleInput.tsx
@@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import debounce from "lodash/debounce";
import classNames from "classnames";
-import styles from "./InternalChipDismissible.css";
+import styles from "./InternalChipDismissible.module.css";
import { ChipDismissibleInputProps } from "./InternalChipDismissibleTypes";
import {
useInView,
diff --git a/packages/components/src/Chips/InternalChipDismissible/__tests__/InternalChipDismissible.test.tsx b/packages/components/src/Chips/InternalChipDismissible/__tests__/InternalChipDismissible.test.tsx
index ebb4e0355a..c5c4e63b79 100644
--- a/packages/components/src/Chips/InternalChipDismissible/__tests__/InternalChipDismissible.test.tsx
+++ b/packages/components/src/Chips/InternalChipDismissible/__tests__/InternalChipDismissible.test.tsx
@@ -162,7 +162,7 @@ describe("Basic interaction", () => {
describe("left and right arrow keys via keyboard", () => {
it("should focus on the correct element when left or right arrow down", async () => {
- const chipWrappers = screen.getAllByTestId("chip-wrapper");
+ const chipWrappers = screen.getAllByTestId("ATL-InternalChip");
const first = chipWrappers[0];
await userEvent.tab();
diff --git a/packages/components/src/Chips/InternalChipMultiSelect.tsx b/packages/components/src/Chips/InternalChipMultiSelect.tsx
index 4a73441546..eb2d92f355 100644
--- a/packages/components/src/Chips/InternalChipMultiSelect.tsx
+++ b/packages/components/src/Chips/InternalChipMultiSelect.tsx
@@ -1,31 +1,41 @@
import React, { MouseEvent } from "react";
-import styles from "./InternalChip.css";
+import classNames from "classnames";
+import styles from "./InternalChip.module.css";
import { InternalChip } from "./InternalChip";
import { ChipMultiSelectProps } from "./ChipsTypes";
-import { Icon } from "../Icon";
+import { useInternalChips } from "./hooks/useInternalChip";
type InternalChipChoiceMultipleProps = Pick<
ChipMultiSelectProps,
- "selected" | "onChange" | "children" | "onClick"
+ "selected" | "onChange" | "children" | "onClick" | "showSelectedSuffix"
>;
export function InternalChipMultiSelect({
children,
selected,
+ showSelectedSuffix = true,
onChange,
onClick,
}: InternalChipChoiceMultipleProps) {
+ const { getSuffixProps } = useInternalChips();
+
return (