@a-type/ui 1.5.1 → 1.5.3
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/dist/cjs/components/box/Box.d.ts +1 -0
- package/dist/cjs/components/box/Box.js +13 -10
- package/dist/cjs/components/box/Box.js.map +1 -1
- package/dist/cjs/components/icon/generated/IconSpritesheet.js +1 -1
- package/dist/cjs/components/icon/generated/IconSpritesheet.js.map +1 -1
- package/dist/cjs/components/icon/generated/iconNames.d.ts +1 -1
- package/dist/cjs/components/icon/generated/iconNames.js +2 -0
- package/dist/cjs/components/icon/generated/iconNames.js.map +1 -1
- package/dist/cjs/components/note/Note.js +1 -1
- package/dist/cjs/components/note/Note.js.map +1 -1
- package/dist/cjs/components/note/Note.stories.d.ts +17 -0
- package/dist/cjs/components/note/Note.stories.js +18 -0
- package/dist/cjs/components/note/Note.stories.js.map +1 -0
- package/dist/css/main.css +2 -2
- package/dist/esm/components/box/Box.d.ts +1 -0
- package/dist/esm/components/box/Box.js +13 -10
- package/dist/esm/components/box/Box.js.map +1 -1
- package/dist/esm/components/icon/generated/IconSpritesheet.js +1 -1
- package/dist/esm/components/icon/generated/IconSpritesheet.js.map +1 -1
- package/dist/esm/components/icon/generated/iconNames.d.ts +1 -1
- package/dist/esm/components/icon/generated/iconNames.js +2 -0
- package/dist/esm/components/icon/generated/iconNames.js.map +1 -1
- package/dist/esm/components/note/Note.js +1 -1
- package/dist/esm/components/note/Note.js.map +1 -1
- package/dist/esm/components/note/Note.stories.d.ts +17 -0
- package/dist/esm/components/note/Note.stories.js +15 -0
- package/dist/esm/components/note/Note.stories.js.map +1 -0
- package/package.json +1 -1
- package/src/components/box/Box.tsx +21 -10
- package/src/components/icon/generated/IconSpritesheet.tsx +20 -0
- package/src/components/icon/generated/iconNames.ts +2 -0
- package/src/components/note/Note.stories.tsx +20 -0
- package/src/components/note/Note.tsx +16 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
import { Note } from './Note.js';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Note',
|
|
5
|
+
component: Note,
|
|
6
|
+
args: {
|
|
7
|
+
children: 'This is a note',
|
|
8
|
+
},
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: { expanded: true },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const Default = {};
|
|
15
|
+
//# sourceMappingURL=Note.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Note.stories.js","sourceRoot":"","sources":["../../../../src/components/note/Note.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,IAAI;IAEf,IAAI,EAAE;QACL,QAAQ,EAAE,gBAAgB;KAC1B;IACD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CAC2B,CAAC;AAE9B,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ export type BoxSpacingSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
15
15
|
export type BoxResponsive<T> =
|
|
16
16
|
| T
|
|
17
17
|
| {
|
|
18
|
+
default?: T;
|
|
18
19
|
sm?: T;
|
|
19
20
|
md?: T;
|
|
20
21
|
lg?: T;
|
|
@@ -26,6 +27,10 @@ function isResponsive<T>(
|
|
|
26
27
|
return typeof value === 'object';
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
function hasDefault<T>(value: BoxResponsive<T>, val: T) {
|
|
31
|
+
return value === val || (isResponsive(value) && value.default === val);
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
export interface BoxProps extends Omit<SlotDivProps, 'wrap'> {
|
|
30
35
|
className?: string;
|
|
31
36
|
direction?: BoxResponsive<'row' | 'col' | 'row-reverse' | 'col-reverse'>;
|
|
@@ -84,10 +89,16 @@ export function Box({
|
|
|
84
89
|
className={clsx(
|
|
85
90
|
'layer-components:flex layer-components:relative',
|
|
86
91
|
{
|
|
87
|
-
'layer-components:flex-row': direction
|
|
88
|
-
'layer-components:flex-col': direction
|
|
89
|
-
'layer-components:flex-row-reverse':
|
|
90
|
-
|
|
92
|
+
'layer-components:flex-row': hasDefault(direction, 'row'),
|
|
93
|
+
'layer-components:flex-col': hasDefault(direction, 'col'),
|
|
94
|
+
'layer-components:flex-row-reverse': hasDefault(
|
|
95
|
+
direction,
|
|
96
|
+
'row-reverse',
|
|
97
|
+
),
|
|
98
|
+
'layer-components:flex-col-reverse': hasDefault(
|
|
99
|
+
direction,
|
|
100
|
+
'col-reverse',
|
|
101
|
+
),
|
|
91
102
|
'layer-components:sm:flex-row':
|
|
92
103
|
isResponsive(direction) && direction.sm === 'row',
|
|
93
104
|
'layer-components:sm:flex-col':
|
|
@@ -112,7 +123,7 @@ export function Box({
|
|
|
112
123
|
isResponsive(direction) && direction.lg === 'row-reverse',
|
|
113
124
|
'layer-components:lg:flex-col-reverse':
|
|
114
125
|
isResponsive(direction) && direction.lg === 'col-reverse',
|
|
115
|
-
'layer-components:flex-wrap': wrap,
|
|
126
|
+
'layer-components:flex-wrap': hasDefault(wrap, true),
|
|
116
127
|
'layer-components:sm:flex-wrap': isResponsive(wrap) && wrap.sm,
|
|
117
128
|
'layer-components:md:flex-wrap': isResponsive(wrap) && wrap.md,
|
|
118
129
|
'layer-components:lg:flex-wrap': isResponsive(wrap) && wrap.lg,
|
|
@@ -131,11 +142,11 @@ export function Box({
|
|
|
131
142
|
'layer-components:justify-end': justify === 'end',
|
|
132
143
|
'layer-components:justify-between': justify === 'between',
|
|
133
144
|
'layer-components:justify-around': justify === 'around',
|
|
134
|
-
'layer-components:p-xs': p
|
|
135
|
-
'layer-components:p-sm': p
|
|
136
|
-
'layer-components:p-md': p
|
|
137
|
-
'layer-components:p-lg': p
|
|
138
|
-
'layer-components:p-xl': p
|
|
145
|
+
'layer-components:p-xs': hasDefault(p, 'xs'),
|
|
146
|
+
'layer-components:p-sm': hasDefault(p, 'sm'),
|
|
147
|
+
'layer-components:p-md': hasDefault(p, 'md') || hasDefault(p, true),
|
|
148
|
+
'layer-components:p-lg': hasDefault(p, 'lg'),
|
|
149
|
+
'layer-components:p-xl': hasDefault(p, 'xl'),
|
|
139
150
|
'layer-components:sm:p-xs': isResponsive(p) && p.sm === 'xs',
|
|
140
151
|
'layer-components:sm:p-sm': isResponsive(p) && p.sm === 'sm',
|
|
141
152
|
'layer-components:sm:p-md': isResponsive(p) && p.sm === 'md',
|
|
@@ -937,6 +937,26 @@ export const IconSpritesheet = (props: any) => (
|
|
|
937
937
|
strokeLinejoin="round"
|
|
938
938
|
/>
|
|
939
939
|
</symbol>
|
|
940
|
+
<symbol id="icon-enterKey" viewBox="0 0 15 15">
|
|
941
|
+
<path
|
|
942
|
+
d="M10.5 8V10.5H3.5M3.5 10.5L5 9M3.5 10.5L5 12"
|
|
943
|
+
stroke="currentColor"
|
|
944
|
+
strokeLinecap="round"
|
|
945
|
+
strokeLinejoin="round"
|
|
946
|
+
/>
|
|
947
|
+
<path
|
|
948
|
+
d="M14.5 2H6.5V6.5H0.5V14H14.5V2Z"
|
|
949
|
+
stroke="currentColor"
|
|
950
|
+
strokeLinejoin="round"
|
|
951
|
+
/>
|
|
952
|
+
</symbol>
|
|
953
|
+
<symbol id="icon-gamePiece" viewBox="0 0 15 15">
|
|
954
|
+
<path
|
|
955
|
+
d="M10 2.5C10 4 8.5 5 8.5 5L10 11C11.1722 11.4548 12.0956 11.9049 12.5 13C9.5 14.5 5.5 14.5 2.5 13C2.85427 12.0596 3.71706 11.5944 5 11L6.5 5C6.5 5 5 4 5 2.5C5 1 6.52369 0.5 7.5 0.5C8.47631 0.5 10 1 10 2.5Z"
|
|
956
|
+
stroke="currentColor"
|
|
957
|
+
strokeLinejoin="round"
|
|
958
|
+
/>
|
|
959
|
+
</symbol>
|
|
940
960
|
</defs>
|
|
941
961
|
</svg>
|
|
942
962
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Note } from './Note.js';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Note',
|
|
6
|
+
component: Note,
|
|
7
|
+
|
|
8
|
+
args: {
|
|
9
|
+
children: 'This is a note',
|
|
10
|
+
},
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: { expanded: true },
|
|
13
|
+
},
|
|
14
|
+
} satisfies Meta<typeof Note>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof Note>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {};
|
|
@@ -7,13 +7,22 @@ export interface NoteProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
|
|
8
8
|
export function Note({ className, children, ...rest }: NoteProps) {
|
|
9
9
|
return (
|
|
10
|
-
<div className={classNames(
|
|
11
|
-
<div className="flex flex-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<div className={classNames(className)} {...rest}>
|
|
11
|
+
<div className="flex flex-row ">
|
|
12
|
+
<div className="flex-1 p-2 border border-solid border-primary-dark bg-primary-wash color-black relative text-sm italic border-r-0">
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
className="flex flex-col items-stretch justify-stretch flex-[0_0_20px]"
|
|
17
|
+
aria-hidden
|
|
18
|
+
>
|
|
19
|
+
<div className="border-0 border-solid border-primary-dark border-b-1px border-l-1px flex-[0_0_20px] w-[20px] h-[20px] relative">
|
|
20
|
+
<div className="absolute w-1px bg-primary-dark h-26px rotate--45 left-9px top--4px transform-origin-cc" />
|
|
21
|
+
<div
|
|
22
|
+
className={`border-solid box-content border-transparent border-r-primary-wash border-13px w-0 h-0 rotate--45 translate--7px transform-origin-br`}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
<div className="bg-primary-wash flex-1 border-0 border-solid border-primary-dark border-r-1px border-b-1px" />
|
|
17
26
|
</div>
|
|
18
27
|
</div>
|
|
19
28
|
</div>
|