@tonyarbor/components 0.4.0 → 0.7.0
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/Button.d.mts +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +56 -0
- package/dist/Button.js.map +1 -1
- package/dist/Button.mjs +1 -1
- package/dist/ButtonSegmented.d.mts +61 -0
- package/dist/ButtonSegmented.d.ts +61 -0
- package/dist/ButtonSegmented.js +167 -0
- package/dist/ButtonSegmented.js.map +1 -0
- package/dist/ButtonSegmented.mjs +7 -0
- package/dist/ButtonSegmented.mjs.map +1 -0
- package/dist/ListRow.d.mts +72 -0
- package/dist/ListRow.d.ts +72 -0
- package/dist/ListRow.js +194 -0
- package/dist/ListRow.js.map +1 -0
- package/dist/ListRow.mjs +7 -0
- package/dist/ListRow.mjs.map +1 -0
- package/dist/ListRowMultiLine.d.mts +56 -0
- package/dist/ListRowMultiLine.d.ts +56 -0
- package/dist/ListRowMultiLine.js +182 -0
- package/dist/ListRowMultiLine.js.map +1 -0
- package/dist/ListRowMultiLine.mjs +7 -0
- package/dist/ListRowMultiLine.mjs.map +1 -0
- package/dist/Logo.d.mts +39 -0
- package/dist/Logo.d.ts +39 -0
- package/dist/Logo.js +119 -0
- package/dist/Logo.js.map +1 -0
- package/dist/Logo.mjs +7 -0
- package/dist/Logo.mjs.map +1 -0
- package/dist/Modal.d.mts +73 -0
- package/dist/Modal.d.ts +73 -0
- package/dist/Modal.js +114 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.mjs +9 -0
- package/dist/Modal.mjs.map +1 -0
- package/dist/ModalFooter.d.mts +40 -0
- package/dist/ModalFooter.d.ts +40 -0
- package/dist/ModalFooter.js +73 -0
- package/dist/ModalFooter.js.map +1 -0
- package/dist/ModalFooter.mjs +7 -0
- package/dist/ModalFooter.mjs.map +1 -0
- package/dist/ModalHeader.d.mts +65 -0
- package/dist/ModalHeader.d.ts +65 -0
- package/dist/ModalHeader.js +257 -0
- package/dist/ModalHeader.js.map +1 -0
- package/dist/ModalHeader.mjs +8 -0
- package/dist/ModalHeader.mjs.map +1 -0
- package/dist/Section.d.mts +57 -0
- package/dist/Section.d.ts +57 -0
- package/dist/Section.js +72 -0
- package/dist/Section.js.map +1 -0
- package/dist/Section.mjs +7 -0
- package/dist/Section.mjs.map +1 -0
- package/dist/SectionHeading.d.mts +111 -0
- package/dist/SectionHeading.d.ts +111 -0
- package/dist/SectionHeading.js +385 -0
- package/dist/SectionHeading.js.map +1 -0
- package/dist/SectionHeading.mjs +8 -0
- package/dist/SectionHeading.mjs.map +1 -0
- package/dist/SectionHeadingInteractive.d.mts +67 -0
- package/dist/SectionHeadingInteractive.d.ts +67 -0
- package/dist/SectionHeadingInteractive.js +225 -0
- package/dist/SectionHeadingInteractive.js.map +1 -0
- package/dist/SectionHeadingInteractive.mjs +7 -0
- package/dist/SectionHeadingInteractive.mjs.map +1 -0
- package/dist/SectionIcon.d.mts +35 -0
- package/dist/SectionIcon.d.ts +35 -0
- package/dist/SectionIcon.js +142 -0
- package/dist/SectionIcon.js.map +1 -0
- package/dist/SectionIcon.mjs +7 -0
- package/dist/SectionIcon.mjs.map +1 -0
- package/dist/SubSectionHeading.d.mts +75 -0
- package/dist/SubSectionHeading.d.ts +75 -0
- package/dist/SubSectionHeading.js +225 -0
- package/dist/SubSectionHeading.js.map +1 -0
- package/dist/SubSectionHeading.mjs +7 -0
- package/dist/SubSectionHeading.mjs.map +1 -0
- package/dist/SubSectionInteractive.d.mts +65 -0
- package/dist/SubSectionInteractive.d.ts +65 -0
- package/dist/SubSectionInteractive.js +211 -0
- package/dist/SubSectionInteractive.js.map +1 -0
- package/dist/SubSectionInteractive.mjs +7 -0
- package/dist/SubSectionInteractive.mjs.map +1 -0
- package/dist/chunk-7JWINM2N.mjs +77 -0
- package/dist/chunk-7JWINM2N.mjs.map +1 -0
- package/dist/chunk-7NYBJKJS.mjs +106 -0
- package/dist/chunk-7NYBJKJS.mjs.map +1 -0
- package/dist/chunk-ALLCJATI.mjs +189 -0
- package/dist/chunk-ALLCJATI.mjs.map +1 -0
- package/dist/chunk-F6JVEIWC.mjs +158 -0
- package/dist/chunk-F6JVEIWC.mjs.map +1 -0
- package/dist/chunk-GHATS25Y.mjs +249 -0
- package/dist/chunk-GHATS25Y.mjs.map +1 -0
- package/dist/chunk-GIQDPHZQ.mjs +121 -0
- package/dist/chunk-GIQDPHZQ.mjs.map +1 -0
- package/dist/chunk-ILLGBZ6R.mjs +131 -0
- package/dist/chunk-ILLGBZ6R.mjs.map +1 -0
- package/dist/chunk-NNYU4DPD.mjs +83 -0
- package/dist/chunk-NNYU4DPD.mjs.map +1 -0
- package/dist/{chunk-ALEJXAZY.mjs → chunk-NOUFR6W2.mjs} +57 -1
- package/dist/chunk-NOUFR6W2.mjs.map +1 -0
- package/dist/chunk-ODKT7LGV.mjs +146 -0
- package/dist/chunk-ODKT7LGV.mjs.map +1 -0
- package/dist/chunk-P7RKUESQ.mjs +37 -0
- package/dist/chunk-P7RKUESQ.mjs.map +1 -0
- package/dist/chunk-RL4G7MR3.mjs +189 -0
- package/dist/chunk-RL4G7MR3.mjs.map +1 -0
- package/dist/chunk-X2CW5GF3.mjs +175 -0
- package/dist/chunk-X2CW5GF3.mjs.map +1 -0
- package/dist/chunk-YJ36ZZJQ.mjs +36 -0
- package/dist/chunk-YJ36ZZJQ.mjs.map +1 -0
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1722 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -1
- package/package.json +66 -1
- package/dist/chunk-ALEJXAZY.mjs.map +0 -1
package/dist/Button.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'destructive' | 'destructive-secondary' | 'ghost';
|
|
4
4
|
type ButtonSize = 'small' | 'medium';
|
|
5
5
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
6
|
/**
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'destructive' | 'destructive-secondary' | 'ghost';
|
|
4
4
|
type ButtonSize = 'small' | 'medium';
|
|
5
5
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
6
|
/**
|
package/dist/Button.js
CHANGED
|
@@ -102,6 +102,32 @@ var buttonStyles = {
|
|
|
102
102
|
cursor: "not-allowed"
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
+
tertiary: {
|
|
106
|
+
backgroundColor: "#efefef",
|
|
107
|
+
// grey-100
|
|
108
|
+
color: "#2f2f2f",
|
|
109
|
+
// grey-900
|
|
110
|
+
":hover": {
|
|
111
|
+
backgroundColor: "#dfdfdf"
|
|
112
|
+
// grey-200
|
|
113
|
+
},
|
|
114
|
+
":active": {
|
|
115
|
+
backgroundColor: "#d1d1d1"
|
|
116
|
+
// grey-300
|
|
117
|
+
},
|
|
118
|
+
":focus-visible": {
|
|
119
|
+
outline: "3px solid #3cad51",
|
|
120
|
+
// brand-500
|
|
121
|
+
outlineOffset: "0px"
|
|
122
|
+
},
|
|
123
|
+
":disabled": {
|
|
124
|
+
backgroundColor: "#f8f8f8",
|
|
125
|
+
// grey-050
|
|
126
|
+
color: "#b3b3b3",
|
|
127
|
+
// grey-400
|
|
128
|
+
cursor: "not-allowed"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
105
131
|
destructive: {
|
|
106
132
|
backgroundColor: "#c93232",
|
|
107
133
|
// destructive-500
|
|
@@ -124,6 +150,36 @@ var buttonStyles = {
|
|
|
124
150
|
cursor: "not-allowed"
|
|
125
151
|
}
|
|
126
152
|
},
|
|
153
|
+
"destructive-secondary": {
|
|
154
|
+
backgroundColor: "#ffffff",
|
|
155
|
+
color: "#a62323",
|
|
156
|
+
// destructive-600
|
|
157
|
+
border: "1px solid #c93232",
|
|
158
|
+
// destructive-500
|
|
159
|
+
":hover": {
|
|
160
|
+
backgroundColor: "#a62323",
|
|
161
|
+
// destructive-600
|
|
162
|
+
color: "#ffffff",
|
|
163
|
+
border: "1px solid #a62323"
|
|
164
|
+
},
|
|
165
|
+
":active": {
|
|
166
|
+
backgroundColor: "#920a0a",
|
|
167
|
+
// destructive-700
|
|
168
|
+
color: "#ffffff",
|
|
169
|
+
border: "1px solid #920a0a"
|
|
170
|
+
},
|
|
171
|
+
":focus-visible": {
|
|
172
|
+
outline: "3px solid #3cad51",
|
|
173
|
+
// brand-500 (green focus ring)
|
|
174
|
+
outlineOffset: "0px"
|
|
175
|
+
},
|
|
176
|
+
":disabled": {
|
|
177
|
+
backgroundColor: "#ffffff",
|
|
178
|
+
color: "#b3b3b3",
|
|
179
|
+
border: "1px solid #d1d1d1",
|
|
180
|
+
cursor: "not-allowed"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
127
183
|
ghost: {
|
|
128
184
|
backgroundColor: "transparent",
|
|
129
185
|
color: "#0b800b",
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Button/index.ts","../src/Button/Button.tsx"],"sourcesContent":["export { Button } from './Button';\nexport type { ButtonProps } from './Button';\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { clsx } from 'clsx';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'destructive' | 'ghost';\nexport type ButtonSize = 'small' | 'medium';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The visual style variant of the button\n * @default 'primary'\n */\n variant?: ButtonVariant;\n /**\n * The size of the button\n * @default 'medium'\n */\n size?: ButtonSize;\n /**\n * If true, the component will be rendered as a child element\n * and merge its props with the child\n */\n asChild?: boolean;\n /**\n * The content of the button\n */\n children: React.ReactNode;\n}\n\n// Arbor Design System button styles\nconst buttonStyles = {\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontWeight: '500',\n borderRadius: '99px', // Pill shape\n border: 'none',\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n outline: 'none',\n },\n variants: {\n primary: {\n backgroundColor: '#0e8a0e', // brand-600\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#005700', // brand-800\n },\n ':active': {\n backgroundColor: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3', // grey-400\n cursor: 'not-allowed',\n },\n },\n secondary: {\n backgroundColor: '#ffffff',\n color: '#2f2f2f', // grey-900\n border: '1px solid #d1d1d1', // grey-300\n ':hover': {\n backgroundColor: '#f8f8f8', // grey-050\n },\n ':active': {\n backgroundColor: '#efefef', // grey-100\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#f8f8f8',\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n destructive: {\n backgroundColor: '#c93232', // destructive-500\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#920a0a', // destructive-700\n },\n ':active': {\n backgroundColor: '#610202', // destructive-800\n },\n ':focus-visible': {\n outline: '3px solid #e86565', // destructive-300\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n ghost: {\n backgroundColor: 'transparent',\n color: '#0b800b', // brand-700 for link style\n textDecoration: 'underline',\n ':hover': {\n color: '#005700', // brand-800\n },\n ':active': {\n color: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51',\n outlineOffset: '2px',\n },\n ':disabled': {\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n },\n sizes: {\n small: {\n height: '32px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n medium: {\n height: '36px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n },\n};\n\n/**\n * Button component - Arbor Design System\n *\n * A flexible button component with pill-shaped design following Arbor's design system.\n * Supports primary (green), secondary (outlined), destructive (red), and ghost (link-style) variants.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"medium\">\n * Save Changes\n * </Button>\n * ```\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = 'primary',\n size = 'medium',\n asChild = false,\n className,\n disabled,\n style,\n children,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : 'button';\n const [isHovered, setIsHovered] = React.useState(false);\n const [isFocused, setIsFocused] = React.useState(false);\n\n const variantStyles = buttonStyles.variants[variant];\n const sizeStyles = buttonStyles.sizes[size];\n\n const combinedStyle: React.CSSProperties = {\n ...buttonStyles.base,\n ...variantStyles,\n ...sizeStyles,\n ...(isHovered && !disabled && variantStyles[':hover']),\n ...(isFocused && !disabled && variantStyles[':focus-visible']),\n ...(disabled && variantStyles[':disabled']),\n ...style,\n };\n\n const handleMouseEnter = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(true);\n onMouseEnter?.(e);\n };\n\n const handleMouseLeave = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(false);\n onMouseLeave?.(e);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n };\n\n return (\n <Comp\n ref={ref}\n className={clsx('arbor-button', className)}\n style={combinedStyle}\n disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,wBAAqB;AACrB,kBAAqB;AAyMf;AA7KN,IAAM,eAAe;AAAA,EACnB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,MACP,iBAAiB;AAAA;AAAA,MACjB,OAAO;AAAA,MACP,UAAU;AAAA,QACR,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,WAAW;AAAA,QACT,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,QAChB,SAAS;AAAA;AAAA,QACT,eAAe;AAAA,MACjB;AAAA,MACA,aAAa;AAAA,QACX,iBAAiB;AAAA;AAAA,QACjB,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB;AAAA,MACjB,OAAO;AAAA;AAAA,MACP,QAAQ;AAAA;AAAA,MACR,UAAU;AAAA,QACR,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,WAAW;AAAA,QACT,iBAAiB;AAAA;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,QAChB,SAAS;AAAA;AAAA,QACT,eAAe;AAAA,MACjB;AAAA,MACA,aAAa;AAAA,QACX,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,IACF;AAAA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,aAAa,MAAM,IAAI;AAE1C,UAAM,gBAAqC;AAAA,MACzC,GAAG,aAAa;AAAA,MAChB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,aAAa,CAAC,YAAY,cAAc,QAAQ;AAAA,MACpD,GAAI,aAAa,CAAC,YAAY,cAAc,gBAAgB;AAAA,MAC5D,GAAI,YAAY,cAAc,WAAW;AAAA,MACzC,GAAG;AAAA,IACL;AAEA,UAAM,mBAAmB,CAAC,MAA2C;AACnE,mBAAa,IAAI;AACjB,qBAAe,CAAC;AAAA,IAClB;AAEA,UAAM,mBAAmB,CAAC,MAA2C;AACnE,mBAAa,KAAK;AAClB,qBAAe,CAAC;AAAA,IAClB;AAEA,UAAM,cAAc,CAAC,MAA2C;AAC9D,mBAAa,IAAI;AACjB,gBAAU,CAAC;AAAA,IACb;AAEA,UAAM,aAAa,CAAC,MAA2C;AAC7D,mBAAa,KAAK;AAClB,eAAS,CAAC;AAAA,IACZ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAK,gBAAgB,SAAS;AAAA,QACzC,OAAO;AAAA,QACP;AAAA,QACA,cAAc;AAAA,QACd,cAAc;AAAA,QACd,SAAS;AAAA,QACT,QAAQ;AAAA,QACP,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/Button/index.ts","../src/Button/Button.tsx"],"sourcesContent":["export { Button } from './Button';\nexport type { ButtonProps } from './Button';\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { clsx } from 'clsx';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'destructive' | 'destructive-secondary' | 'ghost';\nexport type ButtonSize = 'small' | 'medium';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The visual style variant of the button\n * @default 'primary'\n */\n variant?: ButtonVariant;\n /**\n * The size of the button\n * @default 'medium'\n */\n size?: ButtonSize;\n /**\n * If true, the component will be rendered as a child element\n * and merge its props with the child\n */\n asChild?: boolean;\n /**\n * The content of the button\n */\n children: React.ReactNode;\n}\n\n// Arbor Design System button styles\nconst buttonStyles = {\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontWeight: '500',\n borderRadius: '99px', // Pill shape\n border: 'none',\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n outline: 'none',\n },\n variants: {\n primary: {\n backgroundColor: '#0e8a0e', // brand-600\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#005700', // brand-800\n },\n ':active': {\n backgroundColor: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3', // grey-400\n cursor: 'not-allowed',\n },\n },\n secondary: {\n backgroundColor: '#ffffff',\n color: '#2f2f2f', // grey-900\n border: '1px solid #d1d1d1', // grey-300\n ':hover': {\n backgroundColor: '#f8f8f8', // grey-050\n },\n ':active': {\n backgroundColor: '#efefef', // grey-100\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#f8f8f8',\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n tertiary: {\n backgroundColor: '#efefef', // grey-100\n color: '#2f2f2f', // grey-900\n ':hover': {\n backgroundColor: '#dfdfdf', // grey-200\n },\n ':active': {\n backgroundColor: '#d1d1d1', // grey-300\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#f8f8f8', // grey-050\n color: '#b3b3b3', // grey-400\n cursor: 'not-allowed',\n },\n },\n destructive: {\n backgroundColor: '#c93232', // destructive-500\n color: '#ffffff',\n ':hover': {\n backgroundColor: '#920a0a', // destructive-700\n },\n ':active': {\n backgroundColor: '#610202', // destructive-800\n },\n ':focus-visible': {\n outline: '3px solid #e86565', // destructive-300\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n 'destructive-secondary': {\n backgroundColor: '#ffffff',\n color: '#a62323', // destructive-600\n border: '1px solid #c93232', // destructive-500\n ':hover': {\n backgroundColor: '#a62323', // destructive-600\n color: '#ffffff',\n border: '1px solid #a62323',\n },\n ':active': {\n backgroundColor: '#920a0a', // destructive-700\n color: '#ffffff',\n border: '1px solid #920a0a',\n },\n ':focus-visible': {\n outline: '3px solid #3cad51', // brand-500 (green focus ring)\n outlineOffset: '0px',\n },\n ':disabled': {\n backgroundColor: '#ffffff',\n color: '#b3b3b3',\n border: '1px solid #d1d1d1',\n cursor: 'not-allowed',\n },\n },\n ghost: {\n backgroundColor: 'transparent',\n color: '#0b800b', // brand-700 for link style\n textDecoration: 'underline',\n ':hover': {\n color: '#005700', // brand-800\n },\n ':active': {\n color: '#024002', // brand-900\n },\n ':focus-visible': {\n outline: '3px solid #3cad51',\n outlineOffset: '2px',\n },\n ':disabled': {\n color: '#b3b3b3',\n cursor: 'not-allowed',\n },\n },\n },\n sizes: {\n small: {\n height: '32px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n medium: {\n height: '36px',\n fontSize: '13px',\n padding: '8px 16px',\n },\n },\n};\n\n/**\n * Button component - Arbor Design System\n *\n * A flexible button component with pill-shaped design following Arbor's design system.\n * Supports primary (green), secondary (outlined), destructive (red), and ghost (link-style) variants.\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" size=\"medium\">\n * Save Changes\n * </Button>\n * ```\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = 'primary',\n size = 'medium',\n asChild = false,\n className,\n disabled,\n style,\n children,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : 'button';\n const [isHovered, setIsHovered] = React.useState(false);\n const [isFocused, setIsFocused] = React.useState(false);\n\n const variantStyles = buttonStyles.variants[variant];\n const sizeStyles = buttonStyles.sizes[size];\n\n const combinedStyle: React.CSSProperties = {\n ...buttonStyles.base,\n ...variantStyles,\n ...sizeStyles,\n ...(isHovered && !disabled && variantStyles[':hover']),\n ...(isFocused && !disabled && variantStyles[':focus-visible']),\n ...(disabled && variantStyles[':disabled']),\n ...style,\n };\n\n const handleMouseEnter = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(true);\n onMouseEnter?.(e);\n };\n\n const handleMouseLeave = (e: React.MouseEvent<HTMLButtonElement>) => {\n setIsHovered(false);\n onMouseLeave?.(e);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(true);\n onFocus?.(e);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {\n setIsFocused(false);\n onBlur?.(e);\n };\n\n return (\n <Comp\n ref={ref}\n className={clsx('arbor-button', className)}\n style={combinedStyle}\n disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,wBAAqB;AACrB,kBAAqB;AAqPf;AAzNN,IAAM,eAAe;AAAA,EACnB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,MACP,i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
* The label text for the button
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional icon to display before the label
|
|
10
|
+
*/
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Optional value identifier for the button
|
|
14
|
+
*/
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ButtonSegmentedProps {
|
|
18
|
+
/**
|
|
19
|
+
* Array of button items (minimum 2, maximum 4)
|
|
20
|
+
*/
|
|
21
|
+
items: ButtonSegmentedItem[];
|
|
22
|
+
/**
|
|
23
|
+
* The index of the currently active button
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
activeIndex?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when a button is clicked
|
|
29
|
+
*/
|
|
30
|
+
onChange?: (index: number, item: ButtonSegmentedItem) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Additional CSS class name
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional inline styles
|
|
37
|
+
*/
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* ButtonSegmented component - Arbor Design System
|
|
42
|
+
*
|
|
43
|
+
* A segmented button group where one button is always active.
|
|
44
|
+
* Supports 2-4 buttons with optional icons.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <ButtonSegmented
|
|
49
|
+
* items={[
|
|
50
|
+
* { label: 'Day' },
|
|
51
|
+
* { label: 'Week' },
|
|
52
|
+
* { label: 'Month' },
|
|
53
|
+
* ]}
|
|
54
|
+
* activeIndex={0}
|
|
55
|
+
* onChange={(index, item) => console.log(index, item)}
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const ButtonSegmented: React.ForwardRefExoticComponent<ButtonSegmentedProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
|
|
61
|
+
export { ButtonSegmented, type ButtonSegmentedItem, type ButtonSegmentedProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonSegmentedItem {
|
|
4
|
+
/**
|
|
5
|
+
* The label text for the button
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional icon to display before the label
|
|
10
|
+
*/
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Optional value identifier for the button
|
|
14
|
+
*/
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ButtonSegmentedProps {
|
|
18
|
+
/**
|
|
19
|
+
* Array of button items (minimum 2, maximum 4)
|
|
20
|
+
*/
|
|
21
|
+
items: ButtonSegmentedItem[];
|
|
22
|
+
/**
|
|
23
|
+
* The index of the currently active button
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
activeIndex?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when a button is clicked
|
|
29
|
+
*/
|
|
30
|
+
onChange?: (index: number, item: ButtonSegmentedItem) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Additional CSS class name
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional inline styles
|
|
37
|
+
*/
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* ButtonSegmented component - Arbor Design System
|
|
42
|
+
*
|
|
43
|
+
* A segmented button group where one button is always active.
|
|
44
|
+
* Supports 2-4 buttons with optional icons.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <ButtonSegmented
|
|
49
|
+
* items={[
|
|
50
|
+
* { label: 'Day' },
|
|
51
|
+
* { label: 'Week' },
|
|
52
|
+
* { label: 'Month' },
|
|
53
|
+
* ]}
|
|
54
|
+
* activeIndex={0}
|
|
55
|
+
* onChange={(index, item) => console.log(index, item)}
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const ButtonSegmented: React.ForwardRefExoticComponent<ButtonSegmentedProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
|
|
61
|
+
export { ButtonSegmented, type ButtonSegmentedItem, type ButtonSegmentedProps };
|
|
@@ -0,0 +1,167 @@
|
|
|
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 __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/ButtonSegmented/index.ts
|
|
31
|
+
var ButtonSegmented_exports = {};
|
|
32
|
+
__export(ButtonSegmented_exports, {
|
|
33
|
+
ButtonSegmented: () => ButtonSegmented
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(ButtonSegmented_exports);
|
|
36
|
+
|
|
37
|
+
// src/ButtonSegmented/ButtonSegmented.tsx
|
|
38
|
+
var React = __toESM(require("react"));
|
|
39
|
+
var import_clsx = require("clsx");
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var segmentedStyles = {
|
|
42
|
+
container: {
|
|
43
|
+
display: "inline-flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "8px",
|
|
46
|
+
padding: "8px",
|
|
47
|
+
backgroundColor: "#ffffff",
|
|
48
|
+
border: "1px solid #efefef",
|
|
49
|
+
borderRadius: "99px",
|
|
50
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
51
|
+
},
|
|
52
|
+
button: {
|
|
53
|
+
base: {
|
|
54
|
+
display: "inline-flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
gap: "8px",
|
|
58
|
+
padding: "8px 16px",
|
|
59
|
+
borderRadius: "99px",
|
|
60
|
+
border: "none",
|
|
61
|
+
cursor: "pointer",
|
|
62
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
63
|
+
fontSize: "13px",
|
|
64
|
+
fontWeight: "600",
|
|
65
|
+
lineHeight: "1.5",
|
|
66
|
+
transition: "all 0.15s ease-in-out",
|
|
67
|
+
outline: "none",
|
|
68
|
+
whiteSpace: "nowrap"
|
|
69
|
+
},
|
|
70
|
+
default: {
|
|
71
|
+
backgroundColor: "transparent",
|
|
72
|
+
color: "#595959"
|
|
73
|
+
},
|
|
74
|
+
hover: {
|
|
75
|
+
backgroundColor: "#f8f8f8",
|
|
76
|
+
color: "#2f2f2f"
|
|
77
|
+
},
|
|
78
|
+
active: {
|
|
79
|
+
backgroundColor: "#0e8a0e",
|
|
80
|
+
color: "#ffffff"
|
|
81
|
+
},
|
|
82
|
+
activeHover: {
|
|
83
|
+
backgroundColor: "#005700",
|
|
84
|
+
color: "#ffffff"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var ButtonSegmented = React.forwardRef(
|
|
89
|
+
({ items, activeIndex = 0, onChange, className, style, ...props }, ref) => {
|
|
90
|
+
const [hoveredIndex, setHoveredIndex] = React.useState(null);
|
|
91
|
+
const validItems = items.slice(0, 4);
|
|
92
|
+
if (validItems.length < 2) {
|
|
93
|
+
console.warn("ButtonSegmented requires at least 2 items");
|
|
94
|
+
}
|
|
95
|
+
const hasIcons = validItems.some((item) => item.icon);
|
|
96
|
+
const handleClick = (index) => {
|
|
97
|
+
if (index !== activeIndex && onChange) {
|
|
98
|
+
onChange(index, validItems[index]);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
ref,
|
|
105
|
+
className: (0, import_clsx.clsx)("arbor-button-segmented", className),
|
|
106
|
+
style: { ...segmentedStyles.container, ...style },
|
|
107
|
+
role: "group",
|
|
108
|
+
"aria-label": "Segmented button group",
|
|
109
|
+
...props,
|
|
110
|
+
children: validItems.map((item, index) => {
|
|
111
|
+
const isActive = index === activeIndex;
|
|
112
|
+
const isHovered = hoveredIndex === index;
|
|
113
|
+
let buttonStyle = {
|
|
114
|
+
...segmentedStyles.button.base
|
|
115
|
+
};
|
|
116
|
+
if (isActive) {
|
|
117
|
+
buttonStyle = {
|
|
118
|
+
...buttonStyle,
|
|
119
|
+
...segmentedStyles.button.active,
|
|
120
|
+
...isHovered && segmentedStyles.button.activeHover
|
|
121
|
+
};
|
|
122
|
+
} else {
|
|
123
|
+
buttonStyle = {
|
|
124
|
+
...buttonStyle,
|
|
125
|
+
...segmentedStyles.button.default,
|
|
126
|
+
...isHovered && segmentedStyles.button.hover
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "button",
|
|
133
|
+
style: buttonStyle,
|
|
134
|
+
onClick: () => handleClick(index),
|
|
135
|
+
onMouseEnter: () => setHoveredIndex(index),
|
|
136
|
+
onMouseLeave: () => setHoveredIndex(null),
|
|
137
|
+
"aria-pressed": isActive,
|
|
138
|
+
children: [
|
|
139
|
+
hasIcons && item.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
"span",
|
|
141
|
+
{
|
|
142
|
+
style: {
|
|
143
|
+
display: "flex",
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
width: "16px",
|
|
147
|
+
height: "16px"
|
|
148
|
+
},
|
|
149
|
+
children: item.icon
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
item.label
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
item.value || index
|
|
156
|
+
);
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
ButtonSegmented.displayName = "ButtonSegmented";
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
ButtonSegmented
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=ButtonSegmented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ButtonSegmented/index.ts","../src/ButtonSegmented/ButtonSegmented.tsx"],"sourcesContent":["export { ButtonSegmented } from './ButtonSegmented';\nexport type { ButtonSegmentedProps, ButtonSegmentedItem } from './ButtonSegmented';\n","import * as React from 'react';\nimport { clsx } from 'clsx';\n\nexport interface ButtonSegmentedItem {\n /**\n * The label text for the button\n */\n label: string;\n /**\n * Optional icon to display before the label\n */\n icon?: React.ReactNode;\n /**\n * Optional value identifier for the button\n */\n value?: string;\n}\n\nexport interface ButtonSegmentedProps {\n /**\n * Array of button items (minimum 2, maximum 4)\n */\n items: ButtonSegmentedItem[];\n /**\n * The index of the currently active button\n * @default 0\n */\n activeIndex?: number;\n /**\n * Callback when a button is clicked\n */\n onChange?: (index: number, item: ButtonSegmentedItem) => void;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\n// Arbor Design System segmented button styles\nconst segmentedStyles = {\n container: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: '8px',\n backgroundColor: '#ffffff',\n border: '1px solid #efefef',\n borderRadius: '99px',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n },\n button: {\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '8px',\n padding: '8px 16px',\n borderRadius: '99px',\n border: 'none',\n cursor: 'pointer',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontSize: '13px',\n fontWeight: '600',\n lineHeight: '1.5',\n transition: 'all 0.15s ease-in-out',\n outline: 'none',\n whiteSpace: 'nowrap' as const,\n },\n default: {\n backgroundColor: 'transparent',\n color: '#595959',\n },\n hover: {\n backgroundColor: '#f8f8f8',\n color: '#2f2f2f',\n },\n active: {\n backgroundColor: '#0e8a0e',\n color: '#ffffff',\n },\n activeHover: {\n backgroundColor: '#005700',\n color: '#ffffff',\n },\n },\n};\n\n/**\n * ButtonSegmented component - Arbor Design System\n *\n * A segmented button group where one button is always active.\n * Supports 2-4 buttons with optional icons.\n *\n * @example\n * ```tsx\n * <ButtonSegmented\n * items={[\n * { label: 'Day' },\n * { label: 'Week' },\n * { label: 'Month' },\n * ]}\n * activeIndex={0}\n * onChange={(index, item) => console.log(index, item)}\n * />\n * ```\n */\nexport const ButtonSegmented = React.forwardRef<HTMLDivElement, ButtonSegmentedProps>(\n ({ items, activeIndex = 0, onChange, className, style, ...props }, ref) => {\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n\n // Validate items count (2-4)\n const validItems = items.slice(0, 4);\n if (validItems.length < 2) {\n console.warn('ButtonSegmented requires at least 2 items');\n }\n\n // Check if any item has an icon - if so, all should have icons\n const hasIcons = validItems.some((item) => item.icon);\n\n const handleClick = (index: number) => {\n if (index !== activeIndex && onChange) {\n onChange(index, validItems[index]);\n }\n };\n\n return (\n <div\n ref={ref}\n className={clsx('arbor-button-segmented', className)}\n style={{ ...segmentedStyles.container, ...style }}\n role=\"group\"\n aria-label=\"Segmented button group\"\n {...props}\n >\n {validItems.map((item, index) => {\n const isActive = index === activeIndex;\n const isHovered = hoveredIndex === index;\n\n let buttonStyle: React.CSSProperties = {\n ...segmentedStyles.button.base,\n };\n\n if (isActive) {\n buttonStyle = {\n ...buttonStyle,\n ...segmentedStyles.button.active,\n ...(isHovered && segmentedStyles.button.activeHover),\n };\n } else {\n buttonStyle = {\n ...buttonStyle,\n ...segmentedStyles.button.default,\n ...(isHovered && segmentedStyles.button.hover),\n };\n }\n\n return (\n <button\n key={item.value || index}\n type=\"button\"\n style={buttonStyle}\n onClick={() => handleClick(index)}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n aria-pressed={isActive}\n >\n {hasIcons && item.icon && (\n <span\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n }}\n >\n {item.icon}\n </span>\n )}\n {item.label}\n </button>\n );\n })}\n </div>\n );\n }\n);\n\nButtonSegmented.displayName = 'ButtonSegmented';\n"],"mappings":";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AA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,gBAAgB,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ListRowProps {
|
|
4
|
+
/**
|
|
5
|
+
* The main value/content text (required)
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional label text displayed on the left
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional note text displayed on the right (italic)
|
|
14
|
+
*/
|
|
15
|
+
note?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Show the right arrow icon - enables hover state and indicates row is clickable
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
icon?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Click handler - typically used with icon prop for navigation
|
|
23
|
+
*/
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Additional CSS class name
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Additional inline styles
|
|
31
|
+
*/
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* ListRow component - Arbor Design System
|
|
36
|
+
*
|
|
37
|
+
* A flexible list row component for displaying content within sections.
|
|
38
|
+
* Supports optional label, note, and icon props.
|
|
39
|
+
* Hover state is only enabled when icon is present (indicating clickable row).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Basic row with just value
|
|
44
|
+
* <ListRow value="John Smith" />
|
|
45
|
+
*
|
|
46
|
+
* // With label
|
|
47
|
+
* <ListRow label="Name" value="John Smith" />
|
|
48
|
+
*
|
|
49
|
+
* // With label and note
|
|
50
|
+
* <ListRow label="Name" value="John Smith" note="Primary contact" />
|
|
51
|
+
*
|
|
52
|
+
* // Clickable row with icon
|
|
53
|
+
* <ListRow
|
|
54
|
+
* label="Name"
|
|
55
|
+
* value="John Smith"
|
|
56
|
+
* icon
|
|
57
|
+
* onClick={() => navigate('/user/123')}
|
|
58
|
+
* />
|
|
59
|
+
*
|
|
60
|
+
* // All props
|
|
61
|
+
* <ListRow
|
|
62
|
+
* label="Name"
|
|
63
|
+
* value="John Smith"
|
|
64
|
+
* note="View profile"
|
|
65
|
+
* icon
|
|
66
|
+
* onClick={() => navigate('/user/123')}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const ListRow: React.ForwardRefExoticComponent<ListRowProps & React.RefAttributes<HTMLDivElement>>;
|
|
71
|
+
|
|
72
|
+
export { ListRow, type ListRowProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ListRowProps {
|
|
4
|
+
/**
|
|
5
|
+
* The main value/content text (required)
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional label text displayed on the left
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional note text displayed on the right (italic)
|
|
14
|
+
*/
|
|
15
|
+
note?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Show the right arrow icon - enables hover state and indicates row is clickable
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
icon?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Click handler - typically used with icon prop for navigation
|
|
23
|
+
*/
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Additional CSS class name
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Additional inline styles
|
|
31
|
+
*/
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* ListRow component - Arbor Design System
|
|
36
|
+
*
|
|
37
|
+
* A flexible list row component for displaying content within sections.
|
|
38
|
+
* Supports optional label, note, and icon props.
|
|
39
|
+
* Hover state is only enabled when icon is present (indicating clickable row).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Basic row with just value
|
|
44
|
+
* <ListRow value="John Smith" />
|
|
45
|
+
*
|
|
46
|
+
* // With label
|
|
47
|
+
* <ListRow label="Name" value="John Smith" />
|
|
48
|
+
*
|
|
49
|
+
* // With label and note
|
|
50
|
+
* <ListRow label="Name" value="John Smith" note="Primary contact" />
|
|
51
|
+
*
|
|
52
|
+
* // Clickable row with icon
|
|
53
|
+
* <ListRow
|
|
54
|
+
* label="Name"
|
|
55
|
+
* value="John Smith"
|
|
56
|
+
* icon
|
|
57
|
+
* onClick={() => navigate('/user/123')}
|
|
58
|
+
* />
|
|
59
|
+
*
|
|
60
|
+
* // All props
|
|
61
|
+
* <ListRow
|
|
62
|
+
* label="Name"
|
|
63
|
+
* value="John Smith"
|
|
64
|
+
* note="View profile"
|
|
65
|
+
* icon
|
|
66
|
+
* onClick={() => navigate('/user/123')}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const ListRow: React.ForwardRefExoticComponent<ListRowProps & React.RefAttributes<HTMLDivElement>>;
|
|
71
|
+
|
|
72
|
+
export { ListRow, type ListRowProps };
|