@kushagradhawan/kookie-ui 0.1.5 → 0.1.7
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/components.css +100 -9
- package/dist/cjs/components/_internal/base-button.d.ts +2 -1
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +3 -3
- package/dist/cjs/components/checkbox-cards.js.map +1 -1
- package/dist/cjs/components/icon-button.d.ts +12 -1
- package/dist/cjs/components/icon-button.d.ts.map +1 -1
- package/dist/cjs/components/icon-button.js +1 -1
- package/dist/cjs/components/icon-button.js.map +2 -2
- package/dist/cjs/components/radio-cards.js.map +1 -1
- package/dist/cjs/components/toggle-icon-button.d.ts +21 -7
- package/dist/cjs/components/toggle-icon-button.d.ts.map +1 -1
- package/dist/cjs/components/toggle-icon-button.js +1 -1
- package/dist/cjs/components/toggle-icon-button.js.map +3 -3
- package/dist/esm/components/_internal/base-button.d.ts +2 -1
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/base-button.js.map +3 -3
- package/dist/esm/components/checkbox-cards.js.map +1 -1
- package/dist/esm/components/icon-button.d.ts +12 -1
- package/dist/esm/components/icon-button.d.ts.map +1 -1
- package/dist/esm/components/icon-button.js +1 -1
- package/dist/esm/components/icon-button.js.map +2 -2
- package/dist/esm/components/radio-cards.js.map +1 -1
- package/dist/esm/components/toggle-icon-button.d.ts +21 -7
- package/dist/esm/components/toggle-icon-button.d.ts.map +1 -1
- package/dist/esm/components/toggle-icon-button.js +1 -1
- package/dist/esm/components/toggle-icon-button.js.map +2 -2
- package/package.json +1 -1
- package/src/components/_internal/base-button.css +118 -9
- package/src/components/_internal/base-button.tsx +26 -4
- package/src/components/checkbox-cards.tsx +4 -4
- package/src/components/icon-button.tsx +33 -5
- package/src/components/radio-cards.tsx +3 -3
- package/src/components/toggle-icon-button.tsx +36 -20
- package/src/styles/tokens/base.css +1 -0
- package/src/styles/tokens/shadow.css +4 -4
- package/src/styles/tokens/transition.css +43 -0
- package/styles.css +133 -13
- package/tokens/base.css +33 -4
- package/tokens.css +33 -4
package/components.css
CHANGED
|
@@ -1773,13 +1773,18 @@
|
|
|
1773
1773
|
padding-left: min(var(--space-5), max(var(--space-3), 0.5em));
|
|
1774
1774
|
}
|
|
1775
1775
|
.rt-BaseButton {
|
|
1776
|
+
all: unset;
|
|
1777
|
+
box-sizing: border-box;
|
|
1776
1778
|
display: inline-flex;
|
|
1777
1779
|
align-items: center;
|
|
1778
1780
|
justify-content: center;
|
|
1779
1781
|
flex-shrink: 0;
|
|
1780
1782
|
-webkit-user-select: none;
|
|
1781
1783
|
user-select: none;
|
|
1782
|
-
|
|
1784
|
+
position: relative;
|
|
1785
|
+
cursor: default;
|
|
1786
|
+
gap: var(--base-button-gap);
|
|
1787
|
+
transition: var(--transition-button);
|
|
1783
1788
|
font-family: var(--default-font-family);
|
|
1784
1789
|
font-style: normal;
|
|
1785
1790
|
text-align: center;
|
|
@@ -1787,9 +1792,23 @@
|
|
|
1787
1792
|
}
|
|
1788
1793
|
.rt-BaseButton:where([data-disabled]) {
|
|
1789
1794
|
--spinner-opacity: 1;
|
|
1795
|
+
cursor: not-allowed;
|
|
1796
|
+
pointer-events: none;
|
|
1790
1797
|
}
|
|
1791
1798
|
.rt-BaseButton:where(.rt-loading) {
|
|
1792
1799
|
position: relative;
|
|
1800
|
+
cursor: wait;
|
|
1801
|
+
}
|
|
1802
|
+
.rt-BaseButton:where(:active:not([data-disabled], [data-state='open'])) {
|
|
1803
|
+
transform: scale(0.98);
|
|
1804
|
+
}
|
|
1805
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1806
|
+
.rt-BaseButton {
|
|
1807
|
+
transition: none;
|
|
1808
|
+
}
|
|
1809
|
+
.rt-BaseButton:where(:active:not([data-disabled], [data-state='open'])) {
|
|
1810
|
+
transform: none;
|
|
1811
|
+
}
|
|
1793
1812
|
}
|
|
1794
1813
|
.rt-BaseButton:where(.rt-full-width) {
|
|
1795
1814
|
display: flex;
|
|
@@ -1930,6 +1949,8 @@
|
|
|
1930
1949
|
--base-button-classic-hover-shadow: var(--shadow-3);
|
|
1931
1950
|
--base-button-classic-active-shadow: var(--shadow-2);
|
|
1932
1951
|
--base-button-classic-disabled-shadow: none;
|
|
1952
|
+
--base-button-classic-hover-filter: brightness(1.08) saturate(1.02) contrast(1.02);
|
|
1953
|
+
--base-button-classic-active-filter: brightness(0.88) saturate(1.05) contrast(1.1);
|
|
1933
1954
|
--base-button-solid-active-filter: brightness(0.92) saturate(1.1);
|
|
1934
1955
|
--base-button-solid-high-contrast-hover-filter: contrast(0.88) saturate(1.1) brightness(1.1);
|
|
1935
1956
|
--base-button-solid-high-contrast-active-filter: contrast(0.82) saturate(1.2) brightness(1.16);
|
|
@@ -1962,6 +1983,8 @@
|
|
|
1962
1983
|
--base-button-classic-hover-shadow: var(--shadow-3);
|
|
1963
1984
|
--base-button-classic-active-shadow: var(--shadow-2);
|
|
1964
1985
|
--base-button-classic-disabled-shadow: none;
|
|
1986
|
+
--base-button-classic-hover-filter: brightness(1.12) saturate(1.05) contrast(1.02);
|
|
1987
|
+
--base-button-classic-active-filter: brightness(0.92) saturate(1.1) contrast(1.05);
|
|
1965
1988
|
--base-button-solid-active-filter: brightness(1.08);
|
|
1966
1989
|
--base-button-solid-high-contrast-hover-filter: contrast(0.88) saturate(1.3) brightness(1.18);
|
|
1967
1990
|
--base-button-solid-high-contrast-active-filter: brightness(0.95) saturate(1.2);
|
|
@@ -2003,8 +2026,9 @@
|
|
|
2003
2026
|
}
|
|
2004
2027
|
@media (hover: hover) {
|
|
2005
2028
|
.rt-BaseButton:where(.rt-variant-classic):where(:hover) {
|
|
2006
|
-
background: linear-gradient(to bottom, var(--accent-
|
|
2029
|
+
background: linear-gradient(to bottom, var(--accent-9), var(--accent-10));
|
|
2007
2030
|
box-shadow: var(--base-button-classic-hover-shadow);
|
|
2031
|
+
filter: var(--base-button-classic-hover-filter);
|
|
2008
2032
|
}
|
|
2009
2033
|
.rt-BaseButton:where(.rt-variant-classic):where(:hover):where(.rt-high-contrast) {
|
|
2010
2034
|
background: linear-gradient(to bottom, var(--accent-11), var(--accent-12));
|
|
@@ -2015,8 +2039,9 @@
|
|
|
2015
2039
|
}
|
|
2016
2040
|
}
|
|
2017
2041
|
.rt-BaseButton:where(.rt-variant-classic):where([data-state='open']) {
|
|
2018
|
-
background: linear-gradient(to bottom, var(--accent-
|
|
2042
|
+
background: linear-gradient(to bottom, var(--accent-9), var(--accent-10));
|
|
2019
2043
|
box-shadow: var(--base-button-classic-hover-shadow);
|
|
2044
|
+
filter: var(--base-button-classic-hover-filter);
|
|
2020
2045
|
}
|
|
2021
2046
|
.rt-BaseButton:where(.rt-variant-classic):where([data-state='open']):where(.rt-high-contrast) {
|
|
2022
2047
|
background: linear-gradient(to bottom, var(--accent-11), var(--accent-12));
|
|
@@ -2026,11 +2051,12 @@
|
|
|
2026
2051
|
background: var(--accent-12);
|
|
2027
2052
|
}
|
|
2028
2053
|
.rt-BaseButton:where(.rt-variant-classic):where(:active:not([data-state='open'], [data-disabled])) {
|
|
2029
|
-
background: linear-gradient(to bottom, var(--accent-
|
|
2054
|
+
background: linear-gradient(to bottom, var(--accent-9), var(--accent-10));
|
|
2030
2055
|
box-shadow: var(--base-button-classic-active-shadow);
|
|
2056
|
+
filter: var(--base-button-classic-active-filter);
|
|
2031
2057
|
}
|
|
2032
2058
|
.rt-BaseButton:where(.rt-variant-classic):where(:active:not([data-state='open'], [data-disabled])):where(.rt-high-contrast) {
|
|
2033
|
-
background: linear-gradient(to bottom, var(--accent-
|
|
2059
|
+
background: linear-gradient(to bottom, var(--accent-11), var(--accent-12));
|
|
2034
2060
|
filter: contrast(0.82) saturate(1.2) brightness(1.16);
|
|
2035
2061
|
}
|
|
2036
2062
|
.rt-BaseButton:where(.rt-variant-classic):where(:active:not([data-state='open'], [data-disabled])):where(.rt-high-contrast):where(:not([data-accent-color='gray'])) {
|
|
@@ -2042,6 +2068,8 @@
|
|
|
2042
2068
|
box-shadow: var(--base-button-classic-disabled-shadow);
|
|
2043
2069
|
outline: none;
|
|
2044
2070
|
filter: none;
|
|
2071
|
+
cursor: not-allowed;
|
|
2072
|
+
pointer-events: none;
|
|
2045
2073
|
}
|
|
2046
2074
|
.rt-BaseButton:where(.rt-variant-solid) {
|
|
2047
2075
|
background-color: var(--accent-9);
|
|
@@ -2092,6 +2120,8 @@
|
|
|
2092
2120
|
background-color: var(--gray-a3);
|
|
2093
2121
|
outline: none;
|
|
2094
2122
|
filter: none;
|
|
2123
|
+
cursor: not-allowed;
|
|
2124
|
+
pointer-events: none;
|
|
2095
2125
|
}
|
|
2096
2126
|
.rt-BaseButton:where(.rt-variant-soft, .rt-variant-ghost) {
|
|
2097
2127
|
color: var(--accent-a11);
|
|
@@ -2102,6 +2132,8 @@
|
|
|
2102
2132
|
.rt-BaseButton:where(.rt-variant-soft, .rt-variant-ghost):where([data-disabled]) {
|
|
2103
2133
|
color: var(--gray-a8);
|
|
2104
2134
|
background-color: var(--gray-a3);
|
|
2135
|
+
cursor: not-allowed;
|
|
2136
|
+
pointer-events: none;
|
|
2105
2137
|
}
|
|
2106
2138
|
.rt-BaseButton:where(.rt-variant-soft) {
|
|
2107
2139
|
background-color: var(--accent-a3);
|
|
@@ -2124,6 +2156,8 @@
|
|
|
2124
2156
|
.rt-BaseButton:where(.rt-variant-soft):where([data-disabled]) {
|
|
2125
2157
|
color: var(--gray-a8);
|
|
2126
2158
|
background-color: var(--gray-a3);
|
|
2159
|
+
cursor: not-allowed;
|
|
2160
|
+
pointer-events: none;
|
|
2127
2161
|
}
|
|
2128
2162
|
@media (hover: hover) {
|
|
2129
2163
|
.rt-BaseButton:where(.rt-variant-ghost):where(:hover) {
|
|
@@ -2143,6 +2177,8 @@
|
|
|
2143
2177
|
.rt-BaseButton:where(.rt-variant-ghost):where([data-disabled]) {
|
|
2144
2178
|
color: var(--gray-a8);
|
|
2145
2179
|
background-color: transparent;
|
|
2180
|
+
cursor: not-allowed;
|
|
2181
|
+
pointer-events: none;
|
|
2146
2182
|
}
|
|
2147
2183
|
.rt-BaseButton:where(.rt-variant-outline) {
|
|
2148
2184
|
box-shadow: inset 0 0 0 1px var(--accent-a8);
|
|
@@ -2171,6 +2207,8 @@
|
|
|
2171
2207
|
color: var(--gray-a8);
|
|
2172
2208
|
box-shadow: inset 0 0 0 1px var(--gray-a7);
|
|
2173
2209
|
background-color: transparent;
|
|
2210
|
+
cursor: not-allowed;
|
|
2211
|
+
pointer-events: none;
|
|
2174
2212
|
}
|
|
2175
2213
|
.rt-BaseButton:where(.rt-variant-surface) {
|
|
2176
2214
|
background-color: var(--accent-surface);
|
|
@@ -2200,24 +2238,36 @@
|
|
|
2200
2238
|
color: var(--gray-a8);
|
|
2201
2239
|
box-shadow: inset 0 0 0 1px var(--gray-a6);
|
|
2202
2240
|
background-color: var(--gray-a2);
|
|
2241
|
+
cursor: not-allowed;
|
|
2242
|
+
pointer-events: none;
|
|
2243
|
+
}
|
|
2244
|
+
.rt-BaseButton:where([data-state='on']) {
|
|
2245
|
+
transform: scale(0.98);
|
|
2246
|
+
}
|
|
2247
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2248
|
+
.rt-BaseButton:where([data-state='on']) {
|
|
2249
|
+
transform: none;
|
|
2250
|
+
}
|
|
2203
2251
|
}
|
|
2204
2252
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-classic) {
|
|
2205
|
-
background: linear-gradient(to bottom, var(--accent-
|
|
2206
|
-
box-shadow: var(--base-button-classic-
|
|
2253
|
+
background: linear-gradient(to bottom, var(--accent-9), var(--accent-10));
|
|
2254
|
+
box-shadow: var(--base-button-classic-active-shadow);
|
|
2255
|
+
filter: var(--base-button-classic-active-filter);
|
|
2207
2256
|
}
|
|
2208
2257
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-classic):where(.rt-high-contrast) {
|
|
2209
2258
|
background: linear-gradient(to bottom, var(--accent-11), var(--accent-12));
|
|
2210
|
-
filter: contrast(0.
|
|
2259
|
+
filter: contrast(0.82) saturate(1.2) brightness(1.16);
|
|
2211
2260
|
}
|
|
2212
2261
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-classic):where(.rt-high-contrast):where(:not([data-accent-color='gray'])) {
|
|
2213
2262
|
background: var(--accent-12);
|
|
2214
2263
|
}
|
|
2215
2264
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-solid) {
|
|
2216
2265
|
background-color: var(--accent-10);
|
|
2266
|
+
filter: var(--base-button-solid-active-filter);
|
|
2217
2267
|
}
|
|
2218
2268
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-solid):where(.rt-high-contrast) {
|
|
2219
2269
|
background-color: var(--accent-12);
|
|
2220
|
-
filter: var(--base-button-solid-high-contrast-
|
|
2270
|
+
filter: var(--base-button-solid-high-contrast-active-filter);
|
|
2221
2271
|
}
|
|
2222
2272
|
.rt-BaseButton:where([data-state='on']):where(.rt-variant-soft) {
|
|
2223
2273
|
background-color: var(--accent-a5);
|
|
@@ -2232,6 +2282,47 @@
|
|
|
2232
2282
|
background-color: var(--accent-a3);
|
|
2233
2283
|
box-shadow: inset 0 0 0 1px var(--accent-a8);
|
|
2234
2284
|
}
|
|
2285
|
+
.rt-BaseButton:where([disabled][aria-pressed]) {
|
|
2286
|
+
transform: none;
|
|
2287
|
+
color: var(--gray-a8);
|
|
2288
|
+
background-color: var(--gray-a3);
|
|
2289
|
+
background: var(--gray-a3);
|
|
2290
|
+
box-shadow: none;
|
|
2291
|
+
filter: none;
|
|
2292
|
+
opacity: 0.6;
|
|
2293
|
+
cursor: not-allowed;
|
|
2294
|
+
pointer-events: none;
|
|
2295
|
+
}
|
|
2296
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where([data-state='on']) {
|
|
2297
|
+
transform: none;
|
|
2298
|
+
background: var(--gray-a3);
|
|
2299
|
+
background-color: var(--gray-a3);
|
|
2300
|
+
box-shadow: none;
|
|
2301
|
+
filter: none;
|
|
2302
|
+
}
|
|
2303
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-classic) {
|
|
2304
|
+
background: var(--gray-a3);
|
|
2305
|
+
box-shadow: none;
|
|
2306
|
+
filter: none;
|
|
2307
|
+
}
|
|
2308
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-solid) {
|
|
2309
|
+
background-color: var(--gray-a3);
|
|
2310
|
+
filter: none;
|
|
2311
|
+
}
|
|
2312
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-soft) {
|
|
2313
|
+
background-color: var(--gray-a3);
|
|
2314
|
+
}
|
|
2315
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-ghost) {
|
|
2316
|
+
background-color: var(--gray-a3);
|
|
2317
|
+
}
|
|
2318
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-outline) {
|
|
2319
|
+
background-color: var(--gray-a3);
|
|
2320
|
+
box-shadow: none;
|
|
2321
|
+
}
|
|
2322
|
+
.rt-BaseButton:where([disabled][aria-pressed]):where(.rt-variant-surface) {
|
|
2323
|
+
background-color: var(--gray-a3);
|
|
2324
|
+
box-shadow: none;
|
|
2325
|
+
}
|
|
2235
2326
|
.rt-Button:where(:not(.rt-variant-ghost)) :where(svg) {
|
|
2236
2327
|
opacity: 0.9;
|
|
2237
2328
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { baseButtonPropDefs } from './base-button.props.js';
|
|
3
3
|
import type { MarginProps } from '../../props/margin.props.js';
|
|
4
|
+
import type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';
|
|
4
5
|
import type { GetPropDefTypes } from '../../props/prop-def.js';
|
|
5
6
|
type BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;
|
|
6
7
|
type PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {
|
|
7
8
|
as?: C;
|
|
8
|
-
} & BaseButtonOwnProps & MarginProps &
|
|
9
|
+
} & BaseButtonOwnProps & MarginProps & ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;
|
|
9
10
|
interface BaseButtonProps extends PolymorphicBaseButtonProps {
|
|
10
11
|
}
|
|
11
12
|
declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,KAAK,0BAA0B,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACxE,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,kBAAkB,GACpB,WAAW,GACX,qBAAqB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,kBAAkB,GAAG,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;AAE/F,UAAU,eAAgB,SAAQ,0BAA0B;CAAG;AAE/D,QAAA,MAAM,UAAU,2FA8Ed,CAAC;AAGH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.create;var a=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var k=(e,o)=>{for(var s in o)a(e,s,{get:o[s],enumerable:!0})},f=(e,o,s,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of I(o))!O.call(e,n)&&n!==s&&a(e,n,{get:()=>o[n],enumerable:!(r=N(o,n))||r.enumerable});return e};var y=(e,o,s)=>(s=e!=null?E(M(e)):{},f(o||!e||!e.__esModule?a(s,"default",{value:e,enumerable:!0}):s,e)),F=e=>f(a({},"__esModule",{value:!0}),e);var G={};k(G,{BaseButton:()=>l});module.exports=F(G);var t=y(require("react")),P=y(require("classnames")),c=require("radix-ui"),d=require("./base-button.props.js"),b=require("../flex.js"),h=require("../spinner.js"),g=require("../visually-hidden.js"),C=require("../../helpers/extract-props.js"),i=require("../../helpers/map-prop-values.js"),x=require("../../props/margin.props.js");const l=t.forwardRef((e,o)=>{const{size:s=d.baseButtonPropDefs.size.default}=e,{className:r,children:n,asChild:m,as:p,color:w,radius:D,disabled:u=e.loading,...z}=(0,C.extractProps)(e,d.baseButtonPropDefs,x.marginPropDefs),S=m?c.Slot.Root:p||"button",T=m||!p||["button","input","textarea","select"].includes(p),j=t.useId(),B=e.loading?`${j}-loading`:void 0,v=e.loading?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":B}:{};return t.createElement(S,{"data-disabled":u||void 0,"data-accent-color":w,"data-radius":D,...z,...v,ref:o,className:(0,P.default)("rt-reset","rt-BaseButton",r),...T&&{disabled:u}},e.loading?t.createElement(t.Fragment,null,t.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},n),t.createElement(g.VisuallyHidden,null,t.createElement("span",{id:B},"Loading, please wait..."),n),t.createElement(b.Flex,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},t.createElement("span",null,t.createElement(h.Spinner,{size:(0,i.mapResponsiveProp)(s,i.mapButtonSizeToSpinnerSize),"aria-hidden":"true"})))):n)});l.displayName="BaseButton";
|
|
2
2
|
//# sourceMappingURL=base-button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/base-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n// Polymorphic types\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAqB,oBAErBC,EAAmC,kCACnCC,EAAqB,sBACrBC,EAAwB,yBACxBC,EAA+B,iCAC/BC,EAA6B,0CAC7BC,EAA8D,4CAC9DC,EAA+B,uCAkB/B,MAAMX,EAAaE,EAAM,WAA+C,CAACU,EAAOC,IAAiB,CAC/F,KAAM,CAAE,KAAAC,EAAO,qBAAmB,KAAK,OAAQ,EAAIF,EAC7C,CACJ,UAAAG,EACA,SAAAC,EACA,QAAAC,EACA,GAAAC,EACA,MAAAC,EACA,OAAAC,EACA,SAAAC,EAAWT,EAAM,QACjB,GAAGU,CACL,KAAI,gBAAaV,EAAO,qBAAoB,gBAAc,EAGpDW,EAAON,EAAU,OAAK,KAAOC,GAAM,SAGnCM,EACJP,GAAW,CAACC,GAAM,CAAC,SAAU,QAAS,WAAY,QAAQ,EAAE,SAASA,CAAE,
|
|
6
|
-
"names": ["base_button_exports", "__export", "BaseButton", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_base_button_props", "import_flex", "import_spinner", "import_visually_hidden", "import_extract_props", "import_map_prop_values", "import_margin_props", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "disabled", "baseButtonProps", "Comp", "shouldPassDisabled", "classNames"]
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n// Polymorphic types using the proper ComponentPropsWithout pattern\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;\n\ninterface BaseButtonProps extends PolymorphicBaseButtonProps {}\n\nconst BaseButton = React.forwardRef<BaseButtonElement, BaseButtonProps>((props, forwardedRef) => {\n const { size = baseButtonPropDefs.size.default } = props;\n const {\n className,\n children,\n asChild,\n as,\n color,\n radius,\n disabled = props.loading,\n ...baseButtonProps\n } = extractProps(props, baseButtonPropDefs, marginPropDefs);\n\n // asChild takes precedence over as prop\n const Comp = asChild ? Slot.Root : as || 'button';\n\n // Only pass disabled for elements that support it\n const shouldPassDisabled =\n asChild || !as || ['button', 'input', 'textarea', 'select'].includes(as);\n\n // Generate unique ID for loading announcements\n const loadingId = React.useId();\n const describedById = props.loading ? `${loadingId}-loading` : undefined;\n\n // Enhanced accessibility props for loading state\n const accessibilityProps = props.loading\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'aria-describedby': describedById,\n }\n : {};\n\n return (\n <Comp\n // The `data-disabled` attribute enables correct styles when doing `<Button asChild disabled>`\n data-disabled={disabled || undefined}\n data-accent-color={color}\n data-radius={radius}\n {...baseButtonProps}\n {...accessibilityProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseButton', className)}\n {...(shouldPassDisabled && { disabled })}\n >\n {props.loading ? (\n <>\n {/**\n * We need a wrapper to set `visibility: hidden` to hide the button content whilst we show the `Spinner`.\n * The button is a flex container with a `gap`, so we use `display: contents` to ensure the correct flex layout.\n *\n * However, `display: contents` removes the content from the accessibility tree in some browsers,\n * so we force remove it with `aria-hidden` and re-add it in the tree with `VisuallyHidden`\n */}\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n\n {/* Enhanced accessibility for loading state */}\n <VisuallyHidden>\n <span id={describedById}>Loading, please wait...</span>\n {children}\n </VisuallyHidden>\n\n <Flex asChild align=\"center\" justify=\"center\" position=\"absolute\" inset=\"0\">\n <span>\n <Spinner\n size={mapResponsiveProp(size, mapButtonSizeToSpinnerSize)}\n aria-hidden=\"true\"\n />\n </span>\n </Flex>\n </>\n ) : (\n children\n )}\n </Comp>\n );\n});\nBaseButton.displayName = 'BaseButton';\n\nexport { BaseButton };\nexport type { BaseButtonProps };\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAqB,oBAErBC,EAAmC,kCACnCC,EAAqB,sBACrBC,EAAwB,yBACxBC,EAA+B,iCAC/BC,EAA6B,0CAC7BC,EAA8D,4CAC9DC,EAA+B,uCAkB/B,MAAMX,EAAaE,EAAM,WAA+C,CAACU,EAAOC,IAAiB,CAC/F,KAAM,CAAE,KAAAC,EAAO,qBAAmB,KAAK,OAAQ,EAAIF,EAC7C,CACJ,UAAAG,EACA,SAAAC,EACA,QAAAC,EACA,GAAAC,EACA,MAAAC,EACA,OAAAC,EACA,SAAAC,EAAWT,EAAM,QACjB,GAAGU,CACL,KAAI,gBAAaV,EAAO,qBAAoB,gBAAc,EAGpDW,EAAON,EAAU,OAAK,KAAOC,GAAM,SAGnCM,EACJP,GAAW,CAACC,GAAM,CAAC,SAAU,QAAS,WAAY,QAAQ,EAAE,SAASA,CAAE,EAGnEO,EAAYvB,EAAM,MAAM,EACxBwB,EAAgBd,EAAM,QAAU,GAAGa,CAAS,WAAa,OAGzDE,EAAqBf,EAAM,QAC7B,CACE,YAAa,GACb,gBAAiB,GACjB,mBAAoBc,CACtB,EACA,CAAC,EAEL,OACExB,EAAA,cAACqB,EAAA,CAEC,gBAAeF,GAAY,OAC3B,oBAAmBF,EACnB,cAAaC,EACZ,GAAGE,EACH,GAAGK,EACJ,IAAKd,EACL,aAAW,EAAAe,SAAW,WAAY,gBAAiBb,CAAS,EAC3D,GAAIS,GAAsB,CAAE,SAAAH,CAAS,GAErCT,EAAM,QACLV,EAAA,cAAAA,EAAA,cAQEA,EAAA,cAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,IACpEc,CACH,EAGAd,EAAA,cAAC,sBACCA,EAAA,cAAC,QAAK,GAAIwB,GAAe,yBAAuB,EAC/CV,CACH,EAEAd,EAAA,cAAC,QAAK,QAAO,GAAC,MAAM,SAAS,QAAQ,SAAS,SAAS,WAAW,MAAM,KACtEA,EAAA,cAAC,YACCA,EAAA,cAAC,WACC,QAAM,qBAAkBY,EAAM,4BAA0B,EACxD,cAAY,OACd,CACF,CACF,CACF,EAEAE,CAEJ,CAEJ,CAAC,EACDhB,EAAW,YAAc",
|
|
6
|
+
"names": ["base_button_exports", "__export", "BaseButton", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_base_button_props", "import_flex", "import_spinner", "import_visually_hidden", "import_extract_props", "import_map_prop_values", "import_margin_props", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "disabled", "baseButtonProps", "Comp", "shouldPassDisabled", "loadingId", "describedById", "accessibilityProps", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/checkbox-cards.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Context } from 'radix-ui/internal';\n\nimport * as CheckboxGroupPrimitive from './checkbox-group.primitive.js';\nimport { createCheckboxGroupScope } from './checkbox-group.primitive.js';\nimport { checkboxCardsRootPropDefs } from './checkbox-cards.props.js';\nimport { baseCheckboxPropDefs } from './_internal/base-checkbox.props.js';\nimport { Grid } from './grid.js';\nimport { ThickCheckIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { Responsive, GetPropDefTypes } from '../props/prop-def.js';\n\nconst CHECKBOX_CARD_GROUP_NAME = 'CheckboxCards';\n\ntype ScopedProps<P> = P & { __scopeCheckboxCards?: Context.Scope };\nconst [createCheckboxCardsContext] = Context.createContextScope(CHECKBOX_CARD_GROUP_NAME, [\n createCheckboxGroupScope,\n]);\nconst useCheckboxGroupScope = createCheckboxGroupScope();\n\ntype CheckboxCardsContextValue = {\n size?: Responsive<(typeof checkboxCardsRootPropDefs.size.values)[number]>;\n highContrast?: boolean;\n};\n\nconst [CheckboxCardsProvider, useCheckboxCardsContext] =\n createCheckboxCardsContext<CheckboxCardsContextValue>(CHECKBOX_CARD_GROUP_NAME);\n\ntype CheckboxCardsRootElement = React.ElementRef<typeof CheckboxGroupPrimitive.Root>;\ntype CheckboxCardsRootOwnProps = GetPropDefTypes<typeof checkboxCardsRootPropDefs>;\ninterface CheckboxCardsRootProps\n extends ComponentPropsWithout<\n typeof CheckboxGroupPrimitive.Root,\n 'asChild' | 'color' | 'defaultChecked'\n >,\n MarginProps,\n CheckboxCardsRootOwnProps {}\nconst CheckboxCardsRoot = React.forwardRef<CheckboxCardsRootElement, CheckboxCardsRootProps>(\n (props: ScopedProps<CheckboxCardsRootProps>, forwardedRef) => {\n const { __scopeCheckboxCards, className, color, ...rootProps } = extractProps(\n props,\n checkboxCardsRootPropDefs,\n marginPropDefs
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Context } from 'radix-ui/internal';\n\nimport * as CheckboxGroupPrimitive from './checkbox-group.primitive.js';\nimport { createCheckboxGroupScope } from './checkbox-group.primitive.js';\nimport { checkboxCardsRootPropDefs } from './checkbox-cards.props.js';\nimport { baseCheckboxPropDefs } from './_internal/base-checkbox.props.js';\nimport { Grid } from './grid.js';\nimport { ThickCheckIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { Responsive, GetPropDefTypes } from '../props/prop-def.js';\n\nconst CHECKBOX_CARD_GROUP_NAME = 'CheckboxCards';\n\ntype ScopedProps<P> = P & { __scopeCheckboxCards?: Context.Scope };\nconst [createCheckboxCardsContext] = Context.createContextScope(CHECKBOX_CARD_GROUP_NAME, [\n createCheckboxGroupScope,\n]);\nconst useCheckboxGroupScope = createCheckboxGroupScope();\n\ntype CheckboxCardsContextValue = {\n size?: Responsive<(typeof checkboxCardsRootPropDefs.size.values)[number]>;\n highContrast?: boolean;\n};\n\nconst [CheckboxCardsProvider, useCheckboxCardsContext] =\n createCheckboxCardsContext<CheckboxCardsContextValue>(CHECKBOX_CARD_GROUP_NAME);\n\ntype CheckboxCardsRootElement = React.ElementRef<typeof CheckboxGroupPrimitive.Root>;\ntype CheckboxCardsRootOwnProps = GetPropDefTypes<typeof checkboxCardsRootPropDefs>;\ninterface CheckboxCardsRootProps\n extends ComponentPropsWithout<\n typeof CheckboxGroupPrimitive.Root,\n 'asChild' | 'color' | 'defaultChecked'\n >,\n MarginProps,\n CheckboxCardsRootOwnProps {}\nconst CheckboxCardsRoot = React.forwardRef<CheckboxCardsRootElement, CheckboxCardsRootProps>(\n (props: ScopedProps<CheckboxCardsRootProps>, forwardedRef) => {\n const { __scopeCheckboxCards, className, color, ...rootProps } = extractProps(\n props,\n checkboxCardsRootPropDefs,\n marginPropDefs,\n );\n const checkboxGroupScope = useCheckboxGroupScope(__scopeCheckboxCards);\n return (\n <CheckboxCardsProvider\n scope={__scopeCheckboxCards}\n size={props.size}\n highContrast={props.highContrast}\n >\n <Grid asChild>\n <CheckboxGroupPrimitive.Root\n {...checkboxGroupScope}\n data-accent-color={color}\n {...rootProps}\n ref={forwardedRef}\n className={classNames('rt-CheckboxCardsRoot', className)}\n />\n </Grid>\n </CheckboxCardsProvider>\n );\n },\n);\nCheckboxCardsRoot.displayName = 'CheckboxCards.Root';\n\ntype CheckboxCardsItemElement = React.ElementRef<typeof CheckboxGroupPrimitive.Item>;\ninterface CheckboxCardsItemProps\n extends ComponentPropsWithout<typeof CheckboxGroupPrimitive.Item, RemovedProps>,\n MarginProps {}\nconst CheckboxCardsItem = React.forwardRef<\n CheckboxCardsItemElement,\n ScopedProps<CheckboxCardsItemProps>\n>(({ __scopeCheckboxCards, children, className, style, ...props }, forwardedRef) => {\n const context = useCheckboxCardsContext('CheckboxCardsItem', __scopeCheckboxCards);\n const checkboxGroupScope = useCheckboxGroupScope(__scopeCheckboxCards);\n const { className: checkboxClassName } = extractProps(\n // Pass size / highContrast values from the context and static variant to generate styles\n { size: context?.size, variant: 'surface', highContrast: context?.highContrast },\n // Pass size & variant prop defs to allow it to be extracted\n baseCheckboxPropDefs,\n );\n return (\n <label className={classNames('rt-BaseCard', 'rt-CheckboxCardsItem', className)} style={style}>\n {children}\n <CheckboxGroupPrimitive.Item\n {...checkboxGroupScope}\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-reset',\n 'rt-BaseCheckboxRoot',\n 'rt-CheckboxCardCheckbox',\n checkboxClassName,\n )}\n >\n <CheckboxGroupPrimitive.Indicator\n {...checkboxGroupScope}\n asChild\n className=\"rt-BaseCheckboxIndicator\"\n >\n <ThickCheckIcon />\n </CheckboxGroupPrimitive.Indicator>\n </CheckboxGroupPrimitive.Item>\n </label>\n );\n});\nCheckboxCardsItem.displayName = 'CheckboxCards.Item';\n\nexport { CheckboxCardsRoot as Root, CheckboxCardsItem as Item };\nexport type { CheckboxCardsRootProps as RootProps, CheckboxCardsItemProps as ItemProps };\n"],
|
|
5
5
|
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAwB,6BAExBC,EAAwC,4CACxCC,EAAyC,yCACzCC,EAA0C,qCAC1CC,EAAqC,8CACrCC,EAAqB,qBACrBC,EAA+B,sBAC/BC,EAA6B,uCAC7BC,EAA+B,oCAM/B,MAAMC,EAA2B,gBAG3B,CAACC,CAA0B,EAAI,UAAQ,mBAAmBD,EAA0B,CACxF,0BACF,CAAC,EACKE,KAAwB,4BAAyB,EAOjD,CAACC,EAAuBC,CAAuB,EACnDH,EAAsDD,CAAwB,EAW1Eb,EAAoBE,EAAM,WAC9B,CAACgB,EAA4CC,IAAiB,CAC5D,KAAM,CAAE,qBAAAC,EAAsB,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAU,KAAI,gBAC/DL,EACA,4BACA,gBACF,EACMM,EAAqBT,EAAsBK,CAAoB,EACrE,OACElB,EAAA,cAACc,EAAA,CACC,MAAOI,EACP,KAAMF,EAAM,KACZ,aAAcA,EAAM,cAEpBhB,EAAA,cAAC,QAAK,QAAO,IACXA,EAAA,cAACG,EAAuB,KAAvB,CACE,GAAGmB,EACJ,oBAAmBF,EAClB,GAAGC,EACJ,IAAKJ,EACL,aAAW,EAAAM,SAAW,uBAAwBJ,CAAS,EACzD,CACF,CACF,CAEJ,CACF,EACArB,EAAkB,YAAc,qBAMhC,MAAMD,EAAoBG,EAAM,WAG9B,CAAC,CAAE,qBAAAkB,EAAsB,SAAAM,EAAU,UAAAL,EAAW,MAAAM,EAAO,GAAGT,CAAM,EAAGC,IAAiB,CAClF,MAAMS,EAAUX,EAAwB,oBAAqBG,CAAoB,EAC3EI,EAAqBT,EAAsBK,CAAoB,EAC/D,CAAE,UAAWS,CAAkB,KAAI,gBAEvC,CAAE,KAAMD,GAAS,KAAM,QAAS,UAAW,aAAcA,GAAS,YAAa,EAE/E,sBACF,EACA,OACE1B,EAAA,cAAC,SAAM,aAAW,EAAAuB,SAAW,cAAe,uBAAwBJ,CAAS,EAAG,MAAOM,GACpFD,EACDxB,EAAA,cAACG,EAAuB,KAAvB,CACE,GAAGmB,EACH,GAAGN,EACJ,IAAKC,EACL,aAAW,EAAAM,SACT,WACA,sBACA,0BACAI,CACF,GAEA3B,EAAA,cAACG,EAAuB,UAAvB,CACE,GAAGmB,EACJ,QAAO,GACP,UAAU,4BAEVtB,EAAA,cAAC,qBAAe,CAClB,CACF,CACF,CAEJ,CAAC,EACDH,EAAkB,YAAc",
|
|
6
6
|
"names": ["checkbox_cards_exports", "__export", "CheckboxCardsItem", "CheckboxCardsRoot", "__toCommonJS", "React", "import_classnames", "import_internal", "CheckboxGroupPrimitive", "import_checkbox_group_primitive", "import_checkbox_cards_props", "import_base_checkbox_props", "import_grid", "import_icons", "import_extract_props", "import_margin_props", "CHECKBOX_CARD_GROUP_NAME", "createCheckboxCardsContext", "useCheckboxGroupScope", "CheckboxCardsProvider", "useCheckboxCardsContext", "props", "forwardedRef", "__scopeCheckboxCards", "className", "color", "rootProps", "checkboxGroupScope", "classNames", "children", "style", "context", "checkboxClassName"]
|
|
7
7
|
}
|
|
@@ -2,7 +2,18 @@ import * as React from 'react';
|
|
|
2
2
|
import { BaseButton } from './_internal/base-button.js';
|
|
3
3
|
import type { BaseButtonProps } from './_internal/base-button.js';
|
|
4
4
|
type IconButtonElement = React.ElementRef<typeof BaseButton>;
|
|
5
|
-
type
|
|
5
|
+
type AccessibilityProps = {
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
'aria-labelledby'?: never;
|
|
8
|
+
} | {
|
|
9
|
+
'aria-label'?: never;
|
|
10
|
+
'aria-labelledby': string;
|
|
11
|
+
} | {
|
|
12
|
+
'aria-label'?: never;
|
|
13
|
+
'aria-labelledby'?: never;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
type IconButtonOwnProps = Omit<BaseButtonProps, 'as'> & AccessibilityProps;
|
|
6
17
|
type IconButtonProps<C extends React.ElementType = 'button'> = IconButtonOwnProps & {
|
|
7
18
|
as?: C;
|
|
8
19
|
} & Omit<React.ComponentPropsWithoutRef<C>, keyof IconButtonOwnProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,KAAK,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAG7D,KAAK,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,KAAK,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAG7D,KAAK,kBAAkB,GACnB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAA;CAAE,GACnD;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAGnF,KAAK,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,GAAG,kBAAkB,CAAC;AAE3E,KAAK,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI,kBAAkB,GAAG;IAClF,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,kBAAkB,CAAC,CAAC;AAEtE,KAAK,mBAAmB,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAChE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;CAAE,KACxE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAE/B,QAAA,MAAM,UAAU,EA6BX,mBAAmB,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},s=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!y.call(e,o)&&o!==n&&a(e,o,{get:()=>t[o],enumerable:!(r=u(t,o))||r.enumerable});return e};var i=(e,t,n)=>(n=e!=null?m(B(e)):{},s(t||!e||!e.__esModule?a(n,"default",{value:e,enumerable:!0}):n,e)),I=e=>s(a({},"__esModule",{value:!0}),e);var h={};f(h,{IconButton:()=>l});module.exports=I(h);var p=i(require("react")),c=i(require("classnames")),b=require("./_internal/base-button.js");const l=p.forwardRef(({className:e,...t},n)=>p.createElement(b.BaseButton,{...t,ref:n,className:(0,c.default)("rt-IconButton",e)}));l.displayName="IconButton";
|
|
2
2
|
//# sourceMappingURL=icon-button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/icon-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { BaseButton } from './_internal/base-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\ntype IconButtonElement = React.ElementRef<typeof BaseButton>;\n\n// Polymorphic IconButton props\ntype IconButtonOwnProps = Omit<BaseButtonProps, 'as'
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA2B,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { BaseButton } from './_internal/base-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\ntype IconButtonElement = React.ElementRef<typeof BaseButton>;\n\n// Required accessibility props for icon buttons\ntype AccessibilityProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string }\n | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };\n\n// Polymorphic IconButton props with required accessibility\ntype IconButtonOwnProps = Omit<BaseButtonProps, 'as'> & AccessibilityProps;\n\ntype IconButtonProps<C extends React.ElementType = 'button'> = IconButtonOwnProps & {\n as?: C;\n} & Omit<React.ComponentPropsWithoutRef<C>, keyof IconButtonOwnProps>;\n\ntype IconButtonComponent = <C extends React.ElementType = 'button'>(\n props: IconButtonProps<C> & { ref?: React.ForwardedRef<IconButtonElement> },\n) => React.ReactElement | null;\n\nconst IconButton = React.forwardRef(\n (\n { className, ...props }: IconButtonProps,\n forwardedRef: React.ForwardedRef<IconButtonElement>,\n ) => {\n // Warn in development if no accessibility attributes are provided\n if (process.env.NODE_ENV === 'development') {\n const hasAriaLabel = 'aria-label' in props && props['aria-label'];\n const hasAriaLabelledBy = 'aria-labelledby' in props && props['aria-labelledby'];\n const hasChildren = 'children' in props && props.children;\n\n if (!hasAriaLabel && !hasAriaLabelledBy && !hasChildren) {\n console.warn(\n 'IconButton: Icon buttons must have an accessible name. Please provide either:' +\n '\\n- aria-label prop with descriptive text' +\n '\\n- aria-labelledby prop referencing a label element' +\n '\\n- or visible text children',\n );\n }\n }\n\n return (\n <BaseButton\n {...props}\n ref={forwardedRef}\n className={classNames('rt-IconButton', className)}\n />\n );\n },\n) as IconButtonComponent & { displayName?: string };\n\nIconButton.displayName = 'IconButton';\n\nexport { IconButton };\nexport type { IconButtonProps };\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA2B,sCAsB3B,MAAMJ,EAAaE,EAAM,WACvB,CACE,CAAE,UAAAG,EAAW,GAAGC,CAAM,EACtBC,IAmBEL,EAAA,cAAC,cACE,GAAGI,EACJ,IAAKC,EACL,aAAW,EAAAC,SAAW,gBAAiBH,CAAS,EAClD,CAGN,EAEAL,EAAW,YAAc",
|
|
6
6
|
"names": ["icon_button_exports", "__export", "IconButton", "__toCommonJS", "React", "import_classnames", "import_base_button", "className", "props", "forwardedRef", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/radio-cards.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { RadioGroup as RadioGroupPrimitive } from 'radix-ui';\n\nimport { radioCardsRootPropDefs } from './radio-cards.props.js';\nimport { Grid } from './grid.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype RadioCardsRootElement = React.ElementRef<typeof RadioGroupPrimitive.Root>;\ntype RadioCardsRootOwnProps = GetPropDefTypes<typeof radioCardsRootPropDefs>;\ninterface RadioCardsRootProps\n extends ComponentPropsWithout<\n typeof RadioGroupPrimitive.Root,\n 'asChild' | 'color' | 'defaultChecked'\n >,\n MarginProps,\n RadioCardsRootOwnProps {}\nconst RadioCardsRoot = React.forwardRef<RadioCardsRootElement, RadioCardsRootProps>(\n (props, forwardedRef) => {\n const { className, color, ...rootProps } = extractProps(\n props,\n radioCardsRootPropDefs,\n marginPropDefs
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { RadioGroup as RadioGroupPrimitive } from 'radix-ui';\n\nimport { radioCardsRootPropDefs } from './radio-cards.props.js';\nimport { Grid } from './grid.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype RadioCardsRootElement = React.ElementRef<typeof RadioGroupPrimitive.Root>;\ntype RadioCardsRootOwnProps = GetPropDefTypes<typeof radioCardsRootPropDefs>;\ninterface RadioCardsRootProps\n extends ComponentPropsWithout<\n typeof RadioGroupPrimitive.Root,\n 'asChild' | 'color' | 'defaultChecked'\n >,\n MarginProps,\n RadioCardsRootOwnProps {}\nconst RadioCardsRoot = React.forwardRef<RadioCardsRootElement, RadioCardsRootProps>(\n (props, forwardedRef) => {\n const { className, color, ...rootProps } = extractProps(\n props,\n radioCardsRootPropDefs,\n marginPropDefs,\n );\n return (\n <Grid asChild>\n <RadioGroupPrimitive.Root\n data-accent-color={color}\n {...rootProps}\n ref={forwardedRef}\n className={classNames('rt-RadioCardsRoot', className)}\n />\n </Grid>\n );\n },\n);\nRadioCardsRoot.displayName = 'RadioCards.Root';\n\ntype RadioCardsItemElement = React.ElementRef<typeof RadioGroupPrimitive.Item>;\ninterface RadioCardsItemProps\n extends ComponentPropsWithout<typeof RadioGroupPrimitive.Item, RemovedProps>,\n MarginProps {}\nconst RadioCardsItem = React.forwardRef<RadioCardsItemElement, RadioCardsItemProps>(\n ({ className, ...props }, forwardedRef) => (\n <RadioGroupPrimitive.Item\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseCard', 'rt-RadioCardsItem', className)}\n />\n ),\n);\nRadioCardsItem.displayName = 'RadioCards.Item';\n\nexport { RadioCardsRoot as Root, RadioCardsItem as Item };\nexport type { RadioCardsRootProps as RootProps, RadioCardsItemProps as ItemProps };\n"],
|
|
5
5
|
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAkD,oBAElDC,EAAuC,kCACvCC,EAAqB,qBACrBC,EAA6B,uCAC7BC,EAA+B,oCAe/B,MAAMR,EAAiBE,EAAM,WAC3B,CAACO,EAAOC,IAAiB,CACvB,KAAM,CAAE,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAU,KAAI,gBACzCJ,EACA,yBACA,gBACF,EACA,OACEP,EAAA,cAAC,QAAK,QAAO,IACXA,EAAA,cAAC,EAAAY,WAAoB,KAApB,CACC,oBAAmBF,EAClB,GAAGC,EACJ,IAAKH,EACL,aAAW,EAAAK,SAAW,oBAAqBJ,CAAS,EACtD,CACF,CAEJ,CACF,EACAX,EAAe,YAAc,kBAM7B,MAAMD,EAAiBG,EAAM,WAC3B,CAAC,CAAE,UAAAS,EAAW,GAAGF,CAAM,EAAGC,IACxBR,EAAA,cAAC,EAAAY,WAAoB,KAApB,CACE,GAAGL,EACJ,QAAS,GACT,IAAKC,EACL,aAAW,EAAAK,SAAW,WAAY,cAAe,oBAAqBJ,CAAS,EACjF,CAEJ,EACAZ,EAAe,YAAc",
|
|
6
6
|
"names": ["radio_cards_exports", "__export", "RadioCardsItem", "RadioCardsRoot", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_radio_cards_props", "import_grid", "import_extract_props", "import_margin_props", "props", "forwardedRef", "className", "color", "rootProps", "RadioGroupPrimitive", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Toggle } from 'radix-ui';
|
|
3
|
+
import type { BaseButtonProps } from './_internal/base-button.js';
|
|
4
|
+
type ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;
|
|
5
|
+
type AccessibilityProps = {
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
'aria-labelledby'?: never;
|
|
8
|
+
} | {
|
|
9
|
+
'aria-label'?: never;
|
|
10
|
+
'aria-labelledby': string;
|
|
11
|
+
} | {
|
|
12
|
+
'aria-label'?: never;
|
|
13
|
+
'aria-labelledby'?: never;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
interface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {
|
|
17
|
+
pressed?: ToggleProps['pressed'];
|
|
18
|
+
onPressedChange?: ToggleProps['onPressedChange'];
|
|
19
|
+
defaultPressed?: ToggleProps['defaultPressed'];
|
|
7
20
|
}
|
|
8
|
-
|
|
21
|
+
type ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;
|
|
22
|
+
declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonPropsWithAccessibility & React.RefAttributes<HTMLButtonElement>>;
|
|
9
23
|
export { ToggleIconButton };
|
|
10
|
-
export type { ToggleIconButtonProps };
|
|
24
|
+
export type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };
|
|
11
25
|
//# sourceMappingURL=toggle-icon-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"toggle-icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKlE,KAAK,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AAGtE,KAAK,kBAAkB,GACnB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAA;CAAE,GACnD;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAGnF,UAAU,qBAAsB,SAAQ,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC;IACjE,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;CAChD;AAGD,KAAK,sCAAsC,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEzF,QAAA,MAAM,gBAAgB,kHAcpB,CAAC;AAGH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,sCAAsC,IAAI,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.create;var n=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},g=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of u(o))!B.call(e,s)&&s!==t&&n(e,s,{get:()=>o[s],enumerable:!(r=d(o,s))||r.enumerable});return e};var T=(e,o,t)=>(t=e!=null?c(P(e)):{},g(o||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),b=e=>g(n({},"__esModule",{value:!0}),e);var f={};y(f,{ToggleIconButton:()=>a});module.exports=b(f);var l=T(require("react")),i=require("radix-ui"),p=require("./icon-button.js"),I=require("./_internal/base-button.js");const a=l.forwardRef(({pressed:e,onPressedChange:o,defaultPressed:t,...r},s)=>l.createElement(i.Toggle.Root,{pressed:e,onPressedChange:o,defaultPressed:t,asChild:!0},l.createElement(p.IconButton,{...r,ref:s})));a.displayName="ToggleIconButton";
|
|
2
2
|
//# sourceMappingURL=toggle-icon-button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/toggle-icon-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\n\
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,oBACvBC,EAA2B,
|
|
6
|
-
"names": ["toggle_icon_button_exports", "__export", "ToggleIconButton", "__toCommonJS", "React", "import_radix_ui", "import_icon_button", "pressed", "onPressedChange", "defaultPressed", "iconButtonProps", "forwardedRef"]
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { IconButton } from './icon-button.js';\nimport { BaseButton } from './_internal/base-button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\ntype ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;\n\n// Extract toggle-specific props from Radix Toggle\ntype ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;\n\n// Required accessibility props for icon buttons (same as IconButton)\ntype AccessibilityProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string }\n | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };\n\n// Combine BaseButton props with Toggle-specific props and accessibility requirements\ninterface ToggleIconButtonProps extends Omit<BaseButtonProps, 'as'> {\n pressed?: ToggleProps['pressed'];\n onPressedChange?: ToggleProps['onPressedChange'];\n defaultPressed?: ToggleProps['defaultPressed'];\n}\n\n// Intersection with accessibility props\ntype ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;\n\nconst ToggleIconButton = React.forwardRef<\n ToggleIconButtonElement,\n ToggleIconButtonPropsWithAccessibility\n>(({ pressed, onPressedChange, defaultPressed, ...iconButtonProps }, forwardedRef) => {\n return (\n <Toggle.Root\n pressed={pressed}\n onPressedChange={onPressedChange}\n defaultPressed={defaultPressed}\n asChild\n >\n <IconButton {...iconButtonProps} ref={forwardedRef} />\n </Toggle.Root>\n );\n});\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,oBACvBC,EAA2B,4BAC3BC,EAA2B,sCAwB3B,MAAML,EAAmBE,EAAM,WAG7B,CAAC,CAAE,QAAAI,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,GAAGC,CAAgB,EAAGC,IAEjER,EAAA,cAAC,SAAO,KAAP,CACC,QAASI,EACT,gBAAiBC,EACjB,eAAgBC,EAChB,QAAO,IAEPN,EAAA,cAAC,cAAY,GAAGO,EAAiB,IAAKC,EAAc,CACtD,CAEH,EACDV,EAAiB,YAAc",
|
|
6
|
+
"names": ["toggle_icon_button_exports", "__export", "ToggleIconButton", "__toCommonJS", "React", "import_radix_ui", "import_icon_button", "import_base_button", "pressed", "onPressedChange", "defaultPressed", "iconButtonProps", "forwardedRef"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { baseButtonPropDefs } from './base-button.props.js';
|
|
3
3
|
import type { MarginProps } from '../../props/margin.props.js';
|
|
4
|
+
import type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';
|
|
4
5
|
import type { GetPropDefTypes } from '../../props/prop-def.js';
|
|
5
6
|
type BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;
|
|
6
7
|
type PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {
|
|
7
8
|
as?: C;
|
|
8
|
-
} & BaseButtonOwnProps & MarginProps &
|
|
9
|
+
} & BaseButtonOwnProps & MarginProps & ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;
|
|
9
10
|
interface BaseButtonProps extends PolymorphicBaseButtonProps {
|
|
10
11
|
}
|
|
11
12
|
declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,KAAK,0BAA0B,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACxE,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,kBAAkB,GACpB,WAAW,GACX,qBAAqB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,kBAAkB,GAAG,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;AAE/F,UAAU,eAAgB,SAAQ,0BAA0B;CAAG;AAE/D,QAAA,MAAM,UAAU,2FA8Ed,CAAC;AAGH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from"react";import h from"classnames";import{Slot as g}from"radix-ui";import{baseButtonPropDefs as i}from"./base-button.props.js";import{Flex as C}from"../flex.js";import{Spinner as x}from"../spinner.js";import{VisuallyHidden as w}from"../visually-hidden.js";import{extractProps as D}from"../../helpers/extract-props.js";import{mapResponsiveProp as z,mapButtonSizeToSpinnerSize as S}from"../../helpers/map-prop-values.js";import{marginPropDefs as T}from"../../props/margin.props.js";const p=e.forwardRef((o,d)=>{const{size:l=i.size.default}=o,{className:m,children:t,asChild:n,as:s,color:u,radius:B,disabled:r=o.loading,...f}=D(o,i,T),y=n?g.Root:s||"button",P=n||!s||["button","input","textarea","select"].includes(s),c=e.useId(),a=o.loading?`${c}-loading`:void 0,b=o.loading?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":a}:{};return e.createElement(y,{"data-disabled":r||void 0,"data-accent-color":u,"data-radius":B,...f,...b,ref:d,className:h("rt-reset","rt-BaseButton",m),...P&&{disabled:r}},o.loading?e.createElement(e.Fragment,null,e.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},t),e.createElement(w,null,e.createElement("span",{id:a},"Loading, please wait..."),t),e.createElement(C,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},e.createElement("span",null,e.createElement(x,{size:z(l,S),"aria-hidden":"true"})))):t)});p.displayName="BaseButton";export{p as BaseButton};
|
|
2
2
|
//# sourceMappingURL=base-button.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/base-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n// Polymorphic types\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,WAErB,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,QAAAC,MAAY,aACrB,OAAS,WAAAC,MAAe,gBACxB,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,gBAAAC,MAAoB,iCAC7B,OAAS,qBAAAC,EAAmB,8BAAAC,MAAkC,mCAC9D,OAAS,kBAAAC,MAAsB,8BAkB/B,MAAMC,EAAaX,EAAM,WAA+C,CAACY,EAAOC,IAAiB,CAC/F,KAAM,CAAE,KAAAC,EAAOX,EAAmB,KAAK,OAAQ,EAAIS,EAC7C,CACJ,UAAAG,EACA,SAAAC,EACA,QAAAC,EACA,GAAAC,EACA,MAAAC,EACA,OAAAC,EACA,SAAAC,EAAWT,EAAM,QACjB,GAAGU,CACL,EAAIf,EAAaK,EAAOT,EAAoBO,CAAc,EAGpDa,EAAON,EAAUf,EAAK,KAAOgB,GAAM,SAGnCM,EACJP,GAAW,CAACC,GAAM,CAAC,SAAU,QAAS,WAAY,QAAQ,EAAE,SAASA,CAAE,
|
|
6
|
-
"names": ["React", "classNames", "Slot", "baseButtonPropDefs", "Flex", "Spinner", "VisuallyHidden", "extractProps", "mapResponsiveProp", "mapButtonSizeToSpinnerSize", "marginPropDefs", "BaseButton", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "disabled", "baseButtonProps", "Comp", "shouldPassDisabled"]
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n// Polymorphic types using the proper ComponentPropsWithout pattern\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;\n\ninterface BaseButtonProps extends PolymorphicBaseButtonProps {}\n\nconst BaseButton = React.forwardRef<BaseButtonElement, BaseButtonProps>((props, forwardedRef) => {\n const { size = baseButtonPropDefs.size.default } = props;\n const {\n className,\n children,\n asChild,\n as,\n color,\n radius,\n disabled = props.loading,\n ...baseButtonProps\n } = extractProps(props, baseButtonPropDefs, marginPropDefs);\n\n // asChild takes precedence over as prop\n const Comp = asChild ? Slot.Root : as || 'button';\n\n // Only pass disabled for elements that support it\n const shouldPassDisabled =\n asChild || !as || ['button', 'input', 'textarea', 'select'].includes(as);\n\n // Generate unique ID for loading announcements\n const loadingId = React.useId();\n const describedById = props.loading ? `${loadingId}-loading` : undefined;\n\n // Enhanced accessibility props for loading state\n const accessibilityProps = props.loading\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'aria-describedby': describedById,\n }\n : {};\n\n return (\n <Comp\n // The `data-disabled` attribute enables correct styles when doing `<Button asChild disabled>`\n data-disabled={disabled || undefined}\n data-accent-color={color}\n data-radius={radius}\n {...baseButtonProps}\n {...accessibilityProps}\n ref={forwardedRef}\n className={classNames('rt-reset', 'rt-BaseButton', className)}\n {...(shouldPassDisabled && { disabled })}\n >\n {props.loading ? (\n <>\n {/**\n * We need a wrapper to set `visibility: hidden` to hide the button content whilst we show the `Spinner`.\n * The button is a flex container with a `gap`, so we use `display: contents` to ensure the correct flex layout.\n *\n * However, `display: contents` removes the content from the accessibility tree in some browsers,\n * so we force remove it with `aria-hidden` and re-add it in the tree with `VisuallyHidden`\n */}\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n\n {/* Enhanced accessibility for loading state */}\n <VisuallyHidden>\n <span id={describedById}>Loading, please wait...</span>\n {children}\n </VisuallyHidden>\n\n <Flex asChild align=\"center\" justify=\"center\" position=\"absolute\" inset=\"0\">\n <span>\n <Spinner\n size={mapResponsiveProp(size, mapButtonSizeToSpinnerSize)}\n aria-hidden=\"true\"\n />\n </span>\n </Flex>\n </>\n ) : (\n children\n )}\n </Comp>\n );\n});\nBaseButton.displayName = 'BaseButton';\n\nexport { BaseButton };\nexport type { BaseButtonProps };\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,WAErB,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,QAAAC,MAAY,aACrB,OAAS,WAAAC,MAAe,gBACxB,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,gBAAAC,MAAoB,iCAC7B,OAAS,qBAAAC,EAAmB,8BAAAC,MAAkC,mCAC9D,OAAS,kBAAAC,MAAsB,8BAkB/B,MAAMC,EAAaX,EAAM,WAA+C,CAACY,EAAOC,IAAiB,CAC/F,KAAM,CAAE,KAAAC,EAAOX,EAAmB,KAAK,OAAQ,EAAIS,EAC7C,CACJ,UAAAG,EACA,SAAAC,EACA,QAAAC,EACA,GAAAC,EACA,MAAAC,EACA,OAAAC,EACA,SAAAC,EAAWT,EAAM,QACjB,GAAGU,CACL,EAAIf,EAAaK,EAAOT,EAAoBO,CAAc,EAGpDa,EAAON,EAAUf,EAAK,KAAOgB,GAAM,SAGnCM,EACJP,GAAW,CAACC,GAAM,CAAC,SAAU,QAAS,WAAY,QAAQ,EAAE,SAASA,CAAE,EAGnEO,EAAYzB,EAAM,MAAM,EACxB0B,EAAgBd,EAAM,QAAU,GAAGa,CAAS,WAAa,OAGzDE,EAAqBf,EAAM,QAC7B,CACE,YAAa,GACb,gBAAiB,GACjB,mBAAoBc,CACtB,EACA,CAAC,EAEL,OACE1B,EAAA,cAACuB,EAAA,CAEC,gBAAeF,GAAY,OAC3B,oBAAmBF,EACnB,cAAaC,EACZ,GAAGE,EACH,GAAGK,EACJ,IAAKd,EACL,UAAWZ,EAAW,WAAY,gBAAiBc,CAAS,EAC3D,GAAIS,GAAsB,CAAE,SAAAH,CAAS,GAErCT,EAAM,QACLZ,EAAA,cAAAA,EAAA,cAQEA,EAAA,cAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,IACpEgB,CACH,EAGAhB,EAAA,cAACM,EAAA,KACCN,EAAA,cAAC,QAAK,GAAI0B,GAAe,yBAAuB,EAC/CV,CACH,EAEAhB,EAAA,cAACI,EAAA,CAAK,QAAO,GAAC,MAAM,SAAS,QAAQ,SAAS,SAAS,WAAW,MAAM,KACtEJ,EAAA,cAAC,YACCA,EAAA,cAACK,EAAA,CACC,KAAMG,EAAkBM,EAAML,CAA0B,EACxD,cAAY,OACd,CACF,CACF,CACF,EAEAO,CAEJ,CAEJ,CAAC,EACDL,EAAW,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "Slot", "baseButtonPropDefs", "Flex", "Spinner", "VisuallyHidden", "extractProps", "mapResponsiveProp", "mapButtonSizeToSpinnerSize", "marginPropDefs", "BaseButton", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "disabled", "baseButtonProps", "Comp", "shouldPassDisabled", "loadingId", "describedById", "accessibilityProps"]
|
|
7
7
|
}
|