-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from atomicjolt/sc/build-fixes
Fixed TS builds
- Loading branch information
Showing
69 changed files
with
1,148 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atomicjolt/atomic-elements": major | ||
--- | ||
|
||
Implemented a Composition API for the Calendar component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atomicjolt/atomic-elements": major | ||
--- | ||
|
||
Implemented ChipGroupField using the new Collections API & re-implemented ChipGroup & Chip on top of that base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
packages/atomic-elements/src/components/Buttons/Button/Button.context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import React from "react"; | ||
import { ButtonProps } from "."; | ||
import { createComponentContext } from "@utils/index"; | ||
import { HasIcon } from '../../../types'; | ||
import { CanHaveIcon } from '../../../types'; | ||
|
||
export const ButtonContext = createComponentContext< | ||
ButtonProps & HasIcon | ||
ButtonProps & CanHaveIcon | ||
>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 91 additions & 59 deletions
150
packages/atomic-elements/src/components/Chips/Chip/Chip.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/atomic-elements/src/components/Chips/Chip/Chip.context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { createComponentContext } from "@utils/index"; | ||
import { ChipProps } from "./Chip.types"; | ||
|
||
export const ChipContext = createComponentContext<ChipProps<any>>(); |
11 changes: 9 additions & 2 deletions
11
packages/atomic-elements/src/components/Chips/Chip/Chip.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import { render } from "@testing-library/react"; | ||
import { expect, describe, test } from "vitest"; | ||
import { fireEvent, render, screen } from "@testing-library/react"; | ||
import { expect, describe, test, vi } from "vitest"; | ||
import { Chip } from "."; | ||
|
||
describe("Chip", () => { | ||
test("matches snapshot", () => { | ||
const result = render(<Chip>Item</Chip>); | ||
expect(result.asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
test("onRemove", () => { | ||
const onRemove = vi.fn(); | ||
render(<Chip onRemove={onRemove}>Item</Chip>); | ||
fireEvent.click(screen.getByRole("button")); | ||
expect(onRemove).toHaveBeenCalledOnce(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/atomic-elements/src/components/Chips/Chip/Chip.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Node } from "react-stately"; | ||
import { AriaLabelProps, DomProps, SuggestStrings } from "../../../types"; | ||
import { PressEvent, PressProps } from "@react-aria/interactions"; | ||
import { ItemProps } from "../../Collection"; | ||
|
||
type ChipVariants = SuggestStrings< | ||
"default" | "warning" | "success" | "danger" | ||
>; | ||
|
||
export interface ChipProps<T> extends ItemProps, PressProps { | ||
variant?: ChipVariants; | ||
/** Handler that is called when the user | ||
* clicks the remove button for the chip */ | ||
onRemove?: (e: PressEvent) => void; | ||
isDisabled?: boolean; | ||
} | ||
|
||
export type ChipArgs<T> = | ||
| [ChipProps<T>, React.ForwardedRef<HTMLDivElement>] | ||
| [ChipProps<T>, React.ForwardedRef<HTMLDivElement>, Node<T>]; | ||
|
||
export interface ChipGroupChipProps<T> extends ChipProps<T> { | ||
item: Node<T>; | ||
itemRef: React.ForwardedRef<HTMLDivElement>; | ||
} | ||
|
||
export interface ChipInternalProps<T> extends ChipProps<T> { | ||
allowsRemoving?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { Chip, ChipInternal } from "./Chip.component"; | ||
export type { ChipProps } from "./Chip.component"; | ||
export { Chip, ChipLeaf } from "./Chip.component"; | ||
export type { ChipProps } from "./Chip.types"; |
Oops, something went wrong.