From 884f17a916e8d0081c3a1863464ef6e4bf18ce34 Mon Sep 17 00:00:00 2001 From: Patrick Yeo Date: Fri, 13 Apr 2018 16:39:05 -0700 Subject: [PATCH 1/6] New: (Fixes #798) Label added option to set `$label-line-height`, Label with Icons should be same size, and better support for long text that break to new lines Update: (#798) Badge with Icons should be the same size and better support for long text that break to new lines --- .../clay/src/scss/atlas/variables/_badges.scss | 4 ++-- .../clay/src/scss/atlas/variables/_forms.scss | 9 +++++---- .../clay/src/scss/atlas/variables/_labels.scss | 7 ++++--- packages/clay/src/scss/components/_badges.scss | 16 ++++++++++------ packages/clay/src/scss/components/_labels.scss | 12 ++++++++++-- packages/clay/src/scss/mixins/_labels.scss | 9 ++++----- packages/clay/src/scss/variables/_badges.scss | 5 +++-- packages/clay/src/scss/variables/_forms.scss | 5 +++-- packages/clay/src/scss/variables/_labels.scss | 7 ++++--- 9 files changed, 45 insertions(+), 29 deletions(-) diff --git a/packages/clay/src/scss/atlas/variables/_badges.scss b/packages/clay/src/scss/atlas/variables/_badges.scss index e17a20fd0c..75116ffa33 100644 --- a/packages/clay/src/scss/atlas/variables/_badges.scss +++ b/packages/clay/src/scss/atlas/variables/_badges.scss @@ -1,9 +1,9 @@ $badge-border-radius: 10rem !default; $badge-font-size: 0.625rem !default; // 10px $badge-font-weight: $font-weight-semi-bold !default; -$badge-line-height: 0.875rem !default // 14px +$badge-line-height: 1.1 !default; $badge-padding-x: 0.25rem !default; // 4px -$badge-padding-y: 0 !default; +$badge-padding-y: 0.0625rem !default; // 1px $badge-item-spacer-x: 0.85714em !default; diff --git a/packages/clay/src/scss/atlas/variables/_forms.scss b/packages/clay/src/scss/atlas/variables/_forms.scss index 5d0af12249..b609f3e864 100644 --- a/packages/clay/src/scss/atlas/variables/_forms.scss +++ b/packages/clay/src/scss/atlas/variables/_forms.scss @@ -104,14 +104,15 @@ $input-select-icon-focus: clay-icon(caret-double-l, $input-select-icon-focus-col $input-select-icon-disabled-color: $text-muted !default; $input-select-icon-disabled: clay-icon(caret-double-l, $input-select-icon-disabled-color) !default; -// Form Control Label (Labels inside Form Control) +// Form Control Label (Labels inside Form Control Tag Group) $form-control-label-size: () !default; $form-control-label-size: map-merge(( - border-width: 0.0625rem, - font-size: $input-label-font-size, // 14px + border-width: 0.0625rem, // 1px + font-size: map-get($label-lg, font-size), height: 1.5rem, // 24px - padding-x: 0.625rem, // 10px + padding-x: map-get($label-lg, padding-x), + padding-y: map-get($label-lg, padding-y), text-transform: none ), $form-control-label-size); diff --git a/packages/clay/src/scss/atlas/variables/_labels.scss b/packages/clay/src/scss/atlas/variables/_labels.scss index 04b6c37fee..a7937245c7 100644 --- a/packages/clay/src/scss/atlas/variables/_labels.scss +++ b/packages/clay/src/scss/atlas/variables/_labels.scss @@ -1,8 +1,8 @@ $label-border-radius: 0.125rem !default; // 2px $label-font-size: 0.625rem !default; // 10px $label-font-weight: $font-weight-semi-bold !default; -$label-height: 1rem !default; // 16px $label-padding-x: 0.5rem !default; // 8px +$label-padding-y: 0.125rem !default; // 2px $label-text-transform: uppercase !default; $label-item-spacer-x: 0.85714em !default; @@ -13,9 +13,10 @@ $label-link-text-decoration: none !default; $label-link-hover-text-decoration: underline !default; $label-lg: ( - font-size: 0.75rem, // 13px + font-size: 0.75rem, // 12px height: 1.5rem, // 24px - padding-x: 0.625rem // 10px + padding-x: 0.625rem, // 10px + padding-y: 0.3125rem // 5px ) !default; // Label Variants diff --git a/packages/clay/src/scss/components/_badges.scss b/packages/clay/src/scss/components/_badges.scss index 3499361d27..d7da1eb8cd 100644 --- a/packages/clay/src/scss/components/_badges.scss +++ b/packages/clay/src/scss/components/_badges.scss @@ -72,11 +72,15 @@ justify-content: center; min-height: 0; position: relative; + text-align: left; + + a { + display: inline-flex; + } .btn-unstyled { color: inherit; display: inline-flex; - font-size: $badge-lexicon-icon-height; } .close { @@ -88,17 +92,17 @@ margin-top: $badge-lexicon-icon-margin-top; width: $badge-lexicon-icon-width; } - - .text-truncate-inline { - display: inline-flex; - } } .badge-item-expand { flex-grow: 1; flex-shrink: 1; - min-width: 1rem; + min-width: $badge-item-expand-min-width; word-wrap: break-word; + + a { + flex-direction: column; + } } .badge-item-before { diff --git a/packages/clay/src/scss/components/_labels.scss b/packages/clay/src/scss/components/_labels.scss index e0f02b21f9..6bf4093453 100644 --- a/packages/clay/src/scss/components/_labels.scss +++ b/packages/clay/src/scss/components/_labels.scss @@ -9,7 +9,8 @@ display: inline-flex; font-size: $label-font-size; font-weight: $label-font-weight; - line-height: $label-height - ($label-border-width * 2); + height: $label-height; + line-height: $label-line-height; margin-bottom: $label-spacer-y; margin-right: $label-spacer-x; margin-top: $label-spacer-y; @@ -94,10 +95,13 @@ a.label { min-height: 0; position: relative; + a { + display: inline-flex; + } + .btn-unstyled { color: inherit; display: inline-flex; - font-size: $label-lexicon-icon-height; } .close { @@ -120,6 +124,10 @@ a.label { flex-shrink: 1; min-width: 1rem; word-wrap: break-word; + + a { + flex-direction: column; + } } .label-item-before { diff --git a/packages/clay/src/scss/mixins/_labels.scss b/packages/clay/src/scss/mixins/_labels.scss index c79125284e..a052901115 100644 --- a/packages/clay/src/scss/mixins/_labels.scss +++ b/packages/clay/src/scss/mixins/_labels.scss @@ -2,6 +2,7 @@ $border-width: setter(map-get($map, border-width), $label-border-width); $font-size: map-get($map, font-size); $height: map-get($map, height); + $line-height: map-get($map, line-height); $padding-x: map-get($map, padding-x); $padding-y: map-get($map, padding-y); $text-transform: map-get($map, text-transform); @@ -12,11 +13,9 @@ border-width: $border-width; font-size: $font-size; - - @if ($height) { - line-height: $height - ($border-width * 2); - } - + height: auto; + line-height: $line-height; + min-height: $height; padding-bottom: $padding-y; padding-left: $padding-x; padding-right: $padding-x; diff --git a/packages/clay/src/scss/variables/_badges.scss b/packages/clay/src/scss/variables/_badges.scss index 71472b5e1f..22c702f73e 100644 --- a/packages/clay/src/scss/variables/_badges.scss +++ b/packages/clay/src/scss/variables/_badges.scss @@ -6,10 +6,11 @@ $badge-line-height: null !default; $badge-spacer-x: 0.25rem !default; // 4px $badge-spacer-y: 0.125rem !default; // 2px -$badge-lexicon-icon-height: 0.8125em !default; +$badge-lexicon-icon-height: 0.875em !default; $badge-lexicon-icon-margin-top: 0 !default; -$badge-lexicon-icon-width: 0.8125em !default; +$badge-lexicon-icon-width: 0.875em !default; +$badge-item-expand-min-width: 0.375rem !default; $badge-item-spacer-x: 0.5em !default; $badge-link-color: #FFF !default; diff --git a/packages/clay/src/scss/variables/_forms.scss b/packages/clay/src/scss/variables/_forms.scss index 227fb593b4..7bd28c2022 100644 --- a/packages/clay/src/scss/variables/_forms.scss +++ b/packages/clay/src/scss/variables/_forms.scss @@ -54,11 +54,12 @@ $input-readonly-cursor: null !default; $input-textarea-height: 150px !default; -// Form Control Label (Labels inside Form Control) +// Form Control Label (Labels inside Form Control Tag Group) $form-control-label-size: () !default; $form-control-label-size: map-merge(( - height: 1.25rem + border-width: 0.0625rem, // 1px + height: 1.25rem // 20px ), $form-control-label-size); // Form Control Tag Group diff --git a/packages/clay/src/scss/variables/_labels.scss b/packages/clay/src/scss/variables/_labels.scss index 1ac773ba92..dad89fa651 100644 --- a/packages/clay/src/scss/variables/_labels.scss +++ b/packages/clay/src/scss/variables/_labels.scss @@ -3,9 +3,10 @@ $label-link-hover-color: #FFF !default; $label-font-size: 75% !default; $label-font-weight: $font-weight-bold !default; -$label-height: 1.25rem !default; // 20px +$label-height: null !default; +$label-line-height: 1 !default; $label-padding-x: 0.4375rem !default; // 7px -$label-padding-y: null !default; // 3px +$label-padding-y: 0.1875rem !default; // 3px $label-spacer-x: 0.25rem !default; // 4px $label-spacer-y: 0.125rem !default; // 2px $label-text-transform: null !default; @@ -50,8 +51,8 @@ $label-close: map-merge(( $label-lg: () !default; $label-lg: map-merge(( font-size: 0.875rem, // 14px - height: 1.875rem, // 30px padding-x: 1rem, // 16px + padding-y: 0.375rem, // 6px text-transform: none ), $label-lg); From 4c3d1f1b36251982f7897be161d150896bba15ff Mon Sep 17 00:00:00 2001 From: Patrick Yeo Date: Mon, 16 Apr 2018 09:51:21 -0700 Subject: [PATCH 2/6] Site: (#798) Update Label and Badges to break to new line by default and add examples of truncating text --- .../clay/src/content/badges_and_labels.html | 323 ++++++++---------- packages/clay/src/content/cards.html | 44 ++- .../content/form_elements_input_groups.html | 168 +++++---- packages/clay/src/content/grid.html | 4 +- packages/clay/src/content/list_groups.html | 16 +- packages/clay/src/content/nav-pills.html | 4 +- packages/clay/src/content/sidebar.html | 32 +- .../src/content/test_card_view_template.html | 44 ++- .../test_card_view_template_info_panel.html | 44 ++- .../src/content/test_list_view_template.html | 40 ++- .../test_list_view_template_info_panel.html | 40 ++- .../content/test_localizable_input_field.html | 48 ++- .../src/content/test_table_view_template.html | 40 ++- .../test_table_view_template_info_panel.html | 40 ++- packages/clay/src/content/utilities.html | 36 +- 15 files changed, 559 insertions(+), 364 deletions(-) diff --git a/packages/clay/src/content/badges_and_labels.html b/packages/clay/src/content/badges_and_labels.html index f32fb541dd..5beac3632d 100644 --- a/packages/clay/src/content/badges_and_labels.html +++ b/packages/clay/src/content/badges_and_labels.html @@ -8,89 +8,61 @@

Badges

- - 8 - + 8 - - 87 - + 87 - - 999K - + 999K - - 91 - + 91 - - 21 - + 21 + + + 130 -130
- - 130 - + 130
- - 130 - + 130
- - Primary - + Primary - - Secondary - + Secondary - - Success - + Success - - Info - + Info - - Warning - + Warning - - Danger - + Danger
- - Light - + Light
- - Dark - + Dark
@@ -100,90 +72,58 @@

Badges

Badge Pill

- - 8 - + 8 - - 87 - + 87 - - 999K - + 999K - - 91 - + 91 - - 21 - + 21 - - 130 - + 130
- - 130 - + 130
- - 130 - + 130
- - Primary - + Primary - - Secondary - + Secondary - - Success - + Success - - Info - + Info - - Warning - + Warning - - Danger - + Danger
- - Light - + Light
- - Dark - + Dark
@@ -193,46 +133,30 @@

Badge Pill

Badges as Anchor Tag

- - Primary - + Primary - - Secondary - + Secondary - - Success - + Success - - Info - + Info - - Warning - + Warning - - Danger - + Danger - - Dark - + Dark @@ -241,6 +165,44 @@

Badges as Anchor Tag

Badge with Links Inside

+ + + + + + + + + + + ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAre + + + + + + + + +
+ + +
+
+

Badge with Text Truncate

+ @@ -258,7 +220,7 @@

Badge with Links Inside

- Badge + ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAre
@@ -292,47 +254,31 @@

Badge Sizes

Labels

- - Primary - + Primary - - Secondary - + Secondary - - Success - + Success - - Info - + Info - - Warning - + Warning - - Danger - + Danger
- - Light - + Light
- - Dark - + Dark
@@ -349,16 +295,14 @@

Label Dismissible

- + - - - Normal Label - - + Normal Label + + + + + @@ -458,14 +413,10 @@

Label Sizes

- - Normal Label - + Normal Label - - Large Label - + Large Label diff --git a/packages/clay/src/content/cards.html b/packages/clay/src/content/cards.html index 24b0e42203..b742c588e2 100644 --- a/packages/clay/src/content/cards.html +++ b/packages/clay/src/content/cards.html @@ -62,7 +62,9 @@

- Approved + + Approved +
@@ -140,7 +142,9 @@

- Approved + + Approved +
@@ -228,7 +232,9 @@

- Approved + + Approved +
@@ -286,7 +292,9 @@

- Approved + + Approved +
@@ -326,7 +334,9 @@

- Approved + + Approved +
@@ -1182,7 +1192,9 @@

- Approved + + Approved +
@@ -1282,7 +1294,9 @@

- Approved + + Approved +
@@ -1402,7 +1416,9 @@

- Approved + + Approved +
@@ -1503,7 +1519,9 @@

- Approved + + Approved +
@@ -1627,7 +1645,9 @@

- Approved + + Approved +
@@ -1794,7 +1814,9 @@

- Approved + + Approved +
diff --git a/packages/clay/src/content/form_elements_input_groups.html b/packages/clay/src/content/form_elements_input_groups.html index 3dcb192062..267daf7eb0 100644 --- a/packages/clay/src/content/form_elements_input_groups.html +++ b/packages/clay/src/content/form_elements_input_groups.html @@ -176,7 +176,9 @@

Input Group (Mixed)

en-US - Default + + Default +
  • @@ -187,7 +189,9 @@

    Input Group (Mixed)

    en-GB - Translated + + Translated +
  • @@ -198,7 +202,9 @@

    Input Group (Mixed)

    es-ES - Translated + + Translated +
  • @@ -209,7 +215,9 @@

    Input Group (Mixed)

    fr-FR - Not Translated + + Not Translated +
  • @@ -753,7 +761,7 @@

    Form Control Tag Group

    - This component requires custom javascript. The class focus must be managed when interacting with this component. It must be added/removed on input-group-item when any item in form-control-tag-group is focused/blurred.

    + This component requires custom javascript. The class focus must be managed when interacting with this component. It must be added/removed on form-control-tag-group when any item in form-control-tag-group is focused/blurred.

    If form-control-tag-group is clicked, form-control-inset must be focused.
    @@ -782,44 +790,54 @@

    Form Control Tag Group

    - wall - + wall + + + - wallpaper - + wallpaper + + + - wonderwall - + wonderwall + + + - winterfell - + winterfell + + + - kings landing - + ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAre + + +
    @@ -879,44 +897,54 @@

    Form Control Tag Group With Contenteditable Elements

    - wall - + wall + + + - wallpaper - + wallpaper + + + - wonderwall - + wonderwall + + + - winterfell - + winterfell + + + - kings landing - + kings landing + + + some value @@ -940,23 +968,23 @@

    Form Control Tag Group With Contenteditable Elements

    }); $('.form-control-inset').on('focusin', function(event) { - $(this).closest('.input-group-item').addClass('focus'); + $(this).closest('.form-control-tag-group').addClass('focus'); }); $('.form-control-inset').on('focusout', function(event) { - $(this).closest('.input-group-item').removeClass('focus'); + $(this).closest('.form-control-tag-group').removeClass('focus'); }); $('.form-control-tag-group .label button').on('focus', function(event) { - $(this).closest('.input-group-item').addClass('focus'); + $(this).closest('.form-control-tag-group').addClass('focus'); }); $('.form-control-tag-group .label button').on('blur', function(event) { - $(this).closest('.input-group-item').removeClass('focus'); + $(this).closest('.form-control-tag-group').removeClass('focus'); }); $('.form-control-hidden').on('focus', function(event) { - $(this).closest('.input-group-item').find('form-control-inset').focus(); + $(this).closest('.form-control-tag-group').find('form-control-inset').focus(); }); $('.form-control-hidden').on('focus', function(event) { diff --git a/packages/clay/src/content/grid.html b/packages/clay/src/content/grid.html index ebdaba73c0..35f68c8bf3 100644 --- a/packages/clay/src/content/grid.html +++ b/packages/clay/src/content/grid.html @@ -314,7 +314,9 @@

    Application

    700KB - Approved + + Approved + 6 days ago 4 days ago diff --git a/packages/clay/src/content/list_groups.html b/packages/clay/src/content/list_groups.html index 997d9e0d30..deea5d6ae7 100644 --- a/packages/clay/src/content/list_groups.html +++ b/packages/clay/src/content/list_groups.html @@ -366,7 +366,9 @@

    - Pending + + Pending +

    @@ -425,7 +427,9 @@

    List Group Subtext

    - Info + + Info +
    @@ -549,7 +553,9 @@

    - Approved + + Approved +

    @@ -608,7 +614,9 @@

    List Group Subtext

    - Approved + + Approved +
    diff --git a/packages/clay/src/content/nav-pills.html b/packages/clay/src/content/nav-pills.html index 6b0ab84ee2..60e2c3e49e 100644 --- a/packages/clay/src/content/nav-pills.html +++ b/packages/clay/src/content/nav-pills.html @@ -78,7 +78,9 @@

    Vertical Nav Pills

    diff --git a/packages/clay/src/content/sidebar.html b/packages/clay/src/content/sidebar.html index f8e3f4db3c..e1b75522fd 100644 --- a/packages/clay/src/content/sidebar.html +++ b/packages/clay/src/content/sidebar.html @@ -157,14 +157,30 @@