Skip to content

Commit

Permalink
fix(w-field): use correct colors in label and hint/error text (#150)
Browse files Browse the repository at this point in the history
* fix(field): remove invalid label color

Based on the design, the label should always have the same color, even if input has invalid state

* fix(field): fix hint/helpText color in invalid and regular state

* chore(deps): update @warp-ds/css to 1.9.1
  • Loading branch information
BalbinaK authored Mar 20, 2024
1 parent 3062347 commit fa3a621
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/forms/w-field.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<component :is="as" :class="{[ccInput.wrapper]: true, [$attrs.class || '']: true}" :role="role" v-bind="wrapperAria">
<component :is="labelType" v-if="label" :class="{[ccLabel.label]: true, [ccLabel.labelInvalid]: isInvalid}" :id="labelId" :for="labelFor" :role="valueOrUndefined(labelLevel, 'heading')" :aria-level="valueOrUndefined(labelLevel, labelLevel)">{{ label }}<span v-if="optional" :class="ccLabel.optional">{{ optionalHelperText }}</span></component>
<component :is="labelType" v-if="label" :class="ccLabel.label" :id="labelId" :for="labelFor" :role="valueOrUndefined(labelLevel, 'heading')" :aria-level="valueOrUndefined(labelLevel, labelLevel)">{{ label }}<span v-if="optional" :class="ccLabel.optional">{{ optionalHelperText }}</span></component>
<slot :triggerValidation="triggerValidation" :labelFor="id" :labelId="labelId" :aria="aria" :hasValidationErrors="isInvalid" />
<slot name="control" :form="collector" />
<div :class="{[ccHelpText.helpText]: true, [ccHelpText.helpTextInvalid]: isInvalid}" v-if="hint || isInvalid">
<div :class="{[ccHelpText.helpText]: true, [ccHelpText.helpTextColor]: !isInvalid, [ccHelpText.helpTextColorInvalid]: isInvalid}" v-if="hint || isInvalid">
<span :id="hintId" v-if="hint" v-html="hint" />
<span v-if="hint && isInvalid">, </span>
<span :id="errorId" v-if="isInvalid">{{ errorMessage }}</span>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@floating-ui/dom": "1.6.3",
"@lingui/core": "^4.7.0",
"@warp-ds/core": "^1.0.2",
"@warp-ds/css": "1.8.4",
"@warp-ds/css": "1.9.1",
"@warp-ds/icons": "2.0.0",
"@warp-ds/uno": "1.9.0",
"create-v-model": "^2.2.0",
Expand Down
21 changes: 11 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fa3a621

Please sign in to comment.