Skip to content

Commit

Permalink
fix(web-components): update checkbox so that it works correctly on rt…
Browse files Browse the repository at this point in the history
…l pages

Update checkbox so that it works correctly on rtl pages
  • Loading branch information
GCHQ-Developer-530 committed Feb 26, 2025
1 parent 4f35305 commit 8911b4f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,33 @@ export const TextFieldValueChange = {
name: "TextField value change",
};

export const RTL = {
render: (args) => html`
<ic-checkbox-group label="This is a label" name="group1" dir="rtl">
<ic-checkbox
value="valueName1"
label="Indeterminate"
indeterminate="true"
></ic-checkbox>
<ic-checkbox value="valueName2" label="Selected" checked></ic-checkbox>
<ic-checkbox value="valueName3" label="Disabled" disabled></ic-checkbox>
<ic-checkbox
additional-field-display="dynamic"
value="valueName4"
label="Conditional dynamic"
>
<ic-text-field
slot="additional-field"
placeholder="Placeholder"
label="What's your favourite type of coffee?"
></ic-text-field>
</ic-checkbox>
</ic-checkbox-group>
`,

name: "RTL",
};

const inlineRadioSelector = "inline-radio";

export const Playground = {
Expand Down
24 changes: 24 additions & 0 deletions packages/web-components/src/components/ic-checkbox/ic-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,27 @@
display: none;
}
}

/* Right to left */
.checkmark:dir(rtl) {
right: 0;
}

.checkbox-label:dir(rtl) {
padding-right: var(--ic-space-sm);
padding-left: 0;
}

.indeterminate-symbol:dir(rtl) {
right: 0.288rem;
}

.branch-corner:dir(rtl) {
border-radius: 0 0 0.188rem 0;
border-right: 0.125rem solid var(--ic-action-default);
border-left: none;
}

.dynamic-container:dir(rtl) {
margin: var(--ic-space-xxxs) var(--ic-space-sm) var(--ic-space-xxs) 0;
}

0 comments on commit 8911b4f

Please sign in to comment.