feat(root): gitignore reset

This commit is contained in:
Junior Garcia 2023-03-01 11:39:55 -03:00
parent c1697d6187
commit 564337bac6
9 changed files with 76 additions and 3889 deletions

2
.gitignore vendored
View File

@ -20,7 +20,7 @@ types
/build /build
dist/ dist/
storybook-static storybook-static
/packages/components/storybook/public/tailwind.css /packages/storybook/public/tailwind.css
# misc # misc
.DS_Store .DS_Store
.env .env

View File

@ -13,6 +13,7 @@ const Chip = forwardRef<ChipProps, "div">((props, ref) => {
children, children,
slots, slots,
styles, styles,
variant,
isCloseable, isCloseable,
leftContent, leftContent,
rightContent, rightContent,
@ -23,6 +24,14 @@ const Chip = forwardRef<ChipProps, "div">((props, ref) => {
...props, ...props,
}); });
const left = useMemo(() => {
if (variant === "dot" && !leftContent) {
return <span className={slots.dot({class: styles?.dot})} />;
}
return leftContent;
}, [leftContent, variant]);
const right = useMemo(() => { const right = useMemo(() => {
if (isCloseable) { if (isCloseable) {
return ( return (
@ -35,7 +44,7 @@ const Chip = forwardRef<ChipProps, "div">((props, ref) => {
return ( return (
<Component {...getChipProps()}> <Component {...getChipProps()}>
{leftContent} {left}
<label className={slots.label({class: styles?.label})}>{children}</label> <label className={slots.label({class: styles?.label})}>{children}</label>
{right} {right}
</Component> </Component>

View File

@ -31,6 +31,7 @@ export interface UseChipProps extends HTMLNextUIProps<"div">, ChipVariantProps {
* ```ts * ```ts
* <Chip styles={{ * <Chip styles={{
* base:"base-classes", * base:"base-classes",
* dot: "dot-classes",
* label: "label-classes", * label: "label-classes",
* closeButton: "close-button-classes", * closeButton: "close-button-classes",
* }} /> * }} />
@ -60,13 +61,19 @@ export function useChip(originalProps: UseChipProps) {
const {focusProps: closeFocusProps, isFocusVisible: isCloseButtonFocusVisible} = useFocusRing(); const {focusProps: closeFocusProps, isFocusVisible: isCloseButtonFocusVisible} = useFocusRing();
const isOneChar = useMemo(
() => typeof children === "string" && children?.length === 1,
[children],
);
const slots = useMemo( const slots = useMemo(
() => () =>
chip({ chip({
...variantProps, ...variantProps,
isOneChar,
isCloseButtonFocusVisible, isCloseButtonFocusVisible,
}), }),
[...Object.values(variantProps), isCloseButtonFocusVisible], [...Object.values(variantProps), isCloseButtonFocusVisible, isOneChar],
); );
const {pressProps: closePressProps} = usePress({ const {pressProps: closePressProps} = usePress({
@ -103,6 +110,7 @@ export function useChip(originalProps: UseChipProps) {
children, children,
slots, slots,
styles, styles,
variant: originalProps.variant,
leftContent: getContentClone(leftContent), leftContent: getContentClone(leftContent),
rightContent: getContentClone(rightContent), rightContent: getContentClone(rightContent),
isCloseable, isCloseable,

View File

@ -13,7 +13,7 @@ export default {
variant: { variant: {
control: { control: {
type: "select", type: "select",
options: ["solid", "bordered", "light", "flat", "faded", "shadow"], options: ["solid", "bordered", "light", "flat", "faded", "shadow", "dot"],
}, },
}, },
color: { color: {

View File

@ -28,7 +28,7 @@ const badge = tv({
"items-center", "items-center",
"text-inherit", "text-inherit",
"select-none", "select-none",
"font-medium", "font-regular",
"scale-100", "scale-100",
"opacity-100", "opacity-100",
"data-[invisible=true]:scale-0", "data-[invisible=true]:scale-0",
@ -116,7 +116,7 @@ const badge = tv({
badge: "transition-none", badge: "transition-none",
}, },
false: { false: {
badge: "transition-all", badge: "transition-transform-opacity",
}, },
}, },
disableOutline: { disableOutline: {

View File

@ -5,10 +5,12 @@ import {ringClasses, colorVariants} from "../utils";
/** /**
* Chip wrapper **Tailwind Variants** component * Chip wrapper **Tailwind Variants** component
* *
* const {base, label,closeButton} = chip({...}) * const {base, label, dot, closeButton} = chip({...})
* *
* @example * @example
* <div className={base())}> * <div className={base())}>
* // left content
* <svg className={dot()}/>
* <label className={label()}>Default</label> * <label className={label()}>Default</label>
* <svg className={closeButton()}>close button</svg> * <svg className={closeButton()}>close button</svg>
* </div> * </div>
@ -17,6 +19,7 @@ const chip = tv({
slots: { slots: {
base: ["relative", "inline-flex", "items-center", "justify-between", "box-border"], base: ["relative", "inline-flex", "items-center", "justify-between", "box-border"],
label: "flex-1 text-inherit select-none font-regular", label: "flex-1 text-inherit select-none font-regular",
dot: ["w-2", "h-2", "mr-2", "rounded-full"],
closeButton: [ closeButton: [
"z-10", "z-10",
"apparance-none", "apparance-none",
@ -42,6 +45,7 @@ const chip = tv({
base: "border-2", base: "border-2",
}, },
shadow: {}, shadow: {},
dot: {},
}, },
color: { color: {
neutral: { neutral: {
@ -101,6 +105,12 @@ const chip = tv({
"3xl": {base: "rounded-3xl"}, "3xl": {base: "rounded-3xl"},
full: {base: "rounded-full"}, full: {base: "rounded-full"},
}, },
isOneChar: {
true: {
base: "px-0 justify-center",
label: "px-0 flex-none",
},
},
isDisabled: { isDisabled: {
true: {base: "opacity-50 pointer-events-none"}, true: {base: "opacity-50 pointer-events-none"},
}, },
@ -337,6 +347,42 @@ const chip = tv({
base: colorVariants.light.danger, base: colorVariants.light.danger,
}, },
}, },
// isOneChar / size
{
isOneChar: true,
size: "xs",
class: {
base: "w-4 h-4",
},
},
{
isOneChar: true,
size: "sm",
class: {
base: "w-5 h-5",
},
},
{
isOneChar: true,
size: "md",
class: {
base: "w-6 h-6",
},
},
{
isOneChar: true,
size: "lg",
class: {
base: "w-7 h-7",
},
},
{
isOneChar: true,
size: "xl",
class: {
base: "w-8 h-8",
},
},
], ],
}); });

View File

@ -58,4 +58,9 @@ export const utilities = {
"transition-timing-function": "ease", "transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION, "transition-duration": DEFAULT_TRANSITION_DURATION,
}, },
".transition-transform-opacity": {
"transition-property": "transform, opacity",
"transition-timing-function": "ease",
"transition-duration": DEFAULT_TRANSITION_DURATION,
},
}; };

View File

@ -90,7 +90,7 @@ const SwatchSet = ({colors, isSematic = false}: SwatchSetProps) => (
); );
export default { export default {
title: "Theme/Colors", title: "Foundation/Colors",
component: SwatchSet, component: SwatchSet,
} as ComponentMeta<typeof SwatchSet>; } as ComponentMeta<typeof SwatchSet>;

File diff suppressed because it is too large Load Diff