-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-patternhub-next-previous
- Loading branch information
Showing
47 changed files
with
1,187 additions
and
74 deletions.
There are no files selected for viewing
Binary file added
BIN
+2.45 KB
__snapshots__/stack/component/chromium/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.55 KB
__snapshots__/stack/component/firefox/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.45 KB
__snapshots__/stack/component/mobile-chrome/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.3 KB
__snapshots__/stack/patternhub/stack-overview-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.8 KB
__snapshots__/stack/patternhub/stack-properties-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+126 KB
...hContrast/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+148 KB
.../chromium/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+272 KB
...e/firefox/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+200 KB
...le-chrome/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+194 KB
...le-safari/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+156 KB
...se/webkit/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Angular | ||
|
||
For general installation and configuration take a look at the [ngx-components](https://www.npmjs.com/package/@db-ui/ngx-components) package. | ||
|
||
### Load component | ||
|
||
```ts app.component.ts | ||
// app.component.ts | ||
import { DBStack } from '@db-ui/ngx-components'; | ||
|
||
@Component({ | ||
// ... | ||
standalone: true, | ||
imports: [..., DBStack], | ||
// ... | ||
}) | ||
``` | ||
|
||
### Use component | ||
|
||
```html app.component.html | ||
<!-- app.component.html --> | ||
<db-stack> | ||
<span>Test 1</span> | ||
<span>Test 2</span> | ||
<span>Test 3</span> | ||
</db-stack> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## HTML | ||
|
||
For general installation and configuration take a look at the [components](https://www.npmjs.com/package/@db-ui/components) package. | ||
|
||
### Use component | ||
|
||
```html index.html | ||
<!-- index.html --> | ||
... | ||
<body> | ||
<div class="db-stack"> | ||
<span>Test 1</span> | ||
<span>Test 2</span> | ||
<span>Test 3</span> | ||
</div> | ||
</body> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## General | ||
|
||
> **Note** | ||
> For a general installation or migration process check out this [documentation](https://www.npmjs.com/package/@db-ui/components). | ||
## DB UI Core ➡ DB UI Components | ||
|
||
New Component 🥳 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## React | ||
|
||
For general installation and configuration take a look at the [react-components](https://www.npmjs.com/package/@db-ui/react-components) package. | ||
|
||
### Use component | ||
|
||
```tsx App.tsx | ||
// App.tsx | ||
import { DBStack } from "@db-ui/react-components"; | ||
|
||
const App = () => ( | ||
<DBStack> | ||
<span>Test 1</span> | ||
<span>Test 2</span> | ||
<span>Test 3</span> | ||
</DBStack> | ||
); | ||
|
||
export default App; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Vue | ||
|
||
For general installation and configuration take a look at the [v-components](https://www.npmjs.com/package/@db-ui/v-components) package. | ||
|
||
### Use component | ||
|
||
```vue App.vue | ||
<!-- App.vue --> | ||
<script> | ||
import { DBStack } from "@db-ui/v-components"; | ||
</script> | ||
<template> | ||
<DBStack> | ||
<span>Test 1</span> | ||
<span>Test 2</span> | ||
<span>Test 3</span> | ||
</DBStack> | ||
</template> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>DBStack</title> | ||
<link rel="stylesheet" href="/styles/db-ui-42.css" /> | ||
</head> | ||
<body style="padding: var(--db-spacing-fixed-md)"> | ||
<div class="db-stack">Test</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as DBStack } from './stack'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { GapSpacingProps, GlobalProps, GlobalState } from '../../shared/model'; | ||
|
||
export const StackVariantList = ['simple', 'divider'] as const; | ||
export type StackVariantType = (typeof StackVariantList)[number]; | ||
|
||
export const StackDirectionList = ['row', 'column'] as const; | ||
export type StackDirectionType = (typeof StackDirectionList)[number]; | ||
|
||
export const StackAlignmentList = [ | ||
'stretch', | ||
'start', | ||
'end', | ||
'center' | ||
] as const; | ||
export type StackAlignmentType = (typeof StackAlignmentList)[number]; | ||
|
||
export const StackJustifyContentList = [ | ||
'space-between', | ||
'start', | ||
'end', | ||
'center' | ||
] as const; | ||
export type StackJustifyContentType = (typeof StackJustifyContentList)[number]; | ||
|
||
export type DBStackDefaultProps = { | ||
/** | ||
* Change variant of stack. To use variant="divider" add a DBDivider after each element | ||
*/ | ||
variant?: StackVariantType; | ||
/** | ||
* Set the direction of the stack. Defaults to "column" | ||
*/ | ||
direction?: StackDirectionType; | ||
/** | ||
* If the stack should wrap if parent is too small otherwise you get an overflow | ||
*/ | ||
wrap?: boolean; | ||
/** | ||
* Represents css align-items | ||
*/ | ||
alignment?: StackAlignmentType; | ||
/** | ||
* Represents css justify-content | ||
*/ | ||
justifyContent?: StackJustifyContentType; | ||
}; | ||
|
||
export type DBStackProps = DBStackDefaultProps & GlobalProps & GapSpacingProps; | ||
|
||
export type DBStackDefaultState = {}; | ||
|
||
export type DBStackState = DBStackDefaultState & GlobalState; |
1 change: 1 addition & 0 deletions
1
packages/components/src/components/stack/stack-web-component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@forward "stack"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Show, useMetadata, useRef, useStore } from '@builder.io/mitosis'; | ||
import { DBStackState, DBStackProps } from './model'; | ||
import { cls, getBooleanAsString } from '../../utils'; | ||
|
||
useMetadata({}); | ||
|
||
export default function DBStack(props: DBStackProps) { | ||
// This is used as forwardRef | ||
const ref = useRef<HTMLDivElement>(null); | ||
// jscpd:ignore-start | ||
const state = useStore<DBStackState>({}); | ||
// jscpd:ignore-end | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
id={props.id} | ||
class={cls('db-stack', props.className)} | ||
data-gap={props.gap} | ||
data-variant={props.variant} | ||
data-direction={props.direction} | ||
data-alignment={props.alignment} | ||
data-justify-content={props.justifyContent} | ||
data-wrap={getBooleanAsString(props.wrap)}> | ||
{props.children} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@use "../../styles/stack-components"; | ||
|
||
.db-stack { | ||
@extend %default-stack; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
import AxeBuilder from '@axe-core/playwright'; | ||
|
||
import { DBStack } from './index'; | ||
// @ts-ignore - vue can only find it with .ts as file ending | ||
import { DEFAULT_VIEWPORT } from '../../shared/constants.ts'; | ||
|
||
const comp: any = ( | ||
<DBStack> | ||
<span>Test</span> | ||
<span>Test 2</span> | ||
<span>Test 3</span> | ||
</DBStack> | ||
); | ||
|
||
const testComponent = () => { | ||
test('should contain text', async ({ mount }) => { | ||
const component = await mount(comp); | ||
await expect(component).toContainText('Test'); | ||
}); | ||
|
||
test('should match screenshot', async ({ mount }) => { | ||
const component = await mount(comp); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
}; | ||
|
||
const testA11y = () => { | ||
test('should not have any A11y issues', async ({ page, mount }) => { | ||
await mount(comp); | ||
const accessibilityScanResults = await new AxeBuilder({ page }) | ||
.include('.db-stack') | ||
.analyze(); | ||
|
||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}; | ||
|
||
test.describe('DBStack', () => { | ||
test.use({ viewport: DEFAULT_VIEWPORT }); | ||
testComponent(); | ||
testA11y(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$custom-elements: // angular-workaround | ||
db-stack, db-switch, db-tab-panel, db-tabs, db-tab-list, db-tab-item, | ||
db-tab-bar, db-tooltip, db-popover, db-textarea, db-navigation, | ||
db-accordion-item, db-accordion, db-badge, db-navigation-item, db-tag, | ||
db-radio, db-select, db-notification, db-codedocs, db-brand, db-button, | ||
db-card, db-checkbox, db-divider, db-drawer, db-header, db-icon, db-infotext, | ||
db-input, db-link, db-page, db-section, db-tab, db-tabbar; |
Oops, something went wrong.