From 4c0c3b81404dc02070863d9936d93d4df3059de6 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 7 May 2024 12:48:55 +0300 Subject: [PATCH] New tokens for input chips --- .../autocomplete/style/AutoCompleteStyle.js | 2 +- .../lib/inputchips/style/InputChipsStyle.js | 28 +++++++++++++------ .../lib/themes/aura/autocomplete/index.js | 3 ++ components/lib/themes/aura/index.js | 1 + .../lib/themes/aura/inputchips/index.js | 15 +++++++++- .../lib/themes/lara/autocomplete/index.js | 5 +++- components/lib/themes/lara/index.js | 1 + .../lib/themes/lara/inputchips/index.js | 15 +++++++++- 8 files changed, 58 insertions(+), 12 deletions(-) diff --git a/components/lib/autocomplete/style/AutoCompleteStyle.js b/components/lib/autocomplete/style/AutoCompleteStyle.js index 6874a74a3..41798deba 100644 --- a/components/lib/autocomplete/style/AutoCompleteStyle.js +++ b/components/lib/autocomplete/style/AutoCompleteStyle.js @@ -180,7 +180,7 @@ const theme = ({ dt }) => ` .p-autocomplete-input-multiple .p-chip { padding-top: calc(${dt('autocomplete.padding.y')} / 2); padding-bottom: calc(${dt('autocomplete.padding.y')} / 2); - border-radius: calc(${dt('autocomplete.border.radius')} - calc(${dt('autocomplete.padding.y')} / 2)); + border-radius: ${dt('autocomplete.chip.border.radius')}; } .p-autocomplete-input-multiple:has(.p-chip) { diff --git a/components/lib/inputchips/style/InputChipsStyle.js b/components/lib/inputchips/style/InputChipsStyle.js index c709b4cdb..3bded7425 100644 --- a/components/lib/inputchips/style/InputChipsStyle.js +++ b/components/lib/inputchips/style/InputChipsStyle.js @@ -7,21 +7,20 @@ const theme = ({ dt }) => ` .p-inputchips-input { margin: 0; - padding: 0; list-style-type: none; cursor: text; overflow: hidden; display: flex; align-items: center; flex-wrap: wrap; - padding: 0.25rem 0.25rem; - gap: 0.25rem; + padding: calc(${dt('inputchips.padding.y')} / 2) ${dt('inputchips.padding.x')}; + gap: calc(${dt('inputchips.padding.y')} / 2); color: ${dt('inputchips.color')}; background: ${dt('inputchips.background')}; border: 1px solid ${dt('inputchips.border.color')}; - border-radius: ${dt('border.radius.md')}; + border-radius: ${dt('inputchips.border.radius')}; width: 100%; - transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; + transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}; outline-color: transparent; box-shadow: ${dt('inputchips.shadow')}; } @@ -32,7 +31,9 @@ const theme = ({ dt }) => ` .p-inputchips:not(.p-disabled).p-focus .p-inputchips-input { border-color: ${dt('inputchips.focus.border.color')}; - outline: 0 none; + box-shadow: ${dt('inputchips.focus.ring.shadow')}; + outline: ${dt('inputchips.focus.ring.width')} ${dt('inputchips.focus.ring.style')} ${dt('inputchips.focus.ring.color')}; + outline-offset: ${dt('inputchips.focus.ring.offset')}; } .p-inputchips.p-invalid .p-inputchips-input { @@ -53,11 +54,22 @@ const theme = ({ dt }) => ` color: ${dt('inputchips.disabled.color')}; } +.p-inputchips .p-chip { + padding-top: calc(${dt('inputchips.padding.y')} / 2); + padding-bottom: calc(${dt('inputchips.padding.y')} / 2); + border-radius: ${dt('inputchips.chip.border.radius')}; +} + +.p-inputchips-input:has(.p-chip) { + padding-left: calc(${dt('inputchips.padding.y')} / 2); + padding-right: calc(${dt('inputchips.padding.y')} / 2); +} + .p-inputchips-input-item { - padding: 0.25rem 0; - margin-left: 0.5rem; flex: 1 1 auto; display: inline-flex; + padding-top: calc(${dt('inputchips.padding.y')} / 2); + padding-bottom: calc(${dt('inputchips.padding.y')} / 2); } .p-inputchips-input-item input { diff --git a/components/lib/themes/aura/autocomplete/index.js b/components/lib/themes/aura/autocomplete/index.js index 2408ff556..0a58f5632 100644 --- a/components/lib/themes/aura/autocomplete/index.js +++ b/components/lib/themes/aura/autocomplete/index.js @@ -61,5 +61,8 @@ export default { color: '{button.secondary.color}', hoverColor: '{button.secondary.hover.color}', activeColor: '{button.secondary.active.color}' + }, + chip: { + borderRadius: '{border.radius.sm}' } }; diff --git a/components/lib/themes/aura/index.js b/components/lib/themes/aura/index.js index 3135bbde2..3b67c89e2 100644 --- a/components/lib/themes/aura/index.js +++ b/components/lib/themes/aura/index.js @@ -88,6 +88,7 @@ export default { primitive: { borderRadius: { none: '0', + xs: '2px', sm: '4px', md: '6px', lg: '8px', diff --git a/components/lib/themes/aura/inputchips/index.js b/components/lib/themes/aura/inputchips/index.js index ea3c65e2d..607905eac 100644 --- a/components/lib/themes/aura/inputchips/index.js +++ b/components/lib/themes/aura/inputchips/index.js @@ -11,6 +11,19 @@ export default { color: '{form.field.color}', disabledColor: '{form.field.disabled.color}', placeholderColor: '{form.field.placeholder.color}', - shadow: '{form.field.shadow}' + shadow: '{form.field.shadow}', + paddingX: '{form.field.padding.x}', + paddingY: '{form.field.padding.y}', + borderRadius: '{form.field.border.radius}', + focusRing: { + width: '{form.field.focus.ring.width}', + style: '{form.field.focus.ring.style}', + color: '{form.field.focus.ring.color}', + offset: '{form.field.focus.ring.offset}', + shadow: '{form.field.focus.ring.shadow}' + } + }, + chip: { + borderRadius: '{border.radius.sm}' } }; diff --git a/components/lib/themes/lara/autocomplete/index.js b/components/lib/themes/lara/autocomplete/index.js index f96ec55b1..af9a376e0 100644 --- a/components/lib/themes/lara/autocomplete/index.js +++ b/components/lib/themes/lara/autocomplete/index.js @@ -42,7 +42,7 @@ export default { selectedColor: '{list.option.selected.color}', selectedFocusColor: '{list.option.selected.focus.color}', padding: '{list.option.padding}', - borderRadius: '{list.option.border.radius}', + borderRadius: '{list.option.border.radius}' }, optionGroup: { background: '{list.option.group.background}', @@ -61,5 +61,8 @@ export default { color: '{button.secondary.color}', hoverColor: '{button.secondary.hover.color}', activeColor: '{button.secondary.active.color}' + }, + chip: { + borderRadius: '{border.radius.xs}' } }; diff --git a/components/lib/themes/lara/index.js b/components/lib/themes/lara/index.js index 01c3afef3..1630a9961 100644 --- a/components/lib/themes/lara/index.js +++ b/components/lib/themes/lara/index.js @@ -88,6 +88,7 @@ export default { primitive: { borderRadius: { none: '0', + xs: '2px', sm: '4px', md: '6px', lg: '8px', diff --git a/components/lib/themes/lara/inputchips/index.js b/components/lib/themes/lara/inputchips/index.js index ea3c65e2d..7ce8e89fd 100644 --- a/components/lib/themes/lara/inputchips/index.js +++ b/components/lib/themes/lara/inputchips/index.js @@ -11,6 +11,19 @@ export default { color: '{form.field.color}', disabledColor: '{form.field.disabled.color}', placeholderColor: '{form.field.placeholder.color}', - shadow: '{form.field.shadow}' + shadow: '{form.field.shadow}', + paddingX: '{form.field.padding.x}', + paddingY: '{form.field.padding.y}', + borderRadius: '{form.field.border.radius}', + focusRing: { + width: '{form.field.focus.ring.width}', + style: '{form.field.focus.ring.style}', + color: '{form.field.focus.ring.color}', + offset: '{form.field.focus.ring.offset}', + shadow: '{form.field.focus.ring.shadow}' + } + }, + chip: { + borderRadius: '{border.radius.xs}' } };