Skip to content

Commit

Permalink
add data grid as a new component
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdholt committed Mar 12, 2021
1 parent 3b3e2a7 commit f663ec4
Show file tree
Hide file tree
Showing 9 changed files with 651 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "add data grid as a new web component",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch"
}
24 changes: 24 additions & 0 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import { Checkbox } from '@microsoft/fast-foundation';
import { ColorRGBA64 } from '@microsoft/fast-colors';
import { Combobox } from '@microsoft/fast-foundation';
import { CSSCustomPropertyBehavior } from '@microsoft/fast-foundation';
import { DataGrid } from '@microsoft/fast-foundation';
import { DataGridCell } from '@microsoft/fast-foundation';
import { DataGridRow } from '@microsoft/fast-foundation';
import { DesignSystemProvider } from '@microsoft/fast-foundation';
import { Dialog } from '@microsoft/fast-foundation';
import { Direction } from '@microsoft/fast-web-utilities';
Expand Down Expand Up @@ -261,6 +264,15 @@ export const ComboboxStyles: import("@microsoft/fast-element").ElementStyles;
// @public
export function createColorPalette(baseColor: any): string[];

// @public
export const DataGridCellStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export const DataGridRowStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export const DataGridStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export interface DesignSystem {
accentBaseColor: string;
Expand Down Expand Up @@ -473,6 +485,18 @@ export class FluentCombobox extends Combobox {
connectedCallback(): void;
}

// @public
export class FluentDataGrid extends DataGrid {
}

// @public
export class FluentDataGridCell extends DataGridCell {
}

// @public
export class FluentDataGridRow extends DataGridRow {
}

// @public
export type FluentDesignSystem = Omit<DesignSystem, 'contrast' | 'fontWeight' | 'neutralForegroundDarkIndex' | 'neutralForegroundLightIndex'>;

Expand Down
50 changes: 50 additions & 0 deletions packages/web-components/src/data-grid/data-grid-cell.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { css } from '@microsoft/fast-element';
import { SystemColors } from '@microsoft/fast-web-utilities';
import { focusVisible, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
import { neutralFocusBehavior, neutralForegroundActiveBehavior, neutralForegroundRestBehavior } from '../styles';

export const DataGridCellStyles = css`
:host {
padding: calc(var(--design-unit) * 1px) calc(var(--design-unit) * 3px);
color: ${neutralForegroundRestBehavior.var};
box-sizing: border-box;
font-family: var(--body-font);
font-size: var(--type-ramp-base-font-size);
line-height: var(--type-ramp-base-line-height);
font-weight: 400;
border: transparent calc(var(--outline-width) * 1px) solid;
overflow: hidden;
white-space: nowrap;
border-radius: calc(var(--corner-radius) * 1px);
}
:host(.column-header) {
font-weight: 600;
}
:host(:${focusVisible}) {
border: ${neutralFocusBehavior.var} calc(var(--outline-width) * 1px) solid;
color: ${neutralForegroundActiveBehavior.var};
}
`.withBehaviors(
neutralFocusBehavior,
neutralForegroundActiveBehavior,
neutralForegroundRestBehavior,
forcedColorsStylesheetBehavior(
css`
:host {
forced-color-adjust: none;
border-color: transparent;
background: ${SystemColors.Field};
color: ${SystemColors.FieldText};
}
:host(:${focusVisible}) {
border-color: ${SystemColors.FieldText};
box-shadow: 0 0 0 2px inset ${SystemColors.Field};
color: ${SystemColors.FieldText};
}
`,
),
);
31 changes: 31 additions & 0 deletions packages/web-components/src/data-grid/data-grid-row.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { css } from '@microsoft/fast-element';
import { forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
import { neutralDividerRestBehavior, neutralFillRestBehavior } from '../styles';

export const DataGridRowStyles = css`
:host {
display: grid;
padding: 1px 0;
box-sizing: border-box;
width: 100%;
border-bottom: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest);
}
:host(.header) {
}
:host(.sticky-header) {
background: ${neutralFillRestBehavior.var};
position: sticky;
top: 0;
}
`.withBehaviors(
neutralDividerRestBehavior,
neutralFillRestBehavior,
forcedColorsStylesheetBehavior(
css`
:host {
}
`,
),
);
Loading

0 comments on commit f663ec4

Please sign in to comment.