Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pie-webc): DSW-2182 isRtl attr changed to data-is-rtl #1625

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/neat-cooks-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@justeattakeaway/pie-checkbox": patch
"@justeattakeaway/pie-switch": patch
"@justeattakeaway/pie-webc": patch
---

[Changed] - isRtl attr changed to data-is-rtl
4 changes: 2 additions & 2 deletions packages/components/pie-checkbox/src/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
}
}

&[data-pie-checked][isRtl]:before {
&[data-pie-checked][data-is-rtl]:before {
left: unset;
right: 50%;
}
Expand Down Expand Up @@ -184,7 +184,7 @@
background-color: white;
}

.c-checkbox-tick[isRtl]:after {
.c-checkbox-tick[data-is-rtl]:after {
left: unset;
right: 14%;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/components/pie-checkbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class PieCheckbox extends FormControlMixin(RtlMixin(LitElement)) implemen
indeterminate,
assistiveText,
status,
isRTL,
} = this;

const componentDisabled = disabled || disabledByParent;
Expand Down Expand Up @@ -180,7 +181,7 @@ export class PieCheckbox extends FormControlMixin(RtlMixin(LitElement)) implemen
<label for="inputId" data-test-id="checkbox-component">
<span
class="c-checkbox-tick"
?isRTL=${this.isRTL}
?data-is-rtl=${isRTL}
?data-pie-checked=${checked}
?data-pie-disabled=${componentDisabled}
data-pie-status=${!componentDisabled && status}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/pie-switch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class PieSwitch extends FormControlMixin(RtlMixin(LitElement)) implements
return html`
<label
class="c-switch-wrapper"
?isRTL=${isRTL}
?data-is-rtl=${isRTL}
?disabled=${disabled}>
${labelPlacement === 'leading' ? this.renderSwitchLabel() : nothing}
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/components/pie-switch/src/switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
@include p.visually-hidden;
}

.c-switch-wrapper[isRTL] {
.c-switch-wrapper[data-is-rtl] {
.c-switch-control {
position: absolute;
left: initial;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ export interface RTLInterface {
*
* class MyStyledElement extends RtlMixin(LitElement) {
* render() {
* return html`<div class="foo" ?isRTL=${this.isRTL}>Content</div>`;
* return html`<div class="foo" ?data-is-rtl=${this.isRTL}>Content</div>`;
* }
* }
*
* customElements.define('my-styled-element', MyStyledElement);
* ```
*
* The corresponding SCSS to leverage the `isRTL` attribute:
* The corresponding SCSS to leverage the `data-is-rtl` attribute:
* ```scss
* .foo[isRTL] {
* .foo[data-is-rtl] {
* background-color: red;
* text-align: right;
* }
Expand Down
Loading