1
1
mirror of https://github.com/primer/css.git synced 2024-09-20 05:07:11 +03:00

Removing primer-dropdown from 9.6.0 release punting to 10

This commit is contained in:
Jon Rohan 2017-10-24 12:24:07 -07:00
parent 440824a5b3
commit 0f6b7aee46
10 changed files with 0 additions and 642 deletions

View File

@ -2,7 +2,6 @@
### Added
- Storybook. We've added a storybook prototyping environment for testing components in seclusion. To start the server run `npm start`
- Adding `primer-dropdown` module as a new module, and adding to the `primer-product` meta package. https://github.com/primer/primer-css/pull/332
- Adding yeoman generator for creating a primer module. `generator-primer-module`
- Importing `stylelint-config-primer` from https://github.com/primer/stylelint-config-primer/ into monorepo.
- Importing `stylelint-selector-no-utility` from https://github.com/primer/stylelint-selector-no-utility into monorepo.

View File

@ -36,7 +36,6 @@
"primer-buttons": "2.4.0",
"primer-cards": "0.5.0",
"primer-core": "6.4.0",
"primer-dropdown": "0.1.0",
"primer-forms": "1.4.0",
"primer-labels": "1.5.0",
"primer-layout": "1.4.0",

View File

@ -1,2 +0,0 @@
*.yml
.github

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,312 +0,0 @@
# Primer CSS dropdown
[![npm version](http://img.shields.io/npm/v/primer-dropdown.svg)](https://www.npmjs.org/package/primer-dropdown)
[![Build Status](https://travis-ci.org/primer/primer-css.svg?branch=master)](https://travis-ci.org/primer/primer-css)
This repository is a module of the full [primer-css][primer-css] repository.
## Install
This repository is distributed with [npm]. After [installing npm][install-npm], you can install `primer-dropdown` with this command.
```
$ npm install --save primer-dropdown
```
## Usage
The source files included are written in [Sass][sass] (`scss`) You can simply point your sass `include-path` at your `node_modules` directory and import it like this.
```scss
@import "primer-dropdown/index.scss";
```
You can also import specific portions of the module by importing those partials from the `/lib/` folder. _Make sure you import any requirements along with the modules._
## Build
For a compiled **css** version of this module, a npm script is included that will output a css version to `build/build.css` The built css file is also included in the npm package.
```
$ npm run build
```
## Documentation
<!-- %docs
title: Dropdown
status: Stable
-->
Dropdowns are lightweight, JavaScript-powered context menus for housing navigation and actions. They're great for instances where you don't need the full power (and code) of the select menu.
{:toc}
## Basic examples
Dropdowns should be trigged by a `<button>`. **[Each dropdown menu requires a directional class](#alignment)**, much like our tooltips.
Using a GitHub button:
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
Dropdown
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-se">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
Using a button customized with additional utilities:
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn-link no-underline text-gray p-2 dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
Dropdown
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-se">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
## Options
### Alignment
Align the direction of dropdown menus and their arrows with modifier classes.
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-ne
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-ne">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
```html
<div class="dropdown float-right js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-e
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-e">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-se
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-se">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
```html
<div class="dropdown d-inline-block mx-auto js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-s
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-s">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
```html
<div class="dropdown float-right js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-sw
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-sw">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
.dropdown-w
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-w">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
```
### Dividers
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
Dropdown
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-se">
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li class="dropdown-divider" role="separator"></li>
<li><a class="dropdown-item" href="#url">Another item</a></li>
<li><a class="dropdown-item" href="#url">One more</a></li>
</ul>
</div>
</div>
```
### Headers
```html
<div class="dropdown js-menu-container js-select-menu">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
Dropdown
<div class="dropdown-caret"></div>
</button>
<div class="dropdown-menu-content js-menu-content">
<div class="dropdown-menu dropdown-menu-se">
<div class="dropdown-header">
Dropdown header
</div>
<ul>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
<li><a class="dropdown-item" href="#url">Dropdown item</a></li>
</ul>
</div>
</div>
</div>
```
### No overflow
Use `dropdown-menu-no-overflow` modifier class to set the width of the dropdown
to `auto` and prevent hidden overflows on item contents and text.
```html
<div class="select-all-dropdown dropdown js-menu-container js-bulk-actions float-left js-transitionable">
<button class="btn btn-sm mr-3 js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
1 member selected…
<span class="dropdown-caret"></span>
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-no-overflow dropdown-menu-se">
<a href="#url" class="dropdown-item js-menu-close">
Change role...
</a>
<a href="#url" class="dropdown-item menu-item-danger js-menu-close">
Remove from team
</a>
</ul>
</div>
</div>
```
### Sign out button
Use `<button class="dropdown-item dropdown-signout">` to reset button styles
and display it as a link.
```html
<div class="dropdown js-menu-container float-right position-relative">
<button class="btn dropdown-toggle js-menu-target" type="button" aria-expanded="false" aria-haspopup="true">
<img alt="@shawnbot" class="avatar" src="https://avatars0.githubusercontent.com/u/113896?v=4&amp;s=40" height="20" width="20">
</button>
<div class="dropdown-menu-content js-menu-content">
<ul class="dropdown-menu dropdown-menu-sw">
<li class="dropdown-header header-nav-current-user css-truncate">
Signed in as <strong class="css-truncate-target">shawnbot</strong>
</li>
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#url">Your profile</a></li>
<li><a class="dropdown-item" href="#url">Your stars</a></li>
<li><a class="dropdown-item" href="#url">Your Gists</a></li>
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#url">Help</a></li>
<li><a class="dropdown-item" href="#url">Settings</a></li>
<li>
<form class="m-0" accept-charset="UTF-8" action="#url" class="logout-form" method="post">
<button type="submit" class="dropdown-item dropdown-signout">
Sign out
</button>
</form>
</li>
</ul>
</div>
</div>
```
<!-- %enddocs -->
## License
[MIT](./LICENSE) &copy; [GitHub](https://github.com/)
[primer-css]: https://github.com/primer/primer
[docs]: http://primercss.io/
[npm]: https://www.npmjs.com/
[install-npm]: https://docs.npmjs.com/getting-started/installing-node
[sass]: http://sass-lang.com/

View File

@ -1,2 +0,0 @@
@import "primer-support/index.scss";
@import "./lib/dropdown.scss";

View File

@ -1,262 +0,0 @@
// TODO add some docs here
.dropdown {
position: relative;
&.active {
.dropdown-menu-content {
display: block;
pointer-events: all;
}
}
}
.dropdown-caret {
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
content: "";
border: 4px solid;
border-right-color: transparent;
border-bottom-color: transparent;
border-left-color: transparent;
}
// Requires a positioning class (e.g., `.dropdown-menu-w`) to determine which
// way the menu should render from the element triggering it.
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 100;
width: 160px;
padding-top: 5px;
padding-bottom: 5px;
margin-top: 2px;
list-style: none;
background-color: $bg-white;
background-clip: padding-box;
border: 1px solid $black-fade-15;
border-radius: 4px;
box-shadow: 0 3px 12px $black-fade-15;
&::before,
&::after {
position: absolute;
display: inline-block;
content: "";
}
&::before {
border: 8px solid transparent;
border-bottom-color: $black-fade-15;
}
&::after {
border: 7px solid transparent;
border-bottom-color: $white;
}
// stylelint-disable-next-line selector-max-type
> ul {
list-style: none;
}
}
.dropdown-menu-no-overflow {
width: auto;
.dropdown-item {
padding: 4px 15px;
overflow: visible;
text-overflow: inherit;
}
}
// Dropdown items (can be links or buttons)
.dropdown-item {
display: block;
padding: 4px 10px 4px 15px;
overflow: hidden;
color: $text-gray-dark;
text-overflow: ellipsis;
white-space: nowrap;
&:hover,
&.zeroclipboard-is-hover {
color: $text-white;
text-decoration: none;
background-color: $bg-blue;
> .octicon {
color: inherit;
opacity: 1;
}
}
&.btn-link {
width: 100%;
text-align: left;
}
}
.dropdown-signout {
width: 100%;
text-align: left;
background: none;
border: 0;
}
.dropdown-divider {
height: 1px;
margin: 8px 1px;
background-color: $gray-200;
}
.dropdown-header {
padding: 4px 15px;
font-size: 12px;
color: $text-gray;
}
.dropdown-menu-content {
display: none;
// stylelint-disable primer/selector-no-utility
&.anim-scale-in {
position: relative;
z-index: 100;
pointer-events: none;
}
}
// Directional classes
//
// Move the menu and the caret attached to it. Requires at least one of these on
// the `.dropdown-menu` element.
.dropdown-menu-w {
top: 0;
right: 100%;
left: auto;
width: auto;
margin-top: 0;
margin-right: 10px;
&::before {
top: 10px;
right: -16px;
left: auto;
border-color: transparent;
border-left-color: $black-fade-15;
}
&::after {
top: 11px;
right: -14px;
left: auto;
border-color: transparent;
border-left-color: $white;
}
}
.dropdown-menu-e {
top: 0;
left: 100%;
width: auto;
margin-top: 0;
margin-left: 10px;
&::before {
top: 10px;
left: -16px;
border-color: transparent;
border-right-color: $black-fade-15;
}
&::after {
top: 11px;
left: -14px;
border-color: transparent;
border-right-color: $white;
}
}
.dropdown-menu-ne {
top: auto;
bottom: 100%;
left: 0;
margin-bottom: 3px;
&::before,
&::after {
top: auto;
right: auto;
}
&::before {
bottom: -8px;
left: 9px;
border-top: 8px solid $black-fade-15;
border-right: 8px solid transparent;
border-bottom: 0;
border-left: 8px solid transparent;
}
&::after {
bottom: -7px;
left: 10px;
border-top: 7px solid $white;
border-right: 7px solid transparent;
border-bottom: 0;
border-left: 7px solid transparent;
}
}
.dropdown-menu-s {
right: 50%;
left: auto;
transform: translateX(50%);
&::before {
top: -16px;
right: 50%;
transform: translateX(50%);
}
&::after {
top: -14px;
right: 50%;
transform: translateX(50%);
}
}
.dropdown-menu-sw {
right: 0;
left: auto;
&::before {
top: -16px;
right: 9px;
left: auto;
}
&::after {
top: -14px;
right: 10px;
left: auto;
}
}
.dropdown-menu-se {
&::before {
top: -16px;
left: 9px;
}
&::after {
top: -14px;
left: 10px;
}
}

View File

@ -1,39 +0,0 @@
{
"version": "0.1.0",
"name": "primer-dropdown",
"description": "A lightweight context menu for navigation and actions.",
"homepage": "http://primercss.io/",
"author": "GitHub, Inc.",
"license": "MIT",
"style": "index.scss",
"main": "build/index.js",
"primer": {
"category": "product",
"module_type": "components"
},
"files": [
"index.scss",
"lib",
"build"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-dropdown",
"bugs": {
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "../../script/test-docs",
"build": "../../script/npm-run primer-module-build index.scss",
"prepare": "npm run build",
"lint": "../../script/lint-scss",
"test": "../../script/npm-run-all build lint test-docs"
},
"dependencies": {
"primer-support": "4.4.0"
},
"keywords": [
"primer",
"css",
"github",
"primercss"
]
}

View File

@ -17,6 +17,5 @@
@import "primer-alerts/index.scss";
@import "primer-avatars/index.scss";
@import "primer-blankslate/index.scss";
@import "primer-dropdown/index.scss";
@import "primer-labels/index.scss";
@import "primer-markdown/index.scss";

View File

@ -29,7 +29,6 @@
"primer-alerts": "1.5.0",
"primer-avatars": "1.4.0",
"primer-blankslate": "1.4.0",
"primer-dropdown": "0.1.0",
"primer-labels": "1.5.0",
"primer-markdown": "3.7.0",
"primer-support": "4.4.0"