1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Migrate libs/tools/card to be owned by DIRT (#14987)

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith
2025-05-30 09:37:08 +02:00
committed by GitHub
parent 949e9b14ab
commit 0f6d4a92d7
26 changed files with 40 additions and 39 deletions

View File

@@ -1,5 +0,0 @@
## Tools Card
Package name: `@bitwarden/tools-card`
Generic Tools Card Component

View File

@@ -1,13 +0,0 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../../../shared/tsconfig.spec");
/** @type {import('jest').Config} */
module.exports = {
testMatch: ["**/+(*.)+(spec).+(ts)"],
preset: "jest-preset-angular",
setupFilesAfterEnv: ["<rootDir>/test.setup.ts"],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/../../",
}),
};

View File

@@ -1,20 +0,0 @@
{
"name": "@bitwarden/tools-card",
"version": "0.0.0",
"description": "Angular card component",
"keywords": [
"bitwarden"
],
"author": "Bitwarden Inc.",
"homepage": "https://bitwarden.com",
"repository": {
"type": "git",
"url": "https://github.com/bitwarden/clients"
},
"license": "GPL-3.0",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch"
}
}

View File

@@ -1,7 +0,0 @@
<div class="tw-flex-col">
<span bitTypography="body2" class="tw-flex tw-text-muted">{{ title }}</span>
<div class="tw-flex tw-items-baseline tw-gap-2">
<span bitTypography="h1">{{ value }}</span>
<span bitTypography="body2">{{ "cardMetrics" | i18n: maxValue }}</span>
</div>
</div>

View File

@@ -1,32 +0,0 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { CommonModule } from "@angular/common";
import { Component, Input } from "@angular/core";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { TypographyModule } from "@bitwarden/components";
@Component({
selector: "tools-card",
templateUrl: "./card.component.html",
standalone: true,
imports: [CommonModule, TypographyModule, JslibModule],
host: {
class:
"tw-box-border tw-bg-background tw-block tw-text-main tw-border-solid tw-border tw-border-secondary-300 tw-border [&:not(bit-layout_*)]:tw-rounded-lg tw-rounded-lg tw-p-6",
},
})
export class CardComponent {
/**
* The title of the card
*/
@Input() title: string;
/**
* The current value of the card as emphasized text
*/
@Input() value: number;
/**
* The maximum value of the card
*/
@Input() maxValue: number;
}

View File

@@ -1,36 +0,0 @@
import { CommonModule } from "@angular/common";
import { Meta, StoryObj, moduleMetadata } from "@storybook/angular";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { I18nMockService, TypographyModule } from "@bitwarden/components";
import { CardComponent } from "./card.component";
export default {
title: "Tools/Card",
component: CardComponent,
decorators: [
moduleMetadata({
imports: [CardComponent, CommonModule, TypographyModule],
providers: [
{
provide: I18nService,
useFactory: () =>
new I18nMockService({
cardMetrics: (value) => `out of ${value}`,
}),
},
],
}),
],
} as Meta;
type Story = StoryObj<CardComponent>;
export const Default: Story = {
render: (args) => ({
props: args,
template: /*html*/ `
<tools-card [title]="'Unsecured Members'" [value]="'38'" [maxValue]="'157'"></tools-card>`,
}),
};

View File

@@ -1 +0,0 @@
export { CardComponent } from "./card.component";

View File

@@ -1 +0,0 @@
import "@bitwarden/ui-common/setup-jest";

View File

@@ -1,17 +0,0 @@
{
"extends": "../../shared/tsconfig",
"compilerOptions": {
"paths": {
"@bitwarden/admin-console/common": ["../../admin-console/src/common"],
"@bitwarden/angular/*": ["../../angular/src/*"],
"@bitwarden/auth/common": ["../../auth/src/common"],
"@bitwarden/common/*": ["../../common/src/*"],
"@bitwarden/components": ["../../components/src"],
"@bitwarden/key-management": ["../../key-management/src"],
"@bitwarden/platform": ["../../platform/src"],
"@bitwarden/ui-common": ["../../ui/common/src"]
}
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -1,6 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"files": ["./test.setup.ts"],
"exclude": ["node_modules", "dist"]
}