diff --git a/packages/primevue/src/inputgroup/style/InputGroupStyle.js b/packages/primevue/src/inputgroup/style/InputGroupStyle.js index 9173c5789..3055547e0 100644 --- a/packages/primevue/src/inputgroup/style/InputGroupStyle.js +++ b/packages/primevue/src/inputgroup/style/InputGroupStyle.js @@ -1,26 +1,7 @@ import BaseStyle from '@primevue/core/base/style'; const theme = ({ dt }) => ` -.p-inputgroup { - display: flex; - align-items: stretch; - width: 100%; -} - -.p-inputgroupaddon { - display: flex; - align-items: center; - justify-content: center; - padding: 0.5rem; - background: ${dt('inputgroup.addon.background')}; - color: ${dt('inputgroup.addon.color')}; - border-top: 1px solid ${dt('inputgroup.addon.border.color')}; - border-left: 1px solid ${dt('inputgroup.addon.border.color')}; - border-bottom: 1px solid ${dt('inputgroup.addon.border.color')}; - padding: 0.5rem 0.75rem; - min-width: 2.5rem; -} - +.p-inputgroup, .p-inputgroup .p-floatlabel, .p-inputgroup .p-iftalabel { display: flex; @@ -29,83 +10,76 @@ const theme = ({ dt }) => ` } .p-inputgroup .p-inputtext, -.p-inputgroup-fluid .p-inputtext, -.p-inputgroup .p-inputwrapper, -.p-inputgroup-fluid .p-input { +.p-inputgroup .p-inputwrapper { flex: 1 1 auto; width: 1%; } +.p-inputgroupaddon { + display: flex; + align-items: center; + justify-content: center; + padding: ${dt('inputgroup.addon.padding')}; + background: ${dt('inputgroup.addon.background')}; + color: ${dt('inputgroup.addon.color')}; + border-top: 1px solid ${dt('inputgroup.addon.border.color')}; + border-bottom: 1px solid ${dt('inputgroup.addon.border.color')}; + min-width: ${dt('inputgroup.addon.min.width')}; +} + +.p-inputgroupaddon:first-child, +.p-inputgroupaddon + .p-inputgroupaddon { + border-left: 1px solid ${dt('inputgroup.addon.border.color')}; +} + .p-inputgroupaddon:last-child { border-right: 1px solid ${dt('inputgroup.addon.border.color')}; } .p-inputgroup > .p-component, -.p-inputgroup > .p-inputwrapper > .p-inputtext, +.p-inputgroup > .p-inputwrapper > .p-component, .p-inputgroup > .p-floatlabel > .p-component, -.p-inputgroup > .p-iftalabel > .p-component { +.p-inputgroup > .p-floatlabel > .p-inputwrapper > .p-component, +.p-inputgroup > .p-iftalabel > .p-component, +.p-inputgroup > .p-iftalabel > .p-inputwrapper > .p-component { border-radius: 0; margin: 0; } -.p-inputgroup > .p-component + .p-inputgroupaddon, -.p-inputgroup > .p-inputwrapper > .p-inputtext + .p-inputgroupaddon, -.p-inputgroup > .p-floatlabel > .p-component + .p-inputgroupaddon, -.p-inputgroup > .p-iftalabel > .p-component + .p-inputgroupaddon { - border-left: 0 none; -} - -.p-inputgroup > .p-component:focus, -.p-inputgroup > .p-inputwrapper > .p-inputtext:focus, -.p-inputgroup > .p-floatlabel > .p-component:focus, -.p-inputgroup > .p-iftalabel > .p-component:focus { - z-index: 1; -} - -.p-inputgroup > .p-component:focus ~ label, -.p-inputgroup > .p-inputwrapper > .p-inputtext:focus~label, -.p-inputgroup > .p-floatlabel > .p-component:focus~label, -.p-inputgroup > .p-iftalabel > .p-component:focus~label { - z-index: 1; -} - .p-inputgroupaddon:first-child, -.p-inputgroup button:first-child, -.p-inputgroup input:first-child, -.p-inputgroup > .p-inputwrapper:first-child, -.p-inputgroup > .p-inputwrapper:first-child > .p-inputtext { - border-top-left-radius: ${dt('inputgroup.addon.border.radius')}; - border-bottom-left-radius: ${dt('inputgroup.addon.border.radius')}; -} - -.p-inputgroup .p-floatlabel:first-child input, -.p-inputgroup .p-iftalabel:first-child input { +.p-inputgroup > .p-component:first-child, +.p-inputgroup > .p-inputwrapper:first-child > .p-component, +.p-inputgroup > .p-floatlabel:first-child > .p-component, +.p-inputgroup > .p-floatlabel:first-child > .p-inputwrapper > .p-component, +.p-inputgroup > .p-iftalabel:first-child > .p-component, +.p-inputgroup > .p-iftalabel:first-child > .p-inputwrapper > .p-component { border-top-left-radius: ${dt('inputgroup.addon.border.radius')}; border-bottom-left-radius: ${dt('inputgroup.addon.border.radius')}; } .p-inputgroupaddon:last-child, -.p-inputgroup button:last-child, -.p-inputgroup input:last-child, -.p-inputgroup > .p-inputwrapper:last-child, -.p-inputgroup > .p-inputwrapper:last-child > .p-inputtext { +.p-inputgroup > .p-component:last-child, +.p-inputgroup > .p-inputwrapper:last-child > .p-component, +.p-inputgroup > .p-floatlabel:last-child > .p-component, +.p-inputgroup > .p-floatlabel:last-child > .p-inputwrapper > .p-component, +.p-inputgroup > .p-iftalabel:last-child > .p-component, +.p-inputgroup > .p-iftalabel:last-child > .p-inputwrapper > .p-component { border-top-right-radius: ${dt('inputgroup.addon.border.radius')}; border-bottom-right-radius: ${dt('inputgroup.addon.border.radius')}; } -.p-inputgroup .p-floatlabel:last-child input, -.p-inputgroup .p-iftalabel:last-child input { - border-top-right-radius: ${dt('inputgroup.addon.border.radius')}; - border-bottom-right-radius: ${dt('inputgroup.addon.border.radius')}; +.p-inputgroup .p-component:focus, +.p-inputgroup .p-component.p-focus, +.p-inputgroup .p-inputwrapper-focus, +.p-inputgroup .p-component:focus ~ label, +.p-inputgroup .p-component.p-focus ~ label, +.p-inputgroup .p-inputwrapper-focus ~ label { + z-index: 1; } -.p-inputgroup-fluid .p-button { +.p-inputgroup > .p-button:not(.p-button-icon-only) { width: auto; } - -.p-inputgroup-fluid .p-button.p-button-icon-only { - width: 2.5rem; -} `; const classes = { diff --git a/packages/themes/src/presets/aura/inputgroup/index.js b/packages/themes/src/presets/aura/inputgroup/index.js index 4504dd153..38916f297 100644 --- a/packages/themes/src/presets/aura/inputgroup/index.js +++ b/packages/themes/src/presets/aura/inputgroup/index.js @@ -3,6 +3,8 @@ export default { background: '{form.field.background}', borderColor: '{form.field.border.color}', color: '{form.field.icon.color}', - borderRadius: '{form.field.border.radius}' + borderRadius: '{form.field.border.radius}', + padding: '0.5rem', + minWidth: '2.5rem' } }; diff --git a/packages/themes/src/presets/lara/inputgroup/index.js b/packages/themes/src/presets/lara/inputgroup/index.js index 2adc98001..44eb89c4e 100644 --- a/packages/themes/src/presets/lara/inputgroup/index.js +++ b/packages/themes/src/presets/lara/inputgroup/index.js @@ -1,6 +1,8 @@ export default { addon: { - borderRadius: '{form.field.border.radius}' + borderRadius: '{form.field.border.radius}', + padding: '0.625rem 0.5rem', + minWidth: '2.75rem' }, colorScheme: { light: { diff --git a/packages/themes/src/presets/material/inputgroup/index.js b/packages/themes/src/presets/material/inputgroup/index.js index 4504dd153..27d96c12e 100644 --- a/packages/themes/src/presets/material/inputgroup/index.js +++ b/packages/themes/src/presets/material/inputgroup/index.js @@ -3,6 +3,8 @@ export default { background: '{form.field.background}', borderColor: '{form.field.border.color}', color: '{form.field.icon.color}', - borderRadius: '{form.field.border.radius}' + borderRadius: '{form.field.border.radius}', + padding: '0.75rem', + minWidth: '3rem' } }; diff --git a/packages/themes/src/presets/nora/inputgroup/index.js b/packages/themes/src/presets/nora/inputgroup/index.js index 4504dd153..38916f297 100644 --- a/packages/themes/src/presets/nora/inputgroup/index.js +++ b/packages/themes/src/presets/nora/inputgroup/index.js @@ -3,6 +3,8 @@ export default { background: '{form.field.background}', borderColor: '{form.field.border.color}', color: '{form.field.icon.color}', - borderRadius: '{form.field.border.radius}' + borderRadius: '{form.field.border.radius}', + padding: '0.5rem', + minWidth: '2.5rem' } };