@remember-web/primitive 0.2.7 → 0.2.9

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.
Files changed (122) hide show
  1. package/dist/src/Badge/style.cjs.js +1 -1
  2. package/dist/src/Badge/style.cjs.js.map +1 -1
  3. package/dist/src/Badge/style.d.ts.map +1 -1
  4. package/dist/src/Badge/style.esm.js +1 -1
  5. package/dist/src/Badge/style.esm.js.map +1 -1
  6. package/dist/src/Buttons/Button/const.cjs.js +4 -4
  7. package/dist/src/Buttons/Button/const.cjs.js.map +1 -1
  8. package/dist/src/Buttons/Button/const.d.ts +4 -4
  9. package/dist/src/Buttons/Button/const.esm.js +4 -4
  10. package/dist/src/Buttons/Button/const.esm.js.map +1 -1
  11. package/dist/src/Chips/Chip/const.cjs.js +107 -0
  12. package/dist/src/Chips/Chip/const.cjs.js.map +1 -0
  13. package/dist/src/Chips/Chip/const.d.ts +15 -0
  14. package/dist/src/Chips/Chip/const.d.ts.map +1 -0
  15. package/dist/src/Chips/Chip/const.esm.js +104 -0
  16. package/dist/src/Chips/Chip/const.esm.js.map +1 -0
  17. package/dist/src/Chips/Chip/index.cjs.js +57 -0
  18. package/dist/src/Chips/Chip/index.cjs.js.map +1 -0
  19. package/dist/src/Chips/Chip/index.d.ts +4 -0
  20. package/dist/src/Chips/Chip/index.d.ts.map +1 -0
  21. package/dist/src/Chips/Chip/index.esm.js +50 -0
  22. package/dist/src/Chips/Chip/index.esm.js.map +1 -0
  23. package/dist/src/Chips/Chip/styles.cjs.js +46 -0
  24. package/dist/src/Chips/Chip/styles.cjs.js.map +1 -0
  25. package/dist/src/Chips/Chip/styles.d.ts +5 -0
  26. package/dist/src/Chips/Chip/styles.d.ts.map +1 -0
  27. package/dist/src/Chips/Chip/styles.esm.js +36 -0
  28. package/dist/src/Chips/Chip/styles.esm.js.map +1 -0
  29. package/dist/src/Chips/Chip/typeGuard.cjs.js +31 -0
  30. package/dist/src/Chips/Chip/typeGuard.cjs.js.map +1 -0
  31. package/dist/src/Chips/Chip/typeGuard.d.ts +3 -0
  32. package/dist/src/Chips/Chip/typeGuard.d.ts.map +1 -0
  33. package/dist/src/Chips/Chip/typeGuard.esm.js +29 -0
  34. package/dist/src/Chips/Chip/typeGuard.esm.js.map +1 -0
  35. package/dist/src/Chips/Chip/types.d.ts +43 -0
  36. package/dist/src/Chips/Chip/types.d.ts.map +1 -0
  37. package/dist/src/Chips/index.d.ts +2 -0
  38. package/dist/src/Chips/index.d.ts.map +1 -0
  39. package/dist/src/Control/BaseToggle/index.cjs.js +1 -1
  40. package/dist/src/Control/BaseToggle/index.cjs.js.map +1 -1
  41. package/dist/src/Control/BaseToggle/index.esm.js +1 -1
  42. package/dist/src/Control/BaseToggle/index.esm.js.map +1 -1
  43. package/dist/src/Floating/DropdownMenu/styles.cjs.js +3 -3
  44. package/dist/src/Floating/DropdownMenu/styles.cjs.js.map +1 -1
  45. package/dist/src/Floating/DropdownMenu/styles.d.ts +1 -1
  46. package/dist/src/Floating/DropdownMenu/styles.d.ts.map +1 -1
  47. package/dist/src/Floating/DropdownMenu/styles.esm.js +3 -3
  48. package/dist/src/Floating/DropdownMenu/styles.esm.js.map +1 -1
  49. package/dist/src/Floating/Tooltip/styles.cjs.js +2 -2
  50. package/dist/src/Floating/Tooltip/styles.cjs.js.map +1 -1
  51. package/dist/src/Floating/Tooltip/styles.d.ts +1 -1
  52. package/dist/src/Floating/Tooltip/styles.d.ts.map +1 -1
  53. package/dist/src/Floating/Tooltip/styles.esm.js +2 -2
  54. package/dist/src/Floating/Tooltip/styles.esm.js.map +1 -1
  55. package/dist/src/Inputs/Select/NativeSelect/styles.cjs.js +1 -1
  56. package/dist/src/Inputs/Select/NativeSelect/styles.cjs.js.map +1 -1
  57. package/dist/src/Inputs/Select/NativeSelect/styles.esm.js +1 -1
  58. package/dist/src/Inputs/Select/NativeSelect/styles.esm.js.map +1 -1
  59. package/dist/src/Inputs/Select/styles.cjs.js +2 -2
  60. package/dist/src/Inputs/Select/styles.cjs.js.map +1 -1
  61. package/dist/src/Inputs/Select/styles.esm.js +2 -2
  62. package/dist/src/Inputs/Select/styles.esm.js.map +1 -1
  63. package/dist/src/Inputs/TextInput/index.cjs.js +8 -2
  64. package/dist/src/Inputs/TextInput/index.cjs.js.map +1 -1
  65. package/dist/src/Inputs/TextInput/index.d.ts.map +1 -1
  66. package/dist/src/Inputs/TextInput/index.esm.js +8 -2
  67. package/dist/src/Inputs/TextInput/index.esm.js.map +1 -1
  68. package/dist/src/Inputs/TextInput/styles.cjs.js +6 -6
  69. package/dist/src/Inputs/TextInput/styles.cjs.js.map +1 -1
  70. package/dist/src/Inputs/TextInput/styles.d.ts +1 -1
  71. package/dist/src/Inputs/TextInput/styles.esm.js +6 -6
  72. package/dist/src/Inputs/TextInput/styles.esm.js.map +1 -1
  73. package/dist/src/Logos/RememberServiceLogo/index.cjs.js +11 -5
  74. package/dist/src/Logos/RememberServiceLogo/index.cjs.js.map +1 -1
  75. package/dist/src/Logos/RememberServiceLogo/index.d.ts.map +1 -1
  76. package/dist/src/Logos/RememberServiceLogo/index.esm.js +10 -4
  77. package/dist/src/Logos/RememberServiceLogo/index.esm.js.map +1 -1
  78. package/dist/src/Logos/RememberServiceLogo/style.cjs.js +2 -2
  79. package/dist/src/Logos/RememberServiceLogo/style.cjs.js.map +1 -1
  80. package/dist/src/Logos/RememberServiceLogo/style.d.ts.map +1 -1
  81. package/dist/src/Logos/RememberServiceLogo/style.esm.js +3 -3
  82. package/dist/src/Logos/RememberServiceLogo/style.esm.js.map +1 -1
  83. package/dist/src/Modals/Dialog/styles.cjs.js +2 -2
  84. package/dist/src/Modals/Dialog/styles.cjs.js.map +1 -1
  85. package/dist/src/Modals/Dialog/styles.esm.js +2 -2
  86. package/dist/src/Modals/Dialog/styles.esm.js.map +1 -1
  87. package/dist/src/Paginations/styles.cjs.js +3 -3
  88. package/dist/src/Paginations/styles.cjs.js.map +1 -1
  89. package/dist/src/Paginations/styles.esm.js +3 -3
  90. package/dist/src/Paginations/styles.esm.js.map +1 -1
  91. package/dist/src/index.cjs.js +2 -0
  92. package/dist/src/index.cjs.js.map +1 -1
  93. package/dist/src/index.d.ts +1 -0
  94. package/dist/src/index.d.ts.map +1 -1
  95. package/dist/src/index.esm.js +1 -0
  96. package/dist/src/index.esm.js.map +1 -1
  97. package/dist/src/stories/common.styles.d.ts +2 -1
  98. package/dist/src/stories/common.styles.d.ts.map +1 -1
  99. package/package.json +3 -3
  100. package/src/Badge/style.tsx +1 -2
  101. package/src/Buttons/Button/const.ts +4 -4
  102. package/src/Chips/Chip/Chip.stories.tsx +138 -0
  103. package/src/Chips/Chip/const.ts +115 -0
  104. package/src/Chips/Chip/index.tsx +51 -0
  105. package/src/Chips/Chip/styles.ts +80 -0
  106. package/src/Chips/Chip/typeGuard.ts +48 -0
  107. package/src/Chips/Chip/types.ts +61 -0
  108. package/src/Chips/index.ts +1 -0
  109. package/src/Common/Typography/Typography.stories.tsx +7 -7
  110. package/src/Control/BaseToggle/index.tsx +1 -1
  111. package/src/Floating/DropdownMenu/styles.tsx +12 -7
  112. package/src/Floating/Tooltip/styles.ts +9 -13
  113. package/src/Inputs/Select/NativeSelect/styles.ts +1 -1
  114. package/src/Inputs/Select/styles.ts +2 -2
  115. package/src/Inputs/TextInput/index.tsx +9 -2
  116. package/src/Inputs/TextInput/styles.ts +7 -7
  117. package/src/Logos/RememberServiceLogo/index.tsx +6 -4
  118. package/src/Logos/RememberServiceLogo/style.ts +1 -7
  119. package/src/Modals/Dialog/styles.ts +2 -2
  120. package/src/Paginations/styles.ts +3 -3
  121. package/src/index.ts +1 -0
  122. package/src/stories/common.styles.tsx +10 -4
