@remember-web/primitive 0.2.12 → 0.2.14
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/src/Chips/Chip/const.cjs.js +2 -2
- package/dist/src/Chips/Chip/const.cjs.js.map +1 -1
- package/dist/src/Chips/Chip/const.d.ts +2 -2
- package/dist/src/Chips/Chip/const.esm.js +2 -2
- package/dist/src/Chips/Chip/const.esm.js.map +1 -1
- package/dist/src/Chips/Chip/styles.cjs.js +1 -1
- package/dist/src/Chips/Chip/styles.cjs.js.map +1 -1
- package/dist/src/Chips/Chip/styles.d.ts.map +1 -1
- package/dist/src/Chips/Chip/styles.esm.js +1 -1
- package/dist/src/Chips/Chip/styles.esm.js.map +1 -1
- package/dist/src/Inputs/Select/styles.cjs.js +1 -1
- package/dist/src/Inputs/Select/styles.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/styles.esm.js +1 -1
- package/dist/src/Inputs/Select/styles.esm.js.map +1 -1
- package/dist/src/Inputs/Select/types.d.ts +3 -0
- package/dist/src/Inputs/Select/types.d.ts.map +1 -1
- package/dist/src/Inputs/TextInput/styles.cjs.js +2 -2
- package/dist/src/Inputs/TextInput/styles.cjs.js.map +1 -1
- package/dist/src/Inputs/TextInput/styles.esm.js +2 -2
- package/dist/src/Inputs/TextInput/styles.esm.js.map +1 -1
- package/dist/src/Inputs/TextInput/types.d.ts +3 -0
- package/dist/src/Inputs/TextInput/types.d.ts.map +1 -1
- package/dist/src/Labels/Label/index.cjs.js +58 -0
- package/dist/src/Labels/Label/index.cjs.js.map +1 -0
- package/dist/src/Labels/Label/index.d.ts +5 -0
- package/dist/src/Labels/Label/index.d.ts.map +1 -0
- package/dist/src/Labels/Label/index.esm.js +51 -0
- package/dist/src/Labels/Label/index.esm.js.map +1 -0
- package/dist/src/Labels/Label/styles.cjs.js +79 -0
- package/dist/src/Labels/Label/styles.cjs.js.map +1 -0
- package/dist/src/Labels/Label/styles.d.ts +11 -0
- package/dist/src/Labels/Label/styles.d.ts.map +1 -0
- package/dist/src/Labels/Label/styles.esm.js +72 -0
- package/dist/src/Labels/Label/styles.esm.js.map +1 -0
- package/dist/src/Labels/Label/types.d.ts +13 -0
- package/dist/src/Labels/Label/types.d.ts.map +1 -0
- package/dist/src/Labels/index.d.ts +2 -0
- package/dist/src/Labels/index.d.ts.map +1 -0
- package/dist/src/index.cjs.js +2 -0
- package/dist/src/index.cjs.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.esm.js +1 -0
- package/dist/src/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/Chips/Chip/Chip.stories.tsx +6 -1
- package/src/Chips/Chip/const.ts +2 -2
- package/src/Chips/Chip/styles.ts +3 -4
- package/src/Inputs/Select/styles.ts +1 -1
- package/src/Inputs/Select/types.ts +3 -0
- package/src/Inputs/TextInput/styles.ts +2 -2
- package/src/Inputs/TextInput/types.ts +3 -0
- package/src/Labels/Label/Label.stories.tsx +68 -0
- package/src/Labels/Label/index.tsx +50 -0
- package/src/Labels/Label/styles.ts +138 -0
- package/src/Labels/Label/types.ts +30 -0
- package/src/Labels/index.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.cjs.js","sources":["../../../../src/Labels/Label/styles.ts"],"sourcesContent":["import {\n contents000,\n contents100,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\nimport type { LabelProps } from './types';\n\ninterface LabelContainerProps {\n $size: LabelProps['size'];\n $direction: LabelProps['direction'];\n $gap: LabelProps['gap'];\n $width: LabelProps['width'];\n}\nexport const LabelContainer = styled.label<LabelContainerProps>`\n display: flex;\n position: relative;\n width: ${({ $width = 'auto' }) => $width};\n min-width: min-content; \n\n ${({ $size, $gap }) => {\n const defaultGap = $size === 'large' ? '12px' : '8px';\n const finalGap = $gap !== undefined ? `${$gap}px` : defaultGap;\n\n return css`\n gap: ${finalGap};\n `;\n }}\n\n ${({ $direction = 'top' }) => {\n switch ($direction) {\n // Top variations\n case 'top':\n return css`\n flex-direction: column;\n align-items: flex-start;\n `;\n case 'top-left':\n return css`\n flex-direction: column;\n align-items: flex-start;\n `;\n case 'top-right':\n return css`\n flex-direction: column;\n align-items: flex-end;\n `;\n case 'top-center':\n return css`\n flex-direction: column;\n align-items: center;\n `;\n\n // Bottom variations\n case 'bottom':\n return css`\n flex-direction: column-reverse;\n align-items: flex-start;\n `;\n case 'bottom-left':\n return css`\n flex-direction: column-reverse;\n align-items: flex-start;\n `;\n case 'bottom-right':\n return css`\n flex-direction: column-reverse;\n align-items: flex-end;\n `;\n case 'bottom-center':\n return css`\n flex-direction: column-reverse;\n align-items: center;\n `;\n\n // Left variations\n case 'left':\n return css`\n flex-direction: row;\n align-items: center;\n `;\n case 'left-top':\n return css`\n flex-direction: row;\n align-items: flex-start;\n `;\n case 'left-bottom':\n return css`\n flex-direction: row;\n align-items: flex-end;\n `;\n case 'left-center':\n return css`\n flex-direction: row;\n align-items: center;\n `;\n\n // Right variations\n case 'right':\n return css`\n flex-direction: row-reverse;\n align-items: center;\n `;\n case 'right-top':\n return css`\n flex-direction: row-reverse;\n align-items: flex-start;\n `;\n case 'right-bottom':\n return css`\n flex-direction: row-reverse;\n align-items: flex-end;\n `;\n case 'right-center':\n return css`\n flex-direction: row-reverse;\n align-items: center;\n `;\n }\n }}\n\n /* Size styles */\n ${({ $size }) => {\n switch ($size) {\n case 'small':\n return css`\n ${getTypographyStyles('UIBody2')}\n color: ${contents100};\n `;\n case 'large':\n default:\n return css`\n ${getTypographyStyles('Title2')}\n color: ${contents000};\n `;\n }\n }}\n`;\n"],"names":["LabelContainer","styled","label","_templateObject","_taggedTemplateLiteral","_ref","_ref$$width","$width","_ref2","$size","$gap","defaultGap","finalGap","undefined","concat","css","_templateObject2","_ref3","_ref3$$direction","$direction","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","_ref4","_templateObject19","getTypographyStyles","contents100","_templateObject20","contents000"],"mappings":";;;;;;;;;;;;AAcaA,IAAAA,cAAc,GAAGC,uBAAM,CAACC,KAAK,CAAAC,eAAA,KAAAA,eAAA,GAAAC,uCAAA,CAAA,CAAA,sDAAA,EAAA,qCAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,IAAA,CAAA,CAAA,CAAA,EAG/B,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAAC,WAAA,GAAAD,IAAA,CAAGE,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,WAAA,CAAA;AAAA,EAAA,OAAOC,MAAM,CAAA;AAAA,CAGtC,EAAA,UAAAC,KAAA,EAAqB;AAAA,EAAA,IAAlBC,KAAK,GAAAD,KAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,KAAA,CAAJE,IAAI,CAAA;EACd,IAAMC,UAAU,GAAGF,KAAK,KAAK,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;EACrD,IAAMG,QAAQ,GAAGF,IAAI,KAAKG,SAAS,MAAAC,MAAA,CAAMJ,IAAI,EAAA,IAAA,CAAA,GAAOC,UAAU,CAAA;EAE9D,OAAOI,UAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAZ,uCAAA,iCACDQ,QAAQ,CAAA,CAAA;AAEnB,CAAC,EAEC,UAAAK,KAAA,EAA4B;AAAA,EAAA,IAAAC,gBAAA,GAAAD,KAAA,CAAzBE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,gBAAA,CAAA;AACrB,EAAA,QAAQC,UAAU;AAChB;AACA,IAAA,KAAK,KAAK;AACR,MAAA,OAAOJ,UAAG,CAAAK,gBAAA,KAAAA,gBAAA,GAAAhB,uC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AA,CAAA,cAAA,EAAA,qBAAA,EAAA,aAAA,CAAA,CAAA,CAAA,EACPkC,yBAAmB,CAAC,SAAS,CAAC,EACvBC,iBAAW,CAAA,CAAA;AAEvB,IAAA,KAAK,OAAO,CAAA;AACZ,IAAA;AACE,MAAA,OAAOxB,UAAG,CAAAyB,iBAAA,KAAAA,iBAAA,GAAApC,uCAAA,CAAA,CAAA,cAAA,EAAA,qBAAA,EAAA,aAAA,CAAA,CAAA,CAAA,EACPkC,yBAAmB,CAAC,QAAQ,CAAC,EACtBG,iBAAW,CAAA,CAAA;AAEzB,GAAA;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LabelProps } from './types';
|
|
3
|
+
interface LabelContainerProps {
|
|
4
|
+
$size: LabelProps['size'];
|
|
5
|
+
$direction: LabelProps['direction'];
|
|
6
|
+
$gap: LabelProps['gap'];
|
|
7
|
+
$width: LabelProps['width'];
|
|
8
|
+
}
|
|
9
|
+
export declare const LabelContainer: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, LabelContainerProps>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/Labels/Label/styles.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,UAAU,mBAAmB;IAC3B,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B;AACD,eAAO,MAAM,cAAc,yOA2H1B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
2
|
+
import { getTypographyStyles, contents000, contents100 } from '@remember-web/mixin';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
6
|
+
var LabelContainer = styled.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n width: ", ";\n min-width: min-content; \n\n ", "\n\n ", "\n\n /* Size styles */\n ", "\n"])), function (_ref) {
|
|
7
|
+
var _ref$$width = _ref.$width,
|
|
8
|
+
$width = _ref$$width === void 0 ? 'auto' : _ref$$width;
|
|
9
|
+
return $width;
|
|
10
|
+
}, function (_ref2) {
|
|
11
|
+
var $size = _ref2.$size,
|
|
12
|
+
$gap = _ref2.$gap;
|
|
13
|
+
var defaultGap = $size === 'large' ? '12px' : '8px';
|
|
14
|
+
var finalGap = $gap !== undefined ? "".concat($gap, "px") : defaultGap;
|
|
15
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: ", ";\n "])), finalGap);
|
|
16
|
+
}, function (_ref3) {
|
|
17
|
+
var _ref3$$direction = _ref3.$direction,
|
|
18
|
+
$direction = _ref3$$direction === void 0 ? 'top' : _ref3$$direction;
|
|
19
|
+
switch ($direction) {
|
|
20
|
+
// Top variations
|
|
21
|
+
case 'top':
|
|
22
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex-direction: column;\n align-items: flex-start;\n "])));
|
|
23
|
+
case 'top-left':
|
|
24
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex-direction: column;\n align-items: flex-start;\n "])));
|
|
25
|
+
case 'top-right':
|
|
26
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex-direction: column;\n align-items: flex-end;\n "])));
|
|
27
|
+
case 'top-center':
|
|
28
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n flex-direction: column;\n align-items: center;\n "])));
|
|
29
|
+
|
|
30
|
+
// Bottom variations
|
|
31
|
+
case 'bottom':
|
|
32
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n flex-direction: column-reverse;\n align-items: flex-start;\n "])));
|
|
33
|
+
case 'bottom-left':
|
|
34
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n flex-direction: column-reverse;\n align-items: flex-start;\n "])));
|
|
35
|
+
case 'bottom-right':
|
|
36
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n flex-direction: column-reverse;\n align-items: flex-end;\n "])));
|
|
37
|
+
case 'bottom-center':
|
|
38
|
+
return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n flex-direction: column-reverse;\n align-items: center;\n "])));
|
|
39
|
+
|
|
40
|
+
// Left variations
|
|
41
|
+
case 'left':
|
|
42
|
+
return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: center;\n "])));
|
|
43
|
+
case 'left-top':
|
|
44
|
+
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: flex-start;\n "])));
|
|
45
|
+
case 'left-bottom':
|
|
46
|
+
return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: flex-end;\n "])));
|
|
47
|
+
case 'left-center':
|
|
48
|
+
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: center;\n "])));
|
|
49
|
+
|
|
50
|
+
// Right variations
|
|
51
|
+
case 'right':
|
|
52
|
+
return css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n flex-direction: row-reverse;\n align-items: center;\n "])));
|
|
53
|
+
case 'right-top':
|
|
54
|
+
return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n flex-direction: row-reverse;\n align-items: flex-start;\n "])));
|
|
55
|
+
case 'right-bottom':
|
|
56
|
+
return css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n flex-direction: row-reverse;\n align-items: flex-end;\n "])));
|
|
57
|
+
case 'right-center':
|
|
58
|
+
return css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n flex-direction: row-reverse;\n align-items: center;\n "])));
|
|
59
|
+
}
|
|
60
|
+
}, function (_ref4) {
|
|
61
|
+
var $size = _ref4.$size;
|
|
62
|
+
switch ($size) {
|
|
63
|
+
case 'small':
|
|
64
|
+
return css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n ", "\n color: ", ";\n "])), getTypographyStyles('UIBody2'), contents100);
|
|
65
|
+
case 'large':
|
|
66
|
+
default:
|
|
67
|
+
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n ", "\n color: ", ";\n "])), getTypographyStyles('Title2'), contents000);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { LabelContainer };
|
|
72
|
+
//# sourceMappingURL=styles.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.esm.js","sources":["../../../../src/Labels/Label/styles.ts"],"sourcesContent":["import {\n contents000,\n contents100,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\nimport type { LabelProps } from './types';\n\ninterface LabelContainerProps {\n $size: LabelProps['size'];\n $direction: LabelProps['direction'];\n $gap: LabelProps['gap'];\n $width: LabelProps['width'];\n}\nexport const LabelContainer = styled.label<LabelContainerProps>`\n display: flex;\n position: relative;\n width: ${({ $width = 'auto' }) => $width};\n min-width: min-content; \n\n ${({ $size, $gap }) => {\n const defaultGap = $size === 'large' ? '12px' : '8px';\n const finalGap = $gap !== undefined ? `${$gap}px` : defaultGap;\n\n return css`\n gap: ${finalGap};\n `;\n }}\n\n ${({ $direction = 'top' }) => {\n switch ($direction) {\n // Top variations\n case 'top':\n return css`\n flex-direction: column;\n align-items: flex-start;\n `;\n case 'top-left':\n return css`\n flex-direction: column;\n align-items: flex-start;\n `;\n case 'top-right':\n return css`\n flex-direction: column;\n align-items: flex-end;\n `;\n case 'top-center':\n return css`\n flex-direction: column;\n align-items: center;\n `;\n\n // Bottom variations\n case 'bottom':\n return css`\n flex-direction: column-reverse;\n align-items: flex-start;\n `;\n case 'bottom-left':\n return css`\n flex-direction: column-reverse;\n align-items: flex-start;\n `;\n case 'bottom-right':\n return css`\n flex-direction: column-reverse;\n align-items: flex-end;\n `;\n case 'bottom-center':\n return css`\n flex-direction: column-reverse;\n align-items: center;\n `;\n\n // Left variations\n case 'left':\n return css`\n flex-direction: row;\n align-items: center;\n `;\n case 'left-top':\n return css`\n flex-direction: row;\n align-items: flex-start;\n `;\n case 'left-bottom':\n return css`\n flex-direction: row;\n align-items: flex-end;\n `;\n case 'left-center':\n return css`\n flex-direction: row;\n align-items: center;\n `;\n\n // Right variations\n case 'right':\n return css`\n flex-direction: row-reverse;\n align-items: center;\n `;\n case 'right-top':\n return css`\n flex-direction: row-reverse;\n align-items: flex-start;\n `;\n case 'right-bottom':\n return css`\n flex-direction: row-reverse;\n align-items: flex-end;\n `;\n case 'right-center':\n return css`\n flex-direction: row-reverse;\n align-items: center;\n `;\n }\n }}\n\n /* Size styles */\n ${({ $size }) => {\n switch ($size) {\n case 'small':\n return css`\n ${getTypographyStyles('UIBody2')}\n color: ${contents100};\n `;\n case 'large':\n default:\n return css`\n ${getTypographyStyles('Title2')}\n color: ${contents000};\n `;\n }\n }}\n`;\n"],"names":["LabelContainer","styled","label","_templateObject","_taggedTemplateLiteral","_ref","_ref$$width","$width","_ref2","$size","$gap","defaultGap","finalGap","undefined","concat","css","_templateObject2","_ref3","_ref3$$direction","$direction","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","_ref4","_templateObject19","getTypographyStyles","contents100","_templateObject20","contents000"],"mappings":";;;;;AAcaA,IAAAA,cAAc,GAAGC,MAAM,CAACC,KAAK,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAAA,CAAA,sDAAA,EAAA,qCAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,IAAA,CAAA,CAAA,CAAA,EAG/B,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAAC,WAAA,GAAAD,IAAA,CAAGE,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,WAAA,CAAA;AAAA,EAAA,OAAOC,MAAM,CAAA;AAAA,CAGtC,EAAA,UAAAC,KAAA,EAAqB;AAAA,EAAA,IAAlBC,KAAK,GAAAD,KAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,KAAA,CAAJE,IAAI,CAAA;EACd,IAAMC,UAAU,GAAGF,KAAK,KAAK,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;EACrD,IAAMG,QAAQ,GAAGF,IAAI,KAAKG,SAAS,MAAAC,MAAA,CAAMJ,IAAI,EAAA,IAAA,CAAA,GAAOC,UAAU,CAAA;EAE9D,OAAOI,GAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAZ,sBAAA,iCACDQ,QAAQ,CAAA,CAAA;AAEnB,CAAC,EAEC,UAAAK,KAAA,EAA4B;AAAA,EAAA,IAAAC,gBAAA,GAAAD,KAAA,CAAzBE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,gBAAA,CAAA;AACrB,EAAA,QAAQC,UAAU;AAChB;AACA,I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AK,OAAO;AACV,MAAA,OAAOM,GAAG,CAAAsB,iBAAA,KAAAA,iBAAA,GAAAjC,sBAAA,CAAA,CAAA,cAAA,EAAA,qBAAA,EAAA,aAAA,CAAA,CAAA,CAAA,EACPkC,mBAAmB,CAAC,SAAS,CAAC,EACvBC,WAAW,CAAA,CAAA;AAEvB,IAAA,KAAK,OAAO,CAAA;AACZ,IAAA;AACE,MAAA,OAAOxB,GAAG,CAAAyB,iBAAA,KAAAA,iBAAA,GAAApC,sBAAA,CAAA,CAAA,cAAA,EAAA,qBAAA,EAAA,aAAA,CAAA,CAAA,CAAA,EACPkC,mBAAmB,CAAC,QAAQ,CAAC,EACtBG,WAAW,CAAA,CAAA;AAEzB,GAAA;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LabelHTMLAttributes } from 'react';
|
|
2
|
+
export type Direction = 'top' | 'top-left' | 'top-right' | 'top-center' | 'bottom' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'left' | 'left-top' | 'left-bottom' | 'left-center' | 'right' | 'right-top' | 'right-bottom' | 'right-center';
|
|
3
|
+
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
4
|
+
text: string;
|
|
5
|
+
size?: 'small' | 'large';
|
|
6
|
+
gap?: number;
|
|
7
|
+
width?: string;
|
|
8
|
+
rightElement?: React.ReactNode;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
direction?: Direction;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/Labels/Label/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,SAAS,GACjB,KAAK,GACL,UAAU,GACV,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,aAAa,GACb,cAAc,GACd,eAAe,GACf,MAAM,GACN,UAAU,GACV,aAAa,GACb,aAAa,GACb,OAAO,GACP,WAAW,GACX,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,WAAW,UAAW,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Labels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/src/index.cjs.js
CHANGED
|
@@ -32,6 +32,7 @@ var index$k = require('./Floating/Tooltip/index.cjs.js');
|
|
|
32
32
|
var styles$2 = require('./Floating/DropdownMenu/styles.cjs.js');
|
|
33
33
|
var styles$3 = require('./Floating/Popover/styles.cjs.js');
|
|
34
34
|
var index$l = require('./Chips/Chip/index.cjs.js');
|
|
35
|
+
var index$m = require('./Labels/Label/index.cjs.js');
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
@@ -82,4 +83,5 @@ exports.StyledPopoverContentWrapper = styles$3.StyledPopoverContentWrapper;
|
|
|
82
83
|
exports.showFadeIn = styles$3.showFadeIn;
|
|
83
84
|
exports.showFadeOut = styles$3.showFadeOut;
|
|
84
85
|
exports.Chip = index$l.Chip;
|
|
86
|
+
exports.Label = index$m;
|
|
85
87
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
package/dist/src/index.esm.js
CHANGED
|
@@ -30,4 +30,5 @@ export { default as Tooltip } from './Floating/Tooltip/index.esm.js';
|
|
|
30
30
|
export { DropdownMenuItemDisabledCSS, DropdownMenuItemHoverCSS, StyledDropdownMenuContent, StyledDropdownMenuContentWrapper, StyledDropdownMenuItem, StyledDropdownMenuSection, StyledDropdownMenuSectionTitle, dropdownMenuItemCSS, getDropdownMenuItemCss } from './Floating/DropdownMenu/styles.esm.js';
|
|
31
31
|
export { StyledPopoverContent, StyledPopoverContentWrapper, showFadeIn, showFadeOut } from './Floating/Popover/styles.esm.js';
|
|
32
32
|
export { Chip } from './Chips/Chip/index.esm.js';
|
|
33
|
+
export { default as Label } from './Labels/Label/index.esm.js';
|
|
33
34
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remember-web/primitive",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Remember Web Primitive Components",
|
|
5
5
|
"homepage": "https://dramancompany.github.io/remember-web-packages/",
|
|
6
6
|
"author": "Remember",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@radix-ui/react-separator": "^1.0.3",
|
|
42
42
|
"@radix-ui/react-switch": "^1.0.3",
|
|
43
43
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
44
|
-
"@remember-web/icon": "^0.1.
|
|
44
|
+
"@remember-web/icon": "^0.1.13",
|
|
45
45
|
"@remember-web/mixin": "^0.2.6",
|
|
46
46
|
"@remember-web/shared": "^0.1.1"
|
|
47
47
|
},
|
|
@@ -50,7 +50,7 @@ const meta = {
|
|
|
50
50
|
} satisfies Meta<typeof Chip>;
|
|
51
51
|
|
|
52
52
|
export const Default: Story = {
|
|
53
|
-
render: ({ leftIcon, deleteIcon,
|
|
53
|
+
render: ({ leftIcon, deleteIcon, ...args }) => {
|
|
54
54
|
const leftIconString = String(leftIcon);
|
|
55
55
|
const leftIconElement =
|
|
56
56
|
leftIcon && isIconName(leftIconString)
|
|
@@ -63,6 +63,11 @@ export const Default: Story = {
|
|
|
63
63
|
? createElement(getIconComponentFromName(rightIconString))
|
|
64
64
|
: undefined;
|
|
65
65
|
|
|
66
|
+
if (args.clickable === false && Object.hasOwn(args, 'selected')) {
|
|
67
|
+
const { selected, ...rest } = args;
|
|
68
|
+
args = rest;
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
return (
|
|
67
72
|
<Chip
|
|
68
73
|
{...args}
|
package/src/Chips/Chip/const.ts
CHANGED
|
@@ -15,12 +15,12 @@ import type { ChipSize, ChipVariant, ChipVariantStyleMap } from './types';
|
|
|
15
15
|
export const CHIP_SIZE_STYLE = {
|
|
16
16
|
small: {
|
|
17
17
|
typography: 'Caption1',
|
|
18
|
-
padding: '
|
|
18
|
+
padding: '6px 10px',
|
|
19
19
|
height: '28px',
|
|
20
20
|
},
|
|
21
21
|
medium: {
|
|
22
22
|
typography: 'UIBody3',
|
|
23
|
-
padding: '
|
|
23
|
+
padding: '5px 12px',
|
|
24
24
|
height: '30px',
|
|
25
25
|
},
|
|
26
26
|
} as const satisfies Record<ChipSize, unknown>;
|
package/src/Chips/Chip/styles.ts
CHANGED
|
@@ -58,14 +58,13 @@ export const StyledChip = styled.div<ChipStyleProps>`
|
|
|
58
58
|
|
|
59
59
|
width: fit-content;
|
|
60
60
|
border-radius: 50px;
|
|
61
|
-
text-align:
|
|
61
|
+
text-align: left;
|
|
62
62
|
transition: all 0.2s ease-in;
|
|
63
|
-
|
|
64
|
-
height: ${CHIP_SIZE_STYLE[$size].height};
|
|
63
|
+
height: auto;
|
|
65
64
|
padding: ${CHIP_SIZE_STYLE[$size].padding};
|
|
66
65
|
|
|
67
66
|
${getTypographyStyles(CHIP_SIZE_STYLE[$size].typography)}
|
|
68
|
-
|
|
67
|
+
|
|
69
68
|
${getVariantStyles({ $variant, $clickable, ...props })}
|
|
70
69
|
`}
|
|
71
70
|
`;
|
|
@@ -39,7 +39,7 @@ export const SelectContainer = styled.div<{ $width?: number | string }>`
|
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
export const SelectLabel = styled.label`
|
|
42
|
-
${getTypographyStyles('
|
|
42
|
+
${getTypographyStyles('Title2')}
|
|
43
43
|
display: block;
|
|
44
44
|
margin-bottom: 12px;
|
|
45
45
|
display: flex;
|
|
@@ -17,6 +17,9 @@ export type SelectBaseProps<Value extends SelectValue> = {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
error?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Label 컴포넌트를 사용해 주세요.
|
|
22
|
+
*/
|
|
20
23
|
label?: ReactNode;
|
|
21
24
|
required?: boolean;
|
|
22
25
|
// TODO: children의 prop에 따라 결정되는 제네릭 구현이 필요 infer를 활용하면 될 것 같기도 한데 추후 확인
|
|
@@ -86,7 +86,7 @@ export const InputInner = styled.input`
|
|
|
86
86
|
`;
|
|
87
87
|
|
|
88
88
|
export const InputLabel = styled.label`
|
|
89
|
-
${getTypographyStyles('
|
|
89
|
+
${getTypographyStyles('Title2')}
|
|
90
90
|
display: block;
|
|
91
91
|
margin-bottom: 12px;
|
|
92
92
|
display: flex;
|
|
@@ -100,7 +100,7 @@ export const InputLabel = styled.label`
|
|
|
100
100
|
`;
|
|
101
101
|
|
|
102
102
|
export const InputError = styled.div`
|
|
103
|
-
${getTypographyStyles('
|
|
103
|
+
${getTypographyStyles('UIBody3')}
|
|
104
104
|
color: ${roleRed};
|
|
105
105
|
|
|
106
106
|
margin-top: 8px;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Flex } from '@/Common';
|
|
4
|
+
import { Select, TextInput } from '@/Inputs';
|
|
5
|
+
import {
|
|
6
|
+
getIconComponentFromName,
|
|
7
|
+
iconNames,
|
|
8
|
+
isIconName,
|
|
9
|
+
} from '@/stories/util';
|
|
10
|
+
import { createElement } from 'react';
|
|
11
|
+
import Label from '.';
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Label>;
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Primitive/Labels/Label',
|
|
17
|
+
component: Label,
|
|
18
|
+
argTypes: {
|
|
19
|
+
text: { control: 'text' },
|
|
20
|
+
children: { control: 'text' },
|
|
21
|
+
size: { control: 'select', options: ['small', 'large'] },
|
|
22
|
+
rightElement: { control: 'select', options: iconNames },
|
|
23
|
+
required: { control: 'boolean' },
|
|
24
|
+
direction: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: [
|
|
27
|
+
'top',
|
|
28
|
+
'top-left',
|
|
29
|
+
'top-right',
|
|
30
|
+
'top-center',
|
|
31
|
+
'bottom',
|
|
32
|
+
'bottom-left',
|
|
33
|
+
'bottom-right',
|
|
34
|
+
'bottom-center',
|
|
35
|
+
'left',
|
|
36
|
+
'left-top',
|
|
37
|
+
'left-bottom',
|
|
38
|
+
'left-center',
|
|
39
|
+
'right',
|
|
40
|
+
'right-top',
|
|
41
|
+
'right-bottom',
|
|
42
|
+
'right-center',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
text: 'Label 컴포넌트',
|
|
48
|
+
children: <TextInput width="300px" />,
|
|
49
|
+
},
|
|
50
|
+
} satisfies Meta<typeof Label>;
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
render: ({ rightElement, ...props }) => {
|
|
54
|
+
const RightIconString = String(rightElement);
|
|
55
|
+
const renderedRightElement =
|
|
56
|
+
rightElement &&
|
|
57
|
+
isIconName(RightIconString) &&
|
|
58
|
+
createElement(getIconComponentFromName(RightIconString));
|
|
59
|
+
return (
|
|
60
|
+
<Flex gap={20} justify="unset" style={{ width: '100%' }}>
|
|
61
|
+
<Label rightElement={renderedRightElement} {...props} />
|
|
62
|
+
<Label text="children 없이 독립적으로 사용 가능" required />
|
|
63
|
+
</Flex>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default meta;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Flex } from '@/Common';
|
|
2
|
+
import { IconRequiredS } from '@remember-web/icon';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { LabelContainer } from './styles';
|
|
5
|
+
import type { LabelProps } from './types';
|
|
6
|
+
|
|
7
|
+
const Label = forwardRef<HTMLLabelElement, LabelProps>(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
text,
|
|
11
|
+
children,
|
|
12
|
+
direction = 'top-left',
|
|
13
|
+
size = 'small',
|
|
14
|
+
gap,
|
|
15
|
+
width,
|
|
16
|
+
rightElement,
|
|
17
|
+
required,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
21
|
+
ref
|
|
22
|
+
) => {
|
|
23
|
+
return (
|
|
24
|
+
<LabelContainer
|
|
25
|
+
ref={ref}
|
|
26
|
+
$size={size}
|
|
27
|
+
className={className}
|
|
28
|
+
$direction={direction}
|
|
29
|
+
$gap={gap}
|
|
30
|
+
$width={width}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<Flex gap={4}>
|
|
34
|
+
{text}
|
|
35
|
+
<Flex>
|
|
36
|
+
{rightElement}
|
|
37
|
+
{required && (
|
|
38
|
+
<Flex className="required-icon">
|
|
39
|
+
<IconRequiredS />
|
|
40
|
+
</Flex>
|
|
41
|
+
)}
|
|
42
|
+
</Flex>
|
|
43
|
+
</Flex>
|
|
44
|
+
{children}
|
|
45
|
+
</LabelContainer>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default Label;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contents000,
|
|
3
|
+
contents100,
|
|
4
|
+
getTypographyStyles,
|
|
5
|
+
} from '@remember-web/mixin';
|
|
6
|
+
import styled, { css } from 'styled-components';
|
|
7
|
+
import type { LabelProps } from './types';
|
|
8
|
+
|
|
9
|
+
interface LabelContainerProps {
|
|
10
|
+
$size: LabelProps['size'];
|
|
11
|
+
$direction: LabelProps['direction'];
|
|
12
|
+
$gap: LabelProps['gap'];
|
|
13
|
+
$width: LabelProps['width'];
|
|
14
|
+
}
|
|
15
|
+
export const LabelContainer = styled.label<LabelContainerProps>`
|
|
16
|
+
display: flex;
|
|
17
|
+
position: relative;
|
|
18
|
+
width: ${({ $width = 'auto' }) => $width};
|
|
19
|
+
min-width: min-content;
|
|
20
|
+
|
|
21
|
+
${({ $size, $gap }) => {
|
|
22
|
+
const defaultGap = $size === 'large' ? '12px' : '8px';
|
|
23
|
+
const finalGap = $gap !== undefined ? `${$gap}px` : defaultGap;
|
|
24
|
+
|
|
25
|
+
return css`
|
|
26
|
+
gap: ${finalGap};
|
|
27
|
+
`;
|
|
28
|
+
}}
|
|
29
|
+
|
|
30
|
+
${({ $direction = 'top' }) => {
|
|
31
|
+
switch ($direction) {
|
|
32
|
+
// Top variations
|
|
33
|
+
case 'top':
|
|
34
|
+
return css`
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
`;
|
|
38
|
+
case 'top-left':
|
|
39
|
+
return css`
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
`;
|
|
43
|
+
case 'top-right':
|
|
44
|
+
return css`
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: flex-end;
|
|
47
|
+
`;
|
|
48
|
+
case 'top-center':
|
|
49
|
+
return css`
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: center;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
// Bottom variations
|
|
55
|
+
case 'bottom':
|
|
56
|
+
return css`
|
|
57
|
+
flex-direction: column-reverse;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
`;
|
|
60
|
+
case 'bottom-left':
|
|
61
|
+
return css`
|
|
62
|
+
flex-direction: column-reverse;
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
`;
|
|
65
|
+
case 'bottom-right':
|
|
66
|
+
return css`
|
|
67
|
+
flex-direction: column-reverse;
|
|
68
|
+
align-items: flex-end;
|
|
69
|
+
`;
|
|
70
|
+
case 'bottom-center':
|
|
71
|
+
return css`
|
|
72
|
+
flex-direction: column-reverse;
|
|
73
|
+
align-items: center;
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
// Left variations
|
|
77
|
+
case 'left':
|
|
78
|
+
return css`
|
|
79
|
+
flex-direction: row;
|
|
80
|
+
align-items: center;
|
|
81
|
+
`;
|
|
82
|
+
case 'left-top':
|
|
83
|
+
return css`
|
|
84
|
+
flex-direction: row;
|
|
85
|
+
align-items: flex-start;
|
|
86
|
+
`;
|
|
87
|
+
case 'left-bottom':
|
|
88
|
+
return css`
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
align-items: flex-end;
|
|
91
|
+
`;
|
|
92
|
+
case 'left-center':
|
|
93
|
+
return css`
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
align-items: center;
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
// Right variations
|
|
99
|
+
case 'right':
|
|
100
|
+
return css`
|
|
101
|
+
flex-direction: row-reverse;
|
|
102
|
+
align-items: center;
|
|
103
|
+
`;
|
|
104
|
+
case 'right-top':
|
|
105
|
+
return css`
|
|
106
|
+
flex-direction: row-reverse;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
`;
|
|
109
|
+
case 'right-bottom':
|
|
110
|
+
return css`
|
|
111
|
+
flex-direction: row-reverse;
|
|
112
|
+
align-items: flex-end;
|
|
113
|
+
`;
|
|
114
|
+
case 'right-center':
|
|
115
|
+
return css`
|
|
116
|
+
flex-direction: row-reverse;
|
|
117
|
+
align-items: center;
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
}}
|
|
121
|
+
|
|
122
|
+
/* Size styles */
|
|
123
|
+
${({ $size }) => {
|
|
124
|
+
switch ($size) {
|
|
125
|
+
case 'small':
|
|
126
|
+
return css`
|
|
127
|
+
${getTypographyStyles('UIBody2')}
|
|
128
|
+
color: ${contents100};
|
|
129
|
+
`;
|
|
130
|
+
case 'large':
|
|
131
|
+
default:
|
|
132
|
+
return css`
|
|
133
|
+
${getTypographyStyles('Title2')}
|
|
134
|
+
color: ${contents000};
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
}}
|
|
138
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LabelHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export type Direction =
|
|
4
|
+
| 'top'
|
|
5
|
+
| 'top-left'
|
|
6
|
+
| 'top-right'
|
|
7
|
+
| 'top-center'
|
|
8
|
+
| 'bottom'
|
|
9
|
+
| 'bottom-left'
|
|
10
|
+
| 'bottom-right'
|
|
11
|
+
| 'bottom-center'
|
|
12
|
+
| 'left'
|
|
13
|
+
| 'left-top'
|
|
14
|
+
| 'left-bottom'
|
|
15
|
+
| 'left-center'
|
|
16
|
+
| 'right'
|
|
17
|
+
| 'right-top'
|
|
18
|
+
| 'right-bottom'
|
|
19
|
+
| 'right-center';
|
|
20
|
+
|
|
21
|
+
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
22
|
+
text: string;
|
|
23
|
+
size?: 'small' | 'large';
|
|
24
|
+
gap?: number;
|
|
25
|
+
width?: string;
|
|
26
|
+
rightElement?: React.ReactNode;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
direction?: Direction;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Label } from './Label';
|
package/src/index.ts
CHANGED