@dialpad/dialtone-css
Version:
Dialpad's design system
229 lines (204 loc) • 10.1 kB
text/less
//
// DIALTONE
// UTILITIES: FLEXBOX
//
// These are the flexbox utility classes for Dialpad's design system Dialtone.
// For further documentation of these and other classes, visit:
// https://dialtone.dialpad.com/utilities/layout/flex/
//
// TABLE OF CONTENTS
// • ALIGN CONTENT
// • ALIGN ITEMS
// • ALIGN SELF
// • COLUMNS & LAYOUTS
// • DIRECTION, WRAP, & FLOW
// • FLEX, GROW, & SHRINK
// • JUSTIFY CONTENT
// • ORDER
//
// ============================================================================
// $ ALIGN CONTENT
// Aligns the container's lines when there is extra space in the
// cross-axis. Note that this only works when a parent container
// has more than one line.
// ----------------------------------------------------------------------------
.d-ac-center { align-content: center ; }
.d-ac-flex-end { align-content: flex-end ; }
.d-ac-flex-start { align-content: flex-start ; }
.d-ac-space-around { align-content: space-around ; }
.d-ac-space-between { align-content: space-between ; }
.d-ac-space-evenly { align-content: space-evenly ; }
.d-ac-baseline { align-content: baseline ; }
.d-ac-stretch { align-content: stretch ; }
.d-ac-normal { align-content: normal ; }
.d-ac-unset { align-content: unset ; }
// ============================================================================
// $ ALIGN ITEMS
// Defines the default behavior for how child items align along
// the parent's cross axis. Think of it the cross-axis for
// justify-content.
// ----------------------------------------------------------------------------
.d-ai-center { align-items: center ; }
.d-ai-flex-end { align-items: flex-end ; }
.d-ai-flex-start { align-items: flex-start ; }
.d-ai-baseline { align-items: baseline ; }
.d-ai-stretch { align-items: stretch ; }
.d-ai-normal { align-items: normal ; }
.d-ai-unset { align-items: unset ; }
// ============================================================================
// $ ALIGN SELF
// Allows child containers to re-align themselves regardless
// of the parent's main axis direction.
// ----------------------------------------------------------------------------
.d-as-center { align-self: center ; }
.d-as-flex-end { align-self: flex-end ; }
.d-as-flex-start { align-self: flex-start ; }
.d-as-baseline { align-self: baseline ; }
.d-as-stretch { align-self: stretch ; }
.d-as-auto { align-self: auto ; }
.d-as-normal { align-self: normal ; }
.d-as-unset { align-self: unset ; }
// ============================================================================
// $ COLUMNS & LAYOUTS
// ----------------------------------------------------------------------------
// $$ FLEX GAPS
// TODO: Deprecated classes, remove on our next migration. https://dialpad.atlassian.net/browse/DLT-1763
// ----------------------------------------------------------------------------
.d-flg0 > * { --fl-gap: 0 ; }
.d-flg1 > * { --fl-gap: var(--dt-space-100) ; }
.d-flg2 > * { --fl-gap: var(--dt-space-100) ; }
.d-flg4 > * { --fl-gap: var(--dt-space-300) ; }
.d-flg6 > * { --fl-gap: var(--dt-space-350) ; }
.d-flg8 > * { --fl-gap: var(--dt-space-400) ; }
.d-flg12 > * { --fl-gap: var(--dt-space-450) ; }
.d-flg16 > * { --fl-gap: var(--dt-space-500) ; }
.d-flg24 > * { --fl-gap: var(--dt-space-550) ; }
.d-flg32 > * { --fl-gap: var(--dt-space-600) ; }
.d-flg48 > * { --fl-gap: var(--dt-space-650) ; }
.d-flg64 > * { --fl-gap: var(--dt-space-700) ; }
// ============================================================================
// $ DIRECTION, WRAP, & FLOW
// ----------------------------------------------------------------------------
// $$ FLEX DIRECTION
// This determines the content flow direction within the parent container.
// Default value is row.
// ----------------------------------------------------------------------------
.d-fd-row { flex-direction: row ; }
.d-fd-row-reverse { flex-direction: row-reverse ; }
.d-fd-column { flex-direction: column ; }
.d-fd-column-reverse { flex-direction: column-reverse ; }
.d-fd-unset { flex-direction: unset ; }
// $$ FLEX WRAP
// This determines if a parent's children will wrap.
// Default value is nowrap.
// ----------------------------------------------------------------------------
.d-fw-wrap { flex-wrap: wrap ; }
.d-fw-wrap-reverse { flex-wrap: wrap-reverse ; }
.d-fw-nowrap { flex-wrap: nowrap ; }
.d-fw-unset { flex-wrap: unset ; }
// $$ FLEX FLOW
// This is another shorthand property for flex-direction and flex-wrap.
// Default value is 'row nowrap'.
// ----------------------------------------------------------------------------
.d-ff-row-wrap { flex-flow: row wrap ; }
.d-ff-row-wrap-reverse { flex-flow: row wrap-reverse ; }
.d-ff-row-nowrap { flex-flow: row nowrap ; }
.d-ff-row-reverse-wrap { flex-flow: row-reverse wrap ; }
.d-ff-row-reverse-wrap-reverse { flex-flow: row-reverse wrap-reverse ; }
.d-ff-row-reverse-nowrap { flex-flow: row-reverse nowrap ; }
.d-ff-column-wrap { flex-flow: column wrap ; }
.d-ff-column-wrap-reverse { flex-flow: column wrap-reverse ; }
.d-ff-column-nowrap { flex-flow: column nowrap ; }
.d-ff-column-reverse-wrap { flex-flow: column-reverse wrap ; }
.d-ff-column-reverse-wrap-reverse { flex-flow: column-reverse wrap-reverse ; }
.d-ff-column-reverse-nowrap { flex-flow: column-reverse nowrap ; }
.d-f-flow-unset { flex-flow: unset ; }
// ============================================================================
// $ FLEX, GROW, & SHRINK
// ----------------------------------------------------------------------------
// $$ FLEX
// Graduating scale of flex-grow and flex-shrink values
// ----------------------------------------------------------------------------
.d-fl0 { flex: 0 auto ; }
.d-fl1 { flex: 1 auto ; }
.d-fl2 { flex: 2 auto ; }
.d-fl3 { flex: 3 auto ; }
.d-fl4 { flex: 4 auto ; }
.d-fl5 { flex: 5 auto ; }
.d-fl-unset { flex: unset ; }
// $$$ FLEX NONE
// This is equivalent to flex: 0 0 auto.
// It sizes the item according to its width/height properties, but makes it
// fully inflexible.
.d-fl-none { flex: none ; }
// $$$ FLEX EQUAL
// Equally distributes children out within a parent container
.d-fl-equal {
flex-basis: 0 ;
flex-grow: 1 ;
flex-shrink: 1 ;
}
// $$ FLEX GROW
// Specifies the flex-grow value, which states how much an item will
// grow relative to other flex items in the container when there isn't
// enough space in the row. Default value is 1.
// ----------------------------------------------------------------------------
.d-fl-grow0 { flex-grow: 0 ; }
.d-fl-grow1 { flex-grow: 1 ; }
.d-fl-grow2 { flex-grow: 2 ; }
.d-fl-grow3 { flex-grow: 3 ; }
.d-fl-grow4 { flex-grow: 4 ; }
.d-fl-grow5 { flex-grow: 5 ; }
.d-fl-grow-unset { flex-grow: unset ; }
// $$ FLEX SHRINK
// Specifies the flex-shrink factor, which states how much an item will
// shrink relative to other flex items in the container when there isn't
// enough space in the row. Default value is 1.
// ----------------------------------------------------------------------------
.d-fl-shrink0 { flex-shrink: 0 ; }
.d-fl-shrink1 { flex-shrink: 1 ; }
.d-fl-shrink2 { flex-shrink: 2 ; }
.d-fl-shrink3 { flex-shrink: 3 ; }
.d-fl-shrink4 { flex-shrink: 4 ; }
.d-fl-shrink5 { flex-shrink: 5 ; }
.d-fl-shrink-unset { flex-shrink: unset ; }
// ============================================================================
// $ JUSTIFY CONTENT
// Defines the child alignment along the parent's main axis
// ----------------------------------------------------------------------------
.d-jc-center { justify-content: center ; }
.d-jc-flex-end { justify-content: flex-end ; }
.d-jc-flex-start { justify-content: flex-start ; }
.d-jc-space-around { justify-content: space-around ; }
.d-jc-space-between { justify-content: space-between ; }
.d-jc-space-evenly { justify-content: space-evenly ; }
.d-jc-baseline { justify-content: baseline ; }
.d-jc-normal { justify-content: normal ; }
.d-jc-unset { justify-content: unset ; }
// $$ CENTER ITEMS
// A common combination of classes is .d-jc-center and .ai-center.
// Use this class when you want both.
// ----------------------------------------------------------------------------
.d-fl-center {
display: flex;
align-items: center;
justify-content: center;
}
// ============================================================================
// $ ORDER
// Designate a child container's position.
// ----------------------------------------------------------------------------
.d-order1 { order: 1 ; }
.d-order2 { order: 2 ; }
.d-order3 { order: 3 ; }
.d-order4 { order: 4 ; }
.d-order5 { order: 5 ; }
.d-order6 { order: 6 ; }
.d-order7 { order: 7 ; }
.d-order8 { order: 8 ; }
.d-order9 { order: 9 ; }
.d-order10 { order: 10 ; }
.d-order11 { order: 11 ; }
.d-order12 { order: 12 ; }
.d-order-first { order: -9999 ; }
.d-order-last { order: 9999 ; }