Socket
Socket
Sign inDemoInstall

@limetech/mdc-p2-density

Package Overview
Dependencies
0
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @limetech/mdc-p2-density

Density utilities for Material Components for the web


Version published
Weekly downloads
3
Maintainers
5
Install size
10.6 kB
Created
Weekly downloads
 

Changelog

Source

4.0.0 (2019-11-02)

Bug Fixes

  • button: Add overflow: visible to button. (#4973) (905e84e)
  • button: Adjust touch target size when density is applied (#5112) (e2506f4)
  • checkbox: Change minimum ripple size of checkbox & switch 24px => 28px (#5140) (3eae309)
  • checkbox: Fix checkbox terminology in sass mixins (#5014) (2161c02)
  • checkbox: Remove RTL styles from checkbox ripple (#5134) (a646516)
  • chips: Ignore selection events in chip set (#4878) (94c6a00)
  • chips: Remove keyCode check (#4966) (e6304c4)
  • chips: Reset touch target when chip density mixin is applied. (#5116) (d3b515e)
  • chips: Stack trailing/leading icons above touch target el (#5040) (048d4b7)
  • chips: Stop emitting events in handlers (#4969) (cfd81dc)
  • data-table: Minor fixes for data table layout (#5037) (37b1f93)
  • fab: Add overflow: hidden; to ripple target to fix bounded ripple. (#5214) (97cbbdc)
  • fab: Use FAB ripple target selector (#5146) (9d91acc)
  • form-field: Fix radio RTL alignment bug. (#5064) (ef99808)
  • linear-progress: Fix indeterminate animation bug (#5180) (062ade5)
  • linear-progress: Prefix animation keyframes to prevent clashing (#5155) (fc0e474)
  • linear-progress: Restore buffer after determinate is toggl… (#5156) (09b1598)
  • linear-progress: Support high contrast mode (#5190) (d4141c9)
  • list: Add #adapter.listItemAtIndexHasClass to prevent user state change to disabled items (#4922) (b6d213c)
  • menu: Vertically center the group icon (#4862) (c5738ed)
  • menu-surface: remove duplicate export from menu-surface (#5200) (0b120ae)
  • radio: Fix touch target margins: 0px => 4px. (#5096) (a48d06e)
  • ripple: Add overflow: hidden; to the bounded ripple mixin (#5173) (996b091)
  • ripple: Always set even num when initial ripple size is ca… (#5141) (b26ad23)
  • ripple: Remove unnecessary overflow: hidden. (#5191) (5916d18)
  • tabs: Fix tab img icon styling. (#5041) (d0e6cd1)
  • text-field: Do not trigger shake animation when text field is empty (#5097) (4913db9)
  • text-field: Fixes input text alignment on IE11 for densed text field (#5136) (892dd4e)
  • text-field: Fixes input text alignment on IE11 for densed… (#5147) (c8f7693)
  • text-field: Updated shape mixins to set density scale (#5207) (719b57e)
  • touch-target: Add class to touch target wrapper. (#5174) (e7799b8)
  • touch-target: Add missing dependency - touch target to com… (#5098) (9306bd0)

Code Refactoring

Features

  • button: Add support for increased touch target to button. (#4948) (1d7a2e6)
  • checkbox: Add disabled state color mixins (#5167) (01628ef)
  • checkbox: Add support for 48px touch target (#5025) (b5685a8)
  • checkbox: Move ripple to child node (#4981) (9712b24)
  • chip: Add density mixin to chip. (#5109) (bdf3430)
  • chips: Add keyboard navigation (#4844) (42065fe), closes #2259
  • chips: Add setSelectedFromChipset method (#4872) (283bd55)
  • chips: Add support for increased touch target to chips. (#4970) (6aa109d)
  • chips: Use index for all chip operations (#4869) (07078bb)
  • density: Add density subsystem to components (#5059) (73a5e4c)
  • dialog: Add dialog mixin for dialogs with increased touch target buttons. (#5024) (2ef1ddd)
  • icon-button: Add density mixin to icon button (#5122) (37d6458)
  • list: Add density mixin to list (#5069) (5132f89)
  • list: Add mixin for disabled text opacity (#4861) (d68f8a7)
  • radio: Add density mixin to radio (#5118) (199534d)
  • radio: Add disabled state color mixins (#5168) (b5c6d66)
  • radio: Add support for 48px touch target (#5032) (87b0a4c)
  • radio: Move ripple to child element (#4983) (100ab37)
  • ripple: Add support for ripple target to mixins. (#4880) (08dbe69)
  • snackbar: Add option for indefinite timeout (#4998) (4f11851)
  • switch: Add density support for switch component. (#5124) (2c793b4), closes #5104
  • switch: add ripple opacity customization mixins (#5126) (8c0273f)
  • tab: Add text transform mixin (#5144) (22d7ad2)
  • tab-bar: Add a mixin to set scroller animation (#5172) (d7c938a)
  • tab-bar: Add density mixin to tab-bar (#5070) (45dc002)
  • tab-scroller: Add incrementScrollImmediate to bypass animation (#5184) (2b878b3), closes #5123
  • tab-scroller: Mixin for scroll transition (#5154) (efda83d)
  • text-field: Add density mixin to text field variants (#5066) (a12101d)
  • text-field: Center align inner elements for dynamic height (#4990) (4d94b22)
  • touch-target: Add touch target mixins. (#4940) (b2e0fea)

BREAKING CHANGES

  • checkbox: mdc-checkbox-ink-color mixin now only applies to enabled checkboxes

  • chips: Chips markup, adapters, foundations, and events have changed.

  • select: In MDCMenu and MDCMenuSurface, hoistMenuToBody adapter method removed. In MDCSelect, HTML structure changed: the select anchor is now wrapped in a parent element, and the anchor's sibling is the select menu. Support for native select removed. Support added for select with no label. MDCSelectAdapter methods removed: getValue, setValue, isMenuOpen, setSelectedIndex, checkValidity, setValid, toggleClassAtIndex. MDCSelectAdapter methods added: hasLabel, getSelectedMenuItem, setSelectedText, isSelectedTextFocused, get/setSelectedTextAttr, getAnchorElement, setMenuAnchorElement, setMenuAnchorCorner, setMenuWrapFocus, set/removeAttributeAtIndex, focusMenuItemAtIndex, getMenuItemValues, getMenuItemCount, getMenuItemCount, getMenuItemAttr, getMenuItemTextAtIndex, add/removeClassAtIndex. MDCSelectFoundation setValue method removed; getDisabled, handleMenuItemAction, getSelectedIndex, get/setRequired, init added.

  • radio: In Checkbox, Renamed sass variables $mdc-radio-touch-area => $mdc-radio-ripple-size & $mdc-radio-ui-size => $mdc-radio-icon-size to be consistent with checkbox. Also, removed $mdc-radio-ui-pct sass variable.

  • switch: Renames switch variables $mdc-switch-tap-target-size => $mdc-switch-ripple-size, removes $mdc-switch-tap-target-initial-position and $mdc-switch-native-control-width.

  • list: New adapter method listItemAtIndexHasClass

  • list: Renamed mixin mdc-list-item-shape-radius() => mdc-list-single-line-shape-radius()

  • linear-progress: MDCLinearProgressAdapter adapter has new forceLayout method

  • text-field: Removed sass variable in notched outline - $mdc-notched-outline-transition-duration.

  • mdc-fab: This changes the structure of the FAB element by moving the ripple from the outer element to an inner mdc-fab__ripple element.

    OLD

    <button class="mdc-fab" aria-label="Favorite">
      <span class="mdc-fab__icon material-icons">favorite</span>
    </button>
    

    NEW

    <button class="mdc-fab" aria-label="Favorite">
      <div class="mdc-fab__ripple"></div>
      <span class="mdc-fab__icon material-icons">favorite</span>
    </button>
    
  • radio: Ripple has been moved to a child element. See readme for updates.

  • slider: remove adapter methods appendTrackMarkers, removeTrackMarkers , setLastTrackMarkersStyleProperty , and add adapter method setTrackMarkers.

  • button: This changes the structure of the button element by moving the ripple from the outer <button> element to an inner mdc-button__ripple element.

    OLD

    <button class="mdc-button">
      <span class="mdc-button__label">Hello World</span>
    </button>
    

    NEW

    <button class="mdc-button">
      <div class="mdc-button__ripple"></div>
      <span class="mdc-button__label">Hello World</span>
    </button>
    
  • chips: MDCChipSetAdapter#removeChip has been replaced with MDCChipSetAdapter#removeChipAtIndex. MDCChipSetAdapter#setSelected has been replaced with MDCChipSetAdapter#selectChipAtIndex

  • density: Renamed sass mixins & variables in MDC Data Table - mdc-data-table-header-row-height => mdc-data-table-header-cell-height & mdc-data-table-row-height => mdc-data-table-cell-height. Also removed mdc-button--dense variant, use button's density mixin instead.

Readme

Source

Density

Density subsystem provides adaptive layout to components. Material Design uses low-density space by default but offers high-density space when it improves the user experience. Components with high density enable users to process and take action against large amounts of information in a more manageable way. List, tables, and long forms are components that benefit from increased density.

Design & API Documentation

Installation

npm install @limetech/mdc-p2-density

NOTE: You do not need to directly depend on @limetech/mdc-p2-density, use component provided density Sass mixins instead.

Basic Usage

The styles for applying density to button component instance looks like this:

@import "@limetech/mdc-p2-button/mixins";

.my-custom-button {
  // Sets button density scale to `-3`, i.e. button height to `1.5rem`.
  @include mdc-button-density(-3);
}

This would apply -3 (high density) to button component instance.

You would indirectly use the Density API through respective component's mixin which takes care of setting appropriate component height.

Here are the components that do provide density Sass mixins:

Density Mixins

Components that supports density provides Sass mixins to customize density for that component. Each density mixin takes in a density scale number, e.g. 0 (the default) or -1 (higher density).

Currently, the density system only allows negative numbers to customize for high density. The lower the density scale, the higher the component density. The exact density scale range depends on the component. If the scale number is unsupported by the component density mixin, the compiler will report an error at build time.

The height or size of a component is calculated with the following formula:

$height: $mdc-button-height + $mdc-density-interval * $density-scale
/// @example 2.25rem + 0.25rem * (-3) => 1.5rem

The density interval is set to 0.25rem for visual consistency.

It is recommended to customize density via the provided density mixins, rather than arbitrarily applying component height.

NOTE: Touch targets are automatically disabled when density mixins are applied, since dense components should be optionally enabled and therefore do not have the same default accessibility requirements.

Component variants

Components that has different variants may have their own density mixin.

For example, Tab Bar has two density mixins:

  • mdc-tab-bar-density(): Density mixin for standard tab bar.
  • mdc-tab-bar-stacked-density(): Density mixin for tab bar that has icon stacked on top of label.

Similarly, text field provides 3 different density mixins based on its variant.

Nested components

Material component that renders another component inside it needs set its own density scale accordingly. Applying density mixin on parent component does not automatically apply density to its children.

For example, Applying density to data table does not automatically set density scale to row checkbox. You'll have to explicitly set density scale to its children. This'll allow clients to have full control on the layout.

Style Customization

This package is used as utility for other components' density mixins. Customizations provided by this package is not intended to be consumed directly by developers, use component's density mixin instead.

Sass Variables

VariableDescription
$mdc-density-intervalDensity interval between each dense scale. This interval is used for numbered density scale to calculate dense height based on baseline component height.
$mdc-density-minimum-scaleMinimum scale supported by density subsystem. This scale always maps to highest dense scale.
$mdc-density-maximum-scaleMaximum scale supported by density subsystem. This scale always maps to lowest dense scale.
$mdc-density-supported-scalesSupported density scale when density literal is used (For example, minimum).

Sass Functions

FunctionDescription
mdc-density-prop-value($density-config, $density-scale, $property-name)Returns component property value based on given density config and density scale.

Keywords

FAQs

Last updated on 09 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc