Files
prestashop-entity-selector/sources/scss/components/_chips.scss
myprestarocks 4eeb8d85ae Feature: embedded layout mode and schedule improvements
- Add layout-embedded class for nested entity selectors
- Simplified styling for embedded widgets (less padding, borders)
- Schedule toggle row with summary badges
- Summary badges show datetime range, weekly schedule, holiday count
- Flag fallback styling for countries without valid ISO codes
- Section hint margin after embedded entity selector
- Holiday countries group without modifiers section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:52:13 +01:00

1072 lines
27 KiB
SCSS

/**
* Chips Component
* Entity chips, selection pills, tags
*/
@use "sass:color";
@use '../variables' as *;
@use '../mixins' as *;
.target-conditions-trait,
.entity-selector-trait {
// Chips container wrapper with toolbar
.chips-wrapper {
display: flex;
flex-direction: column;
margin-top: $es-spacing-sm;
background: $es-slate-50;
border: 1px solid $es-border-color;
border-radius: $es-radius-md;
overflow: hidden;
}
// Chips toolbar - integrated filter bar inside chips area
.chips-toolbar {
display: none;
align-items: center;
flex-wrap: nowrap;
gap: $es-spacing-sm;
padding: $es-spacing-sm $es-spacing-md;
padding-bottom: 0;
background: transparent;
&.has-chips {
display: flex;
}
// Filter input - takes available space, icon embedded as background
// Using [type="text"] for specificity over .bootstrap input[type="text"]
input[type="text"].chips-search-input {
all: unset;
display: block;
flex: 1 1 auto;
min-width: 80px;
width: auto;
height: auto;
padding: 0.2rem 0.5rem 0.2rem 1.5rem;
background: $es-white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 0.375rem center;
background-size: 10px;
border: 1px solid $es-slate-300;
border-radius: $es-radius-sm;
font-size: 11px;
line-height: 1.4;
color: $es-text-primary;
box-sizing: border-box;
transition: all $es-transition-fast;
&::placeholder {
color: $es-text-muted;
font-size: 11px;
}
&:focus {
outline: none;
border-color: $es-primary;
box-shadow: 0 0 0 2px rgba($es-primary, 0.1);
}
}
// Sort dropdown - compact, auto width
select.chips-sort-select {
all: unset;
flex: 0 0 auto;
padding: 0.2rem 1.25rem 0.2rem 0.5rem;
border: 1px solid $es-border-color;
border-radius: $es-radius-sm;
background: $es-white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23666' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 0.375rem center;
background-size: 8px;
font-size: 10px;
line-height: 1.4;
color: $es-text-secondary;
cursor: pointer;
box-sizing: border-box;
white-space: nowrap;
&:hover {
border-color: $es-primary;
}
&:focus {
outline: none;
border-color: $es-primary;
box-shadow: 0 0 0 2px rgba($es-primary, 0.1);
}
}
}
// Count badge - smaller, pill style
.chips-count {
display: inline-flex;
align-items: center;
flex-shrink: 0; // Don't shrink
gap: 0.125rem;
padding: 0.2rem 0.5rem;
background: $es-slate-200;
color: $es-text-secondary;
font-size: 10px;
font-weight: $es-font-weight-semibold;
border-radius: $es-radius-sm;
white-space: nowrap;
line-height: 1.4;
&.has-filter {
background: $es-cyan-100;
color: $es-cyan-700;
}
.count-filtered {
font-weight: $es-font-weight-bold;
}
.count-separator {
opacity: 0.6;
margin: 0 0.125rem;
}
}
.chips-actions {
display: flex;
align-items: center;
gap: $es-spacing-xs;
margin-left: auto;
}
// Clear button - subtle, chip-like
.btn-chips-clear {
@include button-reset;
display: inline-flex;
align-items: center;
flex-shrink: 0; // Don't shrink
gap: 0.25rem;
padding: 0.2rem 0.5rem;
color: $es-danger;
font-size: 10px;
font-weight: $es-font-weight-medium;
background: rgba($es-danger, 0.1);
border-radius: $es-radius-sm;
transition: all $es-transition-fast;
white-space: nowrap; // Prevent text wrapping
line-height: 1.4;
&:hover {
background: $es-danger;
color: $es-white;
}
i {
font-size: 9px;
flex-shrink: 0;
}
.clear-text {
// Hide text on small screens, keep icon
@media (max-width: 480px) {
display: none;
}
}
}
// Chips container - flows naturally from toolbar
.entity-chips {
display: flex;
flex-wrap: wrap;
gap: $es-spacing-xs;
padding: $es-spacing-sm $es-spacing-md $es-spacing-md;
min-height: 40px;
max-height: 300px;
overflow-y: auto;
&:empty {
display: none;
}
}
// Load more section with select dropdown
.chips-load-more {
display: flex;
align-items: center;
justify-content: center;
gap: $es-spacing-sm;
padding: $es-spacing-sm $es-spacing-md;
background: transparent;
border-top: 1px dashed $es-border-color;
.load-more-label {
font-size: $es-font-size-xs;
color: $es-text-muted;
}
.load-more-select,
select.load-more-select {
appearance: none;
padding: 0.25rem 1.75rem 0.25rem 0.5rem !important;
border: 1px solid $es-border-color !important;
border-radius: $es-radius-sm !important;
background: $es-white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23666' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 0.5rem center !important;
background-size: 8px !important;
font-size: $es-font-size-xs !important;
font-weight: $es-font-weight-medium;
color: $es-primary;
cursor: pointer;
transition: all $es-transition-fast;
height: auto !important;
min-height: 0 !important;
line-height: 1.3 !important;
&:hover {
border-color: $es-primary !important;
background-color: $es-primary-light !important;
}
&:focus {
outline: none !important;
border-color: $es-primary !important;
box-shadow: 0 0 0 2px rgba($es-primary, 0.1) !important;
}
}
.load-more-remaining {
font-size: $es-font-size-xs;
color: $es-text-muted;
}
}
// Individual chip
.entity-chip {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.25rem 0.5rem;
background: $es-slate-100;
color: $es-text-secondary;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
border-radius: $es-radius-full;
transition: all $es-transition-fast;
&:hover {
background: $es-slate-200;
}
// Chip with image
&.has-image {
padding-left: 0.25rem;
}
// Hidden by search filter or pagination
&.chip-filtered-out,
&.chip-paginated-out {
display: none;
}
}
.chip-image {
width: 20px;
height: 20px;
object-fit: cover;
border-radius: 50%;
flex-shrink: 0;
}
.chip-icon {
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: $es-text-muted;
flex-shrink: 0;
// Product/entity images inside chip
img {
width: 20px;
height: 20px;
object-fit: cover;
border-radius: $es-radius-sm;
}
}
// Country flag in chip
.chip-flag {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
img {
width: 18px;
height: 12px;
object-fit: cover;
border-radius: 2px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.flag-fallback {
width: 18px;
height: 12px;
display: inline-flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #e8eaed 0%, #dadce0 100%);
border-radius: 2px;
font-size: 10px;
color: #5f6368;
}
}
// Holiday preview button in country chip
.chip-preview-holidays {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
color: $es-primary;
border-radius: 50%;
flex-shrink: 0;
transition: all $es-transition-fast;
&:hover {
background: rgba($es-primary, 0.15);
color: darken($es-primary, 10%);
}
i.material-icons {
font-size: 14px;
}
}
.chip-text,
.chip-name {
// Show full name, no truncation
word-break: break-word;
}
.chip-remove {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
margin-left: 0.125rem;
color: $es-text-muted;
border-radius: 50%;
flex-shrink: 0;
transition: all $es-transition-fast;
&:hover {
background: rgba(0, 0, 0, 0.1);
color: $es-danger;
}
i {
font-size: 10px;
}
}
// Chip variants
.entity-chip.chip-primary {
background: $es-primary-light;
color: $es-primary;
&:hover {
background: rgba($es-primary, 0.2);
}
}
.entity-chip.chip-success {
background: $es-success-light;
color: $es-success-dark;
&:hover {
background: rgba($es-success, 0.2);
}
}
.entity-chip.chip-danger {
background: $es-danger-light;
color: $es-danger;
&:hover {
background: rgba($es-danger, 0.2);
}
}
.entity-chip.chip-warning {
background: $es-warning-light;
color: color.adjust($es-warning, $lightness: -20%);
&:hover {
background: rgba($es-warning, 0.3);
}
}
// Chip loading state
.entity-chip.loading,
.entity-chip-loading {
opacity: 0.7;
.chip-remove {
display: none;
}
.chip-icon i {
animation: spin 0.6s linear infinite;
}
}
// Hidden chip (collapsed view)
.entity-chip.chip-hidden {
display: none;
}
// Chips expanded/collapsed states
.entity-chips.chips-collapsed,
.entity-chips.chips-expanded {
position: relative;
}
// Show more/less toggle
.chips-show-more-toggle {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
color: $es-primary;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
cursor: pointer;
transition: color $es-transition-fast;
&:hover {
color: $es-primary-hover;
}
i {
font-size: 10px;
}
}
.chips-collapse-toggle,
.chips-expand-toggle {
// Specific variants inherit from .chips-show-more-toggle
}
// More chips indicator
.chips-more {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.25rem 0.5rem;
background: $es-slate-200;
color: $es-text-secondary;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-semibold;
border-radius: $es-radius-full;
cursor: pointer;
transition: all $es-transition-fast;
&:hover {
background: $es-slate-300;
}
}
// Add chip button
.chip-add-btn {
@include button-reset;
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
background: transparent;
color: $es-primary;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
border: 1px dashed $es-primary;
border-radius: $es-radius-full;
transition: all $es-transition-fast;
&:hover {
background: $es-primary-light;
}
i {
font-size: 10px;
}
}
// Inline chips (compact mode)
.entity-chips.inline {
display: inline-flex;
padding: 0;
min-height: auto;
.entity-chip {
padding: 0.125rem 0.375rem;
font-size: 11px;
}
}
// Selected chips section in include/exclude
.selected-chips-container {
display: flex;
flex-direction: column;
gap: $es-spacing-xs;
}
.selected-chips-label {
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
color: $es-text-muted;
}
// Pattern chips (for name/reference patterns)
.entity-chip.chip-pattern {
background: #fef3c7;
color: #92400e;
font-family: monospace;
&:hover {
background: #fde68a;
}
.chip-icon {
color: #d97706;
}
}
// Range chips (price, quantity, etc.)
.entity-chip.chip-range,
.range-chip {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.25rem 0.5rem;
background: $es-cyan-50;
color: $es-cyan-600;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
border-radius: $es-radius-full;
transition: all $es-transition-fast;
&:hover {
background: $es-cyan-100;
}
}
.range-chip-text {
font-family: monospace;
}
.btn-remove-range {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
color: $es-cyan-600;
border-radius: 50%;
transition: all $es-transition-fast;
&:hover {
background: rgba(0, 0, 0, 0.1);
color: $es-danger;
}
i {
font-size: 10px;
}
}
// Multi-range chips container
.multi-range-chips {
display: flex;
flex-wrap: wrap;
gap: $es-spacing-xs;
margin-bottom: $es-spacing-xs;
&:empty {
display: none;
}
}
// Pattern chips container
.pattern-chips {
display: flex;
flex-wrap: wrap;
gap: $es-spacing-xs;
padding: $es-spacing-sm 0;
min-height: 32px;
&:empty::before {
content: attr(data-placeholder);
color: $es-text-muted;
font-size: $es-font-size-xs;
font-style: italic;
}
}
// Pattern tag
.pattern-tag {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
background: #fef3c7;
color: #92400e;
font-size: $es-font-size-xs;
font-weight: $es-font-weight-medium;
border-radius: $es-radius-sm;
transition: all $es-transition-fast;
&:hover {
background: #fde68a;
}
&.case-sensitive {
.case-icon {
color: $es-success;
font-weight: $es-font-weight-bold;
}
}
&.draft-tag {
background: $es-white;
border: 1px solid $es-border-color;
padding: 0;
flex: 1;
min-width: 150px;
&:hover {
background: $es-white;
}
.pattern-input {
flex: 1;
min-width: 100px;
padding: 0.375rem;
border: 0;
background: transparent;
font-size: $es-font-size-sm;
font-family: inherit;
&:focus {
outline: none;
}
&::placeholder {
color: $es-text-muted;
font-style: italic;
}
}
}
}
.pattern-tag-text {
font-family: monospace;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-toggle-case {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
color: $es-text-muted;
border-radius: $es-radius-sm;
transition: all $es-transition-fast;
&:hover {
background: rgba(0, 0, 0, 0.1);
}
}
.case-icon {
font-size: 11px;
font-weight: $es-font-weight-semibold;
font-family: monospace;
}
.btn-remove-pattern {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
color: #d97706;
border-radius: $es-radius-sm;
transition: all $es-transition-fast;
&:hover {
background: rgba(0, 0, 0, 0.1);
color: $es-danger;
}
i {
font-size: 10px;
}
}
.btn-add-pattern {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
color: $es-primary;
border-radius: $es-radius-sm;
transition: all $es-transition-fast;
&:hover {
background: $es-primary-light;
}
i {
font-size: 12px;
}
}
// Pattern match count (in draft tag)
.pattern-match-count {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0 0.375rem;
color: $es-text-muted;
font-size: $es-font-size-xs;
cursor: pointer;
&.count-zero {
color: $es-warning;
}
&.count-found {
color: $es-success;
}
.count-value {
font-weight: $es-font-weight-semibold;
}
}
// Pattern input row
.pattern-input-row {
display: flex;
align-items: stretch;
gap: $es-spacing-xs;
}
}
// ==========================================================================
// Holiday Preview Popover (Country chip eye button)
// ==========================================================================
.holiday-preview-popover {
position: absolute;
z-index: 10001;
width: 320px;
max-width: 90vw;
background: $es-white;
border-radius: $es-radius-lg;
box-shadow: $es-shadow-xl;
overflow: hidden;
.popover-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: $es-spacing-sm;
padding: $es-spacing-sm $es-spacing-md;
background: $es-bg-header;
border-bottom: 1px solid $es-border-color;
}
.popover-title {
display: flex;
align-items: center;
gap: $es-spacing-sm;
font-size: $es-font-size-sm;
font-weight: $es-font-weight-semibold;
color: $es-text-primary;
}
.popover-flag {
border-radius: 2px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.popover-close {
@include button-reset;
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
color: $es-text-muted;
border-radius: $es-radius-md;
transition: all $es-transition-fast;
&:hover {
background: $es-slate-200;
color: $es-text-secondary;
}
i.material-icons {
font-size: 18px;
}
}
.popover-body {
max-height: 350px;
overflow-y: auto;
padding: $es-spacing-sm;
@include custom-scrollbar;
}
// Loading state
.holiday-preview-loading {
display: flex;
align-items: center;
justify-content: center;
gap: $es-spacing-sm;
padding: $es-spacing-xl 0;
color: $es-text-muted;
font-size: $es-font-size-sm;
i.material-icons {
font-size: 20px;
}
.icon-spin {
animation: spin 1s linear infinite;
}
}
// Empty state
.holiday-preview-empty {
text-align: center;
padding: $es-spacing-xl 0;
color: $es-text-muted;
i.material-icons {
font-size: 48px;
opacity: 0.4;
margin-bottom: $es-spacing-sm;
display: block;
}
p {
margin: 0;
font-size: $es-font-size-sm;
}
}
// Holiday list
.holiday-list {
display: flex;
flex-direction: column;
gap: $es-spacing-xs;
}
.holiday-item {
display: flex;
align-items: flex-start;
gap: $es-spacing-md;
padding: $es-spacing-sm $es-spacing-md;
background: $es-slate-50;
border-radius: $es-radius-md;
border-left: 3px solid $es-success;
&.holiday-type-bank,
&.holiday-type-bank-holiday {
border-left-color: $es-info;
}
&.holiday-type-observance {
border-left-color: $es-warning;
}
&.holiday-type-regional,
&.holiday-type-local-holiday {
border-left-color: #8b5cf6;
}
}
.holiday-date {
flex-shrink: 0;
min-width: 80px;
.holiday-day {
display: block;
font-size: $es-font-size-sm;
font-weight: $es-font-weight-semibold;
color: $es-text-primary;
}
.holiday-weekday {
display: block;
font-size: $es-font-size-xs;
color: $es-text-muted;
}
}
.holiday-info {
flex: 1;
min-width: 0;
}
.holiday-country-flag {
vertical-align: middle;
margin-right: 0.25rem;
border-radius: 2px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.holiday-name {
display: inline;
font-size: $es-font-size-sm;
color: $es-text-primary;
word-wrap: break-word;
}
.holiday-type-badge {
display: inline-block;
margin-left: $es-spacing-sm;
padding: 0.125rem 0.375rem;
font-size: 10px;
font-weight: $es-font-weight-medium;
text-transform: capitalize;
background: $es-slate-200;
color: $es-text-secondary;
border-radius: $es-radius-sm;
vertical-align: middle;
}
.holiday-preview-note {
margin-top: $es-spacing-md;
font-size: $es-font-size-xs;
color: $es-text-muted;
text-align: center;
}
// Filter input
.popover-filter {
display: flex;
align-items: center;
gap: $es-spacing-xs;
padding: $es-spacing-xs $es-spacing-md;
border-bottom: 1px solid $es-border-color;
background: $es-slate-50;
i.material-icons {
font-size: 18px;
color: $es-text-muted;
}
.holiday-filter-input {
flex: 1;
border: none;
background: transparent;
font-size: $es-font-size-sm;
color: $es-text-primary;
outline: none;
padding: $es-spacing-xs 0;
&::placeholder {
color: $es-text-muted;
}
}
}
}
// Spin animation for loading icons
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
// Bootstrap specificity overrides for chips toolbar form elements
// PrestaShop admin uses #content .mpr-config-form... with high specificity
// We need to match or exceed that specificity
#content.bootstrap,
#content .bootstrap,
.bootstrap #content {
.target-conditions-trait,
.entity-selector-trait {
.chips-wrapper .chips-toolbar {
// Double class for extra specificity
input[type="text"].chips-search-input.chips-search-input {
all: unset;
display: block;
flex: 1 1 auto;
min-width: 80px;
width: auto;
height: auto;
padding: 0.2rem 0.5rem 0.2rem 1.5rem;
background: $es-white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 0.375rem center;
background-size: 10px;
border: 1px solid $es-slate-300;
border-radius: $es-radius-sm;
font-size: 11px;
line-height: 1.4;
color: $es-text-primary;
box-sizing: border-box;
transition: all $es-transition-fast;
&::placeholder {
color: $es-text-muted;
font-size: 11px;
}
&:focus {
outline: none;
border-color: $es-primary;
box-shadow: 0 0 0 2px rgba($es-primary, 0.1);
}
}
// Double class for extra specificity
select.chips-sort-select.chips-sort-select {
all: unset;
flex: 0 0 auto;
padding: 0.2rem 1.25rem 0.2rem 0.5rem;
border: 1px solid $es-border-color;
border-radius: $es-radius-sm;
background: $es-white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23666' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 0.375rem center;
background-size: 8px;
font-size: 10px;
line-height: 1.4;
color: $es-text-secondary;
cursor: pointer;
box-sizing: border-box;
white-space: nowrap;
height: auto;
&:hover {
border-color: $es-primary;
}
&:focus {
outline: none;
border-color: $es-primary;
box-shadow: 0 0 0 2px rgba($es-primary, 0.1);
}
}
}
}
}