Skip to content

Commit 0037f03

Browse files
authored
feat(Dates): placeholder data attribute (#859)
* feat: add data-placeholder attribute * docs: update stories to use data-placeholder * docs: use data-placeholder in demo * docs: add docs for new data attribute
1 parent cc441ed commit 0037f03

File tree

20 files changed

+60
-38
lines changed

20 files changed

+60
-38
lines changed

docs/components/demo/DateField/tailwind/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { DateFieldInput, DateFieldRoot, Label } from 'radix-vue'
2121
<DateFieldInput
2222
v-else
2323
:part="item.part"
24-
class="rounded p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
24+
class="rounded p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
2525
>
2626
{{ item.value }}
2727
</DateFieldInput>

docs/components/demo/DatePicker/tailwind/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
<DatePickerInput
4646
v-else
4747
:part="item.part"
48-
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9 "
48+
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9 "
4949
>
5050
{{ item.value }}
5151
</DatePickerInput>

docs/components/demo/DateRangeField/tailwind/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { DateRangeFieldInput, DateRangeFieldRoot, Label } from 'radix-vue'
2424
<DateRangeFieldInput
2525
v-else
2626
:part="item.part"
27-
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
27+
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
2828
type="start"
2929
>
3030
{{ item.value }}
@@ -45,7 +45,7 @@ import { DateRangeFieldInput, DateRangeFieldRoot, Label } from 'radix-vue'
4545
<DateRangeFieldInput
4646
v-else
4747
:part="item.part"
48-
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
48+
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
4949
type="end"
5050
>
5151
{{ item.value }}

docs/components/demo/DateRangePicker/tailwind/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
<DateRangePickerInput
4646
v-else
4747
:part="item.part"
48-
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
48+
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
4949
type="start"
5050
>
5151
{{ item.value }}
@@ -66,7 +66,7 @@ import {
6666
<DateRangePickerInput
6767
v-else
6868
:part="item.part"
69-
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
69+
class="rounded-md p-0.5 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
7070
type="end"
7171
>
7272
{{ item.value }}

docs/content/components/date-field.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ Contains the date field segments
108108
{
109109
attribute: '[data-invalid]',
110110
values: 'Present when invalid',
111-
}
111+
},
112+
{
113+
attribute: '[data-placeholder]',
114+
values: 'Present when no value is set',
115+
},
112116
]"
113117
/>
114118

docs/content/components/date-picker.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ Contains the date picker date field segments
164164
{
165165
attribute: '[data-invalid]',
166166
values: 'Present when invalid',
167+
},
168+
{
169+
attribute: '[data-placeholder]',
170+
values: 'Present when no value is set',
167171
}
168172
]"
169173
/>

docs/content/components/date-range-field.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ Contains the date field segments
108108
{
109109
attribute: '[data-invalid]',
110110
values: 'Present when invalid',
111-
}
111+
},
112+
{
113+
attribute: '[data-placeholder]',
114+
values: 'Present when no value is set',
115+
},
112116
]"
113117
/>
114118

docs/content/components/date-range-picker.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ Contains the date picker date field segments
165165
{
166166
attribute: '[data-invalid]',
167167
values: 'Present when invalid',
168+
},
169+
{
170+
attribute: '[data-placeholder]',
171+
values: 'Present when no value is set',
168172
}
169173
]"
170174
/>

packages/radix-vue/src/DateField/story/DateFieldChromatic.story.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
2626
<DateFieldInput
2727
v-else
2828
:part="item.part"
29-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
29+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
3030
>
3131
{{ item.value }}
3232
</DateFieldInput>
@@ -50,7 +50,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
5050
<DateFieldInput
5151
v-else
5252
:part="item.part"
53-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
53+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
5454
>
5555
{{ item.value }}
5656
</DateFieldInput>
@@ -73,7 +73,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
7373
<DateFieldInput
7474
v-else
7575
:part="item.part"
76-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
76+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
7777
>
7878
{{ item.value }}
7979
</DateFieldInput>
@@ -97,7 +97,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
9797
<DateFieldInput
9898
v-else
9999
:part="item.part"
100-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
100+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
101101
>
102102
{{ item.value }}
103103
</DateFieldInput>
@@ -122,7 +122,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
122122
<DateFieldInput
123123
v-else
124124
:part="item.part"
125-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
125+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
126126
>
127127
{{ item.value }}
128128
</DateFieldInput>
@@ -147,7 +147,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
147147
<DateFieldInput
148148
v-else
149149
:part="item.part"
150-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
150+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
151151
>
152152
{{ item.value }}
153153
</DateFieldInput>
@@ -172,7 +172,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
172172
<DateFieldInput
173173
v-else
174174
:part="item.part"
175-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
175+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
176176
>
177177
{{ item.value }}
178178
</DateFieldInput>
@@ -196,7 +196,7 @@ const maxValue = new CalendarDate(2024, 2, 29)
196196
<DateFieldInput
197197
v-else
198198
:part="item.part"
199-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
199+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
200200
>
201201
{{ item.value }}
202202
</DateFieldInput>

packages/radix-vue/src/DateField/story/DateFieldDefault.story.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Label } from '@/Label'
2525
<DateFieldInput
2626
v-else
2727
:part="item.part"
28-
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black aria-[valuetext=Empty]:text-green9"
28+
class="rounded-5px px-1 focus:outline-none focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-green9"
2929
>
3030
{{ item.value }}
3131
</DateFieldInput>

0 commit comments

Comments
 (0)