@@ -5,13 +5,13 @@ import styled, { css } from 'styled-components';
5
5
 
6
6
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
7
7
  var PaginationContainer = styled.nav(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n display: inline-flex;\n list-style-type: none;\n box-sizing: border-box;\n user-select: none;\n margin: 0;\n padding: 0;\n gap: 16px;\n\n ", "\n"])), mobileOnly(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 8px;\n "])))));
8
- var CompactPaginationContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n all: unset;\n\n ", "\n gap: 16px;\n display: flex;\n align-items: center;\n width: fit-content;\n height: fit-content;\n"])), getTypographyStyles('Body1_M'));
9
- var CurrentPage = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n"])), getTypographyStyles('Body1_B'));
8
+ var CompactPaginationContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n all: unset;\n\n ", "\n gap: 16px;\n display: flex;\n align-items: center;\n width: fit-content;\n height: fit-content;\n"])), getTypographyStyles('UIBody3'));
9
+ var CurrentPage = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n"])), getTypographyStyles('SubTitle2'));
10
10
  var Pages = styled.ul(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n all: unset;\n display: inherit;\n gap: 4px;\n"])));
11
11
  var Page = styled.li(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral([""])));
12
12
  var DefaultButton = styled.button.attrs({
13
13
  type: 'button'
14
- })(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n all: unset;\n appearance: none;\n box-sizing: border-box;\n\n ", "\n display: grid;\n place-items: center;\n\n min-width: 34px;\n height: 34px;\n cursor: pointer;\n color: ", ";\n border-radius: 4px;\n\n &:disabled {\n color: ", ";\n cursor: not-allowed;\n pointer-events: none;\n }\n"])), getTypographyStyles('Body1_M'), contents000, contents000);
14
+ })(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n all: unset;\n appearance: none;\n box-sizing: border-box;\n\n ", "\n display: grid;\n place-items: center;\n\n min-width: 34px;\n height: 34px;\n cursor: pointer;\n color: ", ";\n border-radius: 4px;\n\n &:disabled {\n color: ", ";\n cursor: not-allowed;\n pointer-events: none;\n }\n"])), getTypographyStyles('UIBody3'), contents000, contents000);
15
15
  var ArrowButton = styled(DefaultButton)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), desktopOnly(css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n "])), bg200, bg300)), mobileOnly(css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n min-width: 44px;\n height: 44px;\n "])))));
