WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit afa968a

Browse files
authored
Merge branch 'main' into main
2 parents 9b9325e + f165b24 commit afa968a

File tree

39 files changed

+1464
-47
lines changed

39 files changed

+1464
-47
lines changed

.github/workflows/stylelint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Stylelint Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- /**
9+
- preview/**/*.rs
10+
- preview/**/Cargo.toml
11+
- primitives/**/*.rs
12+
- primitives/**/Cargo.toml
13+
- .github/**
14+
- Cargo.toml
15+
16+
pull_request:
17+
types: [opened, synchronize, reopened, ready_for_review]
18+
branches:
19+
- main
20+
paths:
21+
- /**
22+
- preview/**/*.rs
23+
- preview/**/Cargo.toml
24+
- primitives/**/*.rs
25+
- primitives/**/Cargo.toml
26+
- .github/**
27+
- Cargo.toml
28+
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
stylelint:
35+
if: github.event.pull_request.draft == false
36+
timeout-minutes: 30
37+
runs-on: ubuntu-latest
38+
steps:
39+
# Do our best to cache the toolchain and node install steps
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: lts/*
44+
- name: Install dependencies
45+
run: |
46+
npm install --save-dev stylelint-config-idiomatic-order
47+
npm install -g stylelint stylelint-config-standard
48+
- name: Stylelint
49+
run: cd ./preview && npx stylelint "**/*.css" --max-warnings=0

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ dioxus-primitives = { path = "primitives" }
77

88
dioxus = "0.7.0"
99
tracing = { version = "0.1", features = ["std"] }
10+
11+
[profile.release]
12+
opt-level = "z"
13+
debug = false
14+
lto = true
15+
codegen-units = 1
16+
strip = true
17+
incremental = false

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ Building styled and more featured component libraries on top of Dioxus Primitive
3333

3434
We're still in the early days - Many components are still being created and stabilized.
3535

36-
28/29
36+
31/31
3737

3838
- [x] Accordion
3939
- [x] Alert Dialog
4040
- [x] Aspect Ratio
4141
- [x] Avatar
4242
- [x] Calendar
43+
- [x] Card
4344
- [x] Checkbox
4445
- [x] Collapsible
4546
- [x] Context Menu
@@ -56,9 +57,11 @@ We're still in the early days - Many components are still being created and stab
5657
- [x] Scroll Area
5758
- [x] Select
5859
- [x] Separator
60+
- [x] Sheet
5961
- [x] Slider
6062
- [x] Switch
6163
- [x] Tabs
64+
- [x] Textarea
6265
- [x] Toast
6366
- [x] Toggle
6467
- [x] Toggle Group

component.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
"preview/src/components/context_menu",
3434
"preview/src/components/aspect_ratio",
3535
"preview/src/components/scroll_area",
36-
"preview/src/components/date_picker"
36+
"preview/src/components/date_picker",
37+
"preview/src/components/textarea",
38+
"preview/src/components/skeleton",
39+
"preview/src/components/card",
40+
"preview/src/components/sheet"
3741
]
3842
}

