smarthr-ui 41.1.1 → 41.1.2
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/esm/components/RadioButton/RadioButton.js +5 -5
- package/esm/components/RadioButton/RadioButton.js.map +1 -1
- package/esm/components/RadioButtonPanel/RadioButtonPanel.js +20 -31
- package/esm/components/RadioButtonPanel/RadioButtonPanel.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.js +5 -5
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioButtonPanel/RadioButtonPanel.js +19 -30
- package/lib/components/RadioButtonPanel/RadioButtonPanel.js.map +1 -1
- package/package.json +4 -4
- package/smarthr-ui.css +44 -4
- package/esm/components/RadioButtonPanel/useClassNames.d.ts +0 -3
- package/esm/components/RadioButtonPanel/useClassNames.js +0 -10
- package/esm/components/RadioButtonPanel/useClassNames.js.map +0 -1
- package/lib/components/RadioButtonPanel/useClassNames.d.ts +0 -3
- package/lib/components/RadioButtonPanel/useClassNames.js +0 -14
- package/lib/components/RadioButtonPanel/useClassNames.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { useId } from '../../hooks/useId';
|
|
|
4
4
|
const radioButton = tv({
|
|
5
5
|
slots: {
|
|
6
6
|
wrapper: 'smarthr-ui-RadioButton shr-inline-flex shr-items-baseline',
|
|
7
|
-
label: 'smarthr-ui-RadioButton-label shr-ms-0.5 shr-
|
|
7
|
+
label: 'smarthr-ui-RadioButton-label shr-ms-0.5 shr-text-base shr-leading-tight',
|
|
8
8
|
innerWrapper: 'shr-relative shr-inline-block shr-h-em shr-w-em shr-shrink-0 shr-translate-y-[0.125em] shr-leading-none',
|
|
9
9
|
box: [
|
|
10
10
|
'shr-pointer-events-none',
|
|
@@ -14,7 +14,7 @@ const radioButton = tv({
|
|
|
14
14
|
'contrast-more:shr-border-high-contrast',
|
|
15
15
|
'peer-checked:shr-border-main peer-checked:shr-bg-main contrast-more:peer-checked:shr-border-high-contrast',
|
|
16
16
|
'peer-checked:before:shr-pointer-events-none peer-checked:before:shr-absolute peer-checked:before:shr-left-1/2 peer-checked:before:shr-top-1/2 peer-checked:before:shr-h-[0.375em] peer-checked:before:shr-w-[0.375em] peer-checked:before:-shr-translate-x-1/2 peer-checked:before:-shr-translate-y-1/2 peer-checked:before:shr-rounded-full peer-checked:before:shr-bg-white peer-checked:before:shr-content-[""]',
|
|
17
|
-
'peer-disabled:shr-
|
|
17
|
+
'peer-disabled:shr-border-default/50 peer-disabled:shr-bg-white-darken',
|
|
18
18
|
'peer-disabled:peer-checked:shr-border-default peer-disabled:peer-checked:shr-bg-border peer-disabled:peer-checked:before:shr-bg-white-darken',
|
|
19
19
|
'peer-focus-visible:shr-focus-indicator',
|
|
20
20
|
],
|
|
@@ -29,10 +29,10 @@ const radioButton = tv({
|
|
|
29
29
|
variants: {
|
|
30
30
|
disabled: {
|
|
31
31
|
true: {
|
|
32
|
-
label: 'shr-cursor-
|
|
32
|
+
label: 'shr-cursor-[revert] shr-text-disabled',
|
|
33
33
|
},
|
|
34
34
|
false: {
|
|
35
|
-
label: 'shr-text-black',
|
|
35
|
+
label: 'shr-cursor-pointer shr-text-black',
|
|
36
36
|
box: 'peer-hover:shr-shadow-input-hover',
|
|
37
37
|
},
|
|
38
38
|
},
|
|
@@ -46,7 +46,7 @@ export const RadioButton = forwardRef(({ onChange, children, className, ...props
|
|
|
46
46
|
innerWrapperStyle: innerWrapper(),
|
|
47
47
|
boxStyle: box({ disabled: !!props.disabled }),
|
|
48
48
|
inputStyle: input(),
|
|
49
|
-
labelStyle: label({ disabled: props.disabled }),
|
|
49
|
+
labelStyle: label({ disabled: !!props.disabled }),
|
|
50
50
|
};
|
|
51
51
|
}, [className, props.disabled]);
|
|
52
52
|
const handleChange = useCallback((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAIZ,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAIzC,MAAM,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,EAAE;QACL,OAAO,EAAE,2DAA2D;QACpE,KAAK,
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAIZ,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAIzC,MAAM,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,EAAE;QACL,OAAO,EAAE,2DAA2D;QACpE,KAAK,EAAE,yEAAyE;QAChF,YAAY,EACV,yGAAyG;QAC3G,GAAG,EAAE;YACH,yBAAyB;YACzB,6HAA6H;YAC7H,iCAAiC;YACjC,0BAA0B;YAC1B,wCAAwC;YACxC,2GAA2G;YAC3G,oZAAoZ;YACpZ,uEAAuE;YACvE,8IAA8I;YAC9I,wCAAwC;SACzC;QACD,KAAK,EAAE;YACL,6CAA6C;YAC7C,kGAAkG;YAClG,kCAAkC;YAClC,iCAAiC;YACjC,wDAAwD;SACzD;KACF;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,IAAI,EAAE;gBACJ,KAAK,EAAE,uCAAuC;aAC/C;YACD,KAAK,EAAE;gBACL,KAAK,EAAE,mCAAmC;gBAC1C,GAAG,EAAE,mCAAmC;aACzC;SACF;KACF;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAA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U,IACjD,QAAQ,CACH,CACT,CACI,CACR,CAAA;AACH,CAAC,CACF,CAAA"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { useTheme } from '../../hooks/useTheme';
|
|
1
|
+
import React, { useMemo, useRef } from 'react';
|
|
2
|
+
import { tv } from 'tailwind-variants';
|
|
4
3
|
import { Base } from '../Base';
|
|
5
4
|
import { RadioButton } from '../RadioButton';
|
|
6
|
-
import { useClassNames } from './useClassNames';
|
|
7
5
|
const MEANLESS_TAG_NAMES = ['div', 'span'];
|
|
6
|
+
const radioButtonPanel = tv({
|
|
7
|
+
base: [
|
|
8
|
+
'smarthr-ui-RadioButtonPanel',
|
|
9
|
+
'shr-border shr-border-solid shr-border-default shr-shadow-none',
|
|
10
|
+
// なぜか :has が動作しないので重ねて書いている
|
|
11
|
+
'has-[:focus-visible]:shr-focus-indicator [&:has(:focus-visible)]:shr-focus-indicator',
|
|
12
|
+
'[&_.smarthr-ui-RadioButton-radioButton:focus-visible_+_span]:shr-shadow-none',
|
|
13
|
+
'[&_.smarthr-ui-RadioButton-label]:shr-ms-0.75',
|
|
14
|
+
'has-[:disabled]:shr-cursor-default has-[:disabled]:[&_.smarthr-ui-RadioButton-label]:shr-cursor-default',
|
|
15
|
+
],
|
|
16
|
+
variants: {
|
|
17
|
+
disabled: {
|
|
18
|
+
false: 'shr-cursor-pointer [&_.smarthr-ui-RadioButton-label]:shr-cursor-pointer',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
8
22
|
export const RadioButtonPanel = ({ onClick, as, className, ...props }) => {
|
|
9
|
-
const
|
|
10
|
-
const classNames = useClassNames(className);
|
|
23
|
+
const styles = useMemo(() => radioButtonPanel({ disabled: !!props.disabled, className }), [className, props.disabled]);
|
|
11
24
|
// 外側の装飾を押しても内側のラジオボタンが押せるようにする
|
|
12
25
|
const innerRef = useRef(null);
|
|
13
26
|
const handleOuterClick = () => {
|
|
@@ -15,31 +28,7 @@ export const RadioButtonPanel = ({ onClick, as, className, ...props }) => {
|
|
|
15
28
|
};
|
|
16
29
|
return (
|
|
17
30
|
// eslint-disable-next-line smarthr/a11y-delegate-element-has-role-presentation
|
|
18
|
-
React.createElement(
|
|
31
|
+
React.createElement(Base, { padding: 1, role: MEANLESS_TAG_NAMES.includes(`${as || ''}`) ? 'presentation' : undefined, onClick: handleOuterClick, as: as, className: styles },
|
|
19
32
|
React.createElement(RadioButton, { ...props, ref: innerRef })));
|
|
20
33
|
};
|
|
21
|
-
const WrapperBase = styled(Base).attrs({ padding: 1 }) `
|
|
22
|
-
${({ themes: { border, shadow, space } }) => css `
|
|
23
|
-
box-shadow: none;
|
|
24
|
-
border: ${border.shorthand};
|
|
25
|
-
|
|
26
|
-
:not(:has([disabled])) {
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* :focus-visible-within の代替 */
|
|
31
|
-
:has(:focus-visible) {
|
|
32
|
-
${shadow.focusIndicatorStyles}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.smarthr-ui-RadioButton-radioButton:focus + span {
|
|
36
|
-
box-shadow: revert;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.smarthr-ui-RadioButton-label {
|
|
40
|
-
/* 視覚的な調整 */
|
|
41
|
-
margin-inline-start: ${space(0.75)};
|
|
42
|
-
}
|
|
43
|
-
`}
|
|
44
|
-
`;
|
|
45
34
|
//# sourceMappingURL=RadioButtonPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtonPanel.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/RadioButtonPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkB,MAAM,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"RadioButtonPanel.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/RadioButtonPanel.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C,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC7E,OAAO,EAAE,gBAAgB,EACzB,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,MAAM;QAGjB,oBAAC,WAAW,OAAK,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAI,CACpC,CACR,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -30,7 +30,7 @@ const useId_1 = require("../../hooks/useId");
|
|
|
30
30
|
const radioButton = (0, tailwind_variants_1.tv)({
|
|
31
31
|
slots: {
|
|
32
32
|
wrapper: 'smarthr-ui-RadioButton shr-inline-flex shr-items-baseline',
|
|
33
|
-
label: 'smarthr-ui-RadioButton-label shr-ms-0.5 shr-
|
|
33
|
+
label: 'smarthr-ui-RadioButton-label shr-ms-0.5 shr-text-base shr-leading-tight',
|
|
34
34
|
innerWrapper: 'shr-relative shr-inline-block shr-h-em shr-w-em shr-shrink-0 shr-translate-y-[0.125em] shr-leading-none',
|
|
35
35
|
box: [
|
|
36
36
|
'shr-pointer-events-none',
|
|
@@ -40,7 +40,7 @@ const radioButton = (0, tailwind_variants_1.tv)({
|
|
|
40
40
|
'contrast-more:shr-border-high-contrast',
|
|
41
41
|
'peer-checked:shr-border-main peer-checked:shr-bg-main contrast-more:peer-checked:shr-border-high-contrast',
|
|
42
42
|
'peer-checked:before:shr-pointer-events-none peer-checked:before:shr-absolute peer-checked:before:shr-left-1/2 peer-checked:before:shr-top-1/2 peer-checked:before:shr-h-[0.375em] peer-checked:before:shr-w-[0.375em] peer-checked:before:-shr-translate-x-1/2 peer-checked:before:-shr-translate-y-1/2 peer-checked:before:shr-rounded-full peer-checked:before:shr-bg-white peer-checked:before:shr-content-[""]',
|
|
43
|
-
'peer-disabled:shr-
|
|
43
|
+
'peer-disabled:shr-border-default/50 peer-disabled:shr-bg-white-darken',
|
|
44
44
|
'peer-disabled:peer-checked:shr-border-default peer-disabled:peer-checked:shr-bg-border peer-disabled:peer-checked:before:shr-bg-white-darken',
|
|
45
45
|
'peer-focus-visible:shr-focus-indicator',
|
|
46
46
|
],
|
|
@@ -55,10 +55,10 @@ const radioButton = (0, tailwind_variants_1.tv)({
|
|
|
55
55
|
variants: {
|
|
56
56
|
disabled: {
|
|
57
57
|
true: {
|
|
58
|
-
label: 'shr-cursor-
|
|
58
|
+
label: 'shr-cursor-[revert] shr-text-disabled',
|
|
59
59
|
},
|
|
60
60
|
false: {
|
|
61
|
-
label: 'shr-text-black',
|
|
61
|
+
label: 'shr-cursor-pointer shr-text-black',
|
|
62
62
|
box: 'peer-hover:shr-shadow-input-hover',
|
|
63
63
|
},
|
|
64
64
|
},
|
|
@@ -72,7 +72,7 @@ exports.RadioButton = (0, react_1.forwardRef)(({ onChange, children, className,
|
|
|
72
72
|
innerWrapperStyle: innerWrapper(),
|
|
73
73
|
boxStyle: box({ disabled: !!props.disabled }),
|
|
74
74
|
inputStyle: input(),
|
|
75
|
-
labelStyle: label({ disabled: props.disabled }),
|
|
75
|
+
labelStyle: label({ disabled: !!props.disabled }),
|
|
76
76
|
};
|
|
77
77
|
}, [className, props.disabled]);
|
|
78
78
|
const handleChange = (0, react_1.useCallback)((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAOc;AACd,yDAAsC;AAEtC,6CAAyC;AAIzC,MAAM,WAAW,GAAG,IAAA,sBAAE,EAAC;IACrB,KAAK,EAAE;QACL,OAAO,EAAE,2DAA2D;QACpE,KAAK,
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAOc;AACd,yDAAsC;AAEtC,6CAAyC;AAIzC,MAAM,WAAW,GAAG,IAAA,sBAAE,EAAC;IACrB,KAAK,EAAE;QACL,OAAO,EAA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AAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IAE/B,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,CAAC,EAAE,EAAE;QACJ,IAAI,QAAQ;YAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,MAAM,aAAa,GAAG,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAErC,OAAO,CACL,wCAAM,SAAS,EAAE,YAAY;QAC3B,wCAAM,SAAS,EAAE,iBAAiB;YAEhC,4CACM,KAAK,EACT,IAAI,EAAC,OAAO,EACZ,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,GAAG,GACR;YACF,wCAAM,SAAS,EAAE,QAAQ,GAAI,CACxB;QAEN,QAAQ,IAAI,CACX,yCAAO,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,IACjD,QAAQ,CACH,CACT,CACI,CACR,CAAA;AACH,CAAC,CACF,CAAA"}
|
|
@@ -25,15 +25,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.RadioButtonPanel = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const
|
|
29
|
-
const useTheme_1 = require("../../hooks/useTheme");
|
|
28
|
+
const tailwind_variants_1 = require("tailwind-variants");
|
|
30
29
|
const Base_1 = require("../Base");
|
|
31
30
|
const RadioButton_1 = require("../RadioButton");
|
|
32
|
-
const useClassNames_1 = require("./useClassNames");
|
|
33
31
|
const MEANLESS_TAG_NAMES = ['div', 'span'];
|
|
32
|
+
const radioButtonPanel = (0, tailwind_variants_1.tv)({
|
|
33
|
+
base: [
|
|
34
|
+
'smarthr-ui-RadioButtonPanel',
|
|
35
|
+
'shr-border shr-border-solid shr-border-default shr-shadow-none',
|
|
36
|
+
// なぜか :has が動作しないので重ねて書いている
|
|
37
|
+
'has-[:focus-visible]:shr-focus-indicator [&:has(:focus-visible)]:shr-focus-indicator',
|
|
38
|
+
'[&_.smarthr-ui-RadioButton-radioButton:focus-visible_+_span]:shr-shadow-none',
|
|
39
|
+
'[&_.smarthr-ui-RadioButton-label]:shr-ms-0.75',
|
|
40
|
+
'has-[:disabled]:shr-cursor-default has-[:disabled]:[&_.smarthr-ui-RadioButton-label]:shr-cursor-default',
|
|
41
|
+
],
|
|
42
|
+
variants: {
|
|
43
|
+
disabled: {
|
|
44
|
+
false: 'shr-cursor-pointer [&_.smarthr-ui-RadioButton-label]:shr-cursor-pointer',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
34
48
|
const RadioButtonPanel = ({ onClick, as, className, ...props }) => {
|
|
35
|
-
const
|
|
36
|
-
const classNames = (0, useClassNames_1.useClassNames)(className);
|
|
49
|
+
const styles = (0, react_1.useMemo)(() => radioButtonPanel({ disabled: !!props.disabled, className }), [className, props.disabled]);
|
|
37
50
|
// 外側の装飾を押しても内側のラジオボタンが押せるようにする
|
|
38
51
|
const innerRef = (0, react_1.useRef)(null);
|
|
39
52
|
const handleOuterClick = () => {
|
|
@@ -41,32 +54,8 @@ const RadioButtonPanel = ({ onClick, as, className, ...props }) => {
|
|
|
41
54
|
};
|
|
42
55
|
return (
|
|
43
56
|
// eslint-disable-next-line smarthr/a11y-delegate-element-has-role-presentation
|
|
44
|
-
react_1.default.createElement(
|
|
57
|
+
react_1.default.createElement(Base_1.Base, { padding: 1, role: MEANLESS_TAG_NAMES.includes(`${as || ''}`) ? 'presentation' : undefined, onClick: handleOuterClick, as: as, className: styles },
|
|
45
58
|
react_1.default.createElement(RadioButton_1.RadioButton, { ...props, ref: innerRef })));
|
|
46
59
|
};
|
|
47
60
|
exports.RadioButtonPanel = RadioButtonPanel;
|
|
48
|
-
const WrapperBase = (0, styled_components_1.default)(Base_1.Base).attrs({ padding: 1 }) `
|
|
49
|
-
${({ themes: { border, shadow, space } }) => (0, styled_components_1.css) `
|
|
50
|
-
box-shadow: none;
|
|
51
|
-
border: ${border.shorthand};
|
|
52
|
-
|
|
53
|
-
:not(:has([disabled])) {
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* :focus-visible-within の代替 */
|
|
58
|
-
:has(:focus-visible) {
|
|
59
|
-
${shadow.focusIndicatorStyles}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.smarthr-ui-RadioButton-radioButton:focus + span {
|
|
63
|
-
box-shadow: revert;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.smarthr-ui-RadioButton-label {
|
|
67
|
-
/* 視覚的な調整 */
|
|
68
|
-
margin-inline-start: ${space(0.75)};
|
|
69
|
-
}
|
|
70
|
-
`}
|
|
71
|
-
`;
|
|
72
61
|
//# sourceMappingURL=RadioButtonPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtonPanel.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/RadioButtonPanel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"RadioButtonPanel.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/RadioButtonPanel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8D;AAC9D,yDAAsC;AAEtC,kCAA8B;AAC9B,gDAA4C;AAM5C,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAE1C,MAAM,gBAAgB,GAAG,IAAA,sBAAE,EAAC;IAC1B,IAAI,EAAE;QACJ,6BAA6B;QAC7B,gEAAgE;QAChE,4BAA4B;QAC5B,sFAAsF;QACtF,8EAA8E;QAC9E,+CAA+C;QAC/C,yGAAyG;KAC1G;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,KAAK,EAAE,yEAAyE;SACjF;KACF;CACF,CAAC,CAAA;AAEK,MAAM,gBAAgB,GAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACxF,MAAM,MAAM,GAAG,IAAA,eAAO,EACpB,GAAG,EAAE,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,EACjE,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAC5B,CAAA;IAED,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAC/C,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC5B,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAA;IAC3B,CAAC,CAAA;IAED,OAAO;IACL,+EAA+E;IAC/E,8BAAC,WAAI,IACH,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAC7E,OAAO,EAAE,gBAAgB,EACzB,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,MAAM;QAGjB,8BAAC,yBAAW,OAAK,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAI,CACpC,CACR,CAAA;AACH,CAAC,CAAA;AAzBY,QAAA,gBAAgB,oBAyB5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smarthr-ui",
|
|
3
3
|
"description": "SmartHR ui components built with React.",
|
|
4
|
-
"version": "41.1.
|
|
4
|
+
"version": "41.1.2",
|
|
5
5
|
"author": "SmartHR-UI Team",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@smarthr/wareki": "^1.2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/jest": "^29.5.11",
|
|
44
44
|
"@types/lodash.merge": "^4.6.9",
|
|
45
45
|
"@types/lodash.range": "^3.2.9",
|
|
46
|
-
"@types/node": "^20.11.
|
|
46
|
+
"@types/node": "^20.11.7",
|
|
47
47
|
"@types/react": "^18.2.48",
|
|
48
48
|
"@types/react-dom": "^18.2.18",
|
|
49
49
|
"@types/react-test-renderer": "^17.0.9",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"babel-loader": "^9.1.3",
|
|
55
55
|
"babel-plugin-polyfill-corejs2": "^0.4.8",
|
|
56
56
|
"babel-plugin-polyfill-regenerator": "^0.5.5",
|
|
57
|
-
"chromatic": "^10.
|
|
57
|
+
"chromatic": "^10.6.1",
|
|
58
58
|
"ecma-version-validator-webpack-plugin": "^1.2.1",
|
|
59
59
|
"eslint": "^8.56.0",
|
|
60
|
-
"eslint-config-smarthr": "^6.
|
|
60
|
+
"eslint-config-smarthr": "^6.17.0",
|
|
61
61
|
"eslint-plugin-storybook": "^0.6.15",
|
|
62
62
|
"fs-extra": "^11.2.0",
|
|
63
63
|
"glob": "10.3.10",
|
package/smarthr-ui.css
CHANGED
|
@@ -816,6 +816,10 @@
|
|
|
816
816
|
animation: shr-spin 1.6s linear infinite
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
+
.shr-cursor-\[revert\] {
|
|
820
|
+
cursor: revert
|
|
821
|
+
}
|
|
822
|
+
|
|
819
823
|
.shr-cursor-auto {
|
|
820
824
|
cursor: auto
|
|
821
825
|
}
|
|
@@ -2020,6 +2024,12 @@
|
|
|
2020
2024
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
2021
2025
|
}
|
|
2022
2026
|
|
|
2027
|
+
.shr-shadow-none {
|
|
2028
|
+
--tw-shadow: 0 0 #0000;
|
|
2029
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
2030
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2023
2033
|
.shr-shadow-underline {
|
|
2024
2034
|
--tw-shadow: 0 1px 0 0;
|
|
2025
2035
|
--tw-shadow-colored: 0 1px 0 0 var(--tw-shadow-color);
|
|
@@ -2113,6 +2123,18 @@
|
|
|
2113
2123
|
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0077c7
|
|
2114
2124
|
}
|
|
2115
2125
|
|
|
2126
|
+
.has-\[\:focus-visible\]\:shr-focus-indicator:has(:focus-visible) {
|
|
2127
|
+
outline: none;
|
|
2128
|
+
isolation: isolate;
|
|
2129
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0077c7
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
.\[\&\:has\(\:focus-visible\)\]\:shr-focus-indicator:has(:focus-visible) {
|
|
2133
|
+
outline: none;
|
|
2134
|
+
isolation: isolate;
|
|
2135
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0077c7
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2116
2138
|
.\[\&\:has\(\:focus-visible\)\]\:aria-\[sort\]\:shr-focus-indicator[aria-sort]:has(:focus-visible) {
|
|
2117
2139
|
outline: none;
|
|
2118
2140
|
isolation: isolate;
|
|
@@ -2888,10 +2910,6 @@
|
|
|
2888
2910
|
color: rgb(35 34 30 / var(--tw-text-opacity))
|
|
2889
2911
|
}
|
|
2890
2912
|
|
|
2891
|
-
.shr-peer:disabled ~ .peer-disabled\:shr-cursor-not-allowed {
|
|
2892
|
-
cursor: not-allowed
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
2913
|
.shr-peer:disabled ~ .peer-disabled\:shr-border-default\/50 {
|
|
2896
2914
|
border-color: rgb(214 211 208 / 0.5)
|
|
2897
2915
|
}
|
|
@@ -2941,6 +2959,10 @@
|
|
|
2941
2959
|
background-color: rgb(214 211 208 / var(--tw-bg-opacity))
|
|
2942
2960
|
}
|
|
2943
2961
|
|
|
2962
|
+
.has-\[\:disabled\]\:shr-cursor-default:has(:disabled) {
|
|
2963
|
+
cursor: default
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2944
2966
|
.aria-checked\:shr-border-main[aria-checked="true"] {
|
|
2945
2967
|
--tw-border-opacity: 1;
|
|
2946
2968
|
border-color: rgb(0 119 199 / var(--tw-border-opacity))
|
|
@@ -3418,6 +3440,24 @@
|
|
|
3418
3440
|
}
|
|
3419
3441
|
}
|
|
3420
3442
|
|
|
3443
|
+
.\[\&_\.smarthr-ui-RadioButton-label\]\:shr-ms-0\.75 .smarthr-ui-RadioButton-label {
|
|
3444
|
+
margin-inline-start: 12px
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
.\[\&_\.smarthr-ui-RadioButton-label\]\:shr-cursor-pointer .smarthr-ui-RadioButton-label {
|
|
3448
|
+
cursor: pointer
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
.has-\[\:disabled\]\:\[\&_\.smarthr-ui-RadioButton-label\]\:shr-cursor-default .smarthr-ui-RadioButton-label:has(:disabled) {
|
|
3452
|
+
cursor: default
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
.\[\&_\.smarthr-ui-RadioButton-radioButton\:focus-visible_\+_span\]\:shr-shadow-none .smarthr-ui-RadioButton-radioButton:focus-visible + span {
|
|
3456
|
+
--tw-shadow: 0 0 #0000;
|
|
3457
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
3458
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3421
3461
|
.\[\&_\>_\*\:nth-child\(2\)\]\:shr-mb-auto > *:nth-child(2) {
|
|
3422
3462
|
margin-bottom: auto
|
|
3423
3463
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { useClassNameGenerator } from '../../hooks/useClassNameGenerator';
|
|
3
|
-
import { RadioButtonPanel } from './RadioButtonPanel';
|
|
4
|
-
export const useClassNames = (className = '') => {
|
|
5
|
-
const generate = useClassNameGenerator(RadioButtonPanel.displayName || 'RadioButtonPanel');
|
|
6
|
-
return useMemo(() => ({
|
|
7
|
-
wrapper: `${className} ${generate()}`,
|
|
8
|
-
}), [className, generate]);
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=useClassNames.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClassNames.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/useClassNames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,WAAW,IAAI,kBAAkB,CAAC,CAAA;IAE1F,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,GAAG,SAAS,IAAI,QAAQ,EAAE,EAAE;KACtC,CAAC,EACF,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useClassNames = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useClassNameGenerator_1 = require("../../hooks/useClassNameGenerator");
|
|
6
|
-
const RadioButtonPanel_1 = require("./RadioButtonPanel");
|
|
7
|
-
const useClassNames = (className = '') => {
|
|
8
|
-
const generate = (0, useClassNameGenerator_1.useClassNameGenerator)(RadioButtonPanel_1.RadioButtonPanel.displayName || 'RadioButtonPanel');
|
|
9
|
-
return (0, react_1.useMemo)(() => ({
|
|
10
|
-
wrapper: `${className} ${generate()}`,
|
|
11
|
-
}), [className, generate]);
|
|
12
|
-
};
|
|
13
|
-
exports.useClassNames = useClassNames;
|
|
14
|
-
//# sourceMappingURL=useClassNames.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClassNames.js","sourceRoot":"","sources":["../../../src/components/RadioButtonPanel/useClassNames.ts"],"names":[],"mappings":";;;AAAA,iCAA+B;AAE/B,6EAAyE;AAEzE,yDAAqD;AAE9C,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAA,6CAAqB,EAAC,mCAAgB,CAAC,WAAW,IAAI,kBAAkB,CAAC,CAAA;IAE1F,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,GAAG,SAAS,IAAI,QAAQ,EAAE,EAAE;KACtC,CAAC,EACF,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtB,CAAA;AACH,CAAC,CAAA;AATY,QAAA,aAAa,iBASzB"}
|