16
16
  var BaseButton = styled(DefaultButton)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n &:hover,\n &:focus {\n border: solid 1px ", ";\n border-radius: 4px;\n background-color: ", ";\n }\n\n ", "\n"])), contents300, bg100, mobileOnly(css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n min-width: 44px;\n height: 44px;\n "])))));
17
17
  var PageButton = styled(BaseButton)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"styles.esm.js","sources":["../../../src/Paginations/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg100,\n bg200,\n bg300,\n contents000,\n contents300,\n desktopOnly,\n getTypographyStyles,\n mobileOnly,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nexport const PaginationContainer = styled.nav`\n all: unset;\n display: inline-flex;\n list-style-type: none;\n box-sizing: border-box;\n user-select: none;\n margin: 0;\n padding: 0;\n gap: 16px;\n\n ${mobileOnly(css`\n gap: 8px;\n `)}\n`;\n\nexport const CompactPaginationContainer = styled.div`\n all: unset;\n\n ${getTypographyStyles('Body1_M')}\n gap: 16px;\n display: flex;\n align-items: center;\n width: fit-content;\n height: fit-content;\n`;\n\nexport const CurrentPage = styled.span`\n ${getTypographyStyles('Body1_B')}\n`;\n\nexport const Pages = styled.ul`\n all: unset;\n display: inherit;\n gap: 4px;\n`;\n\nexport const Page = styled.li``;\n\nconst DefaultButton = styled.button.attrs({ type: 'button' })`\n all: unset;\n appearance: none;\n box-sizing: border-box;\n\n ${getTypographyStyles('Body1_M')}\n display: grid;\n place-items: center;\n\n min-width: 34px;\n height: 34px;\n cursor: pointer;\n color: ${contents000};\n border-radius: 4px;\n\n &:disabled {\n color: ${contents000};\n cursor: not-allowed;\n pointer-events: none;\n }\n`;\n\nexport const ArrowButton = styled(DefaultButton)`\n ${desktopOnly(css`\n &:hover {\n background-color: ${bg200};\n }\n &:active {\n background-color: ${bg300};\n }\n `)}\n\n ${mobileOnly(css`\n min-width: 44px;\n height: 44px;\n `)}\n`;\n\nexport const BaseButton = styled(DefaultButton)`\n &:hover,\n &:focus {\n border: solid 1px ${contents300};\n border-radius: 4px;\n background-color: ${bg100};\n }\n\n ${mobileOnly(css`\n min-width: 44px;\n height: 44px;\n `)}\n`;\n\nexport const PageButton = styled(BaseButton)<{ selected?: boolean }>`\n ${({ selected }) =>\n selected &&\n css`\n border: solid 1px ${contents300};\n border-radius: 4px;\n background-color: ${bg100};\n `}\n`;\n"],"names":["Pages","Page","type","BaseButton","PageButton"],"mappings":";;;;;AAAa;AAcN;;;AA8BMA;AAMAC;AAEb;AAA4CC;AAAe;;AAsC9CC;AAcAC;AACT;AAAW;AAMV;;"}
