diff --git a/src/bundle/Resources/views/themes/standard/design-system/partials/base_input.html.twig b/src/bundle/Resources/views/themes/standard/design-system/partials/base_input.html.twig new file mode 100644 index 00000000..e69de29b diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/accordion.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/accordion.html.twig index ddf6f240..aa9f9961 100644 --- a/src/bundle/Resources/views/themes/standard/design_system/components/accordion.html.twig +++ b/src/bundle/Resources/views/themes/standard/design_system/components/accordion.html.twig @@ -1,8 +1,13 @@ {% set initially_expanded = initially_expanded|default(false) %} -{% set classes = html_classes('ids-accordion', { - 'ids-accordion--is-expanded': initially_expanded -}) %} +{% set classes = + html_classes( + 'ids-accordion', + { + 'ids-accordion--is-expanded': initially_expanded + } + ) +%}
diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/button.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/button.html.twig index 0274b8cb..00f89e90 100644 --- a/src/bundle/Resources/views/themes/standard/design_system/components/button.html.twig +++ b/src/bundle/Resources/views/themes/standard/design_system/components/button.html.twig @@ -6,32 +6,43 @@ {% set attr = attr|default({}) %} {% set classes = attr.class|default('') %} -{% set button_classes = html_cva( - base: 'ids-btn', - variants: { - type: { - 'primary': 'ids-btn--primary', - 'secondary': 'ids-btn--secondary', - 'tertiary': 'ids-btn--tertiary', - 'black-secondary': 'ids-btn--black-secondary', - 'black-tertiary': 'ids-btn--black-tertiary', - }, - size: { - 'large': 'ids-btn--large', - 'small': 'ids-btn--small', - 'extra-small': 'ids-btn--extra-small', - }, - disabled: { - true: 'ids-btn--disabled', - }, - } -) %} +{# prettier-ignore-start #} +{% set button_classes = + html_cva( + base: 'ids-btn', + variants: { + type: { + primary: 'ids-btn--primary', + secondary: 'ids-btn--secondary', + tertiary: 'ids-btn--tertiary', + 'black-secondary': 'ids-btn--black-secondary', + 'black-tertiary': 'ids-btn--black-tertiary' + }, + size: { + large: 'ids-btn--large', + small: 'ids-btn--small', + 'extra-small': 'ids-btn--extra-small' + }, + disabled: { + 'true': 'ids-btn--disabled' + } + } + ) +%} +{# prettier-ignore-end #} {% set attr = attr|merge({ - class: button_classes.apply({ type, size, disabled }, classes), + class: button_classes.apply( + { + type, + size, + disabled + }, + classes + ), disabled, - type: 'button', + type: 'button' }) %} diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/expander.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/expander.html.twig index 2354e28e..2fae42ba 100644 --- a/src/bundle/Resources/views/themes/standard/design_system/components/expander.html.twig +++ b/src/bundle/Resources/views/themes/standard/design_system/components/expander.html.twig @@ -4,10 +4,16 @@ {% set expand_label = expand_label|default('') %} {% set label = is_expanded ? collapse_label : expand_label %} -{% set classes = html_classes('ids-expander', 'ids-expander--has-label', { - 'ids-expander--has-icon': has_icon, - 'ids-expander--is-expanded': is_expanded -}) %} +{% set classes = + html_classes( + 'ids-expander', + 'ids-expander--has-label', + { + 'ids-expander--has-icon': has_icon, + 'ids-expander--is-expanded': is_expanded + } + ) +%} {% include ids_get('button') with { type: 'black-tertiary', diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/helper_text.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/helper_text.html.twig new file mode 100644 index 00000000..3a9098b3 --- /dev/null +++ b/src/bundle/Resources/views/themes/standard/design_system/components/helper_text.html.twig @@ -0,0 +1,60 @@ +{% import ids_get('macros/html') as html %} + +{% set type = type|default('default') %} +{% set title = title|default('') %} +{% set attr = attr|default({}) %} +{% set classes = attr.class|default('') %} + +{% set ICONS_TYPE_MAP = { + default: 'info-circle', + error: 'alert-error' +} %} + +{% set helper_text_classes = + html_cva( + base: 'ids-helper-text', + variants: { + type: { + default: 'ids-helper-text--default', + error: 'ids-helper-text--error' + } + } + ) +%} +{% set attr = + attr|merge({ + class: helper_text_classes.apply( + { + type + }, + classes + ), + title: title + }) +%} + +
+ {% block icon_wrapper %} +
+ {% block icon_content %} + {{ + include( + ids_get('icon'), + { + attr: { + class: 'ids-icon ids-helper-text__icon' + }, + name: ICONS_TYPE_MAP[type], + size: 'small' + } + ) + }} + {% endblock %} +
+ {% endblock %} + {% block content_wrapper %} +
+ {{ content|raw }} +
+ {% endblock %} +
diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/icon.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/icon.html.twig index ef3e952d..0f8aaec2 100644 --- a/src/bundle/Resources/views/themes/standard/design_system/components/icon.html.twig +++ b/src/bundle/Resources/views/themes/standard/design_system/components/icon.html.twig @@ -10,25 +10,32 @@ {% set link_href = ibexa_icon_path(name) %} {% endif %} -{% set icon_classes = html_cva( - base: 'ids-icon', - variants: { - size: { - 'tiny': 'ids-icon--tiny', - 'tiny-small': 'ids-icon--tiny-small', - 'small': 'ids-icon--small', - 'small-medium': 'ids-icon--small-medium', - 'medium': 'ids-icon--medium', - 'medium-large': 'ids-icon--medium-large', - 'large': 'ids-icon--large', - 'extra-large': 'ids-icon--extra-large', +{% set icon_classes = + html_cva( + base: 'ids-icon', + variants: { + size: { + tiny: 'ids-icon--tiny', + 'tiny-small': 'ids-icon--tiny-small', + small: 'ids-icon--small', + 'small-medium': 'ids-icon--small-medium', + medium: 'ids-icon--medium', + 'medium-large': 'ids-icon--medium-large', + large: 'ids-icon--large', + 'extra-large': 'ids-icon--extra-large' + } } - } -) %} + ) +%} {% set attr = attr|merge({ - class: icon_classes.apply({ size }, classes), + class: icon_classes.apply( + { + size + }, + classes + ) }) %} diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/input_text.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/input_text.html.twig new file mode 100644 index 00000000..a2be5fa1 --- /dev/null +++ b/src/bundle/Resources/views/themes/standard/design_system/components/input_text.html.twig @@ -0,0 +1,68 @@ +{% import ids_get('macros/html') as html %} + +{% set disabled = disabled|default(false) %} +{% set error = error|default(false) %} +{% set placeholder = placeholder|default('') %} +{% set readonly = readonly|default(false) %} +{% set required = required|default(false) %} +{% set size = size|default('medium') %} +{% set title = title|default('') %} +{% set type = type|default('text') %} +{% set value = value|default('') %} +{% set attr = attr|default({}) %} +{% set classes = attr.class|default('') %} + +{# prettier-ignore-start #} +{% set input_classes = + html_cva( + base: 'ids-input', + variants: { + type: { + text: 'ids-input--text', + password: 'ids-input--password', + email: 'ids-input--email', + number: 'ids-input--number', + tel: 'ids-input--tel', + search: 'ids-input--search', + url: 'ids-input--url' + }, + size: { + medium: 'ids-input--medium', + small: 'ids-input--small' + }, + disabled: { + 'true': 'ids-input--disabled' + }, + error: { + 'true': 'ids-input--error' + }, + required: { + 'true': 'ids-input--required' + } + } + ) +%} +{# prettier-ignore-end #} + +{% set attr = + attr|merge({ + class: input_classes.apply( + { + type, + size, + disabled, + error, + required + }, + classes + ), + disabled, + placeholder, + readonly, + title, + type, + value + }) +%} + + diff --git a/src/bundle/Resources/views/themes/standard/design_system/components/label.html.twig b/src/bundle/Resources/views/themes/standard/design_system/components/label.html.twig new file mode 100644 index 00000000..d018bc74 --- /dev/null +++ b/src/bundle/Resources/views/themes/standard/design_system/components/label.html.twig @@ -0,0 +1,26 @@ +{% import ids_get('macros/html') as html %} + +{% set error = error|default(false) %} +{% set required = required|default(false) %} +{% set title = title|default('') %} +{% set attr = attr|default({}) %} + +{% set classes = + html_classes( + 'ids-label', + attr.classes|default(''), + { + 'ids-label--error': error, + 'ids-label--required': required + } + ) +%} +{% set attr = + attr|merge({ + class: classes, + for, + title, + }) +%} + +