playwright/sheet.spec.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('sheet basic interactions', async ({ page }) => {
4+
await page.goto('http://127.0.0.1:8080/component/?name=sheet&', { timeout: 20 * 60 * 1000 });
5+
6+
// Open sheet from Right button
7+
await page.getByRole('button', { name: 'Right' }).click();
8+
9+
// Assert the sheet is open
10+
const sheet = page.locator('.sheet-root');
11+
await expect(sheet).toHaveAttribute('data-state', 'open');
12+
13+
// Assert the first input is focused (focus trap)
14+
const nameInput = page.locator('#sheet-demo-name');
15+
await expect(nameInput).toBeFocused();
16+
17+
// Tab through focusable elements and verify focus cycles
18+
// Tab: name input -> username input -> Save button -> Cancel button -> close button -> name input
19+
await page.keyboard.press('Tab');
20+
const usernameInput = page.locator('#sheet-demo-username');
21+
await expect(usernameInput).toBeFocused();
22+
23+
await page.keyboard.press('Tab');
24+
const saveButton = page.getByRole('button', { name: 'Save changes' });
25+
await expect(saveButton).toBeFocused();
26+
27+
await page.keyboard.press('Tab');
28+
const cancelButton = page.getByRole('button', { name: 'Cancel' });
29+
await expect(cancelButton).toBeFocused();
30+
31+
await page.keyboard.press('Tab');
32+
const closeButton = sheet.locator('.sheet-close');
33+
await expect(closeButton).toBeFocused();
34+
35+
// Tab again should cycle back to first input
36+
await page.keyboard.press('Tab');
37+
await expect(nameInput).toBeFocused();
38+
39+
// Hitting escape should close the sheet
40+
await page.keyboard.press('Escape');
41+
await expect(sheet).toHaveCount(0);
42+
43+
// Reopen the sheet
44+
await page.getByRole('button', { name: 'Right' }).click();
45+
await expect(sheet).toHaveAttribute('data-state', 'open');
46+
47+
// Click the close button
48+
await closeButton.click();
49+
await expect(sheet).toHaveCount(0);
50+
});
51+
52+
test('sheet opens from different sides', async ({ page }) => {
53+
await page.goto('http://127.0.0.1:8080/component/?name=sheet&', { timeout: 20 * 60 * 1000 });
54+
55+
const sheet = page.locator('.sheet-root');
56+
const sheetContent = page.locator('[data-slot="sheet-content"]');
57+
58+
// Test Top
59+
await page.getByRole('button', { name: 'Top' }).click();
60+
await expect(sheet).toHaveAttribute('data-state', 'open');
61+
await expect(sheetContent).toHaveAttribute('data-side', 'top');
62+
await page.keyboard.press('Escape');
63+
await expect(sheet).toHaveCount(0);
64+
65+
// Test Bottom
66+
await page.getByRole('button', { name: 'Bottom' }).click();
67+
await expect(sheet).toHaveAttribute('data-state', 'open');
68+
await expect(sheetContent).toHaveAttribute('data-side', 'bottom');
69+
await page.keyboard.press('Escape');
70+
await expect(sheet).toHaveCount(0);
71+
72+
// Test Left
73+
await page.getByRole('button', { name: 'Left' }).click();
74+
await expect(sheet).toHaveAttribute('data-state', 'open');
75+
await expect(sheetContent).toHaveAttribute('data-side', 'left');
76+
await page.keyboard.press('Escape');
77+
await expect(sheet).toHaveCount(0);
78+
});

preview/assets/hero.css

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#hero {
22
display: flex;
3+
height: 40rem;
34
flex-direction: column;
45
align-items: center;
56
justify-content: center;
67
margin: 0;
7-
height: 40rem;
88
}
99

1010
#hero > h1,
@@ -36,24 +36,26 @@
3636
position: absolute;
3737
top: 38rem;
3838
left: 50%;
39-
transform: translate(-50%, -50%);
4039
width: 20px;
4140
height: 20px;
41+
animation: scroll-down-icon-animation 3000ms ease-in-out infinite;
4242
fill: none;
4343
stroke: var(--secondary-color-4);
4444
stroke-linecap: round;
4545
stroke-linejoin: round;
4646
stroke-width: 2;
47-
animation: scroll-down-icon-animation 3000ms ease-in-out infinite;
47+
transform: translate(-50%, -50%);
4848
}
4949

5050
@keyframes scroll-down-icon-animation {
5151
0% {
5252
transform: translateY(0);
5353
}
54+
5455
50% {
5556
transform: translateY(10px);
5657
}
58+
5759
100% {
5860
transform: translateY(0);
5961
}
@@ -62,11 +64,11 @@
6264
#hero-search-container {
6365
display: flex;
6466
width: 80%;
65-
padding: 10px;
6667
max-width: 800px;
6768
flex-direction: column;
6869
align-items: center;
6970
justify-content: center;
71+
padding: 10px;
7072
margin: auto;
7173
}
7274

@@ -102,10 +104,10 @@
102104
}
103105

104106
.explaination {
105-
margin-bottom: 1rem;
106-
padding-left: 5vw;
107-
padding-right: 5vw;
108107
min-width: 50vw;
108+
padding-right: 5vw;
109+
padding-left: 5vw;
110+
margin-bottom: 1rem;
109111
text-align: center;
110112
}
111113

@@ -116,8 +118,8 @@
116118