1
+ {"version":3,"file":"styles.esm.js","sources":["../../../src/Paginations/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg100,\n bg200,\n bg300,\n contents000,\n contents300,\n desktopOnly,\n getTypographyStyles,\n mobileOnly,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nexport const PaginationContainer = styled.nav`\n all: unset;\n display: inline-flex;\n list-style-type: none;\n box-sizing: border-box;\n user-select: none;\n margin: 0;\n padding: 0;\n gap: 16px;\n\n ${mobileOnly(css`\n gap: 8px;\n `)}\n`;\n\nexport const CompactPaginationContainer = styled.div`\n all: unset;\n\n ${getTypographyStyles('UIBody3')}\n gap: 16px;\n display: flex;\n align-items: center;\n width: fit-content;\n height: fit-content;\n`;\n\nexport const CurrentPage = styled.span`\n ${getTypographyStyles('SubTitle2')}\n`;\n\nexport const Pages = styled.ul`\n all: unset;\n display: inherit;\n gap: 4px;\n`;\n\nexport const Page = styled.li``;\n\nconst DefaultButton = styled.button.attrs({ type: 'button' })`\n all: unset;\n appearance: none;\n box-sizing: border-box;\n\n ${getTypographyStyles('UIBody3')}\n display: grid;\n place-items: center;\n\n min-width: 34px;\n height: 34px;\n cursor: pointer;\n color: ${contents000};\n border-radius: 4px;\n\n &:disabled {\n color: ${contents000};\n cursor: not-allowed;\n pointer-events: none;\n }\n`;\n\nexport const ArrowButton = styled(DefaultButton)`\n ${desktopOnly(css`\n &:hover {\n background-color: ${bg200};\n }\n &:active {\n background-color: ${bg300};\n }\n `)}\n\n ${mobileOnly(css`\n min-width: 44px;\n height: 44px;\n `)}\n`;\n\nexport const BaseButton = styled(DefaultButton)`\n &:hover,\n &:focus {\n border: solid 1px ${contents300};\n border-radius: 4px;\n background-color: ${bg100};\n }\n\n ${mobileOnly(css`\n min-width: 44px;\n height: 44px;\n `)}\n`;\n\nexport const PageButton = styled(BaseButton)<{ selected?: boolean }>`\n ${({ selected }) =>\n selected &&\n css`\n border: solid 1px ${contents300};\n border-radius: 4px;\n background-color: ${bg100};\n `}\n`;\n"],"names":["Pages","Page","type","BaseButton","PageButton"],"mappings":";;;;;AAAa;AAcN;;;AA8BMA;AAMAC;AAEb;AAA4CC;AAAe;;AAsC9CC;AAcAC;AACT;AAAW;AAMV;;"}
@@ -31,6 +31,7 @@ var index$j = require('./Floating/Popover/index.cjs.js');
31
31
  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
+ var index$l = require('./Chips/Chip/index.cjs.js');
34
35
 
35
36
 
36
37
 
@@ -80,4 +81,5 @@ exports.StyledPopoverContent = styles$3.StyledPopoverContent;
80
81
  exports.StyledPopoverContentWrapper = styles$3.StyledPopoverContentWrapper;
81
82
  exports.showFadeIn = styles$3.showFadeIn;
82
83
  exports.showFadeOut = styles$3.showFadeOut;
84
+ exports.Chip = index$l.Chip;
83
85
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,4 +8,5 @@ export * from './Modals';
8
8
  export * from './Paginations';
9
9
  export * from './Inputs';
10
10
  export * from './Floating';
11
+ export * from './Chips';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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"}
@@ -29,4 +29,5 @@ export { default as Popover } from './Floating/Popover/index.esm.js';
29
29
  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
+ export { Chip } from './Chips/Chip/index.esm.js';
32
33
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,9 +8,10 @@ export declare const TitleContainer: import("styled-components").IStyledComponen
8
8
  export declare const Table: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>>;
9
9
  export declare const TableHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, never>>;
10
10
  export declare const TableBody: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, never>>;
11
- export declare const TableColumn: ({ isHeader, align, children, }: {
11
+ export declare const TableColumn: ({ isHeader, align, rowSpan, children, }: {
12
12
  isHeader?: boolean;
13
13
  align?: TextAlign;
14
+ rowSpan?: number;
14
15
  children: ReactNode;
15
16
  }) => import("react/jsx-runtime").JSX.Element;
16
17
  export declare const TableRow: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, never>>;
@@ -1 +1 @@
1
- {"version":3,"file":"common.styles.d.ts","sourceRoot":"","sources":["../../../src/stories/common.styles.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,eAAO,MAAM,KAAK;;;GAmBjB,CAAC;AAEF,eAAO,MAAM,cAAc,gNAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,yNAIjB,CAAC;AAEF,eAAO,MAAM,WAAW,kOAAiB,CAAC;AAE1C,eAAO,MAAM,SAAS,kOAAiB,CAAC;AAkBxC,eAAO,MAAM,WAAW,mCAIrB;IACD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAKE,CAAC;AAEJ,eAAO,MAAM,QAAQ,0NAAc,CAAC"}
1
+ {"version":3,"file":"common.styles.d.ts","sourceRoot":"","sources":["../../../src/stories/common.styles.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,eAAO,MAAM,KAAK;;;GAmBjB,CAAC;AAEF,eAAO,MAAM,cAAc,gNAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,yNAIjB,CAAC;AAEF,eAAO,MAAM,WAAW,kOAAiB,CAAC;AAE1C,eAAO,MAAM,SAAS,kOAAiB,CAAC;AAkBxC,eAAO,MAAM,WAAW,4CAKrB;IACD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB,4CASE,CAAC;AAEJ,eAAO,MAAM,QAAQ,0NAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remember-web/primitive",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Remember Web Primitive Components",
5
5
  "homepage": "https://dramancompany.github.io/remember-web-packages/",
6
6
  "author": "Remember",
@@ -41,8 +41,8 @@
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.9",
45
- "@remember-web/mixin": "^0.2.4",
44
+ "@remember-web/icon": "^0.1.12",
45
+ "@remember-web/mixin": "^0.2.5",
46
46
  "@remember-web/shared": "^0.1.1"
47
47
  },
48
48
  "devDependencies": {
@@ -9,8 +9,7 @@ import styled, { css } from 'styled-components';
9
9
  * pseudo로 사용시 data-badge-value attribue가 필요합니다.
10
10
  */
11
11
  export const badgeCss = css`
12
- ${getTypographyStyles('Subtitle2')}
13
-
12
+ ${getTypographyStyles('SubTitle2')}
14
13
  display: inline-block;
15
14
  box-sizing: border-box;
16
15
  line-height: 16px;
@@ -6,25 +6,25 @@ import type { ButtonSize, ButtonVariant } from './types';
6
6
 
7
7
  export const BUTTON_SIZES = {
8
8
  small: {
9
- typography: 'Body2_M',
9
+ typography: 'Caption1',
10
10
  height: '32px',
11
11
  minWidth: '68px',
12
12
  padding: '0 16px',
13
13
  },
14
14
  medium: {
15
- typography: 'Body1_M',
15
+ typography: 'UIBody3',
16
16
  height: '36px',
17
17
  minWidth: '78px',
18
18
  padding: '0 20px',
19
19
  },
20
20
  large: {
21
- typography: 'Headline4_M',
21
+ typography: 'UIBody2',
22
22
  height: '44px',
23
23
  minWidth: '108px',
24
24
  padding: '0 20px',
25
25
  },
26
26
  xLarge: {
27
- typography: 'Headline4_M',
27
+ typography: 'UIBody2',
28
28
  height: '52px',
29
29
  minWidth: '116px',
30
30
  padding: '0 24px',
@@ -0,0 +1,138 @@
1
+ import {
2
+ getIconComponentFromName,
3
+ iconNames,
4
+ isIconName,
5
+ } from '@/stories/util';
6
+ import type { Meta, StoryObj } from '@storybook/react';
7
+ import { Fragment, createElement } from 'react';
8
+
9
+ import { Typography } from '@/Common';
10
+ import {
11
+ Paper,
12
+ Table,
13
+ TableBody,
14
+ TableColumn,
15
+ TableHeader,
16
+ TableRow,
17
+ } from '@/stories/common.styles';
18
+ import { IconArrow2LeftS } from '@remember-web/icon';
19
+ import { Chip } from './';
20
+ import type { ChipSize } from './types';
21
+
22
+ type Story = StoryObj<typeof Chip>;
23
+
24
+ const meta = {
25
+ title: 'Primitive/Chips/Chip',
26
+ component: Chip,
27
+ argTypes: {
28
+ variant: {
29
+ control: 'select',
30
+ options: ['filled', 'outline', 'dashedLine'],
31
+ },
32
+ size: { control: 'select', options: ['small', 'medium'] },
33
+ children: { control: 'text' },
34
+ disabled: { control: 'boolean' },
35
+ selected: { control: 'boolean' },
36
+ clickable: { control: 'boolean' },
37
+ onDelete: { action: 'deleted' },
38
+ leftIcon: { control: 'select', options: ['none', ...iconNames] },
39
+ deleteIcon: { control: 'select', options: ['none', ...iconNames] },
40
+ },
41
+ args: {
42
+ children: 'Test Chip',
43
+ onDelete: () => console.log('Delete'),
44
+ size: 'medium',
45
+ variant: 'filled',
46
+ clickable: true,
47
+ selected: false,
48
+ disabled: false,
49
+ },
50
+ } satisfies Meta<typeof Chip>;
51
+
52
+ export const Default: Story = {
53
+ render: ({ leftIcon, deleteIcon, selected, clickable, ...args }) => {
54
+ const leftIconString = String(leftIcon);
55
+ const leftIconElement =
56
+ leftIcon && isIconName(leftIconString)
57
+ ? createElement(getIconComponentFromName(leftIconString))
58
+ : undefined;
59
+
60
+ const rightIconString = String(deleteIcon);
61
+ const deleteIconElement =
62
+ rightIconString && isIconName(rightIconString)
63
+ ? createElement(getIconComponentFromName(rightIconString))
64
+ : undefined;
65
+
66
+ return (
67
+ <Chip
68
+ {...args}
69
+ key={JSON.stringify(args)}
70
+ leftIcon={leftIconElement}
71
+ deleteIcon={deleteIconElement}
72
+ onDelete={args.onDelete || (() => {})}
73
+ />
74
+ );
75
+ },
76
+ };
77
+
78
+ const variants = ['filled', 'outline', 'dashedLine'] as const;
79
+ const sizes = ['medium', 'small'] as const;
80
+ const states = ['default', 'hover', 'disabled', 'selected'] as const;
81
+
82
+ export const Overview: Story = {
83
+ render: () => (
84
+ <Paper $minWidth={800} $maxWidth={1200}>
85
+ <Typography variant="Headline">Chip Overview</Typography>
86
+ <br />
87
+ <Table>
88
+ <TableHeader>
89
+ <TableRow>
90
+ <TableColumn isHeader>State</TableColumn>
91
+ <TableColumn isHeader>Size</TableColumn>
92
+ {variants.map((variant) => (
93
+ <TableColumn key={variant} isHeader align="center">
94
+ {variant.charAt(0).toUpperCase() + variant.slice(1)}
95
+ </TableColumn>
96
+ ))}
97
+ </TableRow>
98
+ </TableHeader>
99
+ <TableBody>
100
+ {states.map((state) => (
101
+ <Fragment key={state}>
102
+ {sizes.map((size: ChipSize, index: number) => (
103
+ <TableRow key={`${state}-${size}`}>
104
+ {index === 0 && (
105
+ <TableColumn rowSpan={2}>
106
+ {state.charAt(0).toUpperCase() + state.slice(1)}
107
+ </TableColumn>
108
+ )}
109
+ <TableColumn>
110
+ {size.charAt(0).toUpperCase() + size.slice(1)}
111
+ </TableColumn>
112
+ {variants.map((variant) => (
113
+ <TableColumn key={variant} align="center">
114
+ <Chip
115
+ size={size}
116
+ variant={variant}
117
+ clickable={state !== 'disabled' || true}
118
+ disabled={state === 'disabled'}
119
+ selected={state === 'selected'}
120
+ className={state === 'hover' ? 'hover-state' : ''}
121
+ onDelete={() => console.log('Delete')}
122
+ leftIcon={<IconArrow2LeftS />}
123
+ >
124
+ 칩이름
125
+ </Chip>
126
+ </TableColumn>
127
+ ))}
128
+ </TableRow>
129
+ ))}
130
+ </Fragment>
131
+ ))}
132
+ </TableBody>
133
+ </Table>
134
+ </Paper>
135
+ ),
136
+ };
137
+
138
+ export default meta;
@@ -0,0 +1,115 @@
1
+ import {
2
+ bg100,
3
+ bg200,
4
+ bg300,
5
+ contents100,
6
+ contents150,
7
+ contents200,
8
+ contents300,
9
+ contents999,
10
+ primary100,
11
+ } from '@remember-web/mixin';
12
+ import type { ChipSize, ChipVariant, ChipVariantStyleMap } from './types';
13
+
14
+ export const CHIP_SIZE_STYLE = {
15
+ small: {
16
+ typography: 'Caption1',
17
+ padding: '8px 10px',
18
+ height: '28px',
19
+ },
20
+ medium: {
21
+ typography: 'UIBody3',
22
+ padding: '8px 12px',
23
+ height: '30px',
24
+ },
25
+ } as const satisfies Record<ChipSize, unknown>;
26
+
27
+ export const CHIP_VARIANT_STYLE: ChipVariantStyleMap = {
28
+ filled: {
29
+ default: {
30
+ backgroundColor: bg200,
31
+ color: contents150,
32
+ leftIconColor: contents150,
33
+ deleteButtonColor: contents200,
34
+ },
35
+ hover: {
36
+ backgroundColor: bg200,
37
+ color: contents100,
38
+ leftIconColor: contents100,
39
+ deleteButtonColor: contents150,
40
+ },
41
+ disabled: {
42
+ backgroundColor: bg300,
43
+ color: contents300,
44
+ leftIconColor: contents300,
45
+ deleteButtonColor: contents300,
46
+ },
47
+ selected: {
48
+ backgroundColor: primary100,
49
+ color: contents999,
50
+ leftIconColor: contents999,
51
+ deleteButtonColor: contents999,
52
+ },
53
+ },
54
+
55
+ outline: {
56
+ default: {
57
+ backgroundColor: bg100,
58
+ color: contents150,
59
+ leftIconColor: contents150,
60
+ deleteButtonColor: contents200,
61
+ border: `1px solid ${contents150}`,
62
+ },
63
+ hover: {
64
+ backgroundColor: bg100,
65
+ color: contents100,
66
+ leftIconColor: contents100,
67
+ deleteButtonColor: contents150,
68
+ border: `1px solid ${contents100}`,
69
+ },
70
+ disabled: {
71
+ backgroundColor: bg100,
72
+ color: contents200,
73
+ leftIconColor: contents200,
74
+ deleteButtonColor: contents200,
75
+ border: `1px solid ${contents200}`,
76
+ },
77
+ selected: {
78
+ backgroundColor: primary100,
79
+ color: contents999,
80
+ leftIconColor: contents999,
81
+ deleteButtonColor: contents999,
82
+ },
83
+ },
84
+
85
+ dashedLine: {
86
+ default: {
87
+ backgroundColor: bg100,
88
+ color: contents150,
89
+ leftIconColor: contents150,
90
+ deleteButtonColor: contents200,
91
+ border: `1px dashed ${contents150}`,
92
+ },
93
+ hover: {
94
+ backgroundColor: bg100,
95
+ color: contents100,
96
+ leftIconColor: contents100,
97
+ deleteButtonColor: contents150,
98
+ border: `1px dashed ${contents100}`,
99
+ },
100
+ disabled: {
101
+ backgroundColor: bg100,
102
+ color: contents200,
103
+ leftIconColor: contents200,
104
+ deleteButtonColor: contents200,
105
+ border: `1px dashed ${contents200}`,
106
+ },
107
+ selected: {
108
+ backgroundColor: primary100,
109
+ color: contents999,
110
+ leftIconColor: contents999,
111
+ deleteButtonColor: contents999,
112
+ border: `1px solid ${primary100}`,
113
+ },
114
+ },
115
+ } as const satisfies Record<ChipVariant, unknown>;
@@ -0,0 +1,51 @@
1
+ import { IconCloseS } from '@remember-web/icon';
2
+ import { type ForwardedRef, forwardRef } from 'react';
3
+ import type { PolymorphicComponent } from 'styled-components';
4
+ import { ButtonWrapper, StyledChip } from './styles';
5
+ import { ensureValidChipProps } from './typeGuard';
6
+ import type { ChipProps } from './types';
7
+
8
+ export const Chip = forwardRef(
9
+ (props: ChipProps, ref: ForwardedRef<HTMLDivElement | null>) => {
10
+ const {
11
+ size = 'medium',
12
+ variant = 'filled',
13
+ selected = false,
14
+ clickable = true,
15
+ ...rest
16
+ } = props;
17
+
18
+ // NOTE: 개발 모드에서만 런타임 체크 수행
19
+ if (process.env.NODE_ENV === 'development') {
20
+ ensureValidChipProps(props);
21
+ }
22
+
23
+ return (
24
+ <StyledChip
25
+ ref={ref}
26
+ aria-live="polite"
27
+ $size={size}
28
+ $variant={variant}
29
+ $selected={selected}
30
+ $clickable={clickable}
31
+ data-chip-disabled={props.disabled}
32
+ {...rest}
33
+ >
34
+ {props.leftIcon}
35
+ {props.children}
36
+ {props.onDelete && (
37
+ <ButtonWrapper
38
+ onClick={(e: React.MouseEvent | React.KeyboardEvent) => {
39
+ e.stopPropagation();
40
+ e.preventDefault();
41
+ props.onDelete?.();
42
+ }}
43
+ className="delete-button"
44
+ >
45
+ {props.deleteIcon || <IconCloseS />}
46
+ </ButtonWrapper>
47
+ )}
48
+ </StyledChip>
49
+ );
50
+ }
51
+ ) as PolymorphicComponent<'web', ChipProps>;
@@ -0,0 +1,80 @@
1
+ import { getTypographyStyles } from '@remember-web/mixin';
2
+ import styled, { css } from 'styled-components';
3
+ import { CHIP_SIZE_STYLE, CHIP_VARIANT_STYLE } from './const';
4
+ import type { ChipState, ChipStyleProps } from './types';
5
+
6
+ const getVariantStyles = (props: Partial<ChipStyleProps>) => {
7
+ const { $variant = 'filled', $selected, $clickable } = props;
8
+ const getStateStyle = (state: ChipState) => css`
9
+ background-color: ${CHIP_VARIANT_STYLE[$variant][state].backgroundColor};
10
+ color: ${CHIP_VARIANT_STYLE[$variant][state].color};
11
+ border: ${CHIP_VARIANT_STYLE[$variant][state].border || 'none'};
12
+ --left-icon-color: ${CHIP_VARIANT_STYLE[$variant][state].leftIconColor};
13
+ --delete-button-color: ${CHIP_VARIANT_STYLE[$variant][state].deleteButtonColor};
14
+ `;
15
+
16
+ return css`
17
+ ${getStateStyle('default')};
18
+
19
+ ${
20
+ $clickable &&
21
+ css`
22
+ &:hover:not([data-chip-disabled='true']) {
23
+ ${getStateStyle('hover')}
24
+ }
25
+
26
+ ${$selected ? '&' : '&:active'}:not([data-chip-disabled="true"]) {
27
+ ${getStateStyle('selected')}
28
+ ${$variant === 'outline' && 'border: none;'}
29
+ }
30
+ `
31
+ }
32
+
33
+ &[data-chip-disabled='true'] {
34
+ ${getStateStyle('disabled')}
35
+ cursor: not-allowed;
36
+ }
37
+
38
+ & svg {
39
+ color: var(--left-icon-color);
40
+ }
41
+
42
+ .delete-button svg {
43
+ color: var(--delete-button-color);
44
+ }
45
+ `;
46
+ };
47
+
48
+ export const StyledChip = styled.div<ChipStyleProps>`
49
+ ${({ $size, $variant, $clickable = false, ...props }) => css`
50
+ box-sizing: border-box;
51
+ user-select: none;
52
+ cursor: ${$clickable ? 'pointer' : 'default'};
53
+
54
+ display: inline-flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ flex-shrink: 0;
58
+ gap: 4px;
59
+
60
+ width: fit-content;
61
+ border-radius: 50px;
62
+ text-align: center;
63
+ transition: all 0.2s ease-in;
64
+
65
+ height: ${CHIP_SIZE_STYLE[$size].height};
66
+ padding: ${CHIP_SIZE_STYLE[$size].padding};
67
+
68
+ ${getTypographyStyles(CHIP_SIZE_STYLE[$size].typography)}
69
+
70
+ ${getVariantStyles({ $variant, $clickable, ...props })}
71
+ `}
72
+ `;
73
+
74
+ export const ButtonWrapper = styled.button`
75
+ all: unset;
76
+ cursor: pointer;
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ `;
@@ -0,0 +1,48 @@
1
+ import type { ChipProps, ChipSize, ChipVariant } from './types';
2
+
3
+ export function ensureValidChipProps(props: ChipProps): props is ChipProps {
4
+ if (props.clickable === false && 'selected' in props) {
5
+ throw new Error(
6
+ '오류: "clickable"이 false일 때는 "selected" 속성을 사용할 수 없습니다. ' +
7
+ '선택 가능한 Chip을 만들려면 "clickable"을 true로 설정하세요.'
8
+ );
9
+ }
10
+
11
+ if (props.onDelete === undefined && 'deleteIcon' in props) {
12
+ throw new Error(
13
+ '오류: "onDelete" 함수 없이 "deleteIcon"을 사용할 수 없습니다. ' +
14
+ '"deleteIcon"을 사용하려면 "onDelete" 함수를 함께 사용해야 합니다.'
15
+ );
16
+ }
17
+
18
+ if (!props.children) {
19
+ throw new Error(
20
+ '오류: Chip 컴포넌트에는 반드시 children이 있어야 합니다. '
21
+ );
22
+ }
23
+
24
+ if (!props.size) {
25
+ throw new Error('오류: Chip 컴포넌트에는 반드시 size가 있어야 합니다. ');
26
+ }
27
+
28
+ if (!props.variant) {
29
+ throw new Error('오류: Chip 컴포넌트에는 반드시 variant가 있어야 합니다. ');
30
+ }
31
+
32
+ const validSizes: ChipSize[] = ['small', 'medium'];
33
+ if (props.size && !validSizes.includes(props.size)) {
34
+ throw new Error(
35
+ `오류: 올바르지 않은 size 값입니다: "${props.size}". ` +
36
+ `유효한 size 값은 다음과 같습니다: ${validSizes.join(', ')}.`
37
+ );
38
+ }
39
+
40
+ const validVariants: ChipVariant[] = ['filled', 'outline', 'dashedLine'];
41
+ if (props.variant && !validVariants.includes(props.variant)) {
42
+ throw new Error(
43
+ `오류: 올바르지 않은 variant 값입니다: "${props.variant}". ` +
44
+ `유효한 variant 값은 다음과 같습니다: ${validVariants.join(', ')}.`
45
+ );
46
+ }
47
+ return true;
48
+ }
@@ -0,0 +1,61 @@
1
+ import type { ComponentProps } from 'react';
2
+
3
+ // Props types -------------------------------------------------------
4
+ export type ChipSize = 'small' | 'medium';
5
+
6
+ export type ChipVariant = 'filled' | 'outline' | 'dashedLine';
7
+
8
+ type ClickableProps =
9
+ | {
10
+ clickable?: true;
11
+ selected?: boolean;
12
+ }
13
+ | {
14
+ clickable: false;
15
+ selected?: never;
16
+ };
17
+
18
+ type DeleteProps =
19
+ | {
20
+ onDelete: VoidFunction;
21
+ deleteIcon?: React.ReactNode;
22
+ }
23
+ | {
24
+ onDelete?: never;
25
+ deleteIcon?: never;
26
+ };
27
+
28
+ type BaseChipProps = {
29
+ size: ChipSize;
30
+ variant: ChipVariant;
31
+ children: React.ReactNode;
32
+ leftIcon?: React.ReactNode;
33
+ disabled?: boolean;
34
+ };
35
+
36
+ export type ChipProps = BaseChipProps &
37
+ ClickableProps &
38
+ DeleteProps &
39
+ ComponentProps<'div'>;
40
+
41
+ // Styling types -------------------------------------------------------
42
+ export type ChipState = 'default' | 'hover' | 'disabled' | 'selected';
43
+
44
+ export type ChipStyleProps = {
45
+ $size: ChipSize;
46
+ $variant: ChipVariant;
47
+ $clickable: boolean;
48
+ $selected: boolean;
49
+ };
50
+
51
+ interface ChipStateStyle {
52
+ backgroundColor: string;
53
+ color: string;
54
+ leftIconColor: string;
55
+ deleteButtonColor: string;
56
+ border?: string;
57
+ }
58
+
59
+ type ChipStateStyles = Record<ChipState, ChipStateStyle>;
60
+
61
+ export type ChipVariantStyleMap = Record<ChipVariant, ChipStateStyles>;
@@ -0,0 +1 @@
1
+ export * from './Chip';