Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Dec 12, 2023
2 parents f045860 + 8b405fa commit 9b2960e
Show file tree
Hide file tree
Showing 61 changed files with 7,016 additions and 2,527 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum Operator implements Converter<String, SelectorCriteria> {
public SelectorCriteria convert(@Nullable String selector) {
if (preFlightCheck(selector, 3)) {
var i = selector.indexOf(getOperator());
if (i > 0 && (i + getOperator().length()) < selector.length() - 1) {
if (i > 0 && (i + getOperator().length()) <= selector.length() - 1) {
String key = selector.substring(0, i);
String value = selector.substring(i + getOperator().length());
return new SelectorCriteria(key, this, Set.of(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ record TestCase(String source, Operator converter, SelectorCriteria expected) {
new TestCase("name=", Equals, null),
new TestCase("name=value", Equals,
new SelectorCriteria("name", Equals, Set.of("value"))),
new TestCase("name=v", Equals,
new SelectorCriteria("name", Equals, Set.of("v"))),

new TestCase("", NotEquals, null),
new TestCase("=", NotEquals, null),
Expand Down Expand Up @@ -59,4 +61,4 @@ record TestCase(String source, Operator converter, SelectorCriteria expected) {
assertEquals(testCase.expected(), testCase.converter().convert(testCase.source()));
});
}
}
}
1 change: 1 addition & 0 deletions console/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
extends: ["plugin:cypress/recommended"],
},
],
ignorePatterns: ["!.storybook"],
parserOptions: {
ecmaVersion: "latest",
},
Expand Down
1 change: 1 addition & 0 deletions console/packages/components/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.storybook
2 changes: 1 addition & 1 deletion console/packages/components/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ["../../.eslintrc.cjs"],
extends: ["../../.eslintrc.cjs", "plugin:storybook/recommended"],
};
19 changes: 19 additions & 0 deletions console/packages/components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from "@storybook/vue3-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-styling",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config;
19 changes: 19 additions & 0 deletions console/packages/components/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Preview } from "@storybook/vue3";

import "../src/styles/tailwind.css";
import "overlayscrollbars/overlayscrollbars.css";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
layout: "padded",
},
};

export default preview;
2 changes: 2 additions & 0 deletions console/packages/components/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


/// <reference types="vite/client" />
/// <reference types="histoire" />
/// <reference types="unplugin-icons/types/vue" />
Expand Down
22 changes: 0 additions & 22 deletions console/packages/components/histoire.config.ts

This file was deleted.

23 changes: 17 additions & 6 deletions console/packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"test:unit:ui": "vitest --environment jsdom --watch --ui",
"test:unit:coverage": "vitest run --environment jsdom --coverage",
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"story:dev": "histoire dev --port 4000",
"story:build": "histoire build",
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'"
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"keywords": [
"halo",
Expand All @@ -44,9 +44,20 @@
"homepage": "https://github.com/halo-dev/halo/tree/main/console/packages/components#readme",
"license": "MIT",
"devDependencies": {
"@histoire/plugin-vue": "^0.11.7",
"@iconify-json/ri": "^1.1.4",
"histoire": "^0.11.7",
"@iconify-json/ri": "^1.1.15",
"@storybook/addon-essentials": "^7.6.3",
"@storybook/addon-interactions": "^7.6.3",
"@storybook/addon-links": "^7.6.3",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.6.3",
"@storybook/testing-library": "^0.0.14-next.2",
"@storybook/vue3": "^7.6.3",
"@storybook/vue3-vite": "^7.6.3",
"eslint-plugin-storybook": "^0.6.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.6.3",
"unplugin-icons": "^0.14.15",
"vite-plugin-dts": "^2.3.0"
},
"peerDependencies": {
Expand Down
68 changes: 68 additions & 0 deletions console/packages/components/src/components/alert/Alert.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import { VAlert } from ".";

const meta: Meta<typeof VAlert> = {
title: "Alert",
component: VAlert,
tags: ["autodocs"],
render: (args) => ({
components: { VAlert },
setup() {
return { args };
},
template: `<VAlert v-bind="args"></VAlert>`,
}),
argTypes: {
type: {
control: { type: "select" },
options: ["default", "success", "info", "warning", "error"],
},
closable: {
control: { type: "boolean" },
},
},
};

export default meta;
type Story = StoryObj<typeof VAlert>;

export const Default: Story = {
args: {
type: "default",
title: "default",
description: "Halo",
},
};

export const Success: Story = {
args: {
type: "success",
title: "success",
description: "Halo",
},
};

export const Info: Story = {
args: {
type: "info",
title: "info",
description: "Halo",
},
};

export const Warning: Story = {
args: {
type: "warning",
title: "warning",
description: "Halo",
},
};

export const Error: Story = {
args: {
type: "error",
title: "error",
description: "Halo",
},
};
91 changes: 0 additions & 91 deletions console/packages/components/src/components/alert/Alert.story.vue

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import { VAvatar } from ".";

const meta: Meta<typeof VAvatar> = {
title: "Avatar",
component: VAvatar,
tags: ["autodocs"],
render: (args) => ({
components: { VAvatar },
setup() {
return { args };
},
template: `<VAvatar v-bind="args" />`,
}),
argTypes: {
size: {
control: { type: "select" },
options: ["lg", "md", "sm", "xs"],
defaultValue: "md",
},
},
};

export default meta;
type Story = StoryObj<typeof VAvatar>;

export const Default: Story = {
args: {
src: "https://halo.run/logo",
alt: "Hello",
},
};

export const Circle: Story = {
args: {
src: "https://halo.run/logo",
alt: "Hello",
circle: true,
},
};

export const Text: Story = {
args: {
alt: "Ryan Wang",
},
};
Loading

0 comments on commit 9b2960e

Please sign in to comment.