@rolster/react-components 19.12.0 → 19.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.mjs CHANGED
@@ -1251,13 +1251,18 @@ function generateThemeCSS(colors, theme) {
1251
1251
  const rgb900 = rgbChannels(parseHex(colors['900']));
1252
1252
  const rgb700 = rgbChannels(parseHex(colors['700']));
1253
1253
  const rgb500 = rgbChannels(parseHex(colors['500']));
1254
+ const rgb300 = rgbChannels(parseHex(colors['300']));
1254
1255
  const colorProps = SHADE_LABELS.map((label) => prop(`color-${label}`, colors[label]));
1255
1256
  const gradientProps = GRADIENT_LABELS.map((label) => {
1256
1257
  const darker = SHADE_LABELS[SHADE_LABELS.indexOf(label) - 1];
1257
1258
  return prop(`gradient-${label}`, `linear-gradient(180deg, ${colors[label]} 15%, ${colors[darker]} 85%)`);
1258
1259
  });
1259
1260
  const backdropProps = BACKDROP_LABELS.map((label) => prop(`backdrop-${label}`, `rgba(${rgb900}, ${Number(label) / 1000})`));
1260
- const skeletonProps = Object.entries(SKELETON_OPACITY).map(([label, opacity]) => prop(`skeleton-${label}`, `rgba(${rgb700}, ${opacity})`));
1261
+ const skeletonOpacities = Object.entries(SKELETON_OPACITY);
1262
+ const skeletonProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-${label}`, `rgba(${rgb700}, ${opacity})`));
1263
+ // Skeleton tokens for dark surfaces, taken from the light step that mirrors
1264
+ // color-700 around color-500, as the foundations mixin does.
1265
+ const skeletonDarkProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-dark-${label}`, `rgba(${rgb300}, ${opacity})`));
1261
1266
  const shadowProps = [
1262
1267
  prop('shadow-color-500', `rgba(${rgb500}, 0.24)`),
1263
1268
  prop('shadow-500', `0px 0px 0px 3px rgba(${rgb500}, 0.24)`)
@@ -1267,6 +1272,7 @@ function generateThemeCSS(colors, theme) {
1267
1272
  ...gradientProps,
1268
1273
  ...backdropProps,
1269
1274
  ...skeletonProps,
1275
+ ...skeletonDarkProps,
1270
1276
  ...shadowProps
1271
1277
  ];
1272
1278
  }
@@ -1336,12 +1342,69 @@ function setThemeColor(baseColor, theme = 'primary') {
1336
1342
  if (typeof document === 'undefined') {
1337
1343
  return;
1338
1344
  }
1345
+ resetTheme(theme);
1339
1346
  const { properties } = generateThemePalette(baseColor, theme);
1340
1347
  const target = document.body || document.documentElement;
1341
1348
  properties.forEach(({ name, value }) => {
1342
1349
  target.style.setProperty(name, value);
1343
1350
  });
1344
1351
  }
1352
+ const ALIAS_LABELS = [
1353
+ '900',
1354
+ '800',
1355
+ '700',
1356
+ '600',
1357
+ '500',
1358
+ '400',
1359
+ '300',
1360
+ '200',
1361
+ '100'
1362
+ ];
1363
+ const SKELETON_LABELS = Object.keys(SKELETON_OPACITY);
1364
+ const ALIAS_TOKENS = [
1365
+ ...SHADE_LABELS.map((label) => `color-${label}`),
1366
+ ...ALIAS_LABELS.map((label) => `gradient-${label}`),
1367
+ ...ALIAS_LABELS.map((label) => `backdrop-${label}`),
1368
+ ...SKELETON_LABELS.map((label) => `skeleton-${label}`),
1369
+ ...SKELETON_LABELS.map((label) => `skeleton-dark-${label}`),
1370
+ 'shadow-color-500',
1371
+ 'shadow-500'
1372
+ ];
1373
+ function resetTheme(theme = 'primary') {
1374
+ if (typeof document === 'undefined') {
1375
+ return;
1376
+ }
1377
+ const target = document.body || document.documentElement;
1378
+ ALIAS_TOKENS.forEach((token) => {
1379
+ target.style.removeProperty(`--rls-${theme}-${token}`);
1380
+ });
1381
+ }
1382
+ function generateThemeAlias(source, theme = 'primary') {
1383
+ const properties = ALIAS_TOKENS.map((token) => ({
1384
+ name: `--rls-${theme}-${token}`,
1385
+ value: `var(--rls-${source}-${token})`
1386
+ }));
1387
+ return {
1388
+ source,
1389
+ theme,
1390
+ properties,
1391
+ css: properties.map((p) => `${p.name}: ${p.value};`).join('\n')
1392
+ };
1393
+ }
1394
+ function setThemeAlias(source, theme = 'primary') {
1395
+ if (typeof document === 'undefined') {
1396
+ return;
1397
+ }
1398
+ if (source === theme) {
1399
+ resetTheme(theme);
1400
+ return;
1401
+ }
1402
+ const { properties } = generateThemeAlias(source, theme);
1403
+ const target = document.body || document.documentElement;
1404
+ properties.forEach(({ name, value }) => {
1405
+ target.style.setProperty(name, value);
1406
+ });
1407
+ }
1345
1408
  const DEFAULT_COLOR = '#1780e0';
1346
1409
 
1347
1410
  const CONTENT_BACKGROUND = '--pvt-content-background';
@@ -5509,5 +5572,5 @@ function useTabsController(options) {
5509
5572
  return useMemo(() => ({ Tabs, formControl }), [Tabs, formControl]);
5510
5573
  }
5511
5574
 
5512
- export { APP_THEMES, ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsAppThemeTabs, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsChip, RlsChipGroup, RlsChooserAutocomplete, RlsChooserAutocompleteTemplate, RlsChooserList, RlsChooserListTemplate, RlsChooserSelect, RlsChooserSelectTemplate, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsHoverSwap, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsLedColor, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalClock, RlsModalDate, RlsModalDateRange, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemePalette, getAppTheme, getRemSize$1 as getRemSize, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, rgbToHex, rgbToHsl, rgbToHsv, setAppTheme, setDesignSystem, setErrorsI18n, setThemeColor, toggleAppTheme, useAppThemeController, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useEventCallback, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, useNotifications, usePortalController, useRelocationOnComponent, useResize, useRlsContext, useSnackbar, useTabsController };
5575
+ export { APP_THEMES, ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsAppThemeTabs, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsChip, RlsChipGroup, RlsChooserAutocomplete, RlsChooserAutocompleteTemplate, RlsChooserList, RlsChooserListTemplate, RlsChooserSelect, RlsChooserSelectTemplate, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsHoverSwap, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsLedColor, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalClock, RlsModalDate, RlsModalDateRange, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemeAlias, generateThemePalette, getAppTheme, getRemSize$1 as getRemSize, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, resetTheme, rgbToHex, rgbToHsl, rgbToHsv, setAppTheme, setDesignSystem, setErrorsI18n, setThemeAlias, setThemeColor, toggleAppTheme, useAppThemeController, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useEventCallback, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, useNotifications, usePortalController, useRelocationOnComponent, useResize, useRlsContext, useSnackbar, useTabsController };
5513
5576
  //# sourceMappingURL=index.mjs.map