Skip to content

Commit

Permalink
Update border, outline, svg utilities (#1739)
Browse files Browse the repository at this point in the history
  • Loading branch information
anubra266 authored Dec 1, 2023
1 parent 6a9b5b6 commit 428e540
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/tiny-tips-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@pandacss/preset-base": patch
"website": patch
---

- Added `strokeWidth` to svg utilities.
- Connected `outlineWidth` utility to `borderWidths` token.
- Add `borderWidth`, `borderTopWidth`, `borderLeftWidth`, `borderRightWidth`, `borderBottomWidth` to berder utilities.
14 changes: 14 additions & 0 deletions packages/generator/__tests__/generate-prop-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe('generate property types', () => {
marginInline: \\"auto\\" | Tokens[\\"spacing\\"];
marginInlineEnd: \\"auto\\" | Tokens[\\"spacing\\"];
marginInlineStart: \\"auto\\" | Tokens[\\"spacing\\"];
outlineWidth: Tokens[\\"borderWidths\\"];
outlineColor: Tokens[\\"colors\\"];
outline: Tokens[\\"borders\\"];
outlineOffset: Tokens[\\"spacing\\"];
Expand Down Expand Up @@ -122,6 +123,11 @@ describe('generate property types', () => {
borderEndEndRadius: Tokens[\\"radii\\"];
borderEndRadius: Tokens[\\"radii\\"] | CssProperties[\\"borderRadius\\"];
border: Tokens[\\"borders\\"];
borderWidth: Tokens[\\"borderWidths\\"];
borderTopWidth: Tokens[\\"borderWidths\\"];
borderLeftWidth: Tokens[\\"borderWidths\\"];
borderRightWidth: Tokens[\\"borderWidths\\"];
borderBottomWidth: Tokens[\\"borderWidths\\"];
borderColor: Tokens[\\"colors\\"];
borderInline: Tokens[\\"borders\\"];
borderInlineWidth: Tokens[\\"borderWidths\\"];
Expand Down Expand Up @@ -207,6 +213,7 @@ describe('generate property types', () => {
scrollSnapMarginRight: Tokens[\\"spacing\\"];
fill: Tokens[\\"colors\\"];
stroke: Tokens[\\"colors\\"];
strokeWidth: Tokens[\\"borderWidths\\"];
srOnly: boolean;
debug: boolean;
colorPalette: \\"current\\" | \\"black\\" | \\"white\\" | \\"transparent\\" | \\"rose\\" | \\"pink\\" | \\"fuchsia\\" | \\"purple\\" | \\"violet\\" | \\"indigo\\" | \\"blue\\" | \\"sky\\" | \\"cyan\\" | \\"teal\\" | \\"emerald\\" | \\"green\\" | \\"lime\\" | \\"yellow\\" | \\"amber\\" | \\"orange\\" | \\"red\\" | \\"neutral\\" | \\"stone\\" | \\"zinc\\" | \\"gray\\" | \\"slate\\" | \\"deep\\" | \\"deep.test\\" | \\"deep.test.pool\\" | \\"primary\\" | \\"secondary\\" | \\"complex\\" | \\"surface\\" | \\"button\\" | \\"button.card\\";
Expand Down Expand Up @@ -380,6 +387,7 @@ describe('generate property types', () => {
marginInline: \\"auto\\" | Tokens[\\"spacing\\"];
marginInlineEnd: \\"auto\\" | Tokens[\\"spacing\\"];
marginInlineStart: \\"auto\\" | Tokens[\\"spacing\\"];
outlineWidth: Tokens[\\"borderWidths\\"];
outlineColor: Tokens[\\"colors\\"];
outline: Tokens[\\"borders\\"];
outlineOffset: Tokens[\\"spacing\\"];
Expand Down Expand Up @@ -436,6 +444,11 @@ describe('generate property types', () => {
borderEndEndRadius: Tokens[\\"radii\\"];
borderEndRadius: Tokens[\\"radii\\"];
border: Tokens[\\"borders\\"];
borderWidth: Tokens[\\"borderWidths\\"];
borderTopWidth: Tokens[\\"borderWidths\\"];
borderLeftWidth: Tokens[\\"borderWidths\\"];
borderRightWidth: Tokens[\\"borderWidths\\"];
borderBottomWidth: Tokens[\\"borderWidths\\"];
borderColor: Tokens[\\"colors\\"];
borderInline: Tokens[\\"borders\\"];
borderInlineWidth: Tokens[\\"borderWidths\\"];
Expand Down Expand Up @@ -521,6 +534,7 @@ describe('generate property types', () => {
scrollSnapMarginRight: Tokens[\\"spacing\\"];
fill: Tokens[\\"colors\\"];
stroke: Tokens[\\"colors\\"];
strokeWidth: Tokens[\\"borderWidths\\"];
srOnly: boolean;
debug: boolean;
colorPalette: \\"current\\" | \\"black\\" | \\"white\\" | \\"transparent\\" | \\"rose\\" | \\"pink\\" | \\"fuchsia\\" | \\"purple\\" | \\"violet\\" | \\"indigo\\" | \\"blue\\" | \\"sky\\" | \\"cyan\\" | \\"teal\\" | \\"emerald\\" | \\"green\\" | \\"lime\\" | \\"yellow\\" | \\"amber\\" | \\"orange\\" | \\"red\\" | \\"neutral\\" | \\"stone\\" | \\"zinc\\" | \\"gray\\" | \\"slate\\" | \\"deep\\" | \\"deep.test\\" | \\"deep.test.pool\\" | \\"primary\\" | \\"secondary\\" | \\"complex\\" | \\"surface\\" | \\"button\\" | \\"button.card\\";
Expand Down
20 changes: 20 additions & 0 deletions packages/preset-base/src/utilities/border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ export const border: UtilityConfig = {
className: 'border',
values: 'borders',
},
borderWidth: {
className: 'border-w',
values: 'borderWidths',
},
borderTopWidth: {
className: 'border-tw',
values: 'borderWidths',
},
borderLeftWidth: {
className: 'border-lw',
values: 'borderWidths',
},
borderRightWidth: {
className: 'border-rw',
values: 'borderWidths',
},
borderBottomWidth: {
className: 'border-bw',
values: 'borderWidths',
},
borderColor: {
className: 'border',
values: 'colors',
Expand Down
1 change: 1 addition & 0 deletions packages/preset-base/src/utilities/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const outline: UtilityConfig = {
outlineWidth: {
className: 'ring',
shorthand: 'ringWidth',
values: 'borderWidths',
},
outlineColor: {
className: 'ring',
Expand Down
4 changes: 4 additions & 0 deletions packages/preset-base/src/utilities/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ export const svg: UtilityConfig = {
className: 'stroke',
values: 'colors',
},
strokeWidth: {
className: 'stroke-w',
values: 'borderWidths',
},
}
3 changes: 2 additions & 1 deletion website/pages/docs/utilities/outline.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ Set the width, color, and style of the outline.
Change the width of the outline.

```jsx
<div className={css({ outlineWidth: '4' })} />
<div className={css({ outlineWidth: '2px' })} />
<div className={css({ ringWidth: '2px' })} /> // shorthand
```

| Prop | CSS Property | Token Category |
| ---------------------------- | --------------- | -------------- |
| `ringWidth` , `outlineWidth` | `outline-width` | none |
| `ringWidth` , `outlineWidth` | `outline-width` | `borderWidths` |

## Outline Color

Expand Down
12 changes: 12 additions & 0 deletions website/pages/docs/utilities/svg.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@ Change the stroke color of an SVG element.
| Prop | CSS Property | Token Category |
| -------- | ------------ | -------------- |
| `stroke` | `stroke` | colors |

## Stroke Width

Change the stroke width of an SVG element.

```jsx
<div className={css({ strokeWidth: '1px' })} />
```

| Prop | CSS Property | Token Category |
| ------------- | ------------ | -------------- |
| `strokeWidth` | `stroke-width` | borderWidths |

2 comments on commit 428e540

@vercel
Copy link

@vercel vercel bot commented on 428e540 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

panda-docs – ./website

panda-css.com
panda-docs-git-main-chakra-ui.vercel.app
panda-docs.vercel.app
panda-docs-chakra-ui.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 428e540 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.