@d-zero/custom-components 5.0.0-alpha.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/hamburger-menu.d.ts +32 -0
- package/dist/hamburger-menu.d.ts.map +1 -0
- package/dist/hamburger-menu.js +151 -0
- package/dist/hamburger-menu.stories.d.ts +126 -0
- package/dist/hamburger-menu.stories.d.ts.map +1 -0
- package/dist/hamburger-menu.stories.js +168 -0
- package/dist/style-values.d.ts +5 -0
- package/dist/style-values.d.ts.map +1 -0
- package/dist/style-values.js +11 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# custom-components
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class HamburgerMenu extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
get lineCount(): number;
|
|
4
|
+
set lineCount(value: number);
|
|
5
|
+
constructor();
|
|
6
|
+
attributeChangedCallback(name: string, _: string, newValue: string): void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
static defaultStyle: Readonly<{
|
|
9
|
+
readonly lineCount: 3;
|
|
10
|
+
readonly lineWidthValue: 80;
|
|
11
|
+
readonly lineWidthUnit: "cqi";
|
|
12
|
+
readonly lineHeightValue: 2;
|
|
13
|
+
readonly lineHeightUnit: "px";
|
|
14
|
+
readonly lineColor: "currentColor";
|
|
15
|
+
readonly borderRadiusValue: 0;
|
|
16
|
+
readonly borderRadiusUnit: "px";
|
|
17
|
+
readonly borderWidthValue: 1;
|
|
18
|
+
readonly borderWidthUnit: "px";
|
|
19
|
+
readonly borderStyle: "solid";
|
|
20
|
+
readonly borderColor: "currentColor";
|
|
21
|
+
readonly paddingBlockValue: 25;
|
|
22
|
+
readonly paddingBlockUnit: "cqi";
|
|
23
|
+
readonly paddingInlineValue: 20;
|
|
24
|
+
readonly paddingInlineUnit: "cqi";
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param prefix
|
|
30
|
+
*/
|
|
31
|
+
export declare function defineHamburgerMenu(prefix: string): string;
|
|
32
|
+
//# sourceMappingURL=hamburger-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hamburger-menu.d.ts","sourceRoot":"","sources":["../src/hamburger-menu.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAc,SAAQ,WAAW;;IAK7C,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAW1B;;IASD,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAUlE,iBAAiB;IA8FjB,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;OAiBP;CACZ;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM1D"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
export class HamburgerMenu extends HTMLElement {
|
|
3
|
+
#button = null;
|
|
4
|
+
#lineCount;
|
|
5
|
+
#slot = null;
|
|
6
|
+
get lineCount() {
|
|
7
|
+
return this.#lineCount;
|
|
8
|
+
}
|
|
9
|
+
set lineCount(value) {
|
|
10
|
+
if (value < 1) {
|
|
11
|
+
throw new RangeError('lineCount must be greater than 0');
|
|
12
|
+
}
|
|
13
|
+
if (Math.floor(value) !== value) {
|
|
14
|
+
throw new TypeError('lineCount must be an integer');
|
|
15
|
+
}
|
|
16
|
+
this.#lineCount = value;
|
|
17
|
+
this.setAttribute('line-count', value.toString());
|
|
18
|
+
this.#render();
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.attachShadow({ mode: 'open' });
|
|
23
|
+
this.#lineCount = 3;
|
|
24
|
+
this.#render();
|
|
25
|
+
}
|
|
26
|
+
attributeChangedCallback(name, _, newValue) {
|
|
27
|
+
switch (name) {
|
|
28
|
+
case 'line-count': {
|
|
29
|
+
this.#lineCount = Number.parseInt(newValue);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this.#render();
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
this.#slot?.addEventListener('slotchange', () => {
|
|
37
|
+
const realNodes = this.#slot?.assignedNodes({ flatten: true });
|
|
38
|
+
const dialog = realNodes?.find((node) => node instanceof HTMLDialogElement);
|
|
39
|
+
if (dialog) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
this.#button.commandForElement = dialog;
|
|
42
|
+
const closeButton = dialog.querySelector('button[command="close"]');
|
|
43
|
+
if (closeButton) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
closeButton.commandForElement = dialog;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
#render() {
|
|
51
|
+
this.shadowRoot.innerHTML = `
|
|
52
|
+
<style>
|
|
53
|
+
:is(:host, *) {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
:host {
|
|
57
|
+
--line-width: ${_a.defaultStyle.lineWidthValue}${_a.defaultStyle.lineWidthUnit};
|
|
58
|
+
--line-height: ${_a.defaultStyle.lineHeightValue}${_a.defaultStyle.lineHeightUnit};
|
|
59
|
+
--line-color: ${_a.defaultStyle.lineColor};
|
|
60
|
+
--border-radius: ${_a.defaultStyle.borderRadiusValue}${_a.defaultStyle.borderRadiusUnit};
|
|
61
|
+
--border-width: ${_a.defaultStyle.borderWidthValue}${_a.defaultStyle.borderWidthUnit};
|
|
62
|
+
--border-style: ${_a.defaultStyle.borderStyle};
|
|
63
|
+
--border-color: ${_a.defaultStyle.borderColor};
|
|
64
|
+
--padding-block: ${_a.defaultStyle.paddingBlockValue}${_a.defaultStyle.paddingBlockUnit};
|
|
65
|
+
--padding-inline: ${_a.defaultStyle.paddingInlineValue}${_a.defaultStyle.paddingInlineUnit};
|
|
66
|
+
container: hamburger-menu / inline-size;
|
|
67
|
+
display: block;
|
|
68
|
+
inline-size: 5em;
|
|
69
|
+
block-size: 5em;
|
|
70
|
+
}
|
|
71
|
+
button {
|
|
72
|
+
display: block;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
border: none;
|
|
76
|
+
background: none;
|
|
77
|
+
padding: 0;
|
|
78
|
+
margin: 0;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
border-radius: var(--border-radius);
|
|
81
|
+
border: var(--border-width) var(--border-style, solid) var(--border-color);
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
appearance: none;
|
|
84
|
+
-webkit-appearance: none;
|
|
85
|
+
-moz-appearance: none;
|
|
86
|
+
-ms-appearance: none;
|
|
87
|
+
|
|
88
|
+
> span {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
align-items: center;
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
padding: var(--padding-block) var(--padding-inline);
|
|
96
|
+
|
|
97
|
+
> span {
|
|
98
|
+
display: block;
|
|
99
|
+
width: var(--line-width);
|
|
100
|
+
max-width: 100%;
|
|
101
|
+
height: var(--line-height);
|
|
102
|
+
flex: 0 0 var(--line-height);
|
|
103
|
+
background-color: var(--line-color);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
108
|
+
<button type="button" aria-label="メニュー" command="show-modal">
|
|
109
|
+
<span>
|
|
110
|
+
${Array.from({ length: this.#lineCount })
|
|
111
|
+
.map(() => `<span></span>`)
|
|
112
|
+
.join('')}
|
|
113
|
+
</span>
|
|
114
|
+
</button>
|
|
115
|
+
<slot></slot>
|
|
116
|
+
`;
|
|
117
|
+
this.#button = this.shadowRoot.querySelector('button');
|
|
118
|
+
this.#slot = this.shadowRoot.querySelector('slot');
|
|
119
|
+
this.connectedCallback();
|
|
120
|
+
}
|
|
121
|
+
static defaultStyle = Object.freeze({
|
|
122
|
+
lineCount: 3,
|
|
123
|
+
lineWidthValue: 80,
|
|
124
|
+
lineWidthUnit: 'cqi',
|
|
125
|
+
lineHeightValue: 2,
|
|
126
|
+
lineHeightUnit: 'px',
|
|
127
|
+
lineColor: 'currentColor',
|
|
128
|
+
borderRadiusValue: 0,
|
|
129
|
+
borderRadiusUnit: 'px',
|
|
130
|
+
borderWidthValue: 1,
|
|
131
|
+
borderWidthUnit: 'px',
|
|
132
|
+
borderStyle: 'solid',
|
|
133
|
+
borderColor: 'currentColor',
|
|
134
|
+
paddingBlockValue: 25,
|
|
135
|
+
paddingBlockUnit: 'cqi',
|
|
136
|
+
paddingInlineValue: 20,
|
|
137
|
+
paddingInlineUnit: 'cqi',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
_a = HamburgerMenu;
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param prefix
|
|
144
|
+
*/
|
|
145
|
+
export function defineHamburgerMenu(prefix) {
|
|
146
|
+
const tagName = `${prefix}-hamburger-menu`;
|
|
147
|
+
if (!customElements.get(tagName)) {
|
|
148
|
+
customElements.define(tagName, HamburgerMenu);
|
|
149
|
+
}
|
|
150
|
+
return tagName;
|
|
151
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/web-components';
|
|
2
|
+
import { HamburgerMenu } from './hamburger-menu.js';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: string;
|
|
6
|
+
argTypes: {
|
|
7
|
+
lineCount: {
|
|
8
|
+
control: "number";
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
defaultValue: 3;
|
|
12
|
+
min: number;
|
|
13
|
+
};
|
|
14
|
+
lineColor: {
|
|
15
|
+
control: "color";
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
defaultValue: "currentColor";
|
|
19
|
+
};
|
|
20
|
+
lineWidthValue: {
|
|
21
|
+
control: "number";
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
defaultValue: 80;
|
|
25
|
+
step: number;
|
|
26
|
+
min: number;
|
|
27
|
+
};
|
|
28
|
+
lineWidthUnit: {
|
|
29
|
+
control: "select";
|
|
30
|
+
name: string;
|
|
31
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
32
|
+
description: string;
|
|
33
|
+
defaultValue: "cqi";
|
|
34
|
+
};
|
|
35
|
+
lineHeightValue: {
|
|
36
|
+
control: "number";
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
defaultValue: 2;
|
|
40
|
+
step: number;
|
|
41
|
+
min: number;
|
|
42
|
+
};
|
|
43
|
+
lineHeightUnit: {
|
|
44
|
+
control: "select";
|
|
45
|
+
name: string;
|
|
46
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
47
|
+
description: string;
|
|
48
|
+
defaultValue: "px";
|
|
49
|
+
};
|
|
50
|
+
borderRadiusValue: {
|
|
51
|
+
control: "number";
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
defaultValue: 0;
|
|
55
|
+
min: number;
|
|
56
|
+
};
|
|
57
|
+
borderRadiusUnit: {
|
|
58
|
+
control: "select";
|
|
59
|
+
name: string;
|
|
60
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
61
|
+
description: string;
|
|
62
|
+
defaultValue: "px";
|
|
63
|
+
};
|
|
64
|
+
borderWidthValue: {
|
|
65
|
+
control: "number";
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
defaultValue: 1;
|
|
69
|
+
min: number;
|
|
70
|
+
};
|
|
71
|
+
borderWidthUnit: {
|
|
72
|
+
control: "select";
|
|
73
|
+
name: string;
|
|
74
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
75
|
+
description: string;
|
|
76
|
+
defaultValue: "px";
|
|
77
|
+
};
|
|
78
|
+
borderStyle: {
|
|
79
|
+
control: "select";
|
|
80
|
+
name: string;
|
|
81
|
+
options: readonly ["solid", "dashed", "dotted", "double", "groove", "ridge", "inset", "outset"];
|
|
82
|
+
description: string;
|
|
83
|
+
defaultValue: "solid";
|
|
84
|
+
};
|
|
85
|
+
borderColor: {
|
|
86
|
+
control: "color";
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
defaultValue: "currentColor";
|
|
90
|
+
};
|
|
91
|
+
paddingBlockValue: {
|
|
92
|
+
control: "number";
|
|
93
|
+
name: string;
|
|
94
|
+
description: string;
|
|
95
|
+
defaultValue: 25;
|
|
96
|
+
min: number;
|
|
97
|
+
};
|
|
98
|
+
paddingBlockUnit: {
|
|
99
|
+
control: "select";
|
|
100
|
+
name: string;
|
|
101
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
102
|
+
description: string;
|
|
103
|
+
defaultValue: "cqi";
|
|
104
|
+
};
|
|
105
|
+
paddingInlineValue: {
|
|
106
|
+
control: "number";
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
defaultValue: 20;
|
|
110
|
+
min: number;
|
|
111
|
+
};
|
|
112
|
+
paddingInlineUnit: {
|
|
113
|
+
control: "select";
|
|
114
|
+
name: string;
|
|
115
|
+
options: readonly ["em", "px", "rem", "cqi", "%"];
|
|
116
|
+
description: string;
|
|
117
|
+
defaultValue: "cqi";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
render(args: import("@storybook/web-components").Args): HamburgerMenu;
|
|
121
|
+
};
|
|
122
|
+
export default meta;
|
|
123
|
+
type Story = StoryObj;
|
|
124
|
+
export declare const Default: Story;
|
|
125
|
+
export declare const Pattern01: Story;
|
|
126
|
+
//# sourceMappingURL=hamburger-menu.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hamburger-menu.stories.d.ts","sourceRoot":"","sources":["../src/hamburger-menu.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAuB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAMtB,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { defineHamburgerMenu, HamburgerMenu } from './hamburger-menu.js';
|
|
2
|
+
import { lengthUnits, borderStyles } from './style-values.js';
|
|
3
|
+
// Define the custom element with a prefix upfront
|
|
4
|
+
const tagName = defineHamburgerMenu('x'); // Use 'x' as prefix
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/HamburgerMenu',
|
|
7
|
+
component: tagName,
|
|
8
|
+
argTypes: {
|
|
9
|
+
lineCount: {
|
|
10
|
+
control: 'number',
|
|
11
|
+
name: 'line-count',
|
|
12
|
+
description: 'ハンバーガーメニューの線の数',
|
|
13
|
+
defaultValue: HamburgerMenu.defaultStyle.lineCount,
|
|
14
|
+
min: 1,
|
|
15
|
+
},
|
|
16
|
+
lineColor: {
|
|
17
|
+
control: 'color',
|
|
18
|
+
name: '--line-color',
|
|
19
|
+
description: 'ハンバーガーメニューの線の色',
|
|
20
|
+
defaultValue: HamburgerMenu.defaultStyle.lineColor,
|
|
21
|
+
},
|
|
22
|
+
// --line-width
|
|
23
|
+
lineWidthValue: {
|
|
24
|
+
control: 'number',
|
|
25
|
+
name: '--line-width (数値)',
|
|
26
|
+
description: '線の幅(数値部分)',
|
|
27
|
+
defaultValue: HamburgerMenu.defaultStyle.lineWidthValue,
|
|
28
|
+
step: 0.1, // 細かい調整用
|
|
29
|
+
min: 0,
|
|
30
|
+
},
|
|
31
|
+
lineWidthUnit: {
|
|
32
|
+
control: 'select',
|
|
33
|
+
name: '--line-width (単位)',
|
|
34
|
+
options: lengthUnits,
|
|
35
|
+
description: '線の幅(単位)',
|
|
36
|
+
defaultValue: HamburgerMenu.defaultStyle.lineWidthUnit,
|
|
37
|
+
},
|
|
38
|
+
// --line-height
|
|
39
|
+
lineHeightValue: {
|
|
40
|
+
control: 'number',
|
|
41
|
+
name: '--line-height (数値)',
|
|
42
|
+
description: '線の高さ(数値部分)',
|
|
43
|
+
defaultValue: HamburgerMenu.defaultStyle.lineHeightValue,
|
|
44
|
+
step: 1,
|
|
45
|
+
min: 0,
|
|
46
|
+
},
|
|
47
|
+
lineHeightUnit: {
|
|
48
|
+
control: 'select',
|
|
49
|
+
name: '--line-height (単位)',
|
|
50
|
+
options: lengthUnits,
|
|
51
|
+
description: '線の高さ(単位)',
|
|
52
|
+
defaultValue: HamburgerMenu.defaultStyle.lineHeightUnit,
|
|
53
|
+
},
|
|
54
|
+
borderRadiusValue: {
|
|
55
|
+
control: 'number',
|
|
56
|
+
name: '--border-radius (数値)',
|
|
57
|
+
description: '外枠の角丸(数値部分)',
|
|
58
|
+
defaultValue: HamburgerMenu.defaultStyle.borderRadiusValue,
|
|
59
|
+
min: 0,
|
|
60
|
+
},
|
|
61
|
+
borderRadiusUnit: {
|
|
62
|
+
control: 'select',
|
|
63
|
+
name: '--border-radius (単位)',
|
|
64
|
+
options: lengthUnits,
|
|
65
|
+
description: '外枠の角丸(単位)',
|
|
66
|
+
defaultValue: HamburgerMenu.defaultStyle.borderRadiusUnit,
|
|
67
|
+
},
|
|
68
|
+
borderWidthValue: {
|
|
69
|
+
control: 'number',
|
|
70
|
+
name: '--border-width (数値)',
|
|
71
|
+
description: '外枠の線の太さ(数値部分)',
|
|
72
|
+
defaultValue: HamburgerMenu.defaultStyle.borderWidthValue,
|
|
73
|
+
min: 0,
|
|
74
|
+
},
|
|
75
|
+
borderWidthUnit: {
|
|
76
|
+
control: 'select',
|
|
77
|
+
name: '--border-width (単位)',
|
|
78
|
+
options: lengthUnits,
|
|
79
|
+
description: '外枠の線の太さ(単位)',
|
|
80
|
+
defaultValue: HamburgerMenu.defaultStyle.borderWidthUnit,
|
|
81
|
+
},
|
|
82
|
+
borderStyle: {
|
|
83
|
+
control: 'select',
|
|
84
|
+
name: '--border-style',
|
|
85
|
+
options: borderStyles,
|
|
86
|
+
description: '外枠の線の種類',
|
|
87
|
+
defaultValue: HamburgerMenu.defaultStyle.borderStyle,
|
|
88
|
+
},
|
|
89
|
+
borderColor: {
|
|
90
|
+
control: 'color',
|
|
91
|
+
name: '--border-color',
|
|
92
|
+
description: '外枠の線の色',
|
|
93
|
+
defaultValue: HamburgerMenu.defaultStyle.borderColor,
|
|
94
|
+
},
|
|
95
|
+
paddingBlockValue: {
|
|
96
|
+
control: 'number',
|
|
97
|
+
name: '--padding-block (数値)',
|
|
98
|
+
description: 'パディングの上下(数値部分)',
|
|
99
|
+
defaultValue: HamburgerMenu.defaultStyle.paddingBlockValue,
|
|
100
|
+
min: 0,
|
|
101
|
+
},
|
|
102
|
+
paddingBlockUnit: {
|
|
103
|
+
control: 'select',
|
|
104
|
+
name: '--padding-block (単位)',
|
|
105
|
+
options: lengthUnits,
|
|
106
|
+
description: 'パディングの上下(単位)',
|
|
107
|
+
defaultValue: HamburgerMenu.defaultStyle.paddingBlockUnit,
|
|
108
|
+
},
|
|
109
|
+
paddingInlineValue: {
|
|
110
|
+
control: 'number',
|
|
111
|
+
name: '--padding-inline (数値)',
|
|
112
|
+
description: 'パディングの左右(数値部分)',
|
|
113
|
+
defaultValue: HamburgerMenu.defaultStyle.paddingInlineValue,
|
|
114
|
+
min: 0,
|
|
115
|
+
},
|
|
116
|
+
paddingInlineUnit: {
|
|
117
|
+
control: 'select',
|
|
118
|
+
name: '--padding-inline (単位)',
|
|
119
|
+
options: lengthUnits,
|
|
120
|
+
description: 'パディングの左右(単位)',
|
|
121
|
+
defaultValue: HamburgerMenu.defaultStyle.paddingInlineUnit,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
render(args) {
|
|
125
|
+
const element = document.createElement(tagName);
|
|
126
|
+
element.lineCount = args.lineCount;
|
|
127
|
+
element.style.setProperty('--line-color', args.lineColor);
|
|
128
|
+
element.style.setProperty('--line-width', `${args.lineWidthValue}${args.lineWidthUnit}`);
|
|
129
|
+
element.style.setProperty('--line-h eight', `${args.lineHeightValue}${args.lineHeightUnit}`);
|
|
130
|
+
element.style.setProperty('--border-radius', `${args.borderRadiusValue}${args.borderRadiusUnit}`);
|
|
131
|
+
element.style.setProperty('--border-width', `${args.borderWidthValue}${args.borderWidthUnit}`);
|
|
132
|
+
element.style.setProperty('--border-style', args.borderStyle);
|
|
133
|
+
element.style.setProperty('--border-color', args.borderColor);
|
|
134
|
+
element.style.setProperty('--padding-block', `${args.paddingBlockValue}${args.paddingBlockUnit}`);
|
|
135
|
+
element.style.setProperty('--padding-inline', `${args.paddingInlineValue}${args.paddingInlineUnit}`);
|
|
136
|
+
element.innerHTML = `
|
|
137
|
+
<dialog>
|
|
138
|
+
<h1>メニュー</h1>
|
|
139
|
+
<ul>
|
|
140
|
+
<li><a href="#">項目1</a></li>
|
|
141
|
+
<li><a href="#">項目2</a></li>
|
|
142
|
+
</ul>
|
|
143
|
+
<button command="close">閉じる</button>
|
|
144
|
+
</dialog>
|
|
145
|
+
`;
|
|
146
|
+
return element;
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
export default meta;
|
|
150
|
+
const defaultArgs = Object.fromEntries(Object.entries(meta.argTypes).map(([key, value]) => [key, value.defaultValue]));
|
|
151
|
+
export const Default = {
|
|
152
|
+
args: defaultArgs,
|
|
153
|
+
};
|
|
154
|
+
export const Pattern01 = {
|
|
155
|
+
args: {
|
|
156
|
+
...defaultArgs,
|
|
157
|
+
lineCount: 2,
|
|
158
|
+
lineWidthValue: 100,
|
|
159
|
+
lineHeightValue: 6,
|
|
160
|
+
borderRadiusValue: 5,
|
|
161
|
+
borderWidthValue: 1,
|
|
162
|
+
borderColor: '#000',
|
|
163
|
+
paddingBlockValue: 32,
|
|
164
|
+
paddingBlockUnit: 'cqi',
|
|
165
|
+
paddingInlineValue: 20,
|
|
166
|
+
paddingInlineUnit: 'cqi',
|
|
167
|
+
},
|
|
168
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const lengthUnits: readonly ["em", "px", "rem", "cqi", "%"];
|
|
2
|
+
export type LengthUnit = (typeof lengthUnits)[number];
|
|
3
|
+
export declare const borderStyles: readonly ["solid", "dashed", "dotted", "double", "groove", "ridge", "inset", "outset"];
|
|
4
|
+
export type BorderStyle = (typeof borderStyles)[number];
|
|
5
|
+
//# sourceMappingURL=style-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-values.d.ts","sourceRoot":"","sources":["../src/style-values.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,0CAA2C,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,YAAY,wFASf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@d-zero/custom-components",
|
|
3
|
+
"version": "5.0.0-alpha.45",
|
|
4
|
+
"description": "D-ZERO custom components",
|
|
5
|
+
"author": "D-ZERO",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/d-zero-dev/frontend-env.git"
|
|
9
|
+
},
|
|
10
|
+
"private": false,
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./hamburger-menu": {
|
|
17
|
+
"import": "./dist/hamburger-menu.js",
|
|
18
|
+
"types": "./dist/hamburger-menu.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc --project tsconfig.build.json",
|
|
26
|
+
"dev": "storybook dev -p 6006",
|
|
27
|
+
"storybook": "storybook build"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@chromatic-com/storybook": "3.2.6",
|
|
31
|
+
"@storybook/addon-essentials": "8.6.12",
|
|
32
|
+
"@storybook/blocks": "8.6.12",
|
|
33
|
+
"@storybook/experimental-addon-test": "8.6.12",
|
|
34
|
+
"@storybook/test": "8.6.12",
|
|
35
|
+
"@storybook/web-components": "8.6.12",
|
|
36
|
+
"@storybook/web-components-vite": "8.6.12",
|
|
37
|
+
"lit": "3.2.1",
|
|
38
|
+
"storybook": "8.6.12"
|
|
39
|
+
},
|
|
40
|
+
"gitHead": "8f9a1746509e90c061511b19f028c758754b394f"
|
|
41
|
+
}
|