@elliemae/ds-tab-button 3.60.0-next.20

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 (49) hide show
  1. package/dist/cjs/DSTabButton.js +106 -0
  2. package/dist/cjs/DSTabButton.js.map +7 -0
  3. package/dist/cjs/config/useTabButton.js +60 -0
  4. package/dist/cjs/config/useTabButton.js.map +7 -0
  5. package/dist/cjs/config/useValidateProps.js +40 -0
  6. package/dist/cjs/config/useValidateProps.js.map +7 -0
  7. package/dist/cjs/constants/index.js +56 -0
  8. package/dist/cjs/constants/index.js.map +7 -0
  9. package/dist/cjs/index.js +40 -0
  10. package/dist/cjs/index.js.map +7 -0
  11. package/dist/cjs/package.json +10 -0
  12. package/dist/cjs/react-desc-prop-types.js +57 -0
  13. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  14. package/dist/cjs/styles.js +186 -0
  15. package/dist/cjs/styles.js.map +7 -0
  16. package/dist/cjs/typescript-testing/DSTabButtonNamespace.js +122 -0
  17. package/dist/cjs/typescript-testing/DSTabButtonNamespace.js.map +7 -0
  18. package/dist/esm/DSTabButton.js +82 -0
  19. package/dist/esm/DSTabButton.js.map +7 -0
  20. package/dist/esm/config/useTabButton.js +30 -0
  21. package/dist/esm/config/useTabButton.js.map +7 -0
  22. package/dist/esm/config/useValidateProps.js +10 -0
  23. package/dist/esm/config/useValidateProps.js.map +7 -0
  24. package/dist/esm/constants/index.js +26 -0
  25. package/dist/esm/constants/index.js.map +7 -0
  26. package/dist/esm/index.js +10 -0
  27. package/dist/esm/index.js.map +7 -0
  28. package/dist/esm/package.json +10 -0
  29. package/dist/esm/react-desc-prop-types.js +32 -0
  30. package/dist/esm/react-desc-prop-types.js.map +7 -0
  31. package/dist/esm/styles.js +156 -0
  32. package/dist/esm/styles.js.map +7 -0
  33. package/dist/esm/typescript-testing/DSTabButtonNamespace.js +99 -0
  34. package/dist/esm/typescript-testing/DSTabButtonNamespace.js.map +7 -0
  35. package/dist/types/DSTabButton.d.ts +5 -0
  36. package/dist/types/config/useTabButton.d.ts +12 -0
  37. package/dist/types/config/useValidateProps.d.ts +3 -0
  38. package/dist/types/constants/index.d.ts +19 -0
  39. package/dist/types/index.d.ts +3 -0
  40. package/dist/types/react-desc-prop-types.d.ts +26 -0
  41. package/dist/types/styles.d.ts +19 -0
  42. package/dist/types/tests/DSTabButton.API.test.d.ts +1 -0
  43. package/dist/types/tests/DSTabButton.data-testid.test.d.ts +1 -0
  44. package/dist/types/tests/DSTabButton.exports.test.d.ts +1 -0
  45. package/dist/types/tests/DSTabButton.keyboard.test.d.ts +1 -0
  46. package/dist/types/tests/DSTabButton.test.d.ts +1 -0
  47. package/dist/types/tests/axe.test.d.ts +1 -0
  48. package/dist/types/typescript-testing/DSTabButtonNamespace.d.ts +1 -0
  49. package/package.json +73 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\n\nimport { DSTypography, type DSTypographyT } from '@elliemae/ds-typography';\nimport { DSTabButtonName, TAB_BUTTON_SLOTS, TAB_TYPES } from './constants/index.js';\nimport type { DSTabButtonT } from './react-desc-prop-types.js';\n\ninterface StyledTabButtonPropsT {\n isActive?: boolean;\n disabled?: boolean;\n tabType: DSTabButtonT.TabButtonVariant;\n notificationBadge?: boolean;\n}\n\ninterface StyledTypographyPropsT extends DSTypographyT.Props {\n $isSelected?: boolean;\n $isDisabled?: boolean;\n $tabType: DSTabButtonT.TabButtonVariant;\n}\n\nconst borderAroundFocus = css<StyledTabButtonPropsT>`\n &:after {\n pointer-events: none;\n display: block;\n position: absolute;\n content: '';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 3;\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n`;\n\nconst borderAroundFocusUnderline = css<StyledTabButtonPropsT>`\n &:before {\n position: absolute;\n content: '';\n left: -16px;\n right: 0;\n top: calc(100% - 2px);\n transform: none;\n width: calc(100% + 32px);\n height: 2px;\n z-index: 10;\n background: linear-gradient(\n to right,\n transparent 0px,\n transparent 12px,\n white 12px,\n white 16px,\n transparent 16px,\n transparent calc(100% - 16px),\n white calc(100% - 16px),\n white calc(100% - 12px),\n transparent calc(100% - 12px),\n transparent 100%\n );\n }\n`;\n\nconst unlineLabelSelected = css<StyledTypographyPropsT>`\n &:before {\n pointer-events: none;\n display: block;\n content: '';\n position: absolute;\n height: 3px;\n width: calc(100% + var(--border-width) * 2);\n left: calc(var(--border-width) * -1);\n bottom: 0;\n top: initial;\n z-index: 6;\n background: ${({ theme }) => theme.colors.brand[700]};\n border-left: var(--border-width) solid ${({ theme }) => theme.colors.neutral['000']};\n border-right: var(--border-width) solid ${({ theme }) => theme.colors.neutral['000']};\n }\n`;\n\nconst baseButtonStyles = css<StyledTabButtonPropsT>`\n --border-width: 2px;\n --height-padding: ${({ tabType }) =>\n tabType === TAB_TYPES.PRIMARY_SMALL || tabType === TAB_TYPES.SECONDARY ? '2px' : '7px'};\n --width-padding: 16px;\n --width-padding-calc: calc(var(--width-padding) * 2);\n\n position: relative;\n background-color: transparent;\n border: none;\n cursor: pointer;\n padding: 0 var(--width-padding);\n margin: 0;\n transition: 100ms cubic-bezier(0, 0, 0.42, 1);\n text-transform: ${({ tabType }) => {\n if (tabType === TAB_TYPES.SECONDARY) return 'capitalize';\n return 'uppercase';\n }};\n width: fit-content;\n display: flex;\n gap: ${({ notificationBadge }) => (notificationBadge ? '2px' : '8px')};\n white-space: nowrap;\n color: ${({ theme }) => theme.colors.neutral[700]};\n ${({ tabType }) => (tabType === TAB_TYPES.PRIMARY ? `min-height: 32px;` : `min-height: 22px;`)}\n\n &[aria-disabled='true'] {\n color: ${({ theme }) => theme.colors.neutral[500]};\n cursor: not-allowed;\n }\n\n &:hover:not(disabled) {\n color: ${({ theme }) => theme.colors.brand[600]};\n }\n\n &:focus {\n outline: none;\n ${borderAroundFocus}\n ${({ isActive, tabType }) => (tabType !== TAB_TYPES.SECONDARY && isActive ? borderAroundFocusUnderline : ``)}\n }\n`;\n\nexport const StyledNotificationBadge = styled('span', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.REQUIRED_MARK,\n})`\n width: 0.46rem;\n height: 0.46rem;\n background-color: ${({ theme }) => theme.colors.danger[900]};\n border-radius: 50%;\n display: inline-block;\n position: absolute;\n top: 0;\n right: 0;\n`;\n\nexport const StyledTabButton = styled('button', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.ROOT,\n})<StyledTabButtonPropsT>`\n ${baseButtonStyles}\n`;\n\nexport const StyledTypography = styled(DSTypography, {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.LABEL,\n})<StyledTypographyPropsT>`\n padding: var(--height-padding) 0;\n position: relative;\n z-index: 4;\n white-space: nowrap;\n ${({ $isSelected, $tabType }) => $isSelected && $tabType !== TAB_TYPES.SECONDARY && unlineLabelSelected}\n ${({ $isSelected }) => $isSelected && `font-weight: 600;`}\n ${({ $isDisabled, theme }) => $isDisabled && `color: ${theme.colors.neutral[600]};`}\n`;\n\nexport const StyledChildrenWrapper = styled('span', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.CHILDREN_WRAPPER,\n})`\n margin: var(--height-padding) 0;\n position: relative;\n`;\n\nexport const ScreenReaderOnly = styled.span`\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAE5B,2BAAiD;AACjD,uBAA6D;AAgB7D,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,MAK7C,iBAAiB;AAAA,MACjB,CAAC,EAAE,UAAU,QAAQ,MAAO,YAAY,2BAAU,aAAa,WAAW,6BAA6B,EAAG;AAAA;AAAA;AAIzG,MAAM,8BAA0B,yBAAO,QAAQ;AAAA,EACpD,MAAM;AAAA,EACN,MAAM,kCAAiB;AACzB,CAAC;AAAA;AAAA;AAAA,sBAGqB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQtD,MAAM,sBAAkB,yBAAO,UAAU;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,kCAAiB;AACzB,CAAC;AAAA,IACG,gBAAgB;AAAA;AAGb,MAAM,uBAAmB,yBAAO,mCAAc;AAAA,EACnD,MAAM;AAAA,EACN,MAAM,kCAAiB;AACzB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG,CAAC,EAAE,aAAa,SAAS,MAAM,eAAe,aAAa,2BAAU,aAAa,mBAAmB;AAAA,IACrG,CAAC,EAAE,YAAY,MAAM,eAAe,mBAAmB;AAAA,IACvD,CAAC,EAAE,aAAa,MAAM,MAAM,eAAe,UAAU,MAAM,OAAO,QAAQ,GAAG,CAAC,GAAG;AAAA;AAG9E,MAAM,4BAAwB,yBAAO,QAAQ;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,kCAAiB;AACzB,CAAC;AAAA;AAAA;AAAA;AAKM,MAAM,mBAAmB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import__ = require("../index.js");
27
+ const testRequiredProps = {
28
+ label: "string"
29
+ };
30
+ const testOptionalProps = {
31
+ className: "string",
32
+ dsTabbuttonRoot: {
33
+ onClick: () => {
34
+ },
35
+ "data-testid": "over-ride-test-id",
36
+ "aria-label": "over-ride-aria-label"
37
+ }
38
+ };
39
+ const testPartialDefaults = {};
40
+ const testProps = {
41
+ ...testRequiredProps,
42
+ ...testOptionalProps,
43
+ ...testPartialDefaults
44
+ };
45
+ const testPropsAsSyntax = {
46
+ ...testRequiredProps,
47
+ ...testOptionalProps,
48
+ ...testPartialDefaults
49
+ };
50
+ const testCompleteDefaults = {
51
+ variant: "primary",
52
+ isSelected: false,
53
+ notificationBadge: false,
54
+ applyAriaDisabled: false,
55
+ required: false
56
+ };
57
+ const testInternalProps = {
58
+ ...testRequiredProps,
59
+ ...testOptionalProps,
60
+ ...testCompleteDefaults
61
+ };
62
+ const testInternalPropsAsSyntax = {
63
+ ...testRequiredProps,
64
+ ...testOptionalProps,
65
+ ...testCompleteDefaults
66
+ };
67
+ const testExplicitDefinition = {
68
+ label: "string",
69
+ className: "string",
70
+ dsTabbuttonRoot: {
71
+ onClick: () => {
72
+ },
73
+ "data-testid": "over-ride-test-id",
74
+ "aria-label": "over-ride-aria-label"
75
+ }
76
+ };
77
+ const testInferedTypeCompatibility = {
78
+ label: "string",
79
+ className: "string",
80
+ onSomethingEvent: (newVal, e) => {
81
+ },
82
+ dsTabbuttonRoot: {
83
+ onClick: () => {
84
+ },
85
+ "data-testid": "over-ride-test-id",
86
+ "aria-label": "over-ride-aria-label"
87
+ }
88
+ };
89
+ const testDefinitionAsConst = {
90
+ label: "string",
91
+ className: "string",
92
+ onSomethingEvent: (newVal, e) => {
93
+ },
94
+ dsTabbuttonRoot: {
95
+ onClick: () => {
96
+ },
97
+ "data-testid": "over-ride-test-id",
98
+ "aria-label": "over-ride-aria-label"
99
+ },
100
+ foo: "string",
101
+ bar: 0,
102
+ something: "string"
103
+ };
104
+ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTabButton, { ...testExplicitDefinition }),
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTabButton, { ...testInferedTypeCompatibility }),
107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSTabButton, { ...testDefinitionAsConst }),
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
109
+ import__.DSTabButton,
110
+ {
111
+ label: "string",
112
+ className: "string",
113
+ dsTabbuttonRoot: {
114
+ onClick: () => {
115
+ },
116
+ "data-testid": "over-ride-test-id",
117
+ "aria-label": "over-ride-aria-label"
118
+ }
119
+ }
120
+ )
121
+ ] });
122
+ //# sourceMappingURL=DSTabButtonNamespace.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/DSTabButtonNamespace.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTabButton, type DSTabButtonT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTabButtonT.Props;\ntype ComponentPropsInternals = DSTabButtonT.InternalProps;\ntype ComponentPropsDefaultProps = DSTabButtonT.DefaultProps;\ntype ComponentPropsOptionalProps = DSTabButtonT.OptionalProps;\ntype ComponentPropsRequiredProps = DSTabButtonT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n label: 'string',\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n className: 'string',\n dsTabbuttonRoot: {\n onClick: () => {},\n 'data-testid': 'over-ride-test-id',\n 'aria-label': 'over-ride-aria-label',\n },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n variant: 'primary',\n isSelected: false,\n notificationBadge: false,\n applyAriaDisabled: false,\n required: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: 'string',\n className: 'string',\n dsTabbuttonRoot: {\n onClick: () => {},\n 'data-testid': 'over-ride-test-id',\n 'aria-label': 'over-ride-aria-label',\n },\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: 'string',\n className: 'string',\n onSomethingEvent: (newVal: string, e: React.ChangeEvent<HTMLElement>) => {},\n dsTabbuttonRoot: {\n onClick: () => {},\n 'data-testid': 'over-ride-test-id',\n 'aria-label': 'over-ride-aria-label',\n },\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: 'string',\n className: 'string',\n onSomethingEvent: (newVal: string, e: React.ChangeEvent<HTMLElement>) => {},\n dsTabbuttonRoot: {\n onClick: () => {},\n 'data-testid': 'over-ride-test-id',\n 'aria-label': 'over-ride-aria-label',\n },\n foo: 'string',\n bar: 0,\n something: 'string',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSTabButton {...testExplicitDefinition} />\n <DSTabButton {...testInferedTypeCompatibility} />\n <DSTabButton {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSTabButton\n label=\"string\"\n className=\"string\"\n dsTabbuttonRoot={{\n onClick: () => {},\n 'data-testid': 'over-ride-test-id',\n 'aria-label': 'over-ride-aria-label',\n }}\n />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACkGrB;AAjGF,eAA+C;AAS/C,MAAM,oBAAiD;AAAA,EACrD,OAAO;AACT;AAEA,MAAM,oBAAiD;AAAA,EACrD,WAAW;AAAA,EACX,iBAAiB;AAAA,IACf,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,eAAe;AAAA,IACf,cAAc;AAAA,EAChB;AACF;AAIA,MAAM,sBAA2D,CAAC;AAElE,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;A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AAA,GACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { describe } from "@elliemae/ds-props-helpers";
4
+ import { DSTabButtonPropTypesSchema } from "./react-desc-prop-types.js";
5
+ import { useTabButton } from "./config/useTabButton.js";
6
+ import { DSTabButtonName } from "./constants/index.js";
7
+ import {
8
+ StyledChildrenWrapper,
9
+ StyledNotificationBadge,
10
+ StyledTabButton,
11
+ StyledTypography,
12
+ ScreenReaderOnly
13
+ } from "./styles.js";
14
+ const DSTabButton = (props) => {
15
+ const { propsWithDefault, xstyledProps } = useTabButton(props);
16
+ const {
17
+ onClick,
18
+ onKeyDown,
19
+ disabled = false,
20
+ children,
21
+ isSelected,
22
+ variant,
23
+ label,
24
+ notificationBadge,
25
+ required,
26
+ applyAriaDisabled,
27
+ ...rest
28
+ } = propsWithDefault;
29
+ const hasChildren = !!children;
30
+ const isDisabled = disabled || applyAriaDisabled;
31
+ return /* @__PURE__ */ jsxs(
32
+ StyledTabButton,
33
+ {
34
+ ...rest,
35
+ type: "button",
36
+ "aria-disabled": isDisabled,
37
+ tabType: variant,
38
+ disabled,
39
+ onClick: !isDisabled ? onClick : void 0,
40
+ onKeyDown: isDisabled ? (e) => {
41
+ if (e.key === "Enter" || e.key === " ") return;
42
+ onKeyDown?.(e);
43
+ } : onKeyDown,
44
+ ...xstyledProps,
45
+ getOwnerProps: () => propsWithDefault,
46
+ getOwnerPropsArguments: () => ({}),
47
+ children: [
48
+ /* @__PURE__ */ jsx(
49
+ StyledTypography,
50
+ {
51
+ $isSelected: isSelected,
52
+ $isDisabled: isDisabled,
53
+ $tabType: variant,
54
+ variant: "b2",
55
+ component: "span",
56
+ getOwnerProps: () => propsWithDefault,
57
+ getOwnerPropsArguments: () => ({}),
58
+ children: label
59
+ }
60
+ ),
61
+ notificationBadge || required ? /* @__PURE__ */ jsx(StyledChildrenWrapper, { getOwnerProps: () => propsWithDefault, getOwnerPropsArguments: () => ({}), children: /* @__PURE__ */ jsx(
62
+ StyledNotificationBadge,
63
+ {
64
+ "aria-hidden": "true",
65
+ getOwnerProps: () => propsWithDefault,
66
+ getOwnerPropsArguments: () => ({})
67
+ }
68
+ ) }) : null,
69
+ required ? /* @__PURE__ */ jsx(ScreenReaderOnly, { getOwnerProps: () => propsWithDefault, getOwnerPropsArguments: () => ({}), children: "Required" }) : null,
70
+ hasChildren && !notificationBadge ? /* @__PURE__ */ jsx(StyledChildrenWrapper, { getOwnerProps: () => propsWithDefault, getOwnerPropsArguments: () => ({}), children }) : null
71
+ ]
72
+ }
73
+ );
74
+ };
75
+ DSTabButton.displayName = DSTabButtonName;
76
+ const DSTabButtonWithSchema = describe(DSTabButton);
77
+ DSTabButtonWithSchema.propTypes = DSTabButtonPropTypesSchema;
78
+ export {
79
+ DSTabButton,
80
+ DSTabButtonWithSchema
81
+ };
82
+ //# sourceMappingURL=DSTabButton.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSTabButton.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSTabButtonT, DSTabButtonPropTypesSchema } from './react-desc-prop-types.js';\nimport { useTabButton } from './config/useTabButton.js';\nimport { DSTabButtonName } from './constants/index.js';\nimport {\n StyledChildrenWrapper,\n StyledNotificationBadge,\n StyledTabButton,\n StyledTypography,\n ScreenReaderOnly,\n} from './styles.js';\n\nconst DSTabButton: React.ComponentType<DSTabButtonT.Props> = (props) => {\n const { propsWithDefault, xstyledProps } = useTabButton(props);\n\n const {\n onClick,\n onKeyDown,\n disabled = false,\n children,\n isSelected,\n variant,\n label,\n notificationBadge,\n required,\n applyAriaDisabled,\n ...rest\n } = propsWithDefault;\n const hasChildren = !!children;\n const isDisabled = disabled || applyAriaDisabled;\n\n return (\n <StyledTabButton\n {...rest}\n type=\"button\"\n aria-disabled={isDisabled}\n tabType={variant}\n disabled={disabled}\n onClick={!isDisabled ? onClick : undefined}\n onKeyDown={\n isDisabled\n ? (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') return;\n onKeyDown?.(e);\n }\n : onKeyDown\n }\n {...xstyledProps}\n getOwnerProps={() => propsWithDefault}\n getOwnerPropsArguments={() => ({})}\n >\n <StyledTypography\n $isSelected={isSelected}\n $isDisabled={isDisabled}\n $tabType={variant}\n variant=\"b2\"\n component=\"span\"\n getOwnerProps={() => propsWithDefault}\n getOwnerPropsArguments={() => ({})}\n >\n {label}\n </StyledTypography>\n {notificationBadge || required ? (\n <StyledChildrenWrapper getOwnerProps={() => propsWithDefault} getOwnerPropsArguments={() => ({})}>\n <StyledNotificationBadge\n aria-hidden=\"true\"\n getOwnerProps={() => propsWithDefault}\n getOwnerPropsArguments={() => ({})}\n />\n </StyledChildrenWrapper>\n ) : null}\n {required ? (\n <ScreenReaderOnly getOwnerProps={() => propsWithDefault} getOwnerPropsArguments={() => ({})}>\n Required\n </ScreenReaderOnly>\n ) : null}\n {hasChildren && !notificationBadge ? (\n <StyledChildrenWrapper getOwnerProps={() => propsWithDefault} getOwnerPropsArguments={() => ({})}>\n {children}\n </StyledChildrenWrapper>\n ) : null}\n </StyledTabButton>\n );\n};\n\nDSTabButton.displayName = DSTabButtonName;\nconst DSTabButtonWithSchema = describe(DSTabButton);\nDSTabButtonWithSchema.propTypes = DSTabButtonPropTypesSchema;\n\nexport { DSTabButton, DSTabButtonWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiCnB,SAmBE,KAnBF;AAhCJ,SAAS,gBAAgB;AACzB,SAA4B,kCAAkC;AAC9D,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,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J;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,30 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
4
+ import { uid } from "uid";
5
+ import { DSTabButtonPropTypes, defaultProps } from "../react-desc-prop-types.js";
6
+ import { useValidateProps } from "./useValidateProps.js";
7
+ const useTabButton = (propsFromUser) => {
8
+ const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
9
+ useValidateProps(propsWithDefault, DSTabButtonPropTypes);
10
+ const xstyledProps = useGetXstyledProps(propsWithDefault);
11
+ const instanceUid = React2.useMemo(() => `ds-tab-button-${uid(5)}`, []);
12
+ return React2.useMemo(
13
+ () => ({
14
+ propsWithDefault,
15
+ xstyledProps,
16
+ instanceUid
17
+ // ...eventHandlers,
18
+ }),
19
+ [
20
+ propsWithDefault,
21
+ xstyledProps,
22
+ instanceUid
23
+ // eventHandlers,
24
+ ]
25
+ );
26
+ };
27
+ export {
28
+ useTabButton
29
+ };
30
+ //# sourceMappingURL=useTabButton.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTabButton.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSTabButtonT, DSTabButtonPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface TabButtonCTX {\n propsWithDefault: DSTabButtonT.InternalProps;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useTabButton = (propsFromUser: DSTabButtonT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSTabButtonT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSTabButtonPropTypes);\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const instanceUid = React.useMemo(() => `ds-tab-button-${uid(5)}`, []);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n xstyledProps,\n instanceUid,\n // eventHandlers,\n ],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,WAAW;AACpB,SAA4B,sBAAsB,oBAAoB;AACtE,SAAS,wBAAwB;AAQ1B,MAAM,eAAe,CAAC,kBAAsC;AAIjE,QAAM,mBAAmB,6BAAyD,eAAe,YAAY;AAC7G,mBAAiB,kBAAkB,oBAAoB;AAIvD,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,cAAcA,OAAM,QAAQ,MAAM,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAMrE,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
6
+ "names": ["React"]
7
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
3
+ import { DSTabButtonName } from "../constants/index.js";
4
+ const useValidateProps = (props, propTypes) => {
5
+ useValidateTypescriptPropTypes(props, propTypes, DSTabButtonName);
6
+ };
7
+ export {
8
+ useValidateProps
9
+ };
10
+ //# sourceMappingURL=useValidateProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSTabButtonT } from '../react-desc-prop-types.js';\nimport { DSTabButtonName } from '../constants/index.js';\n\nexport const useValidateProps = (props: DSTabButtonT.InternalProps, propTypes: ValidationMap<unknown>): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSTabButtonName);\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,uBAAuB;AAEzB,MAAM,mBAAmB,CAAC,OAAmC,cAA4C;AAE9G,iCAA+B,OAAO,WAAW,eAAe;AAClE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { slotObjectToDataTestIds } from "@elliemae/ds-system";
3
+ const DSTabButtonName = "DSTabbutton";
4
+ const TAB_TYPES = {
5
+ PRIMARY: "primary",
6
+ PRIMARY_SMALL: "primary-small",
7
+ SECONDARY: "secondary"
8
+ };
9
+ const TAB_TYPES_VALUES_AS_ARRAY = Object.values(TAB_TYPES);
10
+ const TAB_BUTTON_SLOTS = {
11
+ ROOT: "root",
12
+ LABEL: "label",
13
+ REQUIRED_MARK: "required-mark",
14
+ CHILDREN_WRAPPER: "children-wrapper"
15
+ };
16
+ const TAB_BUTTON_DATA_TESTID = {
17
+ ...slotObjectToDataTestIds(DSTabButtonName, TAB_BUTTON_SLOTS)
18
+ };
19
+ export {
20
+ DSTabButtonName,
21
+ TAB_BUTTON_DATA_TESTID,
22
+ TAB_BUTTON_SLOTS,
23
+ TAB_TYPES,
24
+ TAB_TYPES_VALUES_AS_ARRAY
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSTabButtonName = 'DSTabbutton';\n\nexport const TAB_TYPES = {\n PRIMARY: 'primary',\n PRIMARY_SMALL: 'primary-small',\n SECONDARY: 'secondary',\n} as const;\n\nexport const TAB_TYPES_VALUES_AS_ARRAY = Object.values(TAB_TYPES);\n\nexport const TAB_BUTTON_SLOTS = {\n ROOT: 'root',\n LABEL: 'label',\n REQUIRED_MARK: 'required-mark',\n CHILDREN_WRAPPER: 'children-wrapper',\n} as const;\n\nexport const TAB_BUTTON_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSTabButtonName, TAB_BUTTON_SLOTS),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,kBAAkB;AAExB,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,WAAW;AACb;AAEO,MAAM,4BAA4B,OAAO,OAAO,SAAS;AAEzD,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,eAAe;AAAA,EACf,kBAAkB;AACpB;AAEO,MAAM,yBAAyB;AAAA,EACpC,GAAG,wBAAwB,iBAAiB,gBAAgB;AAC9D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { DSTabButton, DSTabButtonWithSchema } from "./DSTabButton.js";
3
+ import { TAB_BUTTON_SLOTS, TAB_BUTTON_DATA_TESTID } from "./constants/index.js";
4
+ export {
5
+ DSTabButton,
6
+ DSTabButtonWithSchema,
7
+ TAB_BUTTON_DATA_TESTID,
8
+ TAB_BUTTON_SLOTS
9
+ };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { DSTabButton, DSTabButtonWithSchema } from './DSTabButton.js';\nexport { type DSTabButtonT } from './react-desc-prop-types.js';\nexport { TAB_BUTTON_SLOTS, TAB_BUTTON_DATA_TESTID } from './constants/index.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,aAAa,6BAA6B;AAEnD,SAAS,kBAAkB,8BAA8B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ],
7
+ "publishConfig": {
8
+ "access": "public"
9
+ }
10
+ }
@@ -0,0 +1,32 @@
1
+ import * as React from "react";
2
+ import {
3
+ PropTypes,
4
+ getPropsPerSlotPropTypes,
5
+ globalAttributesPropTypes,
6
+ xstyledPropTypes
7
+ } from "@elliemae/ds-props-helpers";
8
+ import { DSTabButtonName, TAB_BUTTON_SLOTS, TAB_TYPES } from "./constants/index.js";
9
+ const defaultProps = {
10
+ variant: TAB_TYPES.PRIMARY,
11
+ isSelected: false,
12
+ notificationBadge: false,
13
+ required: false
14
+ };
15
+ const DSTabButtonPropTypes = {
16
+ ...getPropsPerSlotPropTypes(DSTabButtonName, TAB_BUTTON_SLOTS),
17
+ ...globalAttributesPropTypes,
18
+ ...xstyledPropTypes,
19
+ label: PropTypes.string.description("The label of the tab button."),
20
+ variant: PropTypes.oneOf(["primary", "secondary", "primary-small"]).description("The variant of the tab button.").defaultValue("primary"),
21
+ isSelected: PropTypes.bool.description("Indicates if the tab button is currently selected.").defaultValue(false),
22
+ notificationBadge: PropTypes.bool.description("Indicates if the tab button has a notification badge.").defaultValue(false),
23
+ required: PropTypes.bool.description("Indicates if the tab button is required.").defaultValue(false),
24
+ applyAriaDisabled: PropTypes.bool.description("Indicates if the tab button should apply aria-disabled.").defaultValue(false)
25
+ };
26
+ const DSTabButtonPropTypesSchema = DSTabButtonPropTypes;
27
+ export {
28
+ DSTabButtonPropTypes,
29
+ DSTabButtonPropTypesSchema,
30
+ defaultProps
31
+ };
32
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSTabButtonName, TAB_BUTTON_SLOTS, TAB_TYPES } from './constants/index.js';\n\nexport declare namespace DSTabButtonT {\n export type TabButtonVariant = (typeof TAB_TYPES)[keyof typeof TAB_TYPES];\n export interface RequiredProps {\n label: string;\n }\n\n export interface DefaultProps {\n variant: TabButtonVariant;\n isSelected: boolean;\n notificationBadge?: boolean;\n required?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSTabButtonName, typeof TAB_BUTTON_SLOTS> {\n className?: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSTabButtonT.DefaultProps = {\n variant: TAB_TYPES.PRIMARY,\n isSelected: false,\n notificationBadge: false,\n required: false,\n};\n\nexport const DSTabButtonPropTypes: DSPropTypesSchema<DSTabButtonT.Props> = {\n ...getPropsPerSlotPropTypes(DSTabButtonName, TAB_BUTTON_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n label: PropTypes.string.description('The label of the tab button.'),\n variant: PropTypes.oneOf(['primary', 'secondary', 'primary-small'])\n .description('The variant of the tab button.')\n .defaultValue('primary'),\n isSelected: PropTypes.bool.description('Indicates if the tab button is currently selected.').defaultValue(false),\n notificationBadge: PropTypes.bool\n .description('Indicates if the tab button has a notification badge.')\n .defaultValue(false),\n required: PropTypes.bool.description('Indicates if the tab button is required.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description('Indicates if the tab button should apply aria-disabled.')\n .defaultValue(false),\n};\n\nexport const DSTabButtonPropTypesSchema = DSTabButtonPropTypes as unknown as ValidationMap<DSTabButtonT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,kBAAkB,iBAAiB;AAoCtD,MAAM,eAA0C;AAAA,EACrD,SAAS,UAAU;AAAA,EACnB,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAEO,MAAM,uBAA8D;AAAA,EACzE,GAAG,yBAAyB,iBAAiB,gBAAgB;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,UAAU,OAAO,YAAY,8BAA8B;AAAA,EAClE,SAAS,UAAU,MAAM,CAAC,WAAW,aAAa,eAAe,CAAC,EAC/D,YAAY,gCAAgC,EAC5C,aAAa,SAAS;AAAA,EACzB,YAAY,UAAU,KAAK,YAAY,oDAAoD,EAAE,aAAa,KAAK;AAAA,EAC/G,mBAAmB,UAAU,KAC1B,YAAY,uDAAuD,EACnE,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KAAK,YAAY,0CAA0C,EAAE,aAAa,KAAK;AAAA,EACnG,mBAAmB,UAAU,KAC1B,YAAY,yDAAyD,EACrE,aAAa,KAAK;AACvB;AAEO,MAAM,6BAA6B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,156 @@
1
+ import * as React from "react";
2
+ import { styled, css } from "@elliemae/ds-system";
3
+ import { DSTypography } from "@elliemae/ds-typography";
4
+ import { DSTabButtonName, TAB_BUTTON_SLOTS, TAB_TYPES } from "./constants/index.js";
5
+ const borderAroundFocus = css`
6
+ &:after {
7
+ pointer-events: none;
8
+ display: block;
9
+ position: absolute;
10
+ content: '';
11
+ top: 0;
12
+ left: 0;
13
+ width: 100%;
14
+ height: 100%;
15
+ z-index: 3;
16
+ border-radius: 2px;
17
+ border: 2px solid ${({ theme }) => theme.colors.brand[700]};
18
+ }
19
+ `;
20
+ const borderAroundFocusUnderline = css`
21
+ &:before {
22
+ position: absolute;
23
+ content: '';
24
+ left: -16px;
25
+ right: 0;
26
+ top: calc(100% - 2px);
27
+ transform: none;
28
+ width: calc(100% + 32px);
29
+ height: 2px;
30
+ z-index: 10;
31
+ background: linear-gradient(
32
+ to right,
33
+ transparent 0px,
34
+ transparent 12px,
35
+ white 12px,
36
+ white 16px,
37
+ transparent 16px,
38
+ transparent calc(100% - 16px),
39
+ white calc(100% - 16px),
40
+ white calc(100% - 12px),
41
+ transparent calc(100% - 12px),
42
+ transparent 100%
43
+ );
44
+ }
45
+ `;
46
+ const unlineLabelSelected = css`
47
+ &:before {
48
+ pointer-events: none;
49
+ display: block;
50
+ content: '';
51
+ position: absolute;
52
+ height: 3px;
53
+ width: calc(100% + var(--border-width) * 2);
54
+ left: calc(var(--border-width) * -1);
55
+ bottom: 0;
56
+ top: initial;
57
+ z-index: 6;
58
+ background: ${({ theme }) => theme.colors.brand[700]};
59
+ border-left: var(--border-width) solid ${({ theme }) => theme.colors.neutral["000"]};
60
+ border-right: var(--border-width) solid ${({ theme }) => theme.colors.neutral["000"]};
61
+ }
62
+ `;
63
+ const baseButtonStyles = css`
64
+ --border-width: 2px;
65
+ --height-padding: ${({ tabType }) => tabType === TAB_TYPES.PRIMARY_SMALL || tabType === TAB_TYPES.SECONDARY ? "2px" : "7px"};
66
+ --width-padding: 16px;
67
+ --width-padding-calc: calc(var(--width-padding) * 2);
68
+
69
+ position: relative;
70
+ background-color: transparent;
71
+ border: none;
72
+ cursor: pointer;
73
+ padding: 0 var(--width-padding);
74
+ margin: 0;
75
+ transition: 100ms cubic-bezier(0, 0, 0.42, 1);
76
+ text-transform: ${({ tabType }) => {
77
+ if (tabType === TAB_TYPES.SECONDARY) return "capitalize";
78
+ return "uppercase";
79
+ }};
80
+ width: fit-content;
81
+ display: flex;
82
+ gap: ${({ notificationBadge }) => notificationBadge ? "2px" : "8px"};
83
+ white-space: nowrap;
84
+ color: ${({ theme }) => theme.colors.neutral[700]};
85
+ ${({ tabType }) => tabType === TAB_TYPES.PRIMARY ? `min-height: 32px;` : `min-height: 22px;`}
86
+
87
+ &[aria-disabled='true'] {
88
+ color: ${({ theme }) => theme.colors.neutral[500]};
89
+ cursor: not-allowed;
90
+ }
91
+
92
+ &:hover:not(disabled) {
93
+ color: ${({ theme }) => theme.colors.brand[600]};
94
+ }
95
+
96
+ &:focus {
97
+ outline: none;
98
+ ${borderAroundFocus}
99
+ ${({ isActive, tabType }) => tabType !== TAB_TYPES.SECONDARY && isActive ? borderAroundFocusUnderline : ``}
100
+ }
101
+ `;
102
+ const StyledNotificationBadge = styled("span", {
103
+ name: DSTabButtonName,
104
+ slot: TAB_BUTTON_SLOTS.REQUIRED_MARK
105
+ })`
106
+ width: 0.46rem;
107
+ height: 0.46rem;
108
+ background-color: ${({ theme }) => theme.colors.danger[900]};
109
+ border-radius: 50%;
110
+ display: inline-block;
111
+ position: absolute;
112
+ top: 0;
113
+ right: 0;
114
+ `;
115
+ const StyledTabButton = styled("button", {
116
+ name: DSTabButtonName,
117
+ slot: TAB_BUTTON_SLOTS.ROOT
118
+ })`
119
+ ${baseButtonStyles}
120
+ `;
121
+ const StyledTypography = styled(DSTypography, {
122
+ name: DSTabButtonName,
123
+ slot: TAB_BUTTON_SLOTS.LABEL
124
+ })`
125
+ padding: var(--height-padding) 0;
126
+ position: relative;
127
+ z-index: 4;
128
+ white-space: nowrap;
129
+ ${({ $isSelected, $tabType }) => $isSelected && $tabType !== TAB_TYPES.SECONDARY && unlineLabelSelected}
130
+ ${({ $isSelected }) => $isSelected && `font-weight: 600;`}
131
+ ${({ $isDisabled, theme }) => $isDisabled && `color: ${theme.colors.neutral[600]};`}
132
+ `;
133
+ const StyledChildrenWrapper = styled("span", {
134
+ name: DSTabButtonName,
135
+ slot: TAB_BUTTON_SLOTS.CHILDREN_WRAPPER
136
+ })`
137
+ margin: var(--height-padding) 0;
138
+ position: relative;
139
+ `;
140
+ const ScreenReaderOnly = styled.span`
141
+ clip: rect(0 0 0 0);
142
+ clip-path: inset(50%);
143
+ height: 1px;
144
+ overflow: hidden;
145
+ position: absolute;
146
+ white-space: nowrap;
147
+ width: 1px;
148
+ `;
149
+ export {
150
+ ScreenReaderOnly,
151
+ StyledChildrenWrapper,
152
+ StyledNotificationBadge,
153
+ StyledTabButton,
154
+ StyledTypography
155
+ };
156
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\n\nimport { DSTypography, type DSTypographyT } from '@elliemae/ds-typography';\nimport { DSTabButtonName, TAB_BUTTON_SLOTS, TAB_TYPES } from './constants/index.js';\nimport type { DSTabButtonT } from './react-desc-prop-types.js';\n\ninterface StyledTabButtonPropsT {\n isActive?: boolean;\n disabled?: boolean;\n tabType: DSTabButtonT.TabButtonVariant;\n notificationBadge?: boolean;\n}\n\ninterface StyledTypographyPropsT extends DSTypographyT.Props {\n $isSelected?: boolean;\n $isDisabled?: boolean;\n $tabType: DSTabButtonT.TabButtonVariant;\n}\n\nconst borderAroundFocus = css<StyledTabButtonPropsT>`\n &:after {\n pointer-events: none;\n display: block;\n position: absolute;\n content: '';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 3;\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n`;\n\nconst borderAroundFocusUnderline = css<StyledTabButtonPropsT>`\n &:before {\n position: absolute;\n content: '';\n left: -16px;\n right: 0;\n top: calc(100% - 2px);\n transform: none;\n width: calc(100% + 32px);\n height: 2px;\n z-index: 10;\n background: linear-gradient(\n to right,\n transparent 0px,\n transparent 12px,\n white 12px,\n white 16px,\n transparent 16px,\n transparent calc(100% - 16px),\n white calc(100% - 16px),\n white calc(100% - 12px),\n transparent calc(100% - 12px),\n transparent 100%\n );\n }\n`;\n\nconst unlineLabelSelected = css<StyledTypographyPropsT>`\n &:before {\n pointer-events: none;\n display: block;\n content: '';\n position: absolute;\n height: 3px;\n width: calc(100% + var(--border-width) * 2);\n left: calc(var(--border-width) * -1);\n bottom: 0;\n top: initial;\n z-index: 6;\n background: ${({ theme }) => theme.colors.brand[700]};\n border-left: var(--border-width) solid ${({ theme }) => theme.colors.neutral['000']};\n border-right: var(--border-width) solid ${({ theme }) => theme.colors.neutral['000']};\n }\n`;\n\nconst baseButtonStyles = css<StyledTabButtonPropsT>`\n --border-width: 2px;\n --height-padding: ${({ tabType }) =>\n tabType === TAB_TYPES.PRIMARY_SMALL || tabType === TAB_TYPES.SECONDARY ? '2px' : '7px'};\n --width-padding: 16px;\n --width-padding-calc: calc(var(--width-padding) * 2);\n\n position: relative;\n background-color: transparent;\n border: none;\n cursor: pointer;\n padding: 0 var(--width-padding);\n margin: 0;\n transition: 100ms cubic-bezier(0, 0, 0.42, 1);\n text-transform: ${({ tabType }) => {\n if (tabType === TAB_TYPES.SECONDARY) return 'capitalize';\n return 'uppercase';\n }};\n width: fit-content;\n display: flex;\n gap: ${({ notificationBadge }) => (notificationBadge ? '2px' : '8px')};\n white-space: nowrap;\n color: ${({ theme }) => theme.colors.neutral[700]};\n ${({ tabType }) => (tabType === TAB_TYPES.PRIMARY ? `min-height: 32px;` : `min-height: 22px;`)}\n\n &[aria-disabled='true'] {\n color: ${({ theme }) => theme.colors.neutral[500]};\n cursor: not-allowed;\n }\n\n &:hover:not(disabled) {\n color: ${({ theme }) => theme.colors.brand[600]};\n }\n\n &:focus {\n outline: none;\n ${borderAroundFocus}\n ${({ isActive, tabType }) => (tabType !== TAB_TYPES.SECONDARY && isActive ? borderAroundFocusUnderline : ``)}\n }\n`;\n\nexport const StyledNotificationBadge = styled('span', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.REQUIRED_MARK,\n})`\n width: 0.46rem;\n height: 0.46rem;\n background-color: ${({ theme }) => theme.colors.danger[900]};\n border-radius: 50%;\n display: inline-block;\n position: absolute;\n top: 0;\n right: 0;\n`;\n\nexport const StyledTabButton = styled('button', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.ROOT,\n})<StyledTabButtonPropsT>`\n ${baseButtonStyles}\n`;\n\nexport const StyledTypography = styled(DSTypography, {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.LABEL,\n})<StyledTypographyPropsT>`\n padding: var(--height-padding) 0;\n position: relative;\n z-index: 4;\n white-space: nowrap;\n ${({ $isSelected, $tabType }) => $isSelected && $tabType !== TAB_TYPES.SECONDARY && unlineLabelSelected}\n ${({ $isSelected }) => $isSelected && `font-weight: 600;`}\n ${({ $isDisabled, theme }) => $isDisabled && `color: ${theme.colors.neutral[600]};`}\n`;\n\nexport const StyledChildrenWrapper = styled('span', {\n name: DSTabButtonName,\n slot: TAB_BUTTON_SLOTS.CHILDREN_WRAPPER,\n})`\n margin: var(--height-padding) 0;\n position: relative;\n`;\n\nexport const ScreenReaderOnly = styled.span`\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAE5B,SAAS,oBAAwC;AACjD,SAAS,iBAAiB,kBAAkB,iBAAiB;AAgB7D,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAYF,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAI9D,MAAM,6BAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BnC,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAYV,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,6CACX,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,8CACzC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAIxF,MAAM,mBAAmB;AAAA;AAAA,sBAEH,CAAC,EAAE,QAAQ,MAC7B,YAAY,UAAU,iBAAiB,YAAY,UAAU,YAAY,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAWtE,CAAC,EAAE,QAAQ,MAAM;AACj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