@obosbbl/grunnmuren-react 2.3.3 → 3.0.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/index.d.mts CHANGED
@@ -80,7 +80,7 @@ declare function Badge(props: BadgeProps): react_jsx_runtime.JSX.Element;
80
80
  */
81
81
  declare const buttonVariants: (props?: ({
82
82
  variant?: "primary" | "secondary" | "tertiary" | undefined;
83
- color?: "mint" | "white" | "green" | undefined;
83
+ color?: "mint" | "white" | "blue" | undefined;
84
84
  isIconOnly?: boolean | undefined;
85
85
  isPending?: boolean | undefined;
86
86
  } & ({
@@ -93,12 +93,6 @@ declare const buttonVariants: (props?: ({
93
93
  type ButtonOrLinkProps$1 = VariantProps<typeof buttonVariants> & {
94
94
  children?: React.ReactNode;
95
95
  href?: LinkProps['href'];
96
- /**
97
- * Display the button in a loading state
98
- * @deprecated Use isPending instead.
99
- * @default false
100
- */
101
- isLoading?: boolean;
102
96
  /** Additional style properties for the element. */
103
97
  style?: React.CSSProperties;
104
98
  /** Ref to the element. */
@@ -158,11 +152,6 @@ type ComboboxProps<T extends object> = {
158
152
  description?: React.ReactNode;
159
153
  /** Error message for the form control. Automatically sets `isInvalid` to true */
160
154
  errorMessage?: React.ReactNode;
161
- /**
162
- * Display the dropdown button trigger in a pending state
163
- * @deprecated Use isPending instead.
164
- */
165
- isLoading?: boolean;
166
155
  /**
167
156
  * Display the dropdown button trigger in a pending state
168
157
  * @default false
package/dist/index.mjs CHANGED
@@ -168,7 +168,7 @@ function AccordionItem(props) {
168
168
  HeadingContext,
169
169
  {
170
170
  // Negative margin to strech the button to the entire with of the accordion (to support containers with a background color)
171
- className: 'font-semibold leading-7 -mx-2 text-base',
171
+ className: 'font-medium leading-7 -mx-2 text-base',
172
172
  // Supply a default level here to make this typecheck ok. Will be overwritten with the consumers set heading level anyways
173
173
  level: 3,
174
174
  _innerWrapper: (children)=>/*#__PURE__*/ jsxs("button", {
@@ -291,14 +291,14 @@ const translations$1 = {
291
291
  */ variant: {
292
292
  primary: 'no-underline',
293
293
  // by using an inset box-shadow to emulate a border instead of an actual border, the button size will be equal regardless of the variant
294
- secondary: 'no-underline shadow-[inset_0_0_0_2px]',
294
+ secondary: 'border-2 border-current no-underline hover:border-transparent',
295
295
  tertiary: 'underline hover:no-underline'
296
296
  },
297
297
  /**
298
298
  * Adjusts the color of the button for usage on different backgrounds.
299
- * @default green
299
+ * @default blue
300
300
  */ color: {
301
- green: 'focus-visible:outline-focus',
301
+ blue: 'focus-visible:outline-focus',
302
302
  mint: 'focus-visible:outline-focus focus-visible:outline-mint',
303
303
  white: 'focus-visible:outline-focus focus-visible:outline-white'
304
304
  },
@@ -317,18 +317,18 @@ const translations$1 = {
317
317
  },
318
318
  compoundVariants: [
319
319
  {
320
- color: 'green',
320
+ color: 'blue',
321
321
  variant: 'primary',
322
322
  // Darken bg by 20% on hover. The color is manually crafted
323
- className: 'bg-green text-white hover:bg-green-dark active:bg-[#007352] [&_[role="progressbar"]]:text-white'
323
+ className: 'bg-blue-dark text-white hover:bg-blue active:bg-[#0536A0] active:text-white [&_[role="progressbar"]]:text-white'
324
324
  },
325
325
  {
326
- color: 'green',
326
+ color: 'blue',
327
327
  variant: 'secondary',
328
- className: 'text-black shadow-green hover:bg-green hover:text-white active:bg-green [&:hover_[role="progressbar"]]:text-white [&_[role="progressbar"]]:text-black'
328
+ className: 'text-blue-dark hover:border-transparent hover:bg-blue hover:text-blue-dark hover:text-white active:bg-[#0536A0] [&:hover_[role="progressbar"]]:text-white [&_[role="progressbar"]]:text-blue-dark'
329
329
  },
330
330
  {
331
- color: 'green',
331
+ color: 'blue',
332
332
  variant: 'tertiary',
333
333
  className: '[&_[role="progressbar"]]:text-black'
334
334
  },
@@ -341,7 +341,7 @@ const translations$1 = {
341
341
  {
342
342
  color: 'mint',
343
343
  variant: 'secondary',
344
- className: 'text-mint shadow-mint hover:bg-mint hover:text-black [&:hover_[role="progressbar"]]:text-black [&_[role="progressbar"]]:text-mint'
344
+ className: 'text-mint hover:bg-mint hover:text-black [&:hover_[role="progressbar"]]:text-black [&_[role="progressbar"]]:text-mint'
345
345
  },
346
346
  {
347
347
  color: 'mint',
@@ -356,7 +356,7 @@ const translations$1 = {
356
356
  {
357
357
  color: 'white',
358
358
  variant: 'secondary',
359
- className: 'text-white shadow-white hover:bg-white hover:text-black [&:hover_[role="progressbar"]]:text-black [&_[role="progressbar"]]:text-white'
359
+ className: 'text-white hover:bg-white hover:text-black [&:hover_[role="progressbar"]]:text-black [&_[role="progressbar"]]:text-white'
360
360
  },
361
361
  {
362
362
  color: 'white',
@@ -366,7 +366,7 @@ const translations$1 = {
366
366
  ],
367
367
  defaultVariants: {
368
368
  variant: 'primary',
369
- color: 'green',
369
+ color: 'blue',
370
370
  isIconOnly: false,
371
371
  isPending: false
372
372
  }
@@ -377,8 +377,7 @@ function isLinkProps$1(props) {
377
377
  }
378
378
  function Button({ ref = null, ...props }) {
379
379
  [props, ref] = useContextProps(props, ref, ButtonContext);
380
- const { children: _children, color, isIconOnly, isLoading, variant, isPending: _isPending, ...restProps } = props;
381
- const isPending = _isPending || isLoading;
380
+ const { children: _children, color, isIconOnly, variant, isPending, ...restProps } = props;
382
381
  const className = buttonVariants({
383
382
  className: props.className,
384
383
  color,
@@ -638,8 +637,7 @@ function InputAddonDivider() {
638
637
  }
639
638
 
640
639
  function Combobox(props) {
641
- const { className, children, description, errorMessage, isLoading, isPending: _isPending, label, isInvalid: _isInvalid, ref, ...restProps } = props;
642
- const isPending = _isPending || isLoading;
640
+ const { className, children, description, errorMessage, isPending, label, isInvalid: _isInvalid, ref, ...restProps } = props;
643
641
  // the order of the conditions matter here, because providing a value for isInvalid makes the validation state "controlled",
644
642
  // which will override any built in validation
645
643
  const isInvalid = !!errorMessage || _isInvalid;
@@ -1802,7 +1800,7 @@ const FileUpload = ({ children, files: _files, onChange, validate, isInvalid: _i
1802
1800
  children: children
1803
1801
  })
1804
1802
  }),
1805
- /*#__PURE__*/ jsx("ul", {
1803
+ controlledOrUncontrolledFiles.length > 0 && /*#__PURE__*/ jsx("ul", {
1806
1804
  className: "mt-4 grid gap-y-2",
1807
1805
  children: controlledOrUncontrolledFiles.map((file, fileIndex)=>{
1808
1806
  let fileName = file.name;
@@ -2025,6 +2023,7 @@ const oneColumnLayout = [
2025
2023
  // Aligns <Content> and any element beside it (e.g. <Media>, <Badge>, <CTA> etc.) to the bottom of the <Content> container
2026
2024
  'lg:items-end'
2027
2025
  ];
2026
+ const nonFullBleedAspectRatiosForSmallScreens = '*:data-[slot="media"]:*:aspect-[1/1] sm:*:data-[slot="media"]:*:aspect-4/3 md:*:data-[slot="media"]:*:aspect-3/2';
2028
2027
  const variants = cva({
2029
2028
  base: [
2030
2029
  'container px-0',
@@ -2045,19 +2044,26 @@ const variants = cva({
2045
2044
  * */ variant: {
2046
2045
  standard: [
2047
2046
  roundedMediaCorners,
2048
- oneColumnLayout
2047
+ oneColumnLayout,
2048
+ nonFullBleedAspectRatiosForSmallScreens,
2049
+ 'lg:*:data-[slot="media"]:*:aspect-2/1'
2049
2050
  ],
2050
2051
  'full-bleed': [
2051
2052
  oneColumnLayout,
2052
2053
  // Position the media and carousel content to fill the entire viewport width
2053
2054
  '*:data-[slot="media"]:*:absolute *:data-[slot="media"]:*:left-0',
2054
- '*:data-[slot="carousel"]:*:absolute *:data-[slot="carousel"]:*:left-0',
2055
+ // Special case for Carousel, where the Media is nested inside a CarouselItem
2056
+ '*:data-[slot="carousel"]:**:data-[slot="media"]:w-full *:data-[slot="carousel"]:*:absolute *:data-[slot="carousel"]:*:left-0',
2055
2057
  // Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
2056
2058
  // This is necessary due to the absolute positioning of the media and carousel containers in this variant
2057
2059
  // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
2058
- '*:data-[slot="media"]:*:h-70 sm:*:data-[slot="media"]:*:h-[25rem] md:*:data-[slot="media"]:*:h-[30rem] lg:*:data-[slot="media"]:*:h-[35rem] xl:*:data-[slot="media"]:*:h-[40rem] 2xl:*:data-[slot="media"]:*:h-[42rem] 3xl:*:data-[slot="media"]:*:h-[48rem] 4xl:*:data-[slot="media"]:*:h-[53rem]',
2060
+ '**:data-[slot="media"]:h-70 sm:**:data-[slot="media"]:h-[25rem] md:**:data-[slot="media"]:h-[30rem] lg:**:data-[slot="media"]:h-[35rem] xl:**:data-[slot="media"]:h-[40rem] 2xl:**:data-[slot="media"]:h-[42rem] 3xl:**:data-[slot="media"]:h-[48rem] 4xl:**:data-[slot="media"]:h-[53rem]',
2061
+ // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
2062
+ '**:data-[slot="media"]:*:h-70 sm:**:data-[slot="media"]:*:h-[25rem] md:**:data-[slot="media"]:*:h-[30rem] lg:**:data-[slot="media"]:*:h-[35rem] xl:**:data-[slot="media"]:*:h-[40rem] 2xl:**:data-[slot="media"]:*:h-[42rem] 3xl:**:data-[slot="media"]:*:h-[48rem] 4xl:**:data-[slot="media"]:*:h-[53rem]',
2059
2063
  // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
2060
2064
  '*:data-[slot="carousel"]:h-70 sm:*:data-[slot="carousel"]:h-[25rem] md:*:data-[slot="carousel"]:h-[30rem] lg:*:data-[slot="carousel"]:h-[35rem] xl:*:data-[slot="carousel"]:h-[40rem] 2xl:*:data-[slot="carousel"]:h-[42rem] 3xl:*:data-[slot="carousel"]:h-[48rem] 4xl:*:data-[slot="carousel"]:h-[53rem]',
2065
+ // Override aspect ratio of the media and carousel-item slots (since we can not use aspect for full-bleed layout)
2066
+ '**:data-[slot="carousel-item"]:data-[slot="media"]:*:aspect-none',
2061
2067
  '**:data-[slot="carousel-controls"]:container **:data-[slot="carousel-controls"]:right-0 **:data-[slot="carousel-controls"]:bottom-4 **:data-[slot="carousel-controls"]:left-0 **:data-[slot="carousel-controls"]:justify-end',
2062
2068
  // Override rounded corners of Carousel slots
2063
2069
  '*:data-[slot="carousel"]:*:rounded-none'
@@ -2067,6 +2073,7 @@ const variants = cva({
2067
2073
  // Vertical spacing in the <Content>
2068
2074
  'lg:*:data-[slot="content"]:gap-y-7',
2069
2075
  roundedMediaCorners,
2076
+ nonFullBleedAspectRatiosForSmallScreens,
2070
2077
  // Set media aspect ratio to 1:1 (square)
2071
2078
  'lg:*:data-[slot="media"]:*:aspect-[1/1]'
2072
2079
  ]
@@ -2087,7 +2094,9 @@ const Hero = ({ variant, className, children })=>{
2087
2094
  HeadingContext,
2088
2095
  {
2089
2096
  // Sets the default heading size for the Hero based on the variant
2090
- size: variant === 'two-column' ? 'xl' : 'l'
2097
+ size: variant === 'two-column' ? 'xl' : 'l',
2098
+ className: // word-break:break-word to allow long words to break (this is necessary to make hyphens work in grid containers in Safari)
2099
+ 'hyphens-auto text-pretty [word-break:break-word]'
2091
2100
  }
2092
2101
  ],
2093
2102
  [
@@ -2272,8 +2281,7 @@ const CarouselItem = ({ className, children, id })=>{
2272
2281
  MediaContext,
2273
2282
  {
2274
2283
  fit: 'cover',
2275
- className: cx('data-[fit="contain"]:bg-blue-dark', '*:w-full', // biome-ignore lint/nursery/useSortedClasses: biome is unable to sort the custom classes for 3xl and 4xl breakpoints
2276
- '*:h-70 sm:*:h-[25rem] lg:*:h-[35rem] xl:*:h-[40rem] 2xl:*:h-[42rem] 3xl:*:h-[48rem] 4xl:*:h-[53rem]')
2284
+ className: cx('data-[fit="contain"]:bg-blue-dark', '*:h-full *:w-full', 'aspect-1/1 max-sm:data-[fit="contain"]:*:object-cover sm:aspect-4/3 md:aspect-3/2 lg:aspect-2/1')
2277
2285
  }
2278
2286
  ]
2279
2287
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "2.3.3",
3
+ "version": "3.0.0",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -35,7 +35,7 @@
35
35
  "react": "^19"
36
36
  },
37
37
  "devDependencies": {
38
- "tailwindcss": "4.1.7"
38
+ "tailwindcss": "4.1.10"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "bunchee"