117119
.explaination-box {
118120
display: flex;
119-
max-width: 30vw;
120121
width: 10rem;
122+
max-width: 30vw;
121123
min-height: 10rem;
122124
box-sizing: border-box;
123125
flex-direction: column;

preview/assets/main.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ body {
187187
}
188188

189189
.component-description {
190-
margin-left: 5vw;
190+
max-width: 90vw;
191191
margin-right: 5vw;
192+
margin-left: 5vw;
192193
font-size: 1em;
193194
overflow-x: scroll;
194-
max-width: 90vw;
195195
}
196196

197197
.component-installation {

preview/src/components/calendar/style.css

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@
9494
.calendar-grid-cell {
9595
width: 2rem;
9696
border: none;
97+
border-radius: 0.5rem;
9798
aspect-ratio: 1;
9899
background: none;
99100
color: var(--secondary-color-4);
100101
cursor: pointer;
101102
font-size: 14px;
102-
border-radius: 0.5rem;
103103
}
104104

105105
.calendar-grid-cell[data-month="current"]:not([data-disabled="true"]):hover {
@@ -130,54 +130,54 @@
130130

131131
.calendar-grid-cell[data-month="current"][data-unavailable="true"] {
132132
color: var(--secondary-color-6);
133-
text-decoration: line-through;
134133
cursor: not-allowed;
134+
text-decoration: line-through;
135135
}
136136

137137
.calendar-grid-week td {
138-
padding-left: 0;
139138
padding-right: 0;
139+
padding-left: 0;
140140
}
141141

142142
.calendar-grid-week td:first-child .calendar-grid-cell {
143-
border-top-left-radius: 0.5rem;
144143
border-bottom-left-radius: 0.5rem;
144+
border-top-left-radius: 0.5rem;
145145
}
146146

147147
.calendar-grid-week td:last-child .calendar-grid-cell {
148-
border-top-right-radius: 0.5rem;
149148
border-bottom-right-radius: 0.5rem;
149+
border-top-right-radius: 0.5rem;
150150
}
151151

152152
.calendar-grid-cell[data-month="last"][data-selection-between="true"],
153153
.calendar-grid-cell[data-month="next"][data-selection-between="true"] {
154+
border-radius: 0;
154155
background-color: var(--primary-color-5);
155156
color: var(--secondary-color-5);
156-
border-radius: 0;
157157
}
158158

159159
.calendar-grid-cell[data-month="current"][data-selection-between="true"] {
160+
border-radius: 0;
160161
background-color: var(--primary-color-5);
161162
color: var(--secondary-color-4);
162-
border-radius: 0;
163163
}
164164

165165
td:has(.calendar-grid-cell[data-selection-start="true"]) {
166+
padding: 0;
167+
margin-top: 1px;
168+
margin-bottom: 1px;
166169
background-color: var(--primary-color-5);
167-
border-top-left-radius: 0.5rem;
168170
border-bottom-left-radius: 0.5rem;
169-
padding: 0;
170-
margin-top: 1;
171-
margin-bottom: 1;
171+
border-top-left-radius: 0.5rem;
172172
}
173173

174174
td:has(.calendar-grid-cell[data-selection-end="true"]) {
175+
padding: 0;
176+
margin-top: 1px;
177+
margin-bottom: 1px;
175178
background-color: var(--primary-color-5);
176-
border-top-right-radius: 0.5rem;
177179
border-bottom-right-radius: 0.5rem;
178-
padding: 0;
179-
margin-top: 1;
180-
margin-bottom: 1;
180+
border-top-right-radius: 0.5rem;
181181
}
182182

183183
.calendar-grid-cell[data-month="current"][data-selected="true"]:hover {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "card",
3+
"description": "A simple card component",
4+
"authors": [
5+
"zhiyanzhaijie"
6+
],
7+
"exclude": [
8+
"variants",
9+
"docs.md",
10+
"component.json"
11+
],
12+
"cargoDependencies": [
13+
{
14+
"name": "dioxus-primitives",
15+
"git": "https://github.com/DioxusLabs/components"
16+
}
17+
],
18+
"globalAssets": [
19+
"../../../assets/dx-components-theme.css"
20+
]
21+
}

0 commit comments

Comments
 (0)