@remember-web/primitive 0.5.3 → 0.5.5
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/Floating/Tooltip/index.cjs.js +4 -1
- package/dist/src/Floating/Tooltip/index.cjs.js.map +1 -1
- package/dist/src/Floating/Tooltip/index.d.ts +1 -1
- package/dist/src/Floating/Tooltip/index.d.ts.map +1 -1
- package/dist/src/Floating/Tooltip/index.esm.js +4 -1
- package/dist/src/Floating/Tooltip/index.esm.js.map +1 -1
- package/dist/src/Floating/Tooltip/types.cjs.js.map +1 -1
- package/dist/src/Floating/Tooltip/types.d.ts +1 -0
- package/dist/src/Floating/Tooltip/types.d.ts.map +1 -1
- package/dist/src/Floating/Tooltip/types.esm.js.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/index.cjs.js +4 -1
- package/dist/src/Inputs/Select/DesignedSelect/index.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/index.d.ts +1 -0
- package/dist/src/Inputs/Select/DesignedSelect/index.d.ts.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/index.esm.js +4 -1
- package/dist/src/Inputs/Select/DesignedSelect/index.esm.js.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/styles.cjs.js +4 -4
- package/dist/src/Inputs/Select/DesignedSelect/styles.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/styles.d.ts.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/styles.esm.js +5 -5
- package/dist/src/Inputs/Select/DesignedSelect/styles.esm.js.map +1 -1
- package/dist/src/Inputs/Select/DesignedSelect/types.d.ts +1 -0
- package/dist/src/Inputs/Select/DesignedSelect/types.d.ts.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/index.cjs.js +4 -1
- package/dist/src/Inputs/Select/NativeSelect/index.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/index.d.ts +1 -0
- package/dist/src/Inputs/Select/NativeSelect/index.d.ts.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/index.esm.js +4 -1
- package/dist/src/Inputs/Select/NativeSelect/index.esm.js.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/styles.cjs.js +2 -2
- package/dist/src/Inputs/Select/NativeSelect/styles.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/styles.d.ts.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/styles.esm.js +3 -3
- package/dist/src/Inputs/Select/NativeSelect/styles.esm.js.map +1 -1
- package/dist/src/Inputs/Select/NativeSelect/types.d.ts +1 -0
- package/dist/src/Inputs/Select/NativeSelect/types.d.ts.map +1 -1
- package/dist/src/Inputs/Select/index.cjs.js +4 -1
- package/dist/src/Inputs/Select/index.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/index.d.ts.map +1 -1
- package/dist/src/Inputs/Select/index.esm.js +4 -1
- package/dist/src/Inputs/Select/index.esm.js.map +1 -1
- package/dist/src/Inputs/Select/styles.cjs.js +12 -3
- package/dist/src/Inputs/Select/styles.cjs.js.map +1 -1
- package/dist/src/Inputs/Select/styles.d.ts +1 -0
- package/dist/src/Inputs/Select/styles.d.ts.map +1 -1
- package/dist/src/Inputs/Select/styles.esm.js +14 -5
- package/dist/src/Inputs/Select/styles.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Floating/Tooltip/Tooltip.stories.tsx +6 -2
- package/src/Floating/Tooltip/index.tsx +2 -0
- package/src/Floating/Tooltip/types.ts +1 -0
- package/src/Inputs/Select/DesignedSelect/index.tsx +2 -0
- package/src/Inputs/Select/DesignedSelect/styles.ts +12 -4
- package/src/Inputs/Select/DesignedSelect/types.ts +1 -0
- package/src/Inputs/Select/NativeSelect/index.tsx +2 -0
- package/src/Inputs/Select/NativeSelect/styles.ts +6 -7
- package/src/Inputs/Select/NativeSelect/types.ts +1 -0
- package/src/Inputs/Select/Select.stories.tsx +2 -3
- package/src/Inputs/Select/index.tsx +3 -0
- package/src/Inputs/Select/styles.ts +28 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../src/Inputs/Select/NativeSelect/index.tsx"],"sourcesContent":["'use client';\n\nimport { IconArrow2Down } from '@remember-web/icon';\nimport type { ForwardRefRenderFunction } from 'react';\nimport { forwardRef } from 'react';\n\nimport { SelectContainer } from '../styles';\nimport { SelectDownIcon, StyledSelect } from './styles';\nimport type { NativeSelectInternalProps } from './types';\n\nconst NativeSelect: ForwardRefRenderFunction<\n HTMLSelectElement,\n NativeSelectInternalProps\n> = (\n {\n children,\n className,\n width,\n placeholder,\n value,\n disabled,\n onClick,\n ...props\n },\n ref\n) => {\n const showPlaceholder = !value && !!placeholder;\n\n return (\n <SelectContainer\n aria-disabled={disabled}\n className={className}\n $width={width}\n >\n <StyledSelect\n {...props}\n value={value}\n $width={width}\n ref={ref}\n isPlaceholder={showPlaceholder}\n disabled={disabled}\n onClick={onClick}\n >\n {!value && (\n <option value=\"\" selected>\n {placeholder || 'ㅤ'}\n </option>\n )}\n {children}\n </StyledSelect>\n <SelectDownIcon>\n <IconArrow2Down size=\"small\" />\n </SelectDownIcon>\n </SelectContainer>\n );\n};\n\nexport default forwardRef(NativeSelect);\n"],"names":["props","className","$width","value","ref","isPlaceholder","disabled","onClick","children","size"],"mappings":";;;;;;;;;AAAa;AAAA;AAAA;AAUb;
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../src/Inputs/Select/NativeSelect/index.tsx"],"sourcesContent":["'use client';\n\nimport { IconArrow2Down } from '@remember-web/icon';\nimport type { ForwardRefRenderFunction } from 'react';\nimport { forwardRef } from 'react';\n\nimport { SelectContainer } from '../styles';\nimport { SelectDownIcon, StyledSelect } from './styles';\nimport type { NativeSelectInternalProps } from './types';\n\nconst NativeSelect: ForwardRefRenderFunction<\n HTMLSelectElement,\n NativeSelectInternalProps\n> = (\n {\n children,\n className,\n width,\n placeholder,\n value,\n disabled,\n onClick,\n error = false,\n ...props\n },\n ref\n) => {\n const showPlaceholder = !value && !!placeholder;\n\n return (\n <SelectContainer\n aria-disabled={disabled}\n className={className}\n $width={width}\n $error={error}\n >\n <StyledSelect\n {...props}\n value={value}\n $width={width}\n ref={ref}\n isPlaceholder={showPlaceholder}\n disabled={disabled}\n onClick={onClick}\n >\n {!value && (\n <option value=\"\" selected>\n {placeholder || 'ㅤ'}\n </option>\n )}\n {children}\n </StyledSelect>\n <SelectDownIcon>\n <IconArrow2Down size=\"small\" />\n </SelectDownIcon>\n </SelectContainer>\n );\n};\n\nexport default forwardRef(NativeSelect);\n"],"names":["error","props","className","$width","$error","value","ref","isPlaceholder","disabled","onClick","children","size"],"mappings":";;;;;;;;;AAAa;AAAA;AAAA;AAUb;AAgBK;;;;;;;;AAJDA;AACGC;AAIL;;AAII;AACAC;AACAC;AACAC;;AAIEC;AACAF;AACAG;AACAC;AACAC;AACAC;AAAiBC;AAGPL;;;;AAID;;AAGOM;;AAAe;AAChB;AAGvB;AAEA;;"}
|
|
@@ -11,7 +11,7 @@ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefault(_taggedTempla
|
|
|
11
11
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
12
12
|
|
|
13
13
|
var _templateObject, _templateObject2, _templateObject3;
|
|
14
|
-
var StyledSelect = styled__default.default.select(_templateObject || (_templateObject = _taggedTemplateLiteral__default.default(["\n all: unset;\n\n ", "
|
|
14
|
+
var StyledSelect = styled__default.default.select(_templateObject || (_templateObject = _taggedTemplateLiteral__default.default(["\n all: unset;\n\n ", ";\n border-width: 1px;\n border-style: solid;\n \n border-radius: 4px;\n padding: 10px 36px 10px 12px;\n box-sizing: border-box;\n\n ", "\n\n width: ", ";\n\n transition: border-color 0.2s, background-color 0.2s;\n\n\n &:not(:disabled) {\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n\n &:active {\n background-color: ", ";\n }\n }\n\n border-color: var(--border-color);\n"])), mixin.getTypographyStyles('UIBody2'), function (_ref) {
|
|
15
15
|
var isPlaceholder = _ref.isPlaceholder;
|
|
16
16
|
return isPlaceholder && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default.default(["\n color: ", ";\n "])), mixin.contents200);
|
|
17
17
|
}, function (_ref2) {
|
|
@@ -23,7 +23,7 @@ var StyledSelect = styled__default.default.select(_templateObject || (_templateO
|
|
|
23
23
|
return "".concat($width, "px");
|
|
24
24
|
}
|
|
25
25
|
return $width;
|
|
26
|
-
}, mixin.
|
|
26
|
+
}, mixin.bg200, mixin.bg300);
|
|
27
27
|
var SelectDownIcon = styled__default.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default.default(["\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n\n & > svg {\n display: block;\n }\n\n pointer-events: none;\n"])));
|
|
28
28
|
|
|
29
29
|
exports.SelectDownIcon = SelectDownIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.cjs.js","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n bg300,\n
|
|
1
|
+
{"version":3,"file":"styles.cjs.js","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n bg300,\n contents200,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nexport const StyledSelect = styled.select<{\n $width?: number | string;\n isPlaceholder?: boolean;\n}>`\n all: unset;\n\n ${getTypographyStyles('UIBody2')};\n border-width: 1px;\n border-style: solid;\n \n border-radius: 4px;\n padding: 10px 36px 10px 12px;\n box-sizing: border-box;\n\n ${({ isPlaceholder }) =>\n isPlaceholder &&\n css`\n color: ${contents200};\n `}\n\n width: ${({ $width }) => {\n if (!$width) {\n return null;\n }\n\n if (typeof $width === 'number') {\n return `${$width}px`;\n }\n\n return $width;\n }};\n\n transition: border-color 0.2s, background-color 0.2s;\n\n\n &:not(:disabled) {\n @media (hover: hover) {\n &:hover {\n background-color: ${bg200};\n }\n }\n\n &:active {\n background-color: ${bg300};\n }\n }\n\n border-color: var(--border-color);\n`;\nexport const SelectDownIcon = styled.div`\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n\n & > svg {\n display: block;\n }\n\n pointer-events: none;\n`;\n"],"names":[],"mappings":";;;;;;;;;;;;AAAa;;AAwBT;;AAIC;AAEsB;;AAErB;AACF;AAEA;;AAEA;AAEA;AACF;AAmBK;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"names":[],"mappings":";AAUA,eAAO,MAAM,YAAY;;;GAgDxB,CAAC;AACF,eAAO,MAAM,cAAc,gNAW1B,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
3
|
-
import { getTypographyStyles,
|
|
3
|
+
import { getTypographyStyles, contents200, bg200, bg300 } from '@remember-web/mixin';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
|
|
6
6
|
var _templateObject, _templateObject2, _templateObject3;
|
|
7
|
-
var StyledSelect = styled.select(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n\n ", "
|
|
7
|
+
var StyledSelect = styled.select(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n\n ", ";\n border-width: 1px;\n border-style: solid;\n \n border-radius: 4px;\n padding: 10px 36px 10px 12px;\n box-sizing: border-box;\n\n ", "\n\n width: ", ";\n\n transition: border-color 0.2s, background-color 0.2s;\n\n\n &:not(:disabled) {\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n\n &:active {\n background-color: ", ";\n }\n }\n\n border-color: var(--border-color);\n"])), getTypographyStyles('UIBody2'), function (_ref) {
|
|
8
8
|
var isPlaceholder = _ref.isPlaceholder;
|
|
9
9
|
return isPlaceholder && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n "])), contents200);
|
|
10
10
|
}, function (_ref2) {
|
|
@@ -16,7 +16,7 @@ var StyledSelect = styled.select(_templateObject || (_templateObject = _taggedTe
|
|
|
16
16
|
return "".concat($width, "px");
|
|
17
17
|
}
|
|
18
18
|
return $width;
|
|
19
|
-
},
|
|
19
|
+
}, bg200, bg300);
|
|
20
20
|
var SelectDownIcon = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n\n & > svg {\n display: block;\n }\n\n pointer-events: none;\n"])));
|
|
21
21
|
|
|
22
22
|
export { SelectDownIcon, StyledSelect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.esm.js","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n bg300,\n
|
|
1
|
+
{"version":3,"file":"styles.esm.js","sources":["../../../../../src/Inputs/Select/NativeSelect/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n bg300,\n contents200,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nexport const StyledSelect = styled.select<{\n $width?: number | string;\n isPlaceholder?: boolean;\n}>`\n all: unset;\n\n ${getTypographyStyles('UIBody2')};\n border-width: 1px;\n border-style: solid;\n \n border-radius: 4px;\n padding: 10px 36px 10px 12px;\n box-sizing: border-box;\n\n ${({ isPlaceholder }) =>\n isPlaceholder &&\n css`\n color: ${contents200};\n `}\n\n width: ${({ $width }) => {\n if (!$width) {\n return null;\n }\n\n if (typeof $width === 'number') {\n return `${$width}px`;\n }\n\n return $width;\n }};\n\n transition: border-color 0.2s, background-color 0.2s;\n\n\n &:not(:disabled) {\n @media (hover: hover) {\n &:hover {\n background-color: ${bg200};\n }\n }\n\n &:active {\n background-color: ${bg300};\n }\n }\n\n border-color: var(--border-color);\n`;\nexport const SelectDownIcon = styled.div`\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n\n & > svg {\n display: block;\n }\n\n pointer-events: none;\n`;\n"],"names":[],"mappings":";;;;;AAAa;;AAwBT;;AAIC;AAEsB;;AAErB;AACF;AAEA;;AAEA;AAEA;AACF;AAmBK;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/Select/NativeSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,mBAAmB,GAAG,YAAY,CACrC,WAAW,CAAC,MAAM,CAAC,EACnB,OAAO,YAAY,CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,QAAQ,MAAM,EAAE,GAAG,UAAU,CAC9B,GAAG;IACF,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/Inputs/Select/NativeSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,mBAAmB,GAAG,YAAY,CACrC,WAAW,CAAC,MAAM,CAAC,EACnB,OAAO,YAAY,CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,QAAQ,MAAM,EAAE,GAAG,UAAU,CAC9B,GAAG;IACF,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
@@ -24,7 +24,8 @@ function Select(props, ref) {
|
|
|
24
24
|
placeholder = props.placeholder,
|
|
25
25
|
width = props.width,
|
|
26
26
|
required = props.required,
|
|
27
|
-
onClick = props.onClick
|
|
27
|
+
onClick = props.onClick,
|
|
28
|
+
error = props.error;
|
|
28
29
|
if (props["native"]) {
|
|
29
30
|
return /*#__PURE__*/jsxRuntime.jsx(index$2, {
|
|
30
31
|
disabled: disabled,
|
|
@@ -37,6 +38,7 @@ function Select(props, ref) {
|
|
|
37
38
|
required: required,
|
|
38
39
|
placeholder: placeholder,
|
|
39
40
|
width: width,
|
|
41
|
+
error: error,
|
|
40
42
|
ref: ref,
|
|
41
43
|
children: react.Children.map(children, function (child) {
|
|
42
44
|
return /*#__PURE__*/jsxRuntime.jsx(index$3.NativeOption, _objectSpread({}, child.props));
|
|
@@ -55,6 +57,7 @@ function Select(props, ref) {
|
|
|
55
57
|
width: width,
|
|
56
58
|
maxHeight: props.maxHeight,
|
|
57
59
|
extendDirection: props.extendDirection,
|
|
60
|
+
error: error,
|
|
58
61
|
ref: ref,
|
|
59
62
|
children: children
|
|
60
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/Inputs/Select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport { Children, forwardRef } from 'react';\n\nimport DesignedSelect from './DesignedSelect';\nimport NativeSelect from './NativeSelect';\nimport { NativeOption } from './NativeSelect/Option';\nimport { OptionHolder } from './Option';\nimport type {\n DesignedSelectProps,\n NativeSelectProps,\n SelectProps,\n SelectValue,\n} from './types';\n\nfunction Select<Value extends SelectValue>(\n props: SelectProps<Value>,\n ref: Ref<HTMLDivElement | HTMLSelectElement>\n) {\n const {\n children,\n value,\n className,\n disabled,\n onChange,\n placeholder,\n width,\n required,\n onClick,\n } = props;\n\n if (props.native) {\n return (\n <NativeSelect\n disabled={disabled}\n className={className}\n onClick={onClick}\n onChange={(e) => {\n onChange?.(e.target.value as Value, e.target.innerText);\n }}\n value={value}\n required={required}\n placeholder={placeholder}\n width={width}\n ref={ref as Ref<HTMLSelectElement>}\n >\n {Children.map(children, (child) => (\n <NativeOption {...child.props} />\n ))}\n </NativeSelect>\n );\n }\n\n return (\n <DesignedSelect\n className={className}\n value={value}\n disabled={disabled}\n onClick={onClick}\n onChange={(_value, _label) => onChange?.(_value as Value, _label)}\n placeholder={placeholder}\n width={width}\n maxHeight={props.maxHeight}\n extendDirection={props.extendDirection}\n ref={ref as Ref<HTMLDivElement>}\n >\n {children}\n </DesignedSelect>\n );\n}\n\nexport default Object.assign(\n forwardRef(Select) as <Value extends SelectValue>(\n props:\n | (DesignedSelectProps<Value> & RefAttributes<HTMLDivElement>)\n | (NativeSelectProps<Value> & RefAttributes<HTMLSelectElement>)\n ) => JSX.Element,\n { Option: OptionHolder }\n);\n"],"names":["disabled","className","onClick","onChange","value","required","placeholder","width","ref","children","Option"],"mappings":";;;;;;;;;;;;;;;AAAa;AAAA;AAgBb;AAIE
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/Inputs/Select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport { Children, forwardRef } from 'react';\n\nimport DesignedSelect from './DesignedSelect';\nimport NativeSelect from './NativeSelect';\nimport { NativeOption } from './NativeSelect/Option';\nimport { OptionHolder } from './Option';\nimport type {\n DesignedSelectProps,\n NativeSelectProps,\n SelectProps,\n SelectValue,\n} from './types';\n\nfunction Select<Value extends SelectValue>(\n props: SelectProps<Value>,\n ref: Ref<HTMLDivElement | HTMLSelectElement>\n) {\n const {\n children,\n value,\n className,\n disabled,\n onChange,\n placeholder,\n width,\n required,\n onClick,\n error,\n } = props;\n\n if (props.native) {\n return (\n <NativeSelect\n disabled={disabled}\n className={className}\n onClick={onClick}\n onChange={(e) => {\n onChange?.(e.target.value as Value, e.target.innerText);\n }}\n value={value}\n required={required}\n placeholder={placeholder}\n width={width}\n error={error}\n ref={ref as Ref<HTMLSelectElement>}\n >\n {Children.map(children, (child) => (\n <NativeOption {...child.props} />\n ))}\n </NativeSelect>\n );\n }\n\n return (\n <DesignedSelect\n className={className}\n value={value}\n disabled={disabled}\n onClick={onClick}\n onChange={(_value, _label) => onChange?.(_value as Value, _label)}\n placeholder={placeholder}\n width={width}\n maxHeight={props.maxHeight}\n extendDirection={props.extendDirection}\n error={error}\n ref={ref as Ref<HTMLDivElement>}\n >\n {children}\n </DesignedSelect>\n );\n}\n\nexport default Object.assign(\n forwardRef(Select) as <Value extends SelectValue>(\n props:\n | (DesignedSelectProps<Value> & RefAttributes<HTMLDivElement>)\n | (NativeSelectProps<Value> & RefAttributes<HTMLSelectElement>)\n ) => JSX.Element,\n { Option: OptionHolder }\n);\n"],"names":["disabled","className","onClick","onChange","value","required","placeholder","width","error","ref","children","Option"],"mappings":";;;;;;;;;;;;;;;AAAa;AAAA;AAgBb;AAIE;;;;;;;;;;;;AAgBMA;AACAC;AACAC;AACAC;AACEA;;AAEFC;AACAC;AACAC;AACAC;AACAC;AACAC;;;;AAIE;AAGR;;AAIIR;AACAG;AACAJ;AACAE;AACAC;;;AACAG;AACAC;;;AAGAC;AACAC;AAAgCC;AAEvB;AAGf;AAEA;AAMIC;AAAqB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAOhD,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAEjB,WAAW,EACZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAOhD,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAEjB,WAAW,EACZ,MAAM,SAAS,CAAC;4DAgET,CAAC,oBAAoB,KAAK,CAAC,GAAG,cAAc,cAAc,CAAC,CAAC,GAC5D,CAAC,kBAAkB,KAAK,CAAC,GAAG,cAAc,iBAAiB,CAAC,CAAC,KAC9D,WAAW;;;;;;AALlB,wBAOE"}
|
|
@@ -18,7 +18,8 @@ function Select(props, ref) {
|
|
|
18
18
|
placeholder = props.placeholder,
|
|
19
19
|
width = props.width,
|
|
20
20
|
required = props.required,
|
|
21
|
-
onClick = props.onClick
|
|
21
|
+
onClick = props.onClick,
|
|
22
|
+
error = props.error;
|
|
22
23
|
if (props["native"]) {
|
|
23
24
|
return /*#__PURE__*/jsx(NativeSelect, {
|
|
24
25
|
disabled: disabled,
|
|
@@ -31,6 +32,7 @@ function Select(props, ref) {
|
|
|
31
32
|
required: required,
|
|
32
33
|
placeholder: placeholder,
|
|
33
34
|
width: width,
|
|
35
|
+
error: error,
|
|
34
36
|
ref: ref,
|
|
35
37
|
children: Children.map(children, function (child) {
|
|
36
38
|
return /*#__PURE__*/jsx(NativeOption, _objectSpread({}, child.props));
|
|
@@ -49,6 +51,7 @@ function Select(props, ref) {
|
|
|
49
51
|
width: width,
|
|
50
52
|
maxHeight: props.maxHeight,
|
|
51
53
|
extendDirection: props.extendDirection,
|
|
54
|
+
error: error,
|
|
52
55
|
ref: ref,
|
|
53
56
|
children: children
|
|
54
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../src/Inputs/Select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport { Children, forwardRef } from 'react';\n\nimport DesignedSelect from './DesignedSelect';\nimport NativeSelect from './NativeSelect';\nimport { NativeOption } from './NativeSelect/Option';\nimport { OptionHolder } from './Option';\nimport type {\n DesignedSelectProps,\n NativeSelectProps,\n SelectProps,\n SelectValue,\n} from './types';\n\nfunction Select<Value extends SelectValue>(\n props: SelectProps<Value>,\n ref: Ref<HTMLDivElement | HTMLSelectElement>\n) {\n const {\n children,\n value,\n className,\n disabled,\n onChange,\n placeholder,\n width,\n required,\n onClick,\n } = props;\n\n if (props.native) {\n return (\n <NativeSelect\n disabled={disabled}\n className={className}\n onClick={onClick}\n onChange={(e) => {\n onChange?.(e.target.value as Value, e.target.innerText);\n }}\n value={value}\n required={required}\n placeholder={placeholder}\n width={width}\n ref={ref as Ref<HTMLSelectElement>}\n >\n {Children.map(children, (child) => (\n <NativeOption {...child.props} />\n ))}\n </NativeSelect>\n );\n }\n\n return (\n <DesignedSelect\n className={className}\n value={value}\n disabled={disabled}\n onClick={onClick}\n onChange={(_value, _label) => onChange?.(_value as Value, _label)}\n placeholder={placeholder}\n width={width}\n maxHeight={props.maxHeight}\n extendDirection={props.extendDirection}\n ref={ref as Ref<HTMLDivElement>}\n >\n {children}\n </DesignedSelect>\n );\n}\n\nexport default Object.assign(\n forwardRef(Select) as <Value extends SelectValue>(\n props:\n | (DesignedSelectProps<Value> & RefAttributes<HTMLDivElement>)\n | (NativeSelectProps<Value> & RefAttributes<HTMLSelectElement>)\n ) => JSX.Element,\n { Option: OptionHolder }\n);\n"],"names":["disabled","className","onClick","onChange","value","required","placeholder","width","ref","children","Option"],"mappings":";;;;;;;;;AAAa;AAAA;AAgBb;AAIE
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../src/Inputs/Select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport { Children, forwardRef } from 'react';\n\nimport DesignedSelect from './DesignedSelect';\nimport NativeSelect from './NativeSelect';\nimport { NativeOption } from './NativeSelect/Option';\nimport { OptionHolder } from './Option';\nimport type {\n DesignedSelectProps,\n NativeSelectProps,\n SelectProps,\n SelectValue,\n} from './types';\n\nfunction Select<Value extends SelectValue>(\n props: SelectProps<Value>,\n ref: Ref<HTMLDivElement | HTMLSelectElement>\n) {\n const {\n children,\n value,\n className,\n disabled,\n onChange,\n placeholder,\n width,\n required,\n onClick,\n error,\n } = props;\n\n if (props.native) {\n return (\n <NativeSelect\n disabled={disabled}\n className={className}\n onClick={onClick}\n onChange={(e) => {\n onChange?.(e.target.value as Value, e.target.innerText);\n }}\n value={value}\n required={required}\n placeholder={placeholder}\n width={width}\n error={error}\n ref={ref as Ref<HTMLSelectElement>}\n >\n {Children.map(children, (child) => (\n <NativeOption {...child.props} />\n ))}\n </NativeSelect>\n );\n }\n\n return (\n <DesignedSelect\n className={className}\n value={value}\n disabled={disabled}\n onClick={onClick}\n onChange={(_value, _label) => onChange?.(_value as Value, _label)}\n placeholder={placeholder}\n width={width}\n maxHeight={props.maxHeight}\n extendDirection={props.extendDirection}\n error={error}\n ref={ref as Ref<HTMLDivElement>}\n >\n {children}\n </DesignedSelect>\n );\n}\n\nexport default Object.assign(\n forwardRef(Select) as <Value extends SelectValue>(\n props:\n | (DesignedSelectProps<Value> & RefAttributes<HTMLDivElement>)\n | (NativeSelectProps<Value> & RefAttributes<HTMLSelectElement>)\n ) => JSX.Element,\n { Option: OptionHolder }\n);\n"],"names":["disabled","className","onClick","onChange","value","required","placeholder","width","error","ref","children","Option"],"mappings":";;;;;;;;;AAAa;AAAA;AAgBb;AAIE;;;;;;;;;;;;AAgBMA;AACAC;AACAC;AACAC;AACEA;;AAEFC;AACAC;AACAC;AACAC;AACAC;AACAC;;;;AAIE;AAGR;;AAIIR;AACAG;AACAJ;AACAE;AACAC;;;AACAG;AACAC;;;AAGAC;AACAC;AAAgCC;AAEvB;AAGf;AAEA;AAMIC;AAAqB;;"}
|
|
@@ -10,8 +10,14 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefault(_taggedTemplateLiteral);
|
|
11
11
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
12
12
|
|
|
13
|
-
var _templateObject;
|
|
14
|
-
var
|
|
13
|
+
var _templateObject, _templateObject2;
|
|
14
|
+
var BORDER_COLOR = {
|
|
15
|
+
FOCUS: mixin.contents000,
|
|
16
|
+
DEFAULT: mixin.contents300,
|
|
17
|
+
ERROR: mixin.roleRed,
|
|
18
|
+
DISABLED: mixin.contents300
|
|
19
|
+
};
|
|
20
|
+
var SelectContainer = styled__default.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral__default.default(["\n --border-color: ", ";\n\n ", "\n color: ", ";\n width: ", ";\n position: relative;\n user-select: none;\n\n &:focus, &:focus-within {\n --border-color: ", ";\n outline: none;\n }\n\n ", "\n\n &[aria-disabled='true'] {\n --border-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n\n"])), BORDER_COLOR.DEFAULT, mixin.getTypographyStyles('UIBody2'), mixin.contents000, function (_ref) {
|
|
15
21
|
var $width = _ref.$width;
|
|
16
22
|
if (!$width) {
|
|
17
23
|
return 'fit-content';
|
|
@@ -20,7 +26,10 @@ var SelectContainer = styled__default.default.div(_templateObject || (_templateO
|
|
|
20
26
|
return "".concat($width, "px");
|
|
21
27
|
}
|
|
22
28
|
return $width;
|
|
23
|
-
},
|
|
29
|
+
}, BORDER_COLOR.FOCUS, function (_ref2) {
|
|
30
|
+
var $error = _ref2.$error;
|
|
31
|
+
return $error && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default.default(["\n &, &:focus, &:focus-within {\n --border-color: ", ";\n }\n "])), BORDER_COLOR.ERROR);
|
|
32
|
+
}, BORDER_COLOR.DISABLED, mixin.contents200, mixin.bg200);
|
|
24
33
|
|
|
25
34
|
exports.SelectContainer = SelectContainer;
|
|
26
35
|
//# sourceMappingURL=styles.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.cjs.js","sources":["../../../../src/Inputs/Select/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n contents000,\n contents200,\n contents300,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled from 'styled-components';\n\nexport const SelectContainer = styled.div<{
|
|
1
|
+
{"version":3,"file":"styles.cjs.js","sources":["../../../../src/Inputs/Select/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n contents000,\n contents200,\n contents300,\n getTypographyStyles,\n roleRed,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nconst BORDER_COLOR = {\n FOCUS: contents000,\n DEFAULT: contents300,\n ERROR: roleRed,\n DISABLED: contents300,\n};\n\nexport const SelectContainer = styled.div<{\n $width?: number | string;\n $error: boolean;\n}>`\n --border-color: ${BORDER_COLOR.DEFAULT};\n\n ${getTypographyStyles('UIBody2')}\n color: ${contents000};\n width: ${({ $width }) => {\n if (!$width) {\n return 'fit-content';\n }\n\n if (typeof $width === 'number') {\n return `${$width}px`;\n }\n\n return $width;\n }};\n position: relative;\n user-select: none;\n\n &:focus, &:focus-within {\n --border-color: ${BORDER_COLOR.FOCUS};\n outline: none;\n }\n\n ${({ $error }) =>\n $error &&\n css`\n &, &:focus, &:focus-within {\n --border-color: ${BORDER_COLOR.ERROR};\n }\n `}\n\n &[aria-disabled='true'] {\n --border-color: ${BORDER_COLOR.DISABLED};\n color: ${contents200};\n background-color: ${bg200};\n }\n\n`;\n"],"names":["FOCUS","DEFAULT","ERROR","DISABLED"],"mappings":";;;;;;;;;;;;AAAa;AAYb;AACEA;AACAC;AACAC;AACAC;AACF;AAEO;AAQoB;;AAErB;AACF;AAEA;;AAEA;AAEA;AACF;AASE;AAAS;AAMR;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const SelectContainer: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
3
|
$width?: string | number | undefined;
|
|
4
|
+
$error: boolean;
|
|
4
5
|
}>>;
|
|
5
6
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/Select/styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/Inputs/Select/styles.ts"],"names":[],"mappings":";AAmBA,eAAO,MAAM,eAAe;;YAElB,OAAO;GAuChB,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
3
|
-
import { getTypographyStyles, contents000,
|
|
4
|
-
import styled from 'styled-components';
|
|
3
|
+
import { contents300, getTypographyStyles, contents000, roleRed, contents200, bg200 } from '@remember-web/mixin';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
5
|
|
|
6
|
-
var _templateObject;
|
|
7
|
-
var
|
|
6
|
+
var _templateObject, _templateObject2;
|
|
7
|
+
var BORDER_COLOR = {
|
|
8
|
+
FOCUS: contents000,
|
|
9
|
+
DEFAULT: contents300,
|
|
10
|
+
ERROR: roleRed,
|
|
11
|
+
DISABLED: contents300
|
|
12
|
+
};
|
|
13
|
+
var SelectContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --border-color: ", ";\n\n ", "\n color: ", ";\n width: ", ";\n position: relative;\n user-select: none;\n\n &:focus, &:focus-within {\n --border-color: ", ";\n outline: none;\n }\n\n ", "\n\n &[aria-disabled='true'] {\n --border-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n\n"])), BORDER_COLOR.DEFAULT, getTypographyStyles('UIBody2'), contents000, function (_ref) {
|
|
8
14
|
var $width = _ref.$width;
|
|
9
15
|
if (!$width) {
|
|
10
16
|
return 'fit-content';
|
|
@@ -13,7 +19,10 @@ var SelectContainer = styled.div(_templateObject || (_templateObject = _taggedTe
|
|
|
13
19
|
return "".concat($width, "px");
|
|
14
20
|
}
|
|
15
21
|
return $width;
|
|
16
|
-
},
|
|
22
|
+
}, BORDER_COLOR.FOCUS, function (_ref2) {
|
|
23
|
+
var $error = _ref2.$error;
|
|
24
|
+
return $error && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &, &:focus, &:focus-within {\n --border-color: ", ";\n }\n "])), BORDER_COLOR.ERROR);
|
|
25
|
+
}, BORDER_COLOR.DISABLED, contents200, bg200);
|
|
17
26
|
|
|
18
27
|
export { SelectContainer };
|
|
19
28
|
//# sourceMappingURL=styles.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.esm.js","sources":["../../../../src/Inputs/Select/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n contents000,\n contents200,\n contents300,\n getTypographyStyles,\n} from '@remember-web/mixin';\nimport styled from 'styled-components';\n\nexport const SelectContainer = styled.div<{
|
|
1
|
+
{"version":3,"file":"styles.esm.js","sources":["../../../../src/Inputs/Select/styles.ts"],"sourcesContent":["'use client';\n\nimport {\n bg200,\n contents000,\n contents200,\n contents300,\n getTypographyStyles,\n roleRed,\n} from '@remember-web/mixin';\nimport styled, { css } from 'styled-components';\n\nconst BORDER_COLOR = {\n FOCUS: contents000,\n DEFAULT: contents300,\n ERROR: roleRed,\n DISABLED: contents300,\n};\n\nexport const SelectContainer = styled.div<{\n $width?: number | string;\n $error: boolean;\n}>`\n --border-color: ${BORDER_COLOR.DEFAULT};\n\n ${getTypographyStyles('UIBody2')}\n color: ${contents000};\n width: ${({ $width }) => {\n if (!$width) {\n return 'fit-content';\n }\n\n if (typeof $width === 'number') {\n return `${$width}px`;\n }\n\n return $width;\n }};\n position: relative;\n user-select: none;\n\n &:focus, &:focus-within {\n --border-color: ${BORDER_COLOR.FOCUS};\n outline: none;\n }\n\n ${({ $error }) =>\n $error &&\n css`\n &, &:focus, &:focus-within {\n --border-color: ${BORDER_COLOR.ERROR};\n }\n `}\n\n &[aria-disabled='true'] {\n --border-color: ${BORDER_COLOR.DISABLED};\n color: ${contents200};\n background-color: ${bg200};\n }\n\n`;\n"],"names":["FOCUS","DEFAULT","ERROR","DISABLED"],"mappings":";;;;;AAAa;AAYb;AACEA;AACAC;AACAC;AACAC;AACF;AAEO;AAQoB;;AAErB;AACF;AAEA;;AAEA;AAEA;AACF;AASE;AAAS;AAMR;;"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconAlarmM } from '@remember-web/icon';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
|
|
4
4
|
import { Button } from '@/Buttons';
|
|
@@ -28,6 +28,10 @@ const meta = {
|
|
|
28
28
|
defaultValue: false,
|
|
29
29
|
type: 'boolean',
|
|
30
30
|
},
|
|
31
|
+
avoidCollisions: {
|
|
32
|
+
defaultValue: true,
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
31
35
|
},
|
|
32
36
|
} satisfies Meta<typeof Tooltip>;
|
|
33
37
|
|
|
@@ -47,7 +51,7 @@ export const Default: Story = {
|
|
|
47
51
|
render: ({ ...props }) => (
|
|
48
52
|
<Flex gap={24}>
|
|
49
53
|
<Tooltip {...props}>
|
|
50
|
-
<
|
|
54
|
+
<IconAlarmM />
|
|
51
55
|
</Tooltip>
|
|
52
56
|
<Tooltip {...props}>
|
|
53
57
|
<Button>버튼</Button>
|
|
@@ -29,6 +29,7 @@ export default function Tooltip<
|
|
|
29
29
|
defaultOpen,
|
|
30
30
|
side = 'top',
|
|
31
31
|
gap = 4,
|
|
32
|
+
avoidCollisions = true,
|
|
32
33
|
onOpenChange,
|
|
33
34
|
onClickOutside,
|
|
34
35
|
...props
|
|
@@ -92,6 +93,7 @@ export default function Tooltip<
|
|
|
92
93
|
}
|
|
93
94
|
onClickOutside?.(e);
|
|
94
95
|
}}
|
|
96
|
+
avoidCollisions={avoidCollisions}
|
|
95
97
|
collisionPadding={20}
|
|
96
98
|
onClick={(e) => {
|
|
97
99
|
if (isClickType) {
|
|
@@ -14,6 +14,7 @@ export type TooltipProps<Type extends TooltipType, Size extends TooltipSize> = {
|
|
|
14
14
|
defaultOpen?: boolean;
|
|
15
15
|
gap?: 4 | 8 | (number & {});
|
|
16
16
|
side?: PopperContentProps['side'];
|
|
17
|
+
avoidCollisions?: PopperContentProps['avoidCollisions'];
|
|
17
18
|
type?: Type;
|
|
18
19
|
size?: Size;
|
|
19
20
|
contentOptions?: TooltipContentOptionProps;
|
|
@@ -36,6 +36,7 @@ const DesignedSelect = <Value extends SelectValue>(
|
|
|
36
36
|
onChange,
|
|
37
37
|
width,
|
|
38
38
|
extendDirection,
|
|
39
|
+
error = false,
|
|
39
40
|
disabled,
|
|
40
41
|
onClick,
|
|
41
42
|
...props
|
|
@@ -213,6 +214,7 @@ const DesignedSelect = <Value extends SelectValue>(
|
|
|
213
214
|
aria-expanded={isExpanded}
|
|
214
215
|
aria-haspopup="listbox"
|
|
215
216
|
aria-disabled={disabled}
|
|
217
|
+
$error={error}
|
|
216
218
|
onKeyDown={keyDownHandler}
|
|
217
219
|
{...props}
|
|
218
220
|
>
|
|
@@ -19,7 +19,9 @@ export const StyledSelect = styled.div<{
|
|
|
19
19
|
isPlaceholder?: boolean;
|
|
20
20
|
}>`
|
|
21
21
|
${ellipsis()}
|
|
22
|
-
border: 1px
|
|
22
|
+
border-width: 1px;
|
|
23
|
+
border-style: solid;;
|
|
24
|
+
|
|
23
25
|
${({ expandedDirection }) =>
|
|
24
26
|
({
|
|
25
27
|
none: css`
|
|
@@ -46,8 +48,8 @@ export const StyledSelect = styled.div<{
|
|
|
46
48
|
|
|
47
49
|
${SelectContainer}:focus-within & {
|
|
48
50
|
outline: none;
|
|
49
|
-
border-color: ${contents000};
|
|
50
51
|
}
|
|
52
|
+
|
|
51
53
|
${SelectContainer}:not([aria-disabled='true']) & {
|
|
52
54
|
@media (hover: hover) {
|
|
53
55
|
&:hover {
|
|
@@ -59,6 +61,8 @@ export const StyledSelect = styled.div<{
|
|
|
59
61
|
background-color: ${bg300};
|
|
60
62
|
}
|
|
61
63
|
}
|
|
64
|
+
|
|
65
|
+
border-color: var(--border-color);
|
|
62
66
|
`;
|
|
63
67
|
|
|
64
68
|
export const SelectDownIcon = styled.div`
|
|
@@ -83,7 +87,10 @@ export const SelectOptionWrapper = styled.ul<{
|
|
|
83
87
|
left: 0;
|
|
84
88
|
right: 0;
|
|
85
89
|
z-index: 1;
|
|
86
|
-
|
|
90
|
+
|
|
91
|
+
border-width: 1px;
|
|
92
|
+
border-style: solid;;
|
|
93
|
+
|
|
87
94
|
background-color: ${bg100};
|
|
88
95
|
overflow-y: auto;
|
|
89
96
|
overscroll-behavior: contain;
|
|
@@ -120,8 +127,9 @@ export const SelectOptionWrapper = styled.ul<{
|
|
|
120
127
|
|
|
121
128
|
${SelectContainer}:focus &, ${SelectContainer}:focus-within & {
|
|
122
129
|
outline: none;
|
|
123
|
-
border-color: ${contents000};
|
|
124
130
|
}
|
|
131
|
+
|
|
132
|
+
border-color: var(--border-color);
|
|
125
133
|
`;
|
|
126
134
|
|
|
127
135
|
export const SelectOption = styled.li<{ isSelected?: boolean }>`
|
|
@@ -15,6 +15,7 @@ export type DesignedSelectInternalProps<Value extends SelectValue> = Omit<
|
|
|
15
15
|
width?: number | string;
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
extendDirection?: Exclude<ExpandedType, 'none'>;
|
|
18
|
+
error?: boolean;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export type ExpandedType = 'none' | 'above' | 'below';
|
|
@@ -20,6 +20,7 @@ const NativeSelect: ForwardRefRenderFunction<
|
|
|
20
20
|
value,
|
|
21
21
|
disabled,
|
|
22
22
|
onClick,
|
|
23
|
+
error = false,
|
|
23
24
|
...props
|
|
24
25
|
},
|
|
25
26
|
ref
|
|
@@ -31,6 +32,7 @@ const NativeSelect: ForwardRefRenderFunction<
|
|
|
31
32
|
aria-disabled={disabled}
|
|
32
33
|
className={className}
|
|
33
34
|
$width={width}
|
|
35
|
+
$error={error}
|
|
34
36
|
>
|
|
35
37
|
<StyledSelect
|
|
36
38
|
{...props}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
bg200,
|
|
5
5
|
bg300,
|
|
6
|
-
contents000,
|
|
7
6
|
contents200,
|
|
8
|
-
contents300,
|
|
9
7
|
getTypographyStyles,
|
|
10
8
|
} from '@remember-web/mixin';
|
|
11
9
|
import styled, { css } from 'styled-components';
|
|
@@ -16,8 +14,10 @@ export const StyledSelect = styled.select<{
|
|
|
16
14
|
}>`
|
|
17
15
|
all: unset;
|
|
18
16
|
|
|
19
|
-
${getTypographyStyles('UIBody2')}
|
|
20
|
-
border: 1px
|
|
17
|
+
${getTypographyStyles('UIBody2')};
|
|
18
|
+
border-width: 1px;
|
|
19
|
+
border-style: solid;
|
|
20
|
+
|
|
21
21
|
border-radius: 4px;
|
|
22
22
|
padding: 10px 36px 10px 12px;
|
|
23
23
|
box-sizing: border-box;
|
|
@@ -42,9 +42,6 @@ export const StyledSelect = styled.select<{
|
|
|
42
42
|
|
|
43
43
|
transition: border-color 0.2s, background-color 0.2s;
|
|
44
44
|
|
|
45
|
-
&:focus {
|
|
46
|
-
border-color: ${contents000};
|
|
47
|
-
}
|
|
48
45
|
|
|
49
46
|
&:not(:disabled) {
|
|
50
47
|
@media (hover: hover) {
|
|
@@ -57,6 +54,8 @@ export const StyledSelect = styled.select<{
|
|
|
57
54
|
background-color: ${bg300};
|
|
58
55
|
}
|
|
59
56
|
}
|
|
57
|
+
|
|
58
|
+
border-color: var(--border-color);
|
|
60
59
|
`;
|
|
61
60
|
export const SelectDownIcon = styled.div`
|
|
62
61
|
position: absolute;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { DesignedSelectProps, NativeSelectProps } from './types';
|
|
5
|
-
|
|
6
3
|
import Select from '.';
|
|
4
|
+
import type { DesignedSelectProps, NativeSelectProps } from './types';
|
|
7
5
|
|
|
8
6
|
type Story = StoryObj<typeof Select>;
|
|
9
7
|
|
|
@@ -18,6 +16,7 @@ const meta = {
|
|
|
18
16
|
maxHeight: { type: 'string' },
|
|
19
17
|
native: { type: 'boolean' },
|
|
20
18
|
onClick: { action: 'clicked' },
|
|
19
|
+
error: { type: 'boolean' },
|
|
21
20
|
},
|
|
22
21
|
} satisfies Meta<typeof Select>;
|
|
23
22
|
|
|
@@ -28,6 +28,7 @@ function Select<Value extends SelectValue>(
|
|
|
28
28
|
width,
|
|
29
29
|
required,
|
|
30
30
|
onClick,
|
|
31
|
+
error,
|
|
31
32
|
} = props;
|
|
32
33
|
|
|
33
34
|
if (props.native) {
|
|
@@ -43,6 +44,7 @@ function Select<Value extends SelectValue>(
|
|
|
43
44
|
required={required}
|
|
44
45
|
placeholder={placeholder}
|
|
45
46
|
width={width}
|
|
47
|
+
error={error}
|
|
46
48
|
ref={ref as Ref<HTMLSelectElement>}
|
|
47
49
|
>
|
|
48
50
|
{Children.map(children, (child) => (
|
|
@@ -63,6 +65,7 @@ function Select<Value extends SelectValue>(
|
|
|
63
65
|
width={width}
|
|
64
66
|
maxHeight={props.maxHeight}
|
|
65
67
|
extendDirection={props.extendDirection}
|
|
68
|
+
error={error}
|
|
66
69
|
ref={ref as Ref<HTMLDivElement>}
|
|
67
70
|
>
|
|
68
71
|
{children}
|
|
@@ -6,10 +6,23 @@ import {
|
|
|
6
6
|
contents200,
|
|
7
7
|
contents300,
|
|
8
8
|
getTypographyStyles,
|
|
9
|
+
roleRed,
|
|
9
10
|
} from '@remember-web/mixin';
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
+
import styled, { css } from 'styled-components';
|
|
12
|
+
|
|
13
|
+
const BORDER_COLOR = {
|
|
14
|
+
FOCUS: contents000,
|
|
15
|
+
DEFAULT: contents300,
|
|
16
|
+
ERROR: roleRed,
|
|
17
|
+
DISABLED: contents300,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const SelectContainer = styled.div<{
|
|
21
|
+
$width?: number | string;
|
|
22
|
+
$error: boolean;
|
|
23
|
+
}>`
|
|
24
|
+
--border-color: ${BORDER_COLOR.DEFAULT};
|
|
11
25
|
|
|
12
|
-
export const SelectContainer = styled.div<{ $width?: number | string }>`
|
|
13
26
|
${getTypographyStyles('UIBody2')}
|
|
14
27
|
color: ${contents000};
|
|
15
28
|
width: ${({ $width }) => {
|
|
@@ -26,13 +39,23 @@ export const SelectContainer = styled.div<{ $width?: number | string }>`
|
|
|
26
39
|
position: relative;
|
|
27
40
|
user-select: none;
|
|
28
41
|
|
|
29
|
-
&:focus {
|
|
42
|
+
&:focus, &:focus-within {
|
|
43
|
+
--border-color: ${BORDER_COLOR.FOCUS};
|
|
30
44
|
outline: none;
|
|
31
|
-
border-color: ${contents000};
|
|
32
45
|
}
|
|
46
|
+
|
|
47
|
+
${({ $error }) =>
|
|
48
|
+
$error &&
|
|
49
|
+
css`
|
|
50
|
+
&, &:focus, &:focus-within {
|
|
51
|
+
--border-color: ${BORDER_COLOR.ERROR};
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
|
|
33
55
|
&[aria-disabled='true'] {
|
|
56
|
+
--border-color: ${BORDER_COLOR.DISABLED};
|
|
34
57
|
color: ${contents200};
|
|
35
|
-
border-color: ${contents300};
|
|
36
58
|
background-color: ${bg200};
|
|
37
59
|
}
|
|
60
|
+
|
|
38
61
|
`;
|