Skip to content

Commit

Permalink
readonly css
Browse files Browse the repository at this point in the history
  • Loading branch information
melohagan committed Nov 7, 2023
1 parent fee9a9d commit c169a73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
9 changes: 4 additions & 5 deletions packages/bbui/src/Form/Core/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@
class:is-invalid={!!error}
class:checked={value}
class:is-indeterminate={indeterminate}
class:readonly
>
<input
checked={value}
{disabled}
on:change={onChange}
on:click={e => {
if (readonly) {
e.preventDefault()
}
}}
type="checkbox"
class="spectrum-Checkbox-input"
{id}
Expand Down Expand Up @@ -74,4 +70,7 @@
.spectrum-Checkbox-input {
opacity: 0;
}
.readonly {
pointer-events: none;
}
</style>
9 changes: 4 additions & 5 deletions packages/bbui/src/Form/Core/CheckboxGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@
title={getOptionLabel(option)}
class="spectrum-Checkbox spectrum-FieldGroup-item"
class:is-invalid={!!error}
class:readonly
>
<label
class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item"
>
<input
on:change={onChange}
on:click={e => {
if (readonly) {
e.preventDefault()
}
}}
type="checkbox"
class="spectrum-Checkbox-input"
value={optionValue}
Expand All @@ -72,4 +68,7 @@
.spectrum-Checkbox-input {
opacity: 0;
}
.readonly {
pointer-events: none;
}
</style>
9 changes: 4 additions & 5 deletions packages/bbui/src/Form/Core/RadioGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@
title={getOptionTitle(option)}
class="spectrum-Radio spectrum-FieldGroup-item spectrum-Radio--emphasized"
class:is-invalid={!!error}
class:readonly
>
<input
on:change={onChange}
on:click={e => {
if (readonly) {
e.preventDefault()
}
}}
bind:group={value}
value={getOptionValue(option)}
type="radio"
Expand All @@ -68,4 +64,7 @@
.spectrum-Radio-input {
opacity: 0;
}
.readonly {
pointer-events: none;
}
</style>
4 changes: 4 additions & 0 deletions packages/client/src/components/app/forms/Field.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
contenteditable={$component.editing}
on:blur={$component.editing ? updateLabel : null}
class:hidden={!label}
class:readonly
for={fieldState?.fieldId}
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${labelClass}`}
>
Expand Down Expand Up @@ -138,4 +139,7 @@
.spectrum-FieldLabel--left {
padding-right: var(--spectrum-global-dimension-size-200);
}
.readonly {
pointer-events: none;
}
</style>

0 comments on commit c169a73

Please sign in to comment.