Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sidepanel): introduce side panel component #11201

Merged
merged 54 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a5965ff
chore: add side panel web component
lee-chase Dec 13, 2023
ceaa24f
fix: move styles to story-styles
lee-chase Dec 18, 2023
0349d88
fix: reduce reliance on class selectors
lee-chase Dec 21, 2023
af038e0
chore: review wip
lee-chase Dec 22, 2023
b5ad188
chore: add types
lee-chase Dec 24, 2023
3deaa74
chore: linter fixes
lee-chase Jan 8, 2024
c06254a
fix: custom prop name
lee-chase Jan 9, 2024
683369c
fix: stacking resize
lee-chase Jan 9, 2024
382b4b6
chore: feat add title scroll behavior
lee-chase Jan 11, 2024
d55280f
fix: scroll behavior with label
lee-chase Jan 11, 2024
3ddcd59
chore: wip
lee-chase Jan 16, 2024
a1d173c
fix: non-animating title
lee-chase Jan 16, 2024
409a654
chore: add condensed button to story
lee-chase Jan 16, 2024
9e63565
fix: include overlay
lee-chase Jan 16, 2024
34866b6
fix: prevent click outside
lee-chase Jan 16, 2024
beafba5
chore: refactor stories
lee-chase Jan 16, 2024
e8c136d
chore: refactor story knobs
lee-chase Jan 16, 2024
21a3cc8
chore: wip
lee-chase Jan 16, 2024
d50f4a0
chore: wip
lee-chase Jan 17, 2024
8febb31
fix: title animate and non-animate
lee-chase Jan 17, 2024
415344f
chore: wip
lee-chase Jan 18, 2024
faceba4
chore: adjust comments
lee-chase Jan 18, 2024
6f3a995
chore: update lock file
lee-chase Jan 18, 2024
0e77f4e
fix: make side panel experimental
lee-chase Jan 18, 2024
4b13583
feat: add slug support
lee-chase Jan 18, 2024
0175dd7
feat: add slug
lee-chase Jan 18, 2024
948f0ca
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Jan 18, 2024
3a9bab6
chore: tidy comments
lee-chase Jan 18, 2024
20b614e
fix: linter issues
lee-chase Jan 18, 2024
4a4f6bd
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Jan 19, 2024
b360de2
chore: move @state to top
lee-chase Jan 24, 2024
cdd7dba
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Jan 24, 2024
10a8fc0
chore: complete merge
lee-chase Jan 24, 2024
d87c2e4
fix: review concerns
lee-chase Jan 25, 2024
c79ae60
fix: remove unused code
lee-chase Jan 25, 2024
d9f5ebc
fix: actions update padding
lee-chase Jan 26, 2024
d56318b
chore: remove commented out code
lee-chase Jan 26, 2024
c7c82c2
chore: remove unused file
lee-chase Jan 29, 2024
ee9ab7a
fix: ghost button width and kind overwrite
lee-chase Jan 29, 2024
715055f
chore: fix ibm products version for now
lee-chase Jan 30, 2024
78eeadd
feat: add side panel example
lee-chase Jan 30, 2024
de5dace
fix: side-panel-button-set declaration
lee-chase Jan 30, 2024
07f4ef5
fix: side panel mdx
lee-chase Jan 30, 2024
a151217
fix: toolbar action size comment
lee-chase Jan 30, 2024
ec468d4
chore: merge suggestions
lee-chase Jan 30, 2024
1971abb
fix: use classes instead of ids
lee-chase Jan 30, 2024
dbb25da
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Jan 30, 2024
eec5957
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Jan 31, 2024
f79cf87
Merge branch 'main' into feat/cwc-sidepanel
lee-chase Feb 1, 2024
8a13ff8
fix: side panel example and spelling
lee-chase Feb 1, 2024
476e9b3
Merge branch 'main' into feat/cwc-sidepanel
kodiakhq[bot] Feb 1, 2024
0f22743
fix(side-panel): yarn.lock
ariellalgilmore Feb 2, 2024
d93a5ad
Merge branch 'main' into feat/cwc-sidepanel
kodiakhq[bot] Feb 2, 2024
eb47a75
Merge branch 'main' into feat/cwc-sidepanel
kodiakhq[bot] Feb 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": [
"last 1 version",
"Firefox ESR",
"not opera > 0",
"not op_mini > 0",
"not op_mob > 0",
"not android > 0",
"not edge > 0",
"not ie > 0",
"not ie_mob > 0"
]
}
]
],
"plugins": [["@babel/plugin-transform-runtime", { "version": "7.3.0" }]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.cache
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"includePaths": [
"node_modules",
"../../node_modules"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!--
@license

Copyright IBM Corp. 2020

This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<html>

<head>
<title>@carbon/ibmdotcom-web-components example</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-text-input:not(:defined) {
display: none;
}

cds-textarea:not(:defined) {
display: none;
}

cds-button:not(:defined) {
display: none;
}

cds-side-panel:not(:defined) {
display: none;
}
</style>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/text-input.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/textarea.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/button.min.js"></script>
<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/side-panel.min.js"></script>
</head>

<body class="cds-theme-zone-white">
<cds-side-panel include-overlay open label-text="An optional label" size="md" title="A title, can be omitted">
<!-- Content -->
<h5>Side panel content</h5>
<div class="${storyPrefix}text-inputs">
<cds-text-input label="Input A" id="side-panel-story-text-input-a"></cds-text-input>
<cds-text-input label="Input B" id="side-panel-story-text-input-b"></cds-text-input>
</div>
<div class="${storyPrefix}text-inputs">
<cds-text-input label="Input C" id="side-panel-story-text-input-c"></cds-text-input>
<cds-text-input label="Input D" id="side-panel-story-text-input-d"></cds-text-input>
</div>
<div class="${storyPrefix}textarea-container">
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
</div>

<!-- subtitle optional -->
<div slot="subtitle">Subtitle text which can provide more detail on the content being displayed.</div>

<!-- Action toolbar optional -->
<cds-button slot="action-toolbar">Copy</cds-button>
<cds-button slot="action-toolbar" aria-label="Settings" has-icon-only="true" kind=${BUTTON_KIND.GHOST} size="sm" tooltip-text="Settings">
${Settings({ slot: 'icon' })}
</cds-button>
<cds-button slot="action-toolbar" aria-label="Delete" has-icon-only="true" kind=${BUTTON_KIND.GHOST} size="sm" tooltip-text="Delete">
${Trashcan({ slot: 'icon' })}
</cds-button>

<!-- Side panel actions optional -->
<cds-button slot="actions" kind=${BUTTON_KIND.GHOST}>Ghost</cds-button>
<cds-button slot="actions" kind=${BUTTON_KIND.PRIMARY}></cds-button>
</cds-side-panel>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!--
@license

Copyright IBM Corp. 2020

This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<html>

<head>
<title>carbon-web-components example</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css" />

<link rel="stylesheet" href="src/styles.scss" />
<style>
/* Suppress custom element until styles are loaded */
cds-side-panel:not(:defined) {
display: none;
}
</style>
<script type="module" src="src/index.js"></script>
</head>

<body>
<cds-side-panel include-overlay open label-text="An optional label" size="md" title="A title, can be omitted">
<!-- Content -->
<h5>Side panel content</h5>
<div class="${storyPrefix}text-inputs">
<cds-text-input label="Input A" id="side-panel-story-text-input-a"></cds-text-input>
<cds-text-input label="Input B" id="side-panel-story-text-input-b"></cds-text-input>
</div>
<div class="${storyPrefix}text-inputs">
<cds-text-input label="Input C" id="side-panel-story-text-input-c"></cds-text-input>
<cds-text-input label="Input D" id="side-panel-story-text-input-d"></cds-text-input>
</div>
<div class="${storyPrefix}textarea-container">
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
</div>

<!-- subtitle optional -->
<div slot="subtitle">Subtitle text which can provide more detail on the content being displayed.</div>

<!-- Action toolbar optional -->
<cds-button slot="action-toolbar">Copy</cds-button>
<cds-button slot="action-toolbar" aria-label="Settings" has-icon-only="true" kind=${BUTTON_KIND.GHOST} size="sm" tooltip-text="Settings">
${Settings({ slot: 'icon' })}
</cds-button>
<cds-button slot="action-toolbar" aria-label="Delete" has-icon-only="true" kind=${BUTTON_KIND.GHOST} size="sm" tooltip-text="Delete">
${Trashcan({ slot: 'icon' })}
</cds-button>

<!-- Side panel actions optional -->
<cds-button slot="actions" kind=${BUTTON_KIND.GHOST}>Ghost</cds-button>
<cds-button slot="actions" kind=${BUTTON_KIND.PRIMARY}></cds-button>
</cds-side-panel>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "carbon-web-components-side-panel-example",
"version": "0.1.0",
"private": true,
"description": "Sample project for getting started with the Web Components from Carbon.",
"license": "Apache-2",
"main": "index.html",
"scripts": {
"build": "parcel build *.html --no-minify --public-url ./",
"clean": "rimraf node_modules dist .cache",
"start": "parcel index.html --port=9000 --no-hmr"
},
"dependencies": {
"@carbon/styles": "^1.34.0",
"@carbon/web-components": "latest",
"sass": "^1.64.1"
},
"devDependencies": {
"@babel/core": "^7.0.0-0",
"parcel-bundler": "1.12.3",
"rimraf": "^3.0.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"template": "node"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license
*
* Copyright IBM Corp. 2020, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import '@carbon/web-components/es/components/text-input/index.js';
import '@carbon/web-components/es/components/textarea/index.js';
import '@carbon/web-components/es/components/button/index.js';
import '@carbon/web-components/es/components/side-panel/index.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@use '@carbon/styles/scss/reset';
@use '@carbon/styles/scss/theme';
@use '@carbon/styles/scss/themes';

:root {
@include theme.theme(themes.$white);
background-color: var(--cds-background);
color: var(--cds-text-primary);
}
1 change: 1 addition & 0 deletions packages/carbon-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
],
"dependencies": {
"@babel/runtime": "^7.16.3",
"@carbon/ibm-products-styles": "2.20.1",
"@carbon/styles": "1.48.1",
"flatpickr": "4.6.1",
"lit": "^2.7.6",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2020, 2023
* Copyright IBM Corp. 2020, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -25,7 +25,7 @@ class CDSButtonSet extends LitElement {
*
* @private
*/
private _handleSlotChange(event: Event) {
protected _handleSlotChange(event: Event) {
const childItems = (event.target as HTMLSlotElement)
.assignedNodes()
.filter((elem) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright IBM Corp. 2019, 2023
// Copyright IBM Corp. 2019, 2024
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -103,7 +103,8 @@ $css--plex: true !default;
outline: none;
}

:host(#{$prefix}-button-set) {
:host(#{$prefix}-button-set),
:host(#{$prefix}-side-panel-button-set) {
@extend .#{$prefix}--btn-set;

::slotted(#{$prefix}-button) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* @license
*
* Copyright IBM Corp. 2023, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* Modal size.
*/
export enum SIDE_PANEL_SIZE {
/**
* Extra small size.
*/
EXTRA_SMALL = 'xs',

/**
* Small size.
*/
SMALL = 'sm',

/**
* Medium size.
*/
MEDIUM = 'md',

/**
* Large size.
*/
LARGE = 'lg',

/**
* 2X-Large size.
*/
EXTRA_EXTRA_LARGE = '2xl',
}

export enum SIDE_PANEL_PLACEMENT {
/** right / default */
RIGHT = 'right',

/** left */
LEFT = 'left',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license
*
* Copyright IBM Corp. 2023, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import './side-panel';
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
*
* Copyright IBM Corp. 2020, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { customElement } from 'lit/decorators.js';
import { prefix } from '../../globals/settings';
import CDSButtonSet from '../button/button-set';

/**
* Button set.
*
* @element cds-side-panel-button-set
*/
@customElement(`${prefix}-side-panel-button-set`)
class CDSSidePanelButtonSet extends CDSButtonSet {
_handleSlotChange() {
// do not re-order button set
return;
}
}

/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */
export default CDSSidePanelButtonSet;
Loading